Class: Basecamp3::Todo
- Includes:
- Concerns::Bucketable, Concerns::Commentable, Concerns::Creatorable, Concerns::Parentable, Concerns::Recordingable
- Defined in:
- lib/basecamp3/models/todo.rb
Overview
A model for Basecamp's TODO
For more information, see the official Basecamp3 API documentation for TODOs
Constant Summary
- REQUIRED_FIELDS =
%w(content)
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#description ⇒ Object
Returns the value of attribute description.
-
#due_on ⇒ Object
Returns the value of attribute due_on.
-
#id ⇒ Object
Returns the value of attribute id.
-
#starts_on ⇒ Object
Returns the value of attribute starts_on.
-
#status ⇒ Object
Returns the value of attribute status.
-
#updated_at ⇒ Object
Returns the value of attribute updated_at.
Attributes included from Concerns::Commentable
Class Method Summary collapse
-
.all(bucket_id, parent_id, params = {}) ⇒ Array<Basecamp3::Todo>
Returns a paginated list of active TODOs.
-
.complete(bucket_id, id) ⇒ Boolean
Completes the TODO.
-
.create(bucket_id, parent_id, data) ⇒ Basecamp3::Todo
Creates a TODO.
-
.find(bucket_id, id) ⇒ Basecamp3::Todo
Returns the TODO.
-
.incomplete(bucket_id, id) ⇒ Boolean
Incompletes the TODO.
-
.update(bucket_id, id, data) ⇒ Basecamp3::Todo
Updates the TODO.
Instance Method Summary collapse
-
#assignees ⇒ Array<Basecamp3::Person>
Returns a list of related assignees.
Methods included from Concerns::Commentable
Methods included from Concerns::Recordingable
Methods included from Concerns::Parentable
Methods included from Concerns::Bucketable
Methods included from Concerns::Creatorable
Methods inherited from Model
Constructor Details
This class inherits a constructor from Basecamp3::Model
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content
11 12 13 |
# File 'lib/basecamp3/models/todo.rb', line 11 def content @content end |
#created_at ⇒ Object
Returns the value of attribute created_at
11 12 13 |
# File 'lib/basecamp3/models/todo.rb', line 11 def created_at @created_at end |
#description ⇒ Object
Returns the value of attribute description
11 12 13 |
# File 'lib/basecamp3/models/todo.rb', line 11 def description @description end |
#due_on ⇒ Object
Returns the value of attribute due_on
11 12 13 |
# File 'lib/basecamp3/models/todo.rb', line 11 def due_on @due_on end |
#id ⇒ Object
Returns the value of attribute id
11 12 13 |
# File 'lib/basecamp3/models/todo.rb', line 11 def id @id end |
#starts_on ⇒ Object
Returns the value of attribute starts_on
11 12 13 |
# File 'lib/basecamp3/models/todo.rb', line 11 def starts_on @starts_on end |
#status ⇒ Object
Returns the value of attribute status
11 12 13 |
# File 'lib/basecamp3/models/todo.rb', line 11 def status @status end |
#updated_at ⇒ Object
Returns the value of attribute updated_at
11 12 13 |
# File 'lib/basecamp3/models/todo.rb', line 11 def updated_at @updated_at end |
Class Method Details
.all(bucket_id, parent_id, params = {}) ⇒ Array<Basecamp3::Todo>
Returns a paginated list of active TODOs.
37 38 39 |
# File 'lib/basecamp3/models/todo.rb', line 37 def self.all(bucket_id, parent_id, params = {}) Basecamp3.request.get("/buckets/#{bucket_id}/todolists/#{parent_id}/todos", params, Basecamp3::Todo) end |
.complete(bucket_id, id) ⇒ Boolean
Completes the TODO.
95 96 97 |
# File 'lib/basecamp3/models/todo.rb', line 95 def self.complete(bucket_id, id) Basecamp3.request.post("/buckets/#{bucket_id}/todos/#{id}/completion") end |
.create(bucket_id, parent_id, data) ⇒ Basecamp3::Todo
Creates a TODO.
64 65 66 67 |
# File 'lib/basecamp3/models/todo.rb', line 64 def self.create(bucket_id, parent_id, data) self.validate_required(data) Basecamp3.request.post("/buckets/#{bucket_id}/todolists/#{parent_id}/todos", data, Basecamp3::Todo) end |
.find(bucket_id, id) ⇒ Basecamp3::Todo
Returns the TODO.
47 48 49 |
# File 'lib/basecamp3/models/todo.rb', line 47 def self.find(bucket_id, id) Basecamp3.request.get("/buckets/#{bucket_id}/todos/#{id}", {}, Basecamp3::Todo) end |
.incomplete(bucket_id, id) ⇒ Boolean
Incompletes the TODO.
105 106 107 |
# File 'lib/basecamp3/models/todo.rb', line 105 def self.incomplete(bucket_id, id) Basecamp3.request.delete("/buckets/#{bucket_id}/todos/#{id}/completion") end |
.update(bucket_id, id, data) ⇒ Basecamp3::Todo
Updates the TODO.
REMEMBER: Pass all existing parameters in addition to those being updated!
84 85 86 87 |
# File 'lib/basecamp3/models/todo.rb', line 84 def self.update(bucket_id, id, data) self.validate_required(data) Basecamp3.request.put("/buckets/#{bucket_id}/todos/#{id}", data, Basecamp3::Todo) end |
Instance Method Details
#assignees ⇒ Array<Basecamp3::Person>
Returns a list of related assignees.
25 26 27 |
# File 'lib/basecamp3/models/todo.rb', line 25 def assignees @mapped_assignees ||= @assignees.map{ |a| Basecamp3::Person.new(a) } end |