open_taobao 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHNAGELOG.md +4 -0
- data/README.md +4 -1
- data/lib/open_taobao/open_taobao.rb +2 -2
- data/lib/open_taobao/version.rb +1 -1
- data/spec/open_taobao_spec.rb +16 -0
- metadata +19 -34
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c56c188907b64a18213855c0fd4462f467ace55b
|
4
|
+
data.tar.gz: f971643cea9e6fb2b12f4f8abc622b9a30d54b81
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5029ab017326d6064a37853314d990af7a3da5ea81abbedb8242cc553c60ec3169188467e0ccf29762a65c87d66f8d82cfd2e2f138f6413fda2c6bf895a2271c
|
7
|
+
data.tar.gz: bf7d4ac94234a4350b7cb082855fe49ef311de98b1dba241c5732725a40cc92d32bbf2af5e38582170d9670ac52bdaeec946b8dc9c1b213fc8033edc6682a022
|
data/CHNAGELOG.md
CHANGED
data/README.md
CHANGED
@@ -5,7 +5,8 @@ Taobao Open Platform client for ruby. Rails3 is supported.
|
|
5
5
|
|
6
6
|
## NOTICE
|
7
7
|
|
8
|
-
`pid` is removed from config file, it's not required any more.
|
8
|
+
* `pid` is removed from config file, it's not required any more.
|
9
|
+
* Change OpenTaobao::Error message to json string from v0.2.1.
|
9
10
|
|
10
11
|
## Installation
|
11
12
|
|
@@ -38,6 +39,8 @@ Open the file and configure it with your taobao info.
|
|
38
39
|
|
39
40
|
Notice: `app_key`, `secret_key`, `endpoint` must be included in your YAML file, otherwise OpenTaobao.load will fail.
|
40
41
|
|
42
|
+
The `app_key` and `secret_key` are avaliable by ENV['TAOBAO_API_KEY'], ENV['TAOBAO_SECRET_KEY'] out of the box, you can use them if you use same keys for OmniauthTaobao or other taobao api.
|
43
|
+
|
41
44
|
call `OpenTaobao.get` or `OpenTaoboa.post`,with taobao parameters:
|
42
45
|
|
43
46
|
hash = OpenTaobao.get(
|
@@ -159,7 +159,7 @@ module OpenTaobao
|
|
159
159
|
# Raise OpenTaobao::Error if returned with error_response
|
160
160
|
def get!(params)
|
161
161
|
response = get params
|
162
|
-
raise Error.new(response['error_response']) if response.has_key?('error_response')
|
162
|
+
raise Error.new(MultiJson.encode response['error_response']) if response.has_key?('error_response')
|
163
163
|
response
|
164
164
|
end
|
165
165
|
|
@@ -172,7 +172,7 @@ module OpenTaobao
|
|
172
172
|
# Raise OpenTaobao::Error if returned with error_response
|
173
173
|
def post!(params)
|
174
174
|
response = post params
|
175
|
-
raise Error.new(response['error_response']) if response.has_key?('error_response')
|
175
|
+
raise Error.new(MultiJson.encode response['error_response']) if response.has_key?('error_response')
|
176
176
|
response
|
177
177
|
end
|
178
178
|
end
|
data/lib/open_taobao/version.rb
CHANGED
data/spec/open_taobao_spec.rb
CHANGED
@@ -205,6 +205,22 @@ describe OpenTaobao do
|
|
205
205
|
OpenTaobao.post!(params)
|
206
206
|
}.to raise_error OpenTaobao::Error
|
207
207
|
end
|
208
|
+
|
209
|
+
it "open_taobao error should be a json string" do
|
210
|
+
OpenTaobao.initialize_session
|
211
|
+
params = {
|
212
|
+
:method => "taobao.itemcats.no-method",
|
213
|
+
:fields => "cid,parent_id,name,is_parent",
|
214
|
+
:parent_cid => 0
|
215
|
+
}
|
216
|
+
|
217
|
+
begin
|
218
|
+
OpenTaobao.post!(params)
|
219
|
+
rescue OpenTaobao::Error => e
|
220
|
+
msg = MultiJson.decode(e.message)
|
221
|
+
msg.class.should == Hash
|
222
|
+
end
|
223
|
+
end
|
208
224
|
end
|
209
225
|
|
210
226
|
# OpenTaobao.load(File.expand_path('../taobao.yml',__FILE__))
|
metadata
CHANGED
@@ -1,110 +1,97 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: open_taobao
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
5
|
-
prerelease:
|
4
|
+
version: 0.2.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- wongyouth
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-09-23 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: multi_json
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: faraday
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - '>='
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - '>='
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: rspec
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - '>='
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0'
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - '>='
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: debugger
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - '>='
|
68
60
|
- !ruby/object:Gem::Version
|
69
61
|
version: '0'
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- -
|
66
|
+
- - '>='
|
76
67
|
- !ruby/object:Gem::Version
|
77
68
|
version: '0'
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: autotest
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
|
-
- -
|
73
|
+
- - '>='
|
84
74
|
- !ruby/object:Gem::Version
|
85
75
|
version: '0'
|
86
76
|
type: :development
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
|
-
- -
|
80
|
+
- - '>='
|
92
81
|
- !ruby/object:Gem::Version
|
93
82
|
version: '0'
|
94
83
|
- !ruby/object:Gem::Dependency
|
95
84
|
name: rake
|
96
85
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
86
|
requirements:
|
99
|
-
- -
|
87
|
+
- - '>='
|
100
88
|
- !ruby/object:Gem::Version
|
101
89
|
version: '0'
|
102
90
|
type: :development
|
103
91
|
prerelease: false
|
104
92
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
93
|
requirements:
|
107
|
-
- -
|
94
|
+
- - '>='
|
108
95
|
- !ruby/object:Gem::Version
|
109
96
|
version: '0'
|
110
97
|
description: 淘宝开放平台ruby版,支持Rails3~
|
@@ -134,29 +121,27 @@ files:
|
|
134
121
|
- spec/spec_helper.rb
|
135
122
|
homepage: http://github.com/wongyouth/open_taobao
|
136
123
|
licenses: []
|
124
|
+
metadata: {}
|
137
125
|
post_install_message:
|
138
126
|
rdoc_options: []
|
139
127
|
require_paths:
|
140
128
|
- lib
|
141
129
|
required_ruby_version: !ruby/object:Gem::Requirement
|
142
|
-
none: false
|
143
130
|
requirements:
|
144
|
-
- -
|
131
|
+
- - '>='
|
145
132
|
- !ruby/object:Gem::Version
|
146
133
|
version: '0'
|
147
134
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
148
|
-
none: false
|
149
135
|
requirements:
|
150
|
-
- -
|
136
|
+
- - '>='
|
151
137
|
- !ruby/object:Gem::Version
|
152
138
|
version: '0'
|
153
139
|
requirements: []
|
154
140
|
rubyforge_project:
|
155
|
-
rubygems_version:
|
141
|
+
rubygems_version: 2.0.3
|
156
142
|
signing_key:
|
157
|
-
specification_version:
|
143
|
+
specification_version: 4
|
158
144
|
summary: Open Taobao API for ruby
|
159
145
|
test_files:
|
160
146
|
- spec/open_taobao_spec.rb
|
161
147
|
- spec/spec_helper.rb
|
162
|
-
has_rdoc:
|