Class: Api
- Inherits:
-
Object
- Object
- Api
- Defined in:
- lib/flickr/api.rb
Instance Attribute Summary collapse
-
#frob ⇒ Object
Returns the value of attribute frob.
Instance Method Summary collapse
- #get_token(frob = @frob) ⇒ Object
-
#initialize(api, parent) ⇒ Api
constructor
A new instance of Api.
- #login_link(perms = 'read') ⇒ Object
Constructor Details
#initialize(api, parent) ⇒ Api
Returns a new instance of Api.
6 7 8 9 |
# File 'lib/flickr/api.rb', line 6 def initialize(api, parent) @api = api @parent = parent end |
Instance Attribute Details
#frob ⇒ Object
Returns the value of attribute frob.
4 5 6 |
# File 'lib/flickr/api.rb', line 4 def frob @frob end |
Instance Method Details
#get_token(frob = @frob) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/flickr/api.rb', line 19 def get_token(frob=@frob) if frob @parent.flickr_auth_getToken(args: { frob: frob }) else raise ArgumentError, "missing 'frob' argument, perhaps you need to call 'login_link' first" end end |
#login_link(perms = 'read') ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/flickr/api.rb', line 11 def login_link(perms='read') @frob = @parent.flickr_auth_getFrob['frob']['_content'] args = {'api_key' => @api.tokens.api_key, 'perms' => perms, 'frob' => @frob} args = @api.sign_request(args) Request.build_url('https://flickr.com/services/auth/', args) end |