Class: Wunderlist::Task
- Inherits:
-
Object
- Object
- Wunderlist::Task
- Includes:
- Helper
- Defined in:
- lib/wunderlist/task.rb
Instance Attribute Summary collapse
-
#api ⇒ Object
Returns the value of attribute api.
-
#assignee_id ⇒ Object
Returns the value of attribute assignee_id.
-
#completed ⇒ Object
Returns the value of attribute completed.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#due_date ⇒ Object
Returns the value of attribute due_date.
-
#id ⇒ Object
Returns the value of attribute id.
-
#list_id ⇒ Object
Returns the value of attribute list_id.
-
#recurrence_count ⇒ Object
Returns the value of attribute recurrence_count.
-
#recurrence_type ⇒ Object
Returns the value of attribute recurrence_type.
-
#revision ⇒ Object
Returns the value of attribute revision.
-
#starred ⇒ Object
Returns the value of attribute starred.
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Task
constructor
A new instance of Task.
- #new_task_comment(attrs = {}) ⇒ Object
- #note ⇒ Object
- #task_comments ⇒ Object
Methods included from Helper
#destroy, #save, #to_hash, #update
Constructor Details
#initialize(options = {}) ⇒ Task
Returns a new instance of Task.
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/wunderlist/task.rb', line 12 def initialize( = {}) @api = ['api'] @id = ['id'] @list_id = ['list_id'] @title = ['title'] @revision = ['revision'] @assignee_id = ['assignee_id'] @completed = ['completed'] @recurrence_type = ['recurrence_type'] @recurrence_count = ['recurrence_count'] @due_date = ['due_date'] @starred = ['starred'] end |
Instance Attribute Details
#api ⇒ Object
Returns the value of attribute api.
10 11 12 |
# File 'lib/wunderlist/task.rb', line 10 def api @api end |
#assignee_id ⇒ Object
Returns the value of attribute assignee_id.
10 11 12 |
# File 'lib/wunderlist/task.rb', line 10 def assignee_id @assignee_id end |
#completed ⇒ Object
Returns the value of attribute completed.
10 11 12 |
# File 'lib/wunderlist/task.rb', line 10 def completed @completed end |
#created_at ⇒ Object
Returns the value of attribute created_at.
10 11 12 |
# File 'lib/wunderlist/task.rb', line 10 def created_at @created_at end |
#due_date ⇒ Object
Returns the value of attribute due_date.
10 11 12 |
# File 'lib/wunderlist/task.rb', line 10 def due_date @due_date end |
#id ⇒ Object
Returns the value of attribute id.
10 11 12 |
# File 'lib/wunderlist/task.rb', line 10 def id @id end |
#list_id ⇒ Object
Returns the value of attribute list_id.
10 11 12 |
# File 'lib/wunderlist/task.rb', line 10 def list_id @list_id end |
#recurrence_count ⇒ Object
Returns the value of attribute recurrence_count.
10 11 12 |
# File 'lib/wunderlist/task.rb', line 10 def recurrence_count @recurrence_count end |
#recurrence_type ⇒ Object
Returns the value of attribute recurrence_type.
10 11 12 |
# File 'lib/wunderlist/task.rb', line 10 def recurrence_type @recurrence_type end |
#revision ⇒ Object
Returns the value of attribute revision.
10 11 12 |
# File 'lib/wunderlist/task.rb', line 10 def revision @revision end |
#starred ⇒ Object
Returns the value of attribute starred.
10 11 12 |
# File 'lib/wunderlist/task.rb', line 10 def starred @starred end |
#title ⇒ Object
Returns the value of attribute title.
10 11 12 |
# File 'lib/wunderlist/task.rb', line 10 def title @title end |
Instance Method Details
#new_task_comment(attrs = {}) ⇒ Object
40 41 42 43 44 45 46 47 48 |
# File 'lib/wunderlist/task.rb', line 40 def new_task_comment(attrs = {}) attrs.stringify_keys t_c = Wunderlist::TaskComment.new(attrs) t_c.api = self.api t_c.task_id = self.id t_c end |
#note ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/wunderlist/task.rb', line 50 def note res = self.api.request :get, 'api/v1/notes', {:task_id => self.id} if !res[0].nil? note = Wunderlist::Note.new(res[0]) else note = Wunderlist::Note.new('task_id' => self.id) end note.api = self.api note.task_id = self.id note end |
#task_comments ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/wunderlist/task.rb', line 26 def task_comments res = self.api.request :get, 'api/v1/task_comments', {:task_id => self.id} task_comments = [] res.each do |t_c| task_comment = Wunderlist::TaskComment.new(t_c) task_comment.api = self.api task_comments << task_comment end task_comments end |