omniauth-tumblr 1.0 → 1.1

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 Tumblr
3
- VERSION = "1.0"
3
+ VERSION = "1.1"
4
4
  end
5
5
  end
@@ -8,21 +8,21 @@ module OmniAuth
8
8
  option :name, 'tumblr'
9
9
  option :client_options, {:site => 'http://www.tumblr.com'}
10
10
 
11
- uid { user['name'] }
11
+ uid { raw_info['name'] }
12
12
 
13
13
  info do
14
14
  {
15
- 'nickname' => user['name'],
16
- 'name' => user['title'],
17
- 'image' => user['avatar_url'],
18
- 'urls' => {
19
- 'website' => user['url'],
20
- }
15
+ :nickname => raw_info['name'],
16
+ :name => raw_info['name'],
17
+ :blogs => raw_info['blogs'].map do |b|
18
+ { :name => b['name'], :url => b['url'], :title => b['title'] }
19
+ end,
20
+ :avatar => avatar_url
21
21
  }
22
22
  end
23
23
 
24
24
  extra do
25
- {'user_hash' => user}
25
+ { :raw_info => raw_info.merge({ :avatar => avatar_url }) }
26
26
  end
27
27
 
28
28
  def user
@@ -34,10 +34,16 @@ module OmniAuth
34
34
  end
35
35
  end
36
36
 
37
- def user_hash
38
- url = "http://www.tumblr.com/api/authenticate"
39
- @user_hash ||= Hash.from_xml(@access_token.get(url).body)
37
+ def raw_info
38
+ url = 'http://api.tumblr.com/v2/user/info'
39
+ @raw_info ||= MultiJson.decode(access_token.get(url).body)['response']['user']
40
+ end
41
+
42
+ def avatar_url
43
+ url = "http://api.tumblr.com/v2/blog/#{ raw_info['blogs'].first['url'].sub(%r|^https?://|, '').sub(%r|/?$|, '') }/avatar"
44
+ res = access_token.get(url).body
45
+ @avatar_url ||= MultiJson.decode(res)['response']['avatar_url']
40
46
  end
41
47
  end
42
48
  end
43
- end
49
+ end
metadata CHANGED
@@ -1,46 +1,39 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: omniauth-tumblr
3
- version: !ruby/object:Gem::Version
4
- hash: 15
3
+ version: !ruby/object:Gem::Version
4
+ version: '1.1'
5
5
  prerelease:
6
- segments:
7
- - 1
8
- - 0
9
- version: "1.0"
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - Jamie Wilkinson
13
9
  autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
-
17
- date: 2011-12-01 00:00:00 Z
18
- dependencies:
19
- - !ruby/object:Gem::Dependency
12
+ date: 2012-08-04 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
20
15
  name: omniauth-oauth
21
- prerelease: false
22
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
23
17
  none: false
24
- requirements:
18
+ requirements:
25
19
  - - ~>
26
- - !ruby/object:Gem::Version
27
- hash: 15
28
- segments:
29
- - 1
30
- - 0
31
- version: "1.0"
20
+ - !ruby/object:Gem::Version
21
+ version: '1.0'
32
22
  type: :runtime
33
- version_requirements: *id001
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '1.0'
34
30
  description: OmniAuth strategy for Tumblr
35
- email:
31
+ email:
36
32
  - jamie@jamiedubs.com
37
33
  executables: []
38
-
39
34
  extensions: []
40
-
41
35
  extra_rdoc_files: []
42
-
43
- files:
36
+ files:
44
37
  - .gitignore
45
38
  - README.md
46
39
  - lib/omniauth-tumblr.rb
@@ -49,38 +42,27 @@ files:
49
42
  - omniauth-tumblr.gemspec
50
43
  homepage: https://github.com/jamiew/omniauth-tumblr
51
44
  licenses: []
52
-
53
45
  post_install_message:
54
46
  rdoc_options: []
55
-
56
- require_paths:
47
+ require_paths:
57
48
  - lib
58
- required_ruby_version: !ruby/object:Gem::Requirement
49
+ required_ruby_version: !ruby/object:Gem::Requirement
59
50
  none: false
60
- requirements:
61
- - - ">="
62
- - !ruby/object:Gem::Version
63
- hash: 3
64
- segments:
65
- - 0
66
- version: "0"
67
- required_rubygems_version: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ required_rubygems_version: !ruby/object:Gem::Requirement
68
56
  none: false
69
- requirements:
70
- - - ">="
71
- - !ruby/object:Gem::Version
72
- hash: 23
73
- segments:
74
- - 1
75
- - 3
76
- - 6
57
+ requirements:
58
+ - - ! '>='
59
+ - !ruby/object:Gem::Version
77
60
  version: 1.3.6
78
61
  requirements: []
79
-
80
62
  rubyforge_project:
81
- rubygems_version: 1.8.11
63
+ rubygems_version: 1.8.24
82
64
  signing_key:
83
65
  specification_version: 3
84
66
  summary: OmniAuth strategy for Tumblr
85
67
  test_files: []
86
-
68
+ has_rdoc: