peddler 1.6.6 → 1.6.7
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.
- checksums.yaml +5 -5
- data/README.md +27 -1
- data/lib/peddler/errors.rb +12 -0
- data/lib/peddler/version.rb +1 -1
- data/test/unit/peddler/test_errors.rb +26 -0
- metadata +59 -56
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a8911af92b466d1ec833d6d1405607440ba190670893b2e4565109a4d00fe866
|
4
|
+
data.tar.gz: 2e9546d098f60386f2f58ea825089448f3334ab6b92c3547dc75ead634a7d808
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 275440d472e985342f9f764bd1e59e975a772d9ca02baec77c05d28458679c9c9b463925fca0afacd18fe1baa31e37983625bc252d53f429a25e7162a978c1fe
|
7
|
+
data.tar.gz: 4709a75480e4c51d0fe86bd6d78bca3f10197d18950ffbeabd70c63d49325f7adfce62102e4eff83b05ce312954b19e51b4cddfb9da7b22aa27f447c54b38986
|
data/README.md
CHANGED
@@ -87,9 +87,27 @@ MWS::Orders::Client.parser = MyParser
|
|
87
87
|
|
88
88
|
For a sample implementation, see my [MWS Orders](https://github.com/hakanensari/mws-orders) library.
|
89
89
|
|
90
|
+
### Throttling
|
91
|
+
|
92
|
+
Amazon limits the number of requests you can submit to a given operation in a given amount of time.
|
93
|
+
|
94
|
+
Peddler exposes header values showing the hourly quota of the current operation:
|
95
|
+
|
96
|
+
```ruby
|
97
|
+
res = client.some_method
|
98
|
+
puts res.quota
|
99
|
+
#<struct Quota max=200, remaining=150, resets_on=2017-01-01 00:12:00 UTC>
|
100
|
+
```
|
101
|
+
|
102
|
+
Read Amazon's tips on how to avoid throttling [here](https://docs.developer.amazonservices.com/en_US/dev_guide/DG_Throttling.html).
|
103
|
+
|
90
104
|
### Debugging
|
91
105
|
|
92
|
-
|
106
|
+
If you are having trouble with a request, read [Amazon documentation](https://developer.amazonservices.com/gp/mws/docs.html). Peddler's source links individual operations to their corresponding entries in the Amazon docs.
|
107
|
+
|
108
|
+
Note that some optional keywords have default values.
|
109
|
+
|
110
|
+
To introspect requests, set the `EXCON_DEBUG` environment variable to `1` or similar truthy value. Peddler will then log request and response internals to stdout.
|
93
111
|
|
94
112
|
### Errors
|
95
113
|
|
@@ -114,6 +132,14 @@ rescue Excon::Error::ServiceUnavailable => e
|
|
114
132
|
end
|
115
133
|
```
|
116
134
|
|
135
|
+
Peddler has an optional new error handler that raises more descriptive errors: for instance, `Peddler::Errors::RequestThrottled` instead of `Excon::Error::ServiceUnavailable`. This error handler will become the default in the next major version.
|
136
|
+
|
137
|
+
To start using this now:
|
138
|
+
|
139
|
+
```ruby
|
140
|
+
require 'peddler/errors'
|
141
|
+
```
|
142
|
+
|
117
143
|
## The APIs
|
118
144
|
|
119
145
|
### Feeds
|
data/lib/peddler/version.rb
CHANGED
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'helper'
|
4
|
+
require 'peddler/errors'
|
5
|
+
|
6
|
+
class TestPeddlerErrors < MiniTest::Test
|
7
|
+
def teardown
|
8
|
+
clients.each do |client|
|
9
|
+
client.error_handler = proc { raise }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_enables_new_error_handler
|
14
|
+
clients.each do |client|
|
15
|
+
assert_equal Peddler::Errors::Handler, client.error_handler
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def clients
|
22
|
+
MWS.constants.map do |klass|
|
23
|
+
MWS.const_get(klass).const_get(:Client)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
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: 1.6.
|
4
|
+
version: 1.6.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hakan Ensari
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02
|
11
|
+
date: 2018-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: excon
|
@@ -90,6 +90,7 @@ files:
|
|
90
90
|
- lib/mws/subscriptions/client.rb
|
91
91
|
- lib/peddler.rb
|
92
92
|
- lib/peddler/client.rb
|
93
|
+
- lib/peddler/errors.rb
|
93
94
|
- lib/peddler/errors/builder.rb
|
94
95
|
- lib/peddler/errors/error.rb
|
95
96
|
- lib/peddler/errors/handler.rb
|
@@ -143,6 +144,7 @@ files:
|
|
143
144
|
- test/unit/peddler/errors/test_handler.rb
|
144
145
|
- test/unit/peddler/errors/test_parser.rb
|
145
146
|
- test/unit/peddler/test_client.rb
|
147
|
+
- test/unit/peddler/test_errors.rb
|
146
148
|
- test/unit/peddler/test_flat_file_parser.rb
|
147
149
|
- test/unit/peddler/test_headers.rb
|
148
150
|
- test/unit/peddler/test_marketplace.rb
|
@@ -183,7 +185,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
183
185
|
requirements:
|
184
186
|
- - ">="
|
185
187
|
- !ruby/object:Gem::Version
|
186
|
-
version: '2.
|
188
|
+
version: '2.2'
|
187
189
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
188
190
|
requirements:
|
189
191
|
- - ">="
|
@@ -191,75 +193,76 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
191
193
|
version: '0'
|
192
194
|
requirements: []
|
193
195
|
rubyforge_project:
|
194
|
-
rubygems_version: 2.
|
196
|
+
rubygems_version: 2.7.3
|
195
197
|
signing_key:
|
196
198
|
specification_version: 4
|
197
199
|
summary: Wraps the Amazon MWS APIs
|
198
200
|
test_files:
|
199
|
-
- test/
|
200
|
-
- test/
|
201
|
-
- test/
|
202
|
-
- test/
|
203
|
-
- test/
|
204
|
-
- test/
|
205
|
-
- test/
|
206
|
-
- test/
|
207
|
-
- test/
|
208
|
-
- test/
|
209
|
-
- test/
|
210
|
-
- test/
|
211
|
-
- test/
|
212
|
-
- test/
|
213
|
-
- test/
|
214
|
-
- test/integration/test_sellers.rb
|
215
|
-
- test/integration/test_subscriptions.rb
|
216
|
-
- test/integration_helper.rb
|
217
|
-
- test/mws.yml.example
|
218
|
-
- test/null_client.rb
|
219
|
-
- test/recorder.rb
|
220
|
-
- test/unit/mws/test_feeds_client.rb
|
201
|
+
- test/unit/peddler/test_headers.rb
|
202
|
+
- test/unit/peddler/test_vcr_matcher.rb
|
203
|
+
- test/unit/peddler/test_marketplace.rb
|
204
|
+
- test/unit/peddler/test_operation.rb
|
205
|
+
- test/unit/peddler/test_structured_list.rb
|
206
|
+
- test/unit/peddler/test_client.rb
|
207
|
+
- test/unit/peddler/test_xml_response_parser.rb
|
208
|
+
- test/unit/peddler/test_xml_parser.rb
|
209
|
+
- test/unit/peddler/test_flat_file_parser.rb
|
210
|
+
- test/unit/peddler/test_errors.rb
|
211
|
+
- test/unit/peddler/errors/test_error.rb
|
212
|
+
- test/unit/peddler/errors/test_builder.rb
|
213
|
+
- test/unit/peddler/errors/test_handler.rb
|
214
|
+
- test/unit/peddler/errors/test_parser.rb
|
215
|
+
- test/unit/peddler/test_parser.rb
|
221
216
|
- test/unit/mws/test_finances_client.rb
|
217
|
+
- test/unit/mws/test_sellers_client.rb
|
222
218
|
- test/unit/mws/test_fulfillment_inbound_shipment_client.rb
|
223
|
-
- test/unit/mws/test_fulfillment_inventory_client.rb
|
224
|
-
- test/unit/mws/test_fulfillment_outbound_shipment_client.rb
|
225
219
|
- test/unit/mws/test_merchant_fulfillment_client.rb
|
220
|
+
- test/unit/mws/test_subscriptions_client.rb
|
226
221
|
- test/unit/mws/test_off_amazon_payments_client.rb
|
222
|
+
- test/unit/mws/test_reports_client.rb
|
223
|
+
- test/unit/mws/test_fulfillment_outbound_shipment_client.rb
|
227
224
|
- test/unit/mws/test_orders_client.rb
|
228
225
|
- test/unit/mws/test_products_client.rb
|
229
226
|
- test/unit/mws/test_recommendations_client.rb
|
230
|
-
- test/unit/mws/
|
231
|
-
- test/unit/mws/
|
232
|
-
- test/unit/mws/test_subscriptions_client.rb
|
233
|
-
- test/unit/peddler/errors/test_builder.rb
|
234
|
-
- test/unit/peddler/errors/test_error.rb
|
235
|
-
- test/unit/peddler/errors/test_handler.rb
|
236
|
-
- test/unit/peddler/errors/test_parser.rb
|
237
|
-
- test/unit/peddler/test_client.rb
|
238
|
-
- test/unit/peddler/test_flat_file_parser.rb
|
239
|
-
- test/unit/peddler/test_headers.rb
|
240
|
-
- test/unit/peddler/test_marketplace.rb
|
241
|
-
- test/unit/peddler/test_operation.rb
|
242
|
-
- test/unit/peddler/test_parser.rb
|
243
|
-
- test/unit/peddler/test_structured_list.rb
|
244
|
-
- test/unit/peddler/test_vcr_matcher.rb
|
245
|
-
- test/unit/peddler/test_xml_parser.rb
|
246
|
-
- test/unit/peddler/test_xml_response_parser.rb
|
227
|
+
- test/unit/mws/test_fulfillment_inventory_client.rb
|
228
|
+
- test/unit/mws/test_feeds_client.rb
|
247
229
|
- test/unit/test_mws.rb
|
248
|
-
- test/
|
230
|
+
- test/null_client.rb
|
231
|
+
- test/mws.yml.example
|
232
|
+
- test/helper.rb
|
233
|
+
- test/integration/test_orders.rb
|
234
|
+
- test/integration/test_recommendations.rb
|
235
|
+
- test/integration/test_multibyte_queries.rb
|
236
|
+
- test/integration/test_feeds.rb
|
237
|
+
- test/integration/test_fulfillment_outbound_shipment.rb
|
238
|
+
- test/integration/test_fulfillment_inbound_shipment.rb
|
239
|
+
- test/integration/test_mws_headers.rb
|
240
|
+
- test/integration/test_reports.rb
|
241
|
+
- test/integration/test_subscriptions.rb
|
242
|
+
- test/integration/test_merchant_fulfillment.rb
|
243
|
+
- test/integration/test_errors.rb
|
244
|
+
- test/integration/test_sellers.rb
|
245
|
+
- test/integration/test_products.rb
|
246
|
+
- test/integration/test_off_amazon_payments.rb
|
247
|
+
- test/integration/test_fulfillment_inventory.rb
|
248
|
+
- test/integration_helper.rb
|
249
|
+
- test/vcr_cassettes/Products.yml
|
250
|
+
- test/vcr_cassettes/MerchantFulfillment.yml
|
249
251
|
- test/vcr_cassettes/CustomerInformation.yml
|
250
|
-
- test/vcr_cassettes/
|
252
|
+
- test/vcr_cassettes/Recommendations.yml
|
251
253
|
- test/vcr_cassettes/Feeds.yml
|
254
|
+
- test/vcr_cassettes/Orders.yml
|
255
|
+
- test/vcr_cassettes/MultibyteQueries.yml
|
256
|
+
- test/vcr_cassettes/CartInformation.yml
|
252
257
|
- test/vcr_cassettes/FulfillmentInboundShipment.yml
|
253
|
-
- test/vcr_cassettes/FulfillmentInventory.yml
|
254
258
|
- test/vcr_cassettes/FulfillmentOutboundShipment.yml
|
255
|
-
- test/vcr_cassettes/MerchantFulfillment.yml
|
256
|
-
- test/vcr_cassettes/MultibyteQueries.yml
|
257
|
-
- test/vcr_cassettes/MWSHeaders.yml
|
258
|
-
- test/vcr_cassettes/OffAmazonPayments.yml
|
259
|
-
- test/vcr_cassettes/Orders.yml
|
260
259
|
- test/vcr_cassettes/PeddlerVCRMatcher.yml
|
261
|
-
- test/vcr_cassettes/
|
262
|
-
- test/vcr_cassettes/Recommendations.yml
|
263
|
-
- test/vcr_cassettes/Reports.yml
|
260
|
+
- test/vcr_cassettes/OffAmazonPayments.yml
|
264
261
|
- test/vcr_cassettes/Sellers.yml
|
262
|
+
- test/vcr_cassettes/FulfillmentInventory.yml
|
263
|
+
- test/vcr_cassettes/Errors.yml
|
265
264
|
- test/vcr_cassettes/Subscriptions.yml
|
265
|
+
- test/vcr_cassettes/MWSHeaders.yml
|
266
|
+
- test/vcr_cassettes/Reports.yml
|
267
|
+
- test/recorder.rb
|
268
|
+
- test/credentials.rb
|