Class: Rufus::RTM::Task
- Inherits:
-
MilkResource
- Object
- MilkResource
- Rufus::RTM::Task
- Defined in:
- lib/rufus/rtm/resources.rb
Overview
The RTM Task class.
Instance Attribute Summary collapse
-
#list_id ⇒ Object
readonly
Returns the value of attribute list_id.
-
#tags ⇒ Object
Returns the value of attribute tags.
-
#task_id ⇒ Object
readonly
Returns the value of attribute task_id.
-
#taskseries_id ⇒ Object
readonly
Returns the value of attribute taskseries_id.
Class Method Summary collapse
-
.add!(name, list_id = nil) ⇒ Object
Adds a new task (and returns it).
- .find(params = {}) ⇒ Object
-
.task_attr(*att_names) ⇒ Object
:nodoc:.
Instance Method Summary collapse
-
#complete! ⇒ Object
Marks the task as completed.
-
#delete! ⇒ Object
Deletes the task.
-
#initialize(list_id, h) ⇒ Task
constructor
A new instance of Task.
Methods inherited from MilkResource
Constructor Details
#initialize(list_id, h) ⇒ Task
Returns a new instance of Task.
156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'lib/rufus/rtm/resources.rb', line 156 def initialize (list_id, h) super(h) t = h['task'] @list_id = list_id @taskseries_id = h['id'] @task_id = t['id'] @tags = TagArray.new(self, h['tags']) end |
Instance Attribute Details
#list_id ⇒ Object (readonly)
Returns the value of attribute list_id.
130 131 132 |
# File 'lib/rufus/rtm/resources.rb', line 130 def list_id @list_id end |
#tags ⇒ Object
Returns the value of attribute tags.
130 131 132 |
# File 'lib/rufus/rtm/resources.rb', line 130 def @tags end |
#task_id ⇒ Object (readonly)
Returns the value of attribute task_id.
130 131 132 |
# File 'lib/rufus/rtm/resources.rb', line 130 def task_id @task_id end |
#taskseries_id ⇒ Object (readonly)
Returns the value of attribute taskseries_id.
130 131 132 |
# File 'lib/rufus/rtm/resources.rb', line 130 def taskseries_id @taskseries_id end |
Class Method Details
.add!(name, list_id = nil) ⇒ Object
Adds a new task (and returns it).
205 206 207 208 209 210 211 212 213 214 215 |
# File 'lib/rufus/rtm/resources.rb', line 205 def self.add! (name, list_id=nil) args = {} args[:name] = name args[:list_id] = list_id if list_id args[:timeline] = Rufus::RTM.get_timeline h = execute('add', args) parse_tasks(h)[0] end |
.find(params = {}) ⇒ Object
197 198 199 200 |
# File 'lib/rufus/rtm/resources.rb', line 197 def self.find (params={}) parse_tasks(execute('getList', params)) end |
.task_attr(*att_names) ⇒ Object
:nodoc:
119 120 121 122 123 124 125 126 127 128 |
# File 'lib/rufus/rtm/resources.rb', line 119 def self.task_attr (*att_names) #:nodoc: att_names.each do |att_name| class_eval %{ def #{att_name} @hsh['task']['#{att_name}'] end } end end |
Instance Method Details
#complete! ⇒ Object
Marks the task as completed.
180 181 182 183 |
# File 'lib/rufus/rtm/resources.rb', line 180 def complete! self.class.execute('complete', prepare_api_args) end |
#delete! ⇒ Object
Deletes the task.
172 173 174 175 |
# File 'lib/rufus/rtm/resources.rb', line 172 def delete! self.class.execute('delete', prepare_api_args) end |