class Wunderlist::Task
Attributes
api[RW]
assignee_id[RW]
completed[RW]
completed_at[RW]
completed_by_id[RW]
created_at[RW]
due_date[RW]
id[RW]
list_id[RW]
recurrence_count[RW]
recurrence_type[RW]
revision[RW]
starred[RW]
title[RW]
Public Class Methods
new(attrs = {})
click to toggle source
# File lib/wunderlist/task.rb, line 14 def initialize(attrs = {}) @api = attrs['api'] @id = attrs['id'] @list_id = attrs['list_id'] @title = attrs['title'] @revision = attrs['revision'] @assignee_id = attrs['assignee_id'] @created_at = attrs['created_at'] @completed = attrs['completed'] @completed_at = attrs['completed_at'] @completed_by_id = attrs['completed_by_id'] @recurrence_type = attrs['recurrence_type'] @recurrence_count = attrs['recurrence_count'] @due_date = attrs['due_date'] @starred = attrs['starred'] end
Public Instance Methods
new_subtask(attrs = {})
click to toggle source
# File lib/wunderlist/task.rb, line 85 def new_subtask(attrs = {}) attrs.stringify_keys s_t = Wunderlist::Subtask.new(attrs) s_t.api = self.api s_t.task_id = self.id s_t end
new_task_comment(attrs = {})
click to toggle source
# File lib/wunderlist/task.rb, line 45 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()
click to toggle source
# File lib/wunderlist/task.rb, line 55 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
reminder()
click to toggle source
# File lib/wunderlist/task.rb, line 70 def reminder res = self.api.request :get, 'api/v1/reminders', {:task_id => self.id} if !res[0].nil? reminder = Wunderlist::Reminder.new(res[0]) else reminder = Wunderlist::Reminder.new('task_id' => self.id) end reminder.api = self.api reminder.task_id = self.id reminder end
subtasks()
click to toggle source
# File lib/wunderlist/task.rb, line 95 def subtasks res = self.api.request :get, 'api/v1/subtasks', {:task_id => self.id} subtasks = [] res.each do |r| subtask = Wunderlist::Subtask.new(r) subtask.api = self subtasks << subtask end #This will return tasks in backwards order, so reverse them subtasks.reverse end
task_comments()
click to toggle source
# File lib/wunderlist/task.rb, line 31 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
Private Instance Methods
set_attrs(attrs = {})
click to toggle source
# File lib/wunderlist/task.rb, line 111 def set_attrs(attrs = {}) self.id = attrs['id'] self.title = attrs['title'] self.created_at = attrs['created_at'] self.completed = attrs['completed'] self.list_id = attrs['list_id'] self.starred = attrs['starred'] self.revision = attrs['revision'] end