Class: Teambox::Task
- Defined in:
- lib/teambox-client/models/task.rb
Constant Summary collapse
- STATUS_NAMES =
[:new, :open, :hold, :resolved, :rejected]
- STATUSES =
[0,1,2,3,4]
Instance Attribute Summary
Attributes inherited from Resource
Instance Method Summary collapse
-
#assigned ⇒ Object
The Teambox::Person assigned this task.
-
#assigned=(value) ⇒ Object
Sets the Teambox::Person assigned this task.
- #comment=(value) ⇒ Object
-
#comments ⇒ Object
Gets a Teambox::ResultSet of all Teambox::Comment objects belonging to the conversation.
-
#due_on ⇒ Object
Current due date.
- #due_on=(value) ⇒ Object
-
#first_comment ⇒ Object
First Teambox::Comment of the task.
-
#recent_comments ⇒ Object
Last two Teambox::Comment of the task (may include first_comment).
-
#status_name ⇒ Object
Current status.
- #status_name=(value) ⇒ Object
-
#task_list ⇒ Object
Teambox::TaskList this task belongs to.
-
#url ⇒ Object
:nodoc:.
- #user ⇒ Object
Methods inherited from Resource
#created_at, #destroy, #id, #initialize, #inspect, #method_missing, #next, #prev, #reload, #save, #updated_at
Methods included from ReferenceList
#generate_references, #get_or_make_reference, #get_or_make_references, #get_reference, #set_reference
Constructor Details
This class inherits a constructor from Teambox::Resource
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Teambox::Resource
Instance Method Details
#assigned ⇒ Object
The Teambox::Person assigned this task
31 32 33 |
# File 'lib/teambox-client/models/task.rb', line 31 def assigned get_or_make_reference('Person', @data, 'assigned_id') end |
#assigned=(value) ⇒ Object
Sets the Teambox::Person assigned this task
36 37 38 |
# File 'lib/teambox-client/models/task.rb', line 36 def assigned=(value) @data['assigned_id'] = set_reference('Person', value).id end |
#comment=(value) ⇒ Object
49 50 51 |
# File 'lib/teambox-client/models/task.rb', line 49 def comment=(value) @data['comments_attributes'] = {'0' => {'body' => value}} end |
#comments ⇒ Object
Gets a Teambox::ResultSet of all Teambox::Comment objects belonging to the conversation
26 27 28 |
# File 'lib/teambox-client/models/task.rb', line 26 def comments @list.client.get("#{url}/comments") end |
#due_on ⇒ Object
Current due date
41 42 43 |
# File 'lib/teambox-client/models/task.rb', line 41 def due_on @data['due_on'] ? Date.parse(@data['due_on']) : nil end |
#due_on=(value) ⇒ Object
45 46 47 |
# File 'lib/teambox-client/models/task.rb', line 45 def due_on=(value) @data['due_on'] = value.strftime('%Y-%m-%d %H:%M:%S %z') end |
#first_comment ⇒ Object
First Teambox::Comment of the task
16 17 18 |
# File 'lib/teambox-client/models/task.rb', line 16 def first_comment get_or_make_reference('Comment', @data, 'first_comment_id') end |
#recent_comments ⇒ Object
Last two Teambox::Comment of the task (may include first_comment)
21 22 23 |
# File 'lib/teambox-client/models/task.rb', line 21 def recent_comments get_or_make_references('Comment', @data, 'recent_comment_ids') end |
#status_name ⇒ Object
Current status
54 55 56 |
# File 'lib/teambox-client/models/task.rb', line 54 def status_name STATUS_NAMES[@data['status']] end |
#status_name=(value) ⇒ Object
58 59 60 |
# File 'lib/teambox-client/models/task.rb', line 58 def status_name=(value) @data['status'] = STATUS_NAMES.index(value.to_sym) end |
#task_list ⇒ Object
Teambox::TaskList this task belongs to
11 12 13 |
# File 'lib/teambox-client/models/task.rb', line 11 def task_list get_or_make_reference('TaskList', @data, 'task_list_id') end |
#url ⇒ Object
:nodoc:
62 63 64 |
# File 'lib/teambox-client/models/task.rb', line 62 def url #:nodoc: "/tasks/#{@data['id']}" end |
#user ⇒ Object
6 7 8 |
# File 'lib/teambox-client/models/task.rb', line 6 def user get_or_make_reference('User', @data, 'user_id') end |