Class: OmniAuth::Strategies::Flickr

Inherits:
OAuth
  • Object
show all
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

Instance Method Details

#image_infoObject



64
65
66
67
68
69
70
# File 'lib/omniauth/strategies/flickr.rb', line 64

def image_info
  if ["iconfarm"] && ["iconfarm"] > 0
    "http://farm#{["iconfarm"]}.static.flickr.com/#{["iconserver"]}/buddyicons/#{uid}.jpg"
  else
    "http://www.flickr.com/images/buddyicon.gif"
  end
end

#raw_infoObject

Return info gathered from the flickr.people.getInfo API call



50
51
52
53
54
55
56
# File 'lib/omniauth/strategies/flickr.rb', line 50

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_phaseObject



72
73
74
75
# File 'lib/omniauth/strategies/flickr.rb', line 72

def request_phase
  options[:authorize_params] = {:perms => options[:scope]} if options[:scope]
  super
end

#user_infoObject

Provide the “Person” portion of the raw_info



60
61
62
# File 'lib/omniauth/strategies/flickr.rb', line 60

def 
  @user_info ||= raw_info.nil? ? {} : raw_info["person"]
end