topsdk 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +1 -1
- data/lib/config/taobao.yml +13 -10
- data/lib/topsdk/client.rb +7 -3
- data/lib/topsdk/version.rb +1 -1
- data/lib/topsdk.rb +2 -2
- metadata +5 -5
data/README.rdoc
CHANGED
@@ -23,12 +23,12 @@ Create a config/taobao.yml
|
|
23
23
|
<<: *default
|
24
24
|
|
25
25
|
production:
|
26
|
+
<<: *default
|
26
27
|
secret_key: 42ab2d12a5bea25d1bc06ccd23123121daf
|
27
28
|
auth_url: https://oauth.taobao.com/authorize
|
28
29
|
token_url: https://oauth.taobao.com/token
|
29
30
|
rest_url: http://gw.api.taobao.com/router/rest
|
30
31
|
callback_url: http://yourdomain.com/auth/callback
|
31
|
-
<<: *default
|
32
32
|
|
33
33
|
== Usage
|
34
34
|
|
data/lib/config/taobao.yml
CHANGED
@@ -1,21 +1,24 @@
|
|
1
|
-
|
1
|
+
prod: &prod
|
2
2
|
api_key: 12012322
|
3
|
-
secret_key:
|
3
|
+
secret_key: 42ab2d12a5bea25d1bc06ccd23123121daf
|
4
|
+
auth_url: https://oauth.taobao.com/authorize
|
5
|
+
token_url: https://oauth.taobao.com/token
|
6
|
+
rest_url: http://gw.api.taobao.com/router/rest
|
7
|
+
callback_url: http://yourdomain.com/auth/callback
|
8
|
+
|
9
|
+
sandbox: &sandbox
|
10
|
+
<<: *prod
|
11
|
+
secret_key: sandbox9ffd79873a7ae0e01fefed97c
|
4
12
|
auth_url: https://oauth.tbsandbox.com/authorize
|
5
13
|
token_url: https://oauth.tbsandbox.com/token
|
6
14
|
rest_url: http://gw.api.tbsandbox.com/router/rest
|
7
15
|
callback_url: http://0.0.0.0:3000/auth/callback
|
8
16
|
|
9
17
|
development:
|
10
|
-
<<: *
|
18
|
+
<<: *sandbox
|
11
19
|
|
12
20
|
test:
|
13
|
-
<<: *
|
21
|
+
<<: *sandbox
|
14
22
|
|
15
23
|
production:
|
16
|
-
|
17
|
-
auth_url: https://oauth.taobao.com/authorize
|
18
|
-
token_url: https://oauth.taobao.com/token
|
19
|
-
rest_url: http://gw.api.taobao.com/router/rest
|
20
|
-
callback_url: http://yourdomain.com/auth/callback
|
21
|
-
<<: *default
|
24
|
+
<<: *prod
|
data/lib/topsdk/client.rb
CHANGED
@@ -20,12 +20,16 @@ module Topsdk
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def get(url=ENV['TAOBAO_REST_URL'])
|
23
|
-
|
23
|
+
request = Nestful::Request.new(url, ({:method => :get, :format => :json, :params => @params}))
|
24
|
+
@result = request.execute
|
24
25
|
parse
|
25
26
|
end
|
26
27
|
|
27
28
|
def post(url=ENV['TAOBAO_REST_URL'])
|
28
|
-
|
29
|
+
request = Nestful::Request.new(url, ({:method => :post, :format => :form, :params => @params}))
|
30
|
+
pp request.to_s
|
31
|
+
pp @params.to_s
|
32
|
+
@result = request.execute
|
29
33
|
@result = JSON.parse(@result)
|
30
34
|
parse
|
31
35
|
end
|
@@ -34,8 +38,8 @@ module Topsdk
|
|
34
38
|
return false unless @result.is_a?(Hash)
|
35
39
|
case
|
36
40
|
when @result.has_key?(response_key)
|
41
|
+
pp response_key if DEBUG
|
37
42
|
result = @result[response_key]
|
38
|
-
result[root_key] if result.has_key?(root_key)
|
39
43
|
when @result.has_key?('error_response')
|
40
44
|
@result['error_response']['msg']
|
41
45
|
else
|
data/lib/topsdk/version.rb
CHANGED
data/lib/topsdk.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: topsdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
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: 2011-
|
12
|
+
date: 2011-10-19 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nestful
|
16
|
-
requirement: &
|
16
|
+
requirement: &70275679541760 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70275679541760
|
25
25
|
description: Simple Taobao API client for Ruby
|
26
26
|
email:
|
27
27
|
- howl.wong@gmail.com
|
@@ -60,7 +60,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
60
60
|
version: '0'
|
61
61
|
requirements: []
|
62
62
|
rubyforge_project: topsdk
|
63
|
-
rubygems_version: 1.8.
|
63
|
+
rubygems_version: 1.8.11
|
64
64
|
signing_key:
|
65
65
|
specification_version: 3
|
66
66
|
summary: Taobao API client
|