peddler 0.5.3 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +237 -8
- data/lib/mws/feeds.rb +1 -0
- data/lib/mws/feeds/client.rb +97 -0
- data/lib/mws/feeds/parsers/feed.rb +14 -0
- data/lib/mws/feeds/parsers/feed_submission.rb +25 -0
- data/lib/mws/feeds/parsers/feed_submission_count.rb +13 -0
- data/lib/mws/feeds/parsers/feed_submission_list.rb +20 -0
- data/lib/mws/feeds/parsers/feed_submission_result.rb +10 -0
- data/lib/mws/feeds/parsers/feed_submissions.rb +18 -0
- data/lib/mws/feeds/requests/feed.rb +38 -0
- data/lib/mws/feeds/requests/feed_submission_count.rb +20 -0
- data/lib/mws/feeds/requests/feed_submission_list.rb +28 -0
- data/lib/mws/feeds/requests/feed_submission_result.rb +18 -0
- data/lib/mws/feeds/requests/feed_submissions.rb +20 -0
- data/lib/mws/fulfillment_inbound_shipment/client.rb +7 -0
- data/lib/mws/fulfillment_inventory/client.rb +7 -0
- data/lib/mws/fulfillment_outbound_shipment/client.rb +7 -0
- data/lib/mws/off_amazon_payments/client.rb +7 -0
- data/lib/mws/orders.rb +1 -0
- data/lib/mws/orders/client.rb +88 -0
- data/lib/mws/orders/parsers/invoice_data.rb +25 -0
- data/lib/mws/orders/parsers/order.rb +113 -0
- data/lib/mws/orders/parsers/order_item.rb +110 -0
- data/lib/mws/orders/parsers/order_items.rb +20 -0
- data/lib/mws/orders/parsers/orders.rb +20 -0
- data/lib/mws/orders/parsers/payment_execution_detail.rb +20 -0
- data/lib/mws/orders/parsers/payment_execution_detail_item.rb +17 -0
- data/lib/mws/orders/parsers/service_status.rb +36 -0
- data/lib/mws/orders/parsers/service_status_message.rb +17 -0
- data/lib/mws/orders/parsers/shipping_address.rb +37 -0
- data/lib/mws/orders/requests/order_items.rb +26 -0
- data/lib/mws/orders/requests/orders.rb +39 -0
- data/lib/mws/orders/requests/service_status.rb +15 -0
- data/lib/mws/products/client.rb +7 -0
- data/lib/mws/recommendations/client.rb +7 -0
- data/lib/mws/reports/client.rb +6 -0
- data/lib/mws/sellers/client.rb +7 -0
- data/lib/mws/subscriptions/client.rb +7 -0
- data/lib/peddler.rb +11 -1
- data/lib/peddler/client.rb +62 -0
- data/lib/peddler/parsers/base.rb +15 -0
- data/lib/peddler/parsers/collection.rb +23 -0
- data/lib/peddler/parsers/model.rb +43 -0
- data/lib/peddler/parsers/text.rb +13 -0
- data/lib/peddler/parsers/xml.rb +25 -0
- data/lib/peddler/request.rb +50 -0
- data/lib/peddler/request/parameters.rb +56 -0
- data/lib/peddler/request/structured_list.rb +43 -0
- data/lib/peddler/response_wrapper.rb +32 -0
- data/lib/peddler/version.rb +1 -1
- data/test/fixtures/feeds/feed_submission.xml +14 -0
- data/test/fixtures/feeds/feed_submission_count.xml +9 -0
- data/test/fixtures/feeds/feed_submission_list.xml +17 -0
- data/test/fixtures/feeds/feed_submissions.xml +15 -0
- data/test/fixtures/mws.yml +8 -0
- data/test/fixtures/mws.yml.example +4 -0
- data/test/fixtures/orders/order_items.xml +83 -0
- data/test/fixtures/orders/orders.xml +109 -0
- data/test/fixtures/orders/service_status.xml +19 -0
- data/test/helper.rb +5 -0
- data/test/integration/feeds/test_feed_submission_count.rb +13 -0
- data/test/integration/feeds/test_feed_submission_list.rb +15 -0
- data/test/integration/feeds/test_feed_submission_result.rb +15 -0
- data/test/integration/orders/test_order_items.rb +19 -0
- data/test/integration/orders/test_orders.rb +20 -0
- data/test/integration/orders/test_service_status.rb +12 -0
- data/test/integration_helper.rb +16 -0
- data/test/mws/feeds/parsers/test_feed.rb +13 -0
- data/test/mws/feeds/parsers/test_feed_submission.rb +25 -0
- data/test/mws/feeds/parsers/test_feed_submission_count.rb +13 -0
- data/test/mws/feeds/parsers/test_feed_submission_list.rb +14 -0
- data/test/mws/feeds/parsers/test_feed_submission_result.rb +13 -0
- data/test/mws/feeds/parsers/test_feed_submissions.rb +17 -0
- data/test/mws/feeds/requests/test_feed.rb +63 -0
- data/test/mws/feeds/requests/test_feed_submission_count.rb +23 -0
- data/test/mws/feeds/requests/test_feed_submission_list.rb +40 -0
- data/test/mws/feeds/requests/test_feed_submissions.rb +29 -0
- data/test/mws/orders/parsers/test_order.rb +86 -0
- data/test/mws/orders/parsers/test_order_item.rb +69 -0
- data/test/mws/orders/parsers/test_order_items.rb +14 -0
- data/test/mws/orders/parsers/test_orders.rb +14 -0
- data/test/mws/orders/parsers/test_payment_execution_detail.rb +14 -0
- data/test/mws/orders/parsers/test_payment_execution_detail_item.rb +17 -0
- data/test/mws/orders/parsers/test_service_status.rb +39 -0
- data/test/mws/orders/parsers/test_service_status_message.rb +17 -0
- data/test/mws/orders/parsers/test_shipping_address.rb +36 -0
- data/test/mws/orders/requests/test_order_items.rb +39 -0
- data/test/mws/orders/requests/test_orders.rb +49 -0
- data/test/mws/orders/requests/test_service_status.rb +25 -0
- data/test/parser_helper.rb +11 -0
- data/test/peddler/parsers/test_collection.rb +8 -0
- data/test/peddler/parsers/test_model.rb +34 -0
- data/test/peddler/request/test_parameters.rb +35 -0
- data/test/peddler/request/test_structured_list.rb +18 -0
- data/test/peddler/test_client.rb +42 -0
- data/test/request_helper.rb +20 -0
- metadata +213 -10
- data/lib/peddler/apis.rb +0 -45
- data/lib/peddler/service.rb +0 -83
- data/test/service_test.rb +0 -42
- data/test/test_helper.rb +0 -3
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'helper'
|
2
|
+
require 'peddler/request/structured_list'
|
3
|
+
|
4
|
+
class PeddlerRequestStructuredListTest < MiniTest::Test
|
5
|
+
def setup
|
6
|
+
@structured_list = Peddler::Request::StructuredList.new(:order_status)
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_builds_a_structured_list_for_a_single_value
|
10
|
+
exp = { 'OrderStatus.Status.1' => 'foo' }
|
11
|
+
assert_equal(exp, @structured_list.build('foo'))
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_builds_a_structured_list_for_an_array_of_values
|
15
|
+
exp = { 'OrderStatus.Status.1' => 'foo', 'OrderStatus.Status.2' => 'bar' }
|
16
|
+
assert_equal(exp, @structured_list.build(%w(foo bar)))
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'helper'
|
2
|
+
require 'peddler/client'
|
3
|
+
|
4
|
+
class PeddlerClientTest < MiniTest::Test
|
5
|
+
def setup
|
6
|
+
@klass = Class.new(Peddler::Client)
|
7
|
+
@client = @klass.new('US', 'key', 'secret', 'merchant_id')
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_configures_path
|
11
|
+
@klass.path('Foo')
|
12
|
+
assert @client.endpoint.match(/Foo$/)
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_has_user_agent
|
16
|
+
refute @client.connection.data[:headers].empty?
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_returns_marketplace_ids
|
20
|
+
refute_equal @client.marketplace_id('US'), @client.marketplace_id('GB')
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_returns_default_marketplace_id
|
24
|
+
assert_equal @client.marketplace_id, @client.marketplace_id('US')
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_inherits_parent_params
|
28
|
+
assert_equal Peddler::Client.params, @klass.params
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_defines_constants_on_service
|
32
|
+
refute_nil @klass.const_get(:HOSTS)
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_has_a_key
|
36
|
+
refute_nil @client.aws_access_key_id
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_has_a_secret
|
40
|
+
refute_nil @client.aws_secret_access_key
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class RequestTest < Minitest::Test
|
4
|
+
def mock_response_body
|
5
|
+
raise NotImplementedError
|
6
|
+
end
|
7
|
+
|
8
|
+
def mock_response
|
9
|
+
res = Minitest::Mock.new
|
10
|
+
res.expect(:body, mock_response_body)
|
11
|
+
|
12
|
+
Peddler::ResponseWrapper.new(res)
|
13
|
+
end
|
14
|
+
|
15
|
+
def mock_client
|
16
|
+
client = Minitest::Mock.new
|
17
|
+
client.expect(:marketplace_id, '123456')
|
18
|
+
client.expect(:post, mock_response, [Hash])
|
19
|
+
end
|
20
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: peddler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hakan Ensari
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jeff
|
@@ -24,8 +24,78 @@ dependencies:
|
|
24
24
|
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.7.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: money
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '5.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '5.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: nokogiri
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.5'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.5'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: structure
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.25.1
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.25.1
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: guard-minitest
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
27
83
|
- !ruby/object:Gem::Dependency
|
28
84
|
name: minitest
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ~>
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '5.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ~>
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '5.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: pry
|
29
99
|
requirement: !ruby/object:Gem::Requirement
|
30
100
|
requirements:
|
31
101
|
- - '>='
|
@@ -52,21 +122,110 @@ dependencies:
|
|
52
122
|
- - '>='
|
53
123
|
- !ruby/object:Gem::Version
|
54
124
|
version: '0'
|
55
|
-
description: A
|
125
|
+
description: A Ruby interface to the Amazon Marketplace Web Service (MWS) APIs
|
56
126
|
email:
|
57
127
|
- hakan.ensari@papercavalier.com
|
58
128
|
executables: []
|
59
129
|
extensions: []
|
60
130
|
extra_rdoc_files: []
|
61
131
|
files:
|
62
|
-
- lib/
|
63
|
-
- lib/
|
132
|
+
- lib/mws/feeds/client.rb
|
133
|
+
- lib/mws/feeds/parsers/feed.rb
|
134
|
+
- lib/mws/feeds/parsers/feed_submission.rb
|
135
|
+
- lib/mws/feeds/parsers/feed_submission_count.rb
|
136
|
+
- lib/mws/feeds/parsers/feed_submission_list.rb
|
137
|
+
- lib/mws/feeds/parsers/feed_submission_result.rb
|
138
|
+
- lib/mws/feeds/parsers/feed_submissions.rb
|
139
|
+
- lib/mws/feeds/requests/feed.rb
|
140
|
+
- lib/mws/feeds/requests/feed_submission_count.rb
|
141
|
+
- lib/mws/feeds/requests/feed_submission_list.rb
|
142
|
+
- lib/mws/feeds/requests/feed_submission_result.rb
|
143
|
+
- lib/mws/feeds/requests/feed_submissions.rb
|
144
|
+
- lib/mws/feeds.rb
|
145
|
+
- lib/mws/fulfillment_inbound_shipment/client.rb
|
146
|
+
- lib/mws/fulfillment_inventory/client.rb
|
147
|
+
- lib/mws/fulfillment_outbound_shipment/client.rb
|
148
|
+
- lib/mws/off_amazon_payments/client.rb
|
149
|
+
- lib/mws/orders/client.rb
|
150
|
+
- lib/mws/orders/parsers/invoice_data.rb
|
151
|
+
- lib/mws/orders/parsers/order.rb
|
152
|
+
- lib/mws/orders/parsers/order_item.rb
|
153
|
+
- lib/mws/orders/parsers/order_items.rb
|
154
|
+
- lib/mws/orders/parsers/orders.rb
|
155
|
+
- lib/mws/orders/parsers/payment_execution_detail.rb
|
156
|
+
- lib/mws/orders/parsers/payment_execution_detail_item.rb
|
157
|
+
- lib/mws/orders/parsers/service_status.rb
|
158
|
+
- lib/mws/orders/parsers/service_status_message.rb
|
159
|
+
- lib/mws/orders/parsers/shipping_address.rb
|
160
|
+
- lib/mws/orders/requests/order_items.rb
|
161
|
+
- lib/mws/orders/requests/orders.rb
|
162
|
+
- lib/mws/orders/requests/service_status.rb
|
163
|
+
- lib/mws/orders.rb
|
164
|
+
- lib/mws/products/client.rb
|
165
|
+
- lib/mws/recommendations/client.rb
|
166
|
+
- lib/mws/reports/client.rb
|
167
|
+
- lib/mws/sellers/client.rb
|
168
|
+
- lib/mws/subscriptions/client.rb
|
169
|
+
- lib/peddler/client.rb
|
170
|
+
- lib/peddler/parsers/base.rb
|
171
|
+
- lib/peddler/parsers/collection.rb
|
172
|
+
- lib/peddler/parsers/model.rb
|
173
|
+
- lib/peddler/parsers/text.rb
|
174
|
+
- lib/peddler/parsers/xml.rb
|
175
|
+
- lib/peddler/request/parameters.rb
|
176
|
+
- lib/peddler/request/structured_list.rb
|
177
|
+
- lib/peddler/request.rb
|
178
|
+
- lib/peddler/response_wrapper.rb
|
64
179
|
- lib/peddler/version.rb
|
65
180
|
- lib/peddler.rb
|
66
181
|
- LICENSE
|
67
182
|
- README.md
|
68
|
-
- test/
|
69
|
-
- test/
|
183
|
+
- test/fixtures/feeds/feed_submission.xml
|
184
|
+
- test/fixtures/feeds/feed_submission_count.xml
|
185
|
+
- test/fixtures/feeds/feed_submission_list.xml
|
186
|
+
- test/fixtures/feeds/feed_submissions.xml
|
187
|
+
- test/fixtures/mws.yml
|
188
|
+
- test/fixtures/mws.yml.example
|
189
|
+
- test/fixtures/orders/order_items.xml
|
190
|
+
- test/fixtures/orders/orders.xml
|
191
|
+
- test/fixtures/orders/service_status.xml
|
192
|
+
- test/helper.rb
|
193
|
+
- test/integration/feeds/test_feed_submission_count.rb
|
194
|
+
- test/integration/feeds/test_feed_submission_list.rb
|
195
|
+
- test/integration/feeds/test_feed_submission_result.rb
|
196
|
+
- test/integration/orders/test_order_items.rb
|
197
|
+
- test/integration/orders/test_orders.rb
|
198
|
+
- test/integration/orders/test_service_status.rb
|
199
|
+
- test/integration_helper.rb
|
200
|
+
- test/mws/feeds/parsers/test_feed.rb
|
201
|
+
- test/mws/feeds/parsers/test_feed_submission.rb
|
202
|
+
- test/mws/feeds/parsers/test_feed_submission_count.rb
|
203
|
+
- test/mws/feeds/parsers/test_feed_submission_list.rb
|
204
|
+
- test/mws/feeds/parsers/test_feed_submission_result.rb
|
205
|
+
- test/mws/feeds/parsers/test_feed_submissions.rb
|
206
|
+
- test/mws/feeds/requests/test_feed.rb
|
207
|
+
- test/mws/feeds/requests/test_feed_submission_count.rb
|
208
|
+
- test/mws/feeds/requests/test_feed_submission_list.rb
|
209
|
+
- test/mws/feeds/requests/test_feed_submissions.rb
|
210
|
+
- test/mws/orders/parsers/test_order.rb
|
211
|
+
- test/mws/orders/parsers/test_order_item.rb
|
212
|
+
- test/mws/orders/parsers/test_order_items.rb
|
213
|
+
- test/mws/orders/parsers/test_orders.rb
|
214
|
+
- test/mws/orders/parsers/test_payment_execution_detail.rb
|
215
|
+
- test/mws/orders/parsers/test_payment_execution_detail_item.rb
|
216
|
+
- test/mws/orders/parsers/test_service_status.rb
|
217
|
+
- test/mws/orders/parsers/test_service_status_message.rb
|
218
|
+
- test/mws/orders/parsers/test_shipping_address.rb
|
219
|
+
- test/mws/orders/requests/test_order_items.rb
|
220
|
+
- test/mws/orders/requests/test_orders.rb
|
221
|
+
- test/mws/orders/requests/test_service_status.rb
|
222
|
+
- test/parser_helper.rb
|
223
|
+
- test/peddler/parsers/test_collection.rb
|
224
|
+
- test/peddler/parsers/test_model.rb
|
225
|
+
- test/peddler/request/test_parameters.rb
|
226
|
+
- test/peddler/request/test_structured_list.rb
|
227
|
+
- test/peddler/test_client.rb
|
228
|
+
- test/request_helper.rb
|
70
229
|
homepage: http://github.com/papercavalier/peddler
|
71
230
|
licenses: []
|
72
231
|
metadata: {}
|
@@ -89,7 +248,51 @@ rubyforge_project:
|
|
89
248
|
rubygems_version: 2.0.3
|
90
249
|
signing_key:
|
91
250
|
specification_version: 4
|
92
|
-
summary: Wraps the Amazon
|
251
|
+
summary: Wraps the Amazon MWS APIs
|
93
252
|
test_files:
|
94
|
-
- test/
|
95
|
-
- test/
|
253
|
+
- test/fixtures/feeds/feed_submission.xml
|
254
|
+
- test/fixtures/feeds/feed_submission_count.xml
|
255
|
+
- test/fixtures/feeds/feed_submission_list.xml
|
256
|
+
- test/fixtures/feeds/feed_submissions.xml
|
257
|
+
- test/fixtures/mws.yml
|
258
|
+
- test/fixtures/mws.yml.example
|
259
|
+
- test/fixtures/orders/order_items.xml
|
260
|
+
- test/fixtures/orders/orders.xml
|
261
|
+
- test/fixtures/orders/service_status.xml
|
262
|
+
- test/helper.rb
|
263
|
+
- test/integration/feeds/test_feed_submission_count.rb
|
264
|
+
- test/integration/feeds/test_feed_submission_list.rb
|
265
|
+
- test/integration/feeds/test_feed_submission_result.rb
|
266
|
+
- test/integration/orders/test_order_items.rb
|
267
|
+
- test/integration/orders/test_orders.rb
|
268
|
+
- test/integration/orders/test_service_status.rb
|
269
|
+
- test/integration_helper.rb
|
270
|
+
- test/mws/feeds/parsers/test_feed.rb
|
271
|
+
- test/mws/feeds/parsers/test_feed_submission.rb
|
272
|
+
- test/mws/feeds/parsers/test_feed_submission_count.rb
|
273
|
+
- test/mws/feeds/parsers/test_feed_submission_list.rb
|
274
|
+
- test/mws/feeds/parsers/test_feed_submission_result.rb
|
275
|
+
- test/mws/feeds/parsers/test_feed_submissions.rb
|
276
|
+
- test/mws/feeds/requests/test_feed.rb
|
277
|
+
- test/mws/feeds/requests/test_feed_submission_count.rb
|
278
|
+
- test/mws/feeds/requests/test_feed_submission_list.rb
|
279
|
+
- test/mws/feeds/requests/test_feed_submissions.rb
|
280
|
+
- test/mws/orders/parsers/test_order.rb
|
281
|
+
- test/mws/orders/parsers/test_order_item.rb
|
282
|
+
- test/mws/orders/parsers/test_order_items.rb
|
283
|
+
- test/mws/orders/parsers/test_orders.rb
|
284
|
+
- test/mws/orders/parsers/test_payment_execution_detail.rb
|
285
|
+
- test/mws/orders/parsers/test_payment_execution_detail_item.rb
|
286
|
+
- test/mws/orders/parsers/test_service_status.rb
|
287
|
+
- test/mws/orders/parsers/test_service_status_message.rb
|
288
|
+
- test/mws/orders/parsers/test_shipping_address.rb
|
289
|
+
- test/mws/orders/requests/test_order_items.rb
|
290
|
+
- test/mws/orders/requests/test_orders.rb
|
291
|
+
- test/mws/orders/requests/test_service_status.rb
|
292
|
+
- test/parser_helper.rb
|
293
|
+
- test/peddler/parsers/test_collection.rb
|
294
|
+
- test/peddler/parsers/test_model.rb
|
295
|
+
- test/peddler/request/test_parameters.rb
|
296
|
+
- test/peddler/request/test_structured_list.rb
|
297
|
+
- test/peddler/test_client.rb
|
298
|
+
- test/request_helper.rb
|
data/lib/peddler/apis.rb
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
require 'peddler/service'
|
2
|
-
|
3
|
-
module Peddler
|
4
|
-
class Feeds < Service
|
5
|
-
end
|
6
|
-
|
7
|
-
class FulfillmentInboundShipment < Service
|
8
|
-
path 'FulfillmentInboundShipment/2010-10-01'
|
9
|
-
end
|
10
|
-
|
11
|
-
class FulfillmentInventory < Service
|
12
|
-
path 'FulfillmentInventory/2010-10-01'
|
13
|
-
end
|
14
|
-
|
15
|
-
class FulfillmentOutboundShipment < Service
|
16
|
-
path 'FulfillmentOutboundShipment/2010-10-01'
|
17
|
-
end
|
18
|
-
|
19
|
-
class OffAmazonPayments < Service
|
20
|
-
path 'OffAmazonPayments/2013-01-01/'
|
21
|
-
end
|
22
|
-
|
23
|
-
class Orders < Service
|
24
|
-
path 'Orders/2011-01-01'
|
25
|
-
end
|
26
|
-
|
27
|
-
class Products < Service
|
28
|
-
path 'Products/2011-10-01'
|
29
|
-
end
|
30
|
-
|
31
|
-
class Recommendations < Service
|
32
|
-
path 'Recommendations/2013-04-01'
|
33
|
-
end
|
34
|
-
|
35
|
-
class Reports < Service
|
36
|
-
end
|
37
|
-
|
38
|
-
class Sellers < Service
|
39
|
-
path 'Sellers/2011-07-01'
|
40
|
-
end
|
41
|
-
|
42
|
-
class Subscriptions < Service
|
43
|
-
path 'Subscriptions/2013-07-01'
|
44
|
-
end
|
45
|
-
end
|
data/lib/peddler/service.rb
DELETED
@@ -1,83 +0,0 @@
|
|
1
|
-
require 'jeff'
|
2
|
-
|
3
|
-
module Peddler
|
4
|
-
# Service is an abstract wrapper around a Marketplace Web Services (MWS)
|
5
|
-
# endpoint.
|
6
|
-
class Service
|
7
|
-
include Jeff
|
8
|
-
|
9
|
-
attr_accessor :country, :seller_id
|
10
|
-
|
11
|
-
# The initializer takes four arguments:
|
12
|
-
#
|
13
|
-
# country - The String ISO 3166-1 two-letter country code of
|
14
|
-
# the base marketplace of the seller.
|
15
|
-
# aws_access_key_id - The String AWS access key id.
|
16
|
-
# aws_secret_access_key - The String AWS secret access key.
|
17
|
-
# seller_id - The String MWS merchant id.
|
18
|
-
#
|
19
|
-
# These arguments are optional and can be set individually later.
|
20
|
-
def initialize(country = nil, aws_access_key_id = nil, aws_secret_access_key = nil, seller_id = nil)
|
21
|
-
@country = country
|
22
|
-
@aws_access_key_id = aws_access_key_id
|
23
|
-
@aws_secret_access_key = aws_secret_access_key
|
24
|
-
@seller_id = seller_id
|
25
|
-
end
|
26
|
-
|
27
|
-
# A list of MWS hosts.
|
28
|
-
HOSTS = {
|
29
|
-
'CA' => 'mws.amazonservices.ca',
|
30
|
-
'CN' => 'mws.amazonservices.com.cn',
|
31
|
-
'DE' => 'mws-eu.amazonservices.com',
|
32
|
-
'ES' => 'mws-eu.amazonservices.com',
|
33
|
-
'FR' => 'mws-eu.amazonservices.com',
|
34
|
-
'GB' => 'mws-eu.amazonservices.com',
|
35
|
-
'IN' => 'mws.amazonservices.in',
|
36
|
-
'IT' => 'mws-eu.amazonservices.com',
|
37
|
-
'JP' => 'mws.amazonservices.jp',
|
38
|
-
'US' => 'mws.amazonservices.com'
|
39
|
-
}
|
40
|
-
|
41
|
-
# A list of marketplace ids.
|
42
|
-
MARKETPLACE_IDS = {
|
43
|
-
'CA' => 'A2EUQ1WTGCTBG2',
|
44
|
-
'CN' => 'AAHKV2X7AFYLW',
|
45
|
-
'DE' => 'A1PA6795UKMFR9',
|
46
|
-
'ES' => 'A1RKKUPIHCS9HS',
|
47
|
-
'FR' => 'A13V1IB3VIYZZH',
|
48
|
-
'GB' => 'A1F83G8C2ARO7P',
|
49
|
-
'IN' => 'A21TJRUUN4KGV',
|
50
|
-
'IT' => 'APJ6JRA9NG5V4',
|
51
|
-
'JP' => 'A1VC38T7YXB528',
|
52
|
-
'US' => 'ATVPDKIKX0DER'
|
53
|
-
}
|
54
|
-
|
55
|
-
# Gets/Sets the path of the MWS endpoint.
|
56
|
-
#
|
57
|
-
# path - A String path (default: nil).
|
58
|
-
def self.path(path = nil)
|
59
|
-
path ? @path = path : @path
|
60
|
-
end
|
61
|
-
|
62
|
-
def self.inherited(base)
|
63
|
-
base.params(params)
|
64
|
-
base.path(path)
|
65
|
-
end
|
66
|
-
|
67
|
-
params('SellerId' => -> { seller_id })
|
68
|
-
|
69
|
-
# Returns the String MWS endpoint.
|
70
|
-
def endpoint
|
71
|
-
"https://#{HOSTS.fetch(country)}/#{self.class.path}"
|
72
|
-
end
|
73
|
-
|
74
|
-
# Get the marketplace id for a given country.
|
75
|
-
#
|
76
|
-
# country - A String ISO 3166-1 two-letter country code.
|
77
|
-
#
|
78
|
-
# Returns a String marketplace id.
|
79
|
-
def marketplace_id(country)
|
80
|
-
MARKETPLACE_IDS.fetch(country)
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|