Class: RememberTheRuby::API
- Inherits:
-
Object
- Object
- RememberTheRuby::API
- Defined in:
- lib/remember-the-ruby/api.rb
Instance Method Summary collapse
- #authenticate ⇒ Object
- #authorization_url ⇒ Object
-
#default_list ⇒ Object
derivative objects ######################################################.
-
#frob ⇒ Object
accessors ##############################################################.
- #frob=(frob) ⇒ Object
-
#initialize(options = {}) ⇒ API
constructor
A new instance of API.
-
#lists ⇒ Object
first-order objects #####################################################.
- #settings ⇒ Object
- #tags ⇒ Object
- #tasks ⇒ Object
- #token=(token) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ API
Returns a new instance of API.
4 5 6 7 8 9 10 11 |
# File 'lib/remember-the-ruby/api.rb', line 4 def initialize(={}) @transport = RPC::Transport.new( :key => 'cb877b5c450d216ce9e563394dff6c07', :secret => '97cbbc48a9b1b54c', :frob => [:frob], :token => [:token] ) end |
Instance Method Details
#authenticate ⇒ Object
18 19 20 |
# File 'lib/remember-the-ruby/api.rb', line 18 def authenticate self.token = @transport.auth.get_token end |
#authorization_url ⇒ Object
13 14 15 16 |
# File 'lib/remember-the-ruby/api.rb', line 13 def self.frob = @transport.auth.get_frob @transport.auth. end |
#default_list ⇒ Object
derivative objects ######################################################
38 39 40 |
# File 'lib/remember-the-ruby/api.rb', line 38 def default_list lists.find(settings["defaultlist"]) end |
#frob ⇒ Object
accessors ##############################################################
61 62 63 |
# File 'lib/remember-the-ruby/api.rb', line 61 def frob @transport.frob end |
#frob=(frob) ⇒ Object
65 66 67 |
# File 'lib/remember-the-ruby/api.rb', line 65 def frob=(frob) @transport.frob = frob end |
#lists ⇒ Object
first-order objects #####################################################
24 25 26 |
# File 'lib/remember-the-ruby/api.rb', line 24 def lists @transport.lists.get_list end |
#settings ⇒ Object
28 29 30 |
# File 'lib/remember-the-ruby/api.rb', line 28 def settings @transport.settings.get_list end |
#tags ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/remember-the-ruby/api.rb', line 42 def = EntityList.new(@transport, Tag) tasks.each do |task| task..each do |tag| found = false .each do |found_tag| if tag.to_s == found_tag.to_s found = true break end end << tag unless found end end end |
#tasks ⇒ Object
32 33 34 |
# File 'lib/remember-the-ruby/api.rb', line 32 def tasks @transport.tasks.get_list end |
#token=(token) ⇒ Object
69 70 71 |
# File 'lib/remember-the-ruby/api.rb', line 69 def token=(token) @transport.token = token end |