omniauth-douban-oauth2 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # OmniAuth-Douban-oauth2
1
+ # OmniAuth-Douban-OAuth2
2
2
  ======================
3
3
  This is the official OmniAuth strategy for authenticating to Douban. To use it, you'll need to sign up for an OAuth2 Application Key and Secret on the [Open Platform](https://www.douban.com/service/auth2/apikey/apply)
4
4
 
@@ -10,3 +10,13 @@ use OmniAuth::Builder do
10
10
  provider :douban, ENV['DOUBAN_KEY'], ENV['DOUBAN_SECRET']
11
11
  end
12
12
  ```
13
+
14
+ ## How to install
15
+
16
+ ``` ruby
17
+ gem install omniauth-douban-oauth2
18
+ ```
19
+
20
+ ## Wiki
21
+
22
+ [Wiki](https://github.com/liluo/omniauth-douban-oauth2/wiki)
@@ -4,6 +4,7 @@ module OmniAuth
4
4
  module Strategies
5
5
  class Douban < OmniAuth::Strategies::OAuth2
6
6
  option :name, 'douban'
7
+
7
8
  option :client_options, {
8
9
  :site => 'https://api.douban.com',
9
10
  :authorize_url => 'https://www.douban.com/service/auth2/auth',
@@ -15,21 +16,20 @@ module OmniAuth
15
16
  }
16
17
 
17
18
  uid do
18
- raw_info['id']
19
+ raw_info['id'].split('/').last
19
20
  end
20
21
 
21
22
  info do
22
23
  {
24
+ :name => raw_info['title'],
23
25
  :nickname => raw_info['uid'],
24
- :name => raw_info['screen_name'],
25
- :city => raw_info['city'],
26
- :location => raw_info['location'],
27
- :description => raw_info['description'],
28
-
29
- :douban => {
30
- :url => raw_info['url'],
31
- :created_at => raw_info['created_at'],
32
- :large_avatar => raw_info['large_avatar']
26
+ :signature => raw_info['signature'],
27
+ :content => raw_info['content'],
28
+ :location => raw_info['location'] ? raw_info['location']['__content__'] : nil,
29
+ :links => {
30
+ :self => raw_info['link'].find{ |l| l['rel'] == 'self' }['href'],
31
+ :icon => raw_info['link'].find{ |l| l['rel'] == 'icon' }['href'],
32
+ :douban => raw_info['link'].find{ |l| l['rel'] == 'alternate' }['href'],
33
33
  }
34
34
  }
35
35
  end
@@ -40,7 +40,7 @@ module OmniAuth
40
40
 
41
41
  def raw_info
42
42
  access_token.options[:param_name] = 'access_token'
43
- @raw_info ||= access_token.get('/shuo/users/@me').parsed
43
+ @raw_info ||= access_token.get('/people/51789002').parsed['entry']
44
44
  rescue ::Timeout::Error => e
45
45
  raise e
46
46
  end
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module Douban
3
- VERSION = '0.0.1'
3
+ VERSION = '0.0.2'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-douban-oauth2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-11 00:00:00.000000000 Z
12
+ date: 2012-07-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: omniauth
16
- requirement: &2160197700 !ruby/object:Gem::Requirement
16
+ requirement: &2152255720 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '1.0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2160197700
24
+ version_requirements: *2152255720
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: omniauth-oauth2
27
- requirement: &2160196920 !ruby/object:Gem::Requirement
27
+ requirement: &2152187820 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '1.1'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2160196920
35
+ version_requirements: *2152187820
36
36
  description: OmniAuth OAuth2 strategy for Douban.
37
37
  email:
38
38
  - i@liluo.org