Methods
public class
protected class
public instance
protected instance
Attributes
| list_id | [R] | |
| tags | [R] | |
| task_id | [R] | |
| taskseries_id | [R] |
Public class methods
add!
(name, list_id=nil)
Adds a new task (and returns it).
[show source]
# File lib/rufus/rtm/resources.rb, line 205 205: def self.add! (name, list_id=nil) 206: 207: args = {} 208: args[:name] = name 209: args[:list_id] = list_id if list_id 210: args[:timeline] = Rufus::RTM.get_timeline 211: 212: h = execute('add', args) 213: 214: parse_tasks(h)[0] 215: end
find
(params={})
[show source]
# File lib/rufus/rtm/resources.rb, line 197 197: def self.find (params={}) 198: 199: parse_tasks(execute('getList', params)) 200: end
new
(list_id, h)
[show source]
# File lib/rufus/rtm/resources.rb, line 156 156: def initialize (list_id, h) 157: 158: super(h) 159: 160: t = h['task'] 161: 162: @list_id = list_id 163: @taskseries_id = h['id'] 164: @task_id = t['id'] 165: 166: @tags = TagArray.new(self, h['tags']) 167: end
Protected class methods
parse_tasks
(o)
[show source]
# File lib/rufus/rtm/resources.rb, line 228 228: def self.parse_tasks (o) 229: 230: o = if o.is_a?(Hash) 231: 232: r = o[resource_name] 233: o = r if r 234: o['list'] 235: end 236: 237: o = [ o ] unless o.is_a?(Array) 238: # Nota bene : not the same thing as o = Array(o) 239: 240: o.inject([]) do |r, h| 241: 242: list_id = h['id'] 243: s = h['taskseries'] 244: r += parse_taskseries(list_id, s) if s 245: r 246: end 247: end
parse_taskseries
(list_id, o)
[show source]
# File lib/rufus/rtm/resources.rb, line 249 249: def self.parse_taskseries (list_id, o) 250: 251: o = [ o ] unless o.is_a?(Array) 252: o.collect { |s| self.new(list_id, s) } 253: end
Public instance methods
complete!
()
Marks the task as completed.
[show source]
# File lib/rufus/rtm/resources.rb, line 180 180: def complete! 181: 182: self.class.execute('complete', prepare_api_args) 183: end
delete!
()
Deletes the task.
[show source]
# File lib/rufus/rtm/resources.rb, line 172 172: def delete! 173: 174: self.class.execute('delete', prepare_api_args) 175: end
tags=
(tags)
Sets the tags for the task.
[show source]
# File lib/rufus/rtm/resources.rb, line 188 188: def tags= (tags) 189: 190: tags = tags.split(',') if tags.is_a?(String) 191: 192: @tags = TagArray.new(list_id, tags) 193: 194: queue_operation('setTasks', tags.join(',')) 195: end
Protected instance methods
prepare_api_args
()
[show source]
# File lib/rufus/rtm/resources.rb, line 219 219: def prepare_api_args 220: { 221: :timeline => timeline, 222: :list_id => list_id, 223: :taskseries_id => taskseries_id, 224: :task_id => task_id 225: } 226: end