Class: OmniAuth::Strategies::Flickr
- Inherits:
-
OAuth
- Object
- OAuth
- OmniAuth::Strategies::Flickr
- Defined in:
- lib/omniauth/strategies/flickr.rb
Overview
An omniauth 1.0 strategy for Flickr authentication Based on www.flickr.com/services/api/auth.oauth.html
Instance Method Summary collapse
- #image_info ⇒ Object
-
#raw_info ⇒ Object
Return info gathered from the flickr.people.getInfo API call.
- #request_phase ⇒ Object
-
#user_info ⇒ Object
Provide the “Person” portion of the raw_info.
Instance Method Details
#image_info ⇒ Object
68 69 70 71 72 73 74 |
# File 'lib/omniauth/strategies/flickr.rb', line 68 def image_info if user_info["iconfarm"] && user_info["iconfarm"] > 0 "http://farm#{user_info["iconfarm"]}.static.flickr.com/#{user_info["iconserver"]}/buddyicons/#{uid}.jpg" else "https://www.flickr.com/images/buddyicon.gif" end end |
#raw_info ⇒ Object
Return info gathered from the flickr.people.getInfo API call
54 55 56 57 58 59 60 |
# File 'lib/omniauth/strategies/flickr.rb', line 54 def raw_info # This is a public API and does not need signing or authentication request = "/services/rest/?format=json&method=flickr.people.getInfo&nojsoncallback=1&user_id=#{uid}" @raw_info ||= MultiJson.decode(access_token.get(request).body) rescue ::Errno::ETIMEDOUT raise ::Timeout::Error end |
#request_phase ⇒ Object
76 77 78 79 80 |
# File 'lib/omniauth/strategies/flickr.rb', line 76 def request_phase [:authorize_params] = {:perms => [:scope]} if [:scope] session['oauth'] ||= {} # https://github.com/timbreitkreutz/omniauth-flickr/issues/4 super end |
#user_info ⇒ Object
Provide the “Person” portion of the raw_info
64 65 66 |
# File 'lib/omniauth/strategies/flickr.rb', line 64 def user_info @user_info ||= raw_info.nil? ? {} : raw_info["person"] end |