Class: Api

Inherits:
Object
  • Object
show all
Defined in:
lib/flickr/api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#frobObject

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


11
12
13
14
15
16
17
# File 'lib/flickr/api.rb', line 11

def (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