omniauth-flickr 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module Flickr
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
  end
5
5
  end
@@ -19,20 +19,37 @@ module OmniAuth
19
19
  }
20
20
 
21
21
  info do
22
- user_info
22
+ {
23
+ :username => access_token.params['username'],
24
+ :fullname => access_token.params['fullname'],
25
+ :ispro => user_info["ispro"],
26
+ :iconserver => user_info["iconserver"],
27
+ :iconfarm => user_info["iconfarm"],
28
+ :path_alias => user_info["path_alias"],
29
+ :photosurl => user_info["photosurl"],
30
+ :mbox_sha1sum => user_info["mbox_sha1sum"],
31
+ :location => user_info["location"],
32
+ :image => "http://farm#{user_info["iconfarm"]}.static.flickr.com/#{user_info["iconserver"]}/buddyicons/#{uid}.jpg"
33
+ }
23
34
  end
24
35
 
25
36
  extra do
26
- {}
37
+ {
38
+ :raw_info => raw_info
39
+ }
40
+ end
41
+
42
+ def raw_info
43
+ # This is a public API and does not need signing or authentication
44
+ url = "/services/rest/?api_key=#{options.consumer_key}&format=json&method=flickr.people.getInfo&nojsoncallback=1&user_id=#{uid}"
45
+ @raw_info ||= Net::HTTP.get(options.client_options[:site].gsub(/.*:\/\//, ""), url)
27
46
  end
28
47
 
29
48
  def user_info
30
- if @user_info.blank?
49
+ unless @user_info
31
50
  @user_info = {}
32
- # This is a public API and does not need signing or authentication
33
- url = "/services/rest/?api_key=#{options.consumer_key}&format=json&method=flickr.people.getInfo&nojsoncallback=1&user_id=#{uid}"
34
- response = Net::HTTP.get(options.client_options[:site].gsub(/.*:\/\//, ""), url)
35
- @user_info ||= MultiJson.decode(response.body) if response
51
+ info = MultiJson.decode(raw_info)
52
+ @user_info = info["person"] unless info.nil?
36
53
  end
37
54
  @user_info
38
55
  rescue ::Errno::ETIMEDOUT
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-flickr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-12-03 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: omniauth-oauth
16
- requirement: &70123939761240 !ruby/object:Gem::Requirement
16
+ requirement: &70199307090160 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '1.0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70123939761240
24
+ version_requirements: *70199307090160
25
25
  description: OmniAuth strategy for Flickr
26
26
  email:
27
27
  - tim@sbrew.com