Methods
public class
protected class
public instance
protected instance
Public class methods
new
(hsh)
[show source]
# File lib/rufus/rtm/resources.rb, line 35 35: def initialize (hsh) 36: 37: @hsh = hsh 38: @operations = [] 39: end
Protected class methods
execute
(method_name, args={})
Calls the milk() method (interacts with the RTM API).
[show source]
# File lib/rufus/rtm/resources.rb, line 75 75: def self.execute (method_name, args={}) 76: 77: args[:method] = "rtm.#{resource_name}.#{method_name}" 78: 79: Rufus::RTM.milk(args) 80: end
resource_name
()
Returns the name of the resource as the API knows it (for example ‘tasks’ or ‘lists’).
[show source]
# File lib/rufus/rtm/resources.rb, line 86 86: def self.resource_name 87: 88: self.to_s.split('::')[-1].downcase + 's' 89: end
timeline
()
Returns the current timeline (fetches one if none has yet been prepared).
[show source]
# File lib/rufus/rtm/resources.rb, line 103 103: def self.timeline 104: 105: @timeline ||= Rufus::RTM.get_timeline 106: end
Public instance methods
save!
()
Saves the instance back to RTM.
[show source]
# File lib/rufus/rtm/resources.rb, line 44 44: def save! 45: 46: # TODO : compact ! 47: 48: @operations.reverse.each do |method_name, args| 49: 50: self.class.execute method_name, args 51: end 52: @operations = [] 53: end
Protected instance methods
queue_operation
(method_name, args)
[show source]
# File lib/rufus/rtm/resources.rb, line 108 108: def queue_operation (method_name, args) 109: 110: @operations << [ method_name, args ] 111: end
timeline
()
Simply calls the timeline() class method.
[show source]
# File lib/rufus/rtm/resources.rb, line 94 94: def timeline 95: 96: MilkResource.timeline 97: end