omniauth-taobao-oauth2 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.DS_Store +0 -0
- data/lib/omniauth-taobao-oauth2.rb +0 -1
- data/lib/omniauth-taobao-oauth2/version.rb +1 -1
- data/lib/omniauth/strategies/taobao.rb +11 -35
- data/omniauth-taobao-oauth2.gemspec +1 -2
- metadata +3 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a5da4db12baf886b3273434deb4c092a7e19ae02
|
4
|
+
data.tar.gz: 26352f54eb7d33f59fbeb887c8f692d745e7603a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04b9c3d372053c74260cfd9587e4235b035825205031b88805a1561361ec6060bc6bd93dbc44f16e671771c75988678a0aaa2370b961b7173f8351bf2815e78f
|
7
|
+
data.tar.gz: 1ce693bf7f8e9113a8fc6ae0b8bda9b7e0cb0b881594354efdca958ffdfb802bd611f213e78bd980ccfe93a5bd4e9d86e4d2bd308667606ff6097ac4cf0d0564
|
data/.DS_Store
ADDED
Binary file
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
require 'omniauth-oauth2'
|
3
|
+
require 'cgi' unless defined?(::CGI)
|
4
|
+
|
3
5
|
|
4
6
|
module OmniAuth
|
5
7
|
module Strategies
|
@@ -11,61 +13,35 @@ module OmniAuth
|
|
11
13
|
token_url: "/token"
|
12
14
|
}
|
13
15
|
option :token_params, {
|
14
|
-
:
|
16
|
+
parse: :json
|
15
17
|
}
|
16
18
|
|
17
19
|
uid do
|
18
|
-
|
20
|
+
user_id
|
19
21
|
end
|
20
22
|
|
21
23
|
info do
|
22
24
|
{
|
23
|
-
nickname:
|
25
|
+
nickname: nickname
|
24
26
|
}
|
25
27
|
end
|
26
28
|
|
27
29
|
extra do
|
28
30
|
{
|
29
|
-
raw_info:
|
31
|
+
raw_info: {}
|
30
32
|
}
|
31
33
|
end
|
32
34
|
|
33
|
-
def raw_info
|
34
|
-
access_token.options[:mode] = :query
|
35
|
-
@raw_info ||= ::OAuth2::Response.new(conn.get("/router/rest", signed_params)).parsed['user_seller_get_response']['user'] rescue {}
|
36
|
-
end
|
37
|
-
|
38
35
|
private
|
39
36
|
|
40
|
-
def
|
41
|
-
|
42
|
-
req.response :logger
|
43
|
-
req.adapter :typhoeus
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
def params
|
48
|
-
{
|
49
|
-
app_key: client.id,
|
50
|
-
method: 'taobao.user.seller.get',
|
51
|
-
fields: 'user_id,nick',
|
52
|
-
format: 'json',
|
53
|
-
session: access_token.token,
|
54
|
-
v: '2.0',
|
55
|
-
timestamp: timestamp,
|
56
|
-
partner_id: 'top-apitools'
|
57
|
-
}
|
58
|
-
end
|
59
|
-
|
60
|
-
def signed_params
|
61
|
-
rand = client.secret + params.sort.flatten.join
|
62
|
-
sign = Digest::MD5.hexdigest(rand).to_s.upcase
|
63
|
-
params.merge(sign: sign)# 數字簽名
|
37
|
+
def nickname
|
38
|
+
::CGI::unescape(access_token.params['taobao_user_nick'].to_s).force_encoding('utf-8')
|
64
39
|
end
|
65
40
|
|
66
|
-
def
|
67
|
-
|
41
|
+
def user_id
|
42
|
+
access_token.params['taobao_user_id'].to_i
|
68
43
|
end
|
44
|
+
|
69
45
|
end
|
70
46
|
end
|
71
47
|
end
|
@@ -17,8 +17,7 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
|
-
|
21
|
-
spec.add_runtime_dependency "typhoeus"
|
20
|
+
|
22
21
|
spec.add_development_dependency "bundler", "~> 1.3"
|
23
22
|
spec.add_development_dependency "rake"
|
24
23
|
end
|
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-taobao-oauth2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Howl王
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: typhoeus
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: bundler
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -59,6 +45,7 @@ executables: []
|
|
59
45
|
extensions: []
|
60
46
|
extra_rdoc_files: []
|
61
47
|
files:
|
48
|
+
- ".DS_Store"
|
62
49
|
- ".gitignore"
|
63
50
|
- Gemfile
|
64
51
|
- LICENSE.txt
|