peddler 2.1.1 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +43 -41
  3. data/lib/mws.rb +2 -1
  4. data/lib/mws/easy_ship.rb +3 -0
  5. data/lib/mws/easy_ship/client.rb +93 -0
  6. data/lib/mws/fulfillment_outbound_shipment/client.rb +1 -1
  7. data/lib/mws/orders/client.rb +6 -6
  8. data/lib/mws/shipment_invoicing.rb +3 -0
  9. data/lib/mws/shipment_invoicing/client.rb +74 -0
  10. data/lib/peddler/client.rb +11 -10
  11. data/lib/peddler/content.rb +2 -2
  12. data/lib/peddler/errors/builder.rb +7 -2
  13. data/lib/peddler/errors/class_generator.rb +1 -1
  14. data/lib/peddler/errors/error.rb +6 -2
  15. data/lib/peddler/errors/parser.rb +1 -1
  16. data/lib/peddler/flat_file_parser.rb +5 -3
  17. data/lib/peddler/marketplace.rb +23 -19
  18. data/lib/peddler/mws.rb +2 -2
  19. data/lib/peddler/operation.rb +17 -11
  20. data/lib/peddler/parser.rb +1 -1
  21. data/lib/peddler/structured_list.rb +1 -1
  22. data/lib/peddler/vcr_matcher.rb +7 -7
  23. data/lib/peddler/version.rb +1 -1
  24. data/lib/peddler/xml_parser.rb +1 -1
  25. data/lib/peddler/xml_response_parser.rb +1 -1
  26. metadata +11 -146
  27. data/lib/mws/off_amazon_payments/client.rb +0 -362
  28. data/test/credentials.rb +0 -23
  29. data/test/helper.rb +0 -15
  30. data/test/integration/internals/test_errors.rb +0 -17
  31. data/test/integration/internals/test_multibyte_queries.rb +0 -17
  32. data/test/integration/internals/test_mws_headers.rb +0 -21
  33. data/test/integration/internals/test_string_encodings.rb +0 -38
  34. data/test/integration/test_feeds.rb +0 -37
  35. data/test/integration/test_fulfillment_inbound_shipment.rb +0 -35
  36. data/test/integration/test_fulfillment_inventory.rb +0 -20
  37. data/test/integration/test_fulfillment_outbound_shipment.rb +0 -13
  38. data/test/integration/test_merchant_fulfillment.rb +0 -69
  39. data/test/integration/test_off_amazon_payments.rb +0 -13
  40. data/test/integration/test_orders.rb +0 -30
  41. data/test/integration/test_products.rb +0 -97
  42. data/test/integration/test_recommendations.rb +0 -20
  43. data/test/integration/test_reports.rb +0 -51
  44. data/test/integration/test_sellers.rb +0 -13
  45. data/test/integration/test_subscriptions.rb +0 -27
  46. data/test/integration_helper.rb +0 -53
  47. data/test/mws.yml +0 -36
  48. data/test/mws.yml.example +0 -32
  49. data/test/null_client.rb +0 -25
  50. data/test/recorder.rb +0 -39
  51. data/test/unit/mws/test_feeds_client.rb +0 -103
  52. data/test/unit/mws/test_finances_client.rb +0 -74
  53. data/test/unit/mws/test_fulfillment_inbound_shipment_client.rb +0 -426
  54. data/test/unit/mws/test_fulfillment_inventory_client.rb +0 -48
  55. data/test/unit/mws/test_fulfillment_outbound_shipment_client.rb +0 -202
  56. data/test/unit/mws/test_merchant_fulfillment_client.rb +0 -109
  57. data/test/unit/mws/test_off_amazon_payments_client.rb +0 -286
  58. data/test/unit/mws/test_orders_client.rb +0 -111
  59. data/test/unit/mws/test_products_client.rb +0 -248
  60. data/test/unit/mws/test_recommendations_client.rb +0 -62
  61. data/test/unit/mws/test_reports_client.rb +0 -209
  62. data/test/unit/mws/test_sellers_client.rb +0 -47
  63. data/test/unit/mws/test_subscriptions_client.rb +0 -182
  64. data/test/unit/peddler/errors/test_builder.rb +0 -65
  65. data/test/unit/peddler/errors/test_class_generator.rb +0 -18
  66. data/test/unit/peddler/errors/test_error.rb +0 -33
  67. data/test/unit/peddler/errors/test_parser.rb +0 -44
  68. data/test/unit/peddler/test_client.rb +0 -203
  69. data/test/unit/peddler/test_flat_file_parser.rb +0 -111
  70. data/test/unit/peddler/test_headers.rb +0 -103
  71. data/test/unit/peddler/test_marketplace.rb +0 -47
  72. data/test/unit/peddler/test_operation.rb +0 -87
  73. data/test/unit/peddler/test_parser.rb +0 -36
  74. data/test/unit/peddler/test_structured_list.rb +0 -39
  75. data/test/unit/peddler/test_vcr_matcher.rb +0 -55
  76. data/test/unit/peddler/test_xml_parser.rb +0 -37
  77. data/test/unit/peddler/test_xml_response_parser.rb +0 -39
  78. data/test/unit/test_mws.rb +0 -11
  79. data/test/vcr_cassettes/CartInformation.yml +0 -433
  80. data/test/vcr_cassettes/CustomerInformation.yml +0 -433
  81. data/test/vcr_cassettes/Errors.yml +0 -444
  82. data/test/vcr_cassettes/Feeds.yml +0 -9957
  83. data/test/vcr_cassettes/FulfillmentInboundShipment.yml +0 -6166
  84. data/test/vcr_cassettes/FulfillmentInventory.yml +0 -850
  85. data/test/vcr_cassettes/FulfillmentOutboundShipment.yml +0 -433
  86. data/test/vcr_cassettes/MWSHeaders.yml +0 -2964
  87. data/test/vcr_cassettes/MerchantFulfillment.yml +0 -753
  88. data/test/vcr_cassettes/MultibyteQueries.yml +0 -437
  89. data/test/vcr_cassettes/OffAmazonPayments.yml +0 -433
  90. data/test/vcr_cassettes/Orders.yml +0 -4740
  91. data/test/vcr_cassettes/PeddlerVCRMatcher.yml +0 -41
  92. data/test/vcr_cassettes/Products.yml +0 -7139
  93. data/test/vcr_cassettes/Recommendations.yml +0 -3145
  94. data/test/vcr_cassettes/Reports.yml +0 -5549
  95. data/test/vcr_cassettes/Sellers.yml +0 -433
  96. data/test/vcr_cassettes/Subscriptions.yml +0 -1529
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5e7134fb2dff4131780197cb98d282b481c650c9042b71c235557db707d02e10
4
- data.tar.gz: 491ddd1e18e480cb2b4250eb1cee4422239cc511ff2c6c1ade32d2ec7717e89e
3
+ metadata.gz: 15634f7228f32bf92ba757d456f66a8c42e46082c0e516a65cf8e2b5e53c7ef6
4
+ data.tar.gz: bc20e8700266c6207f738ca7bc6fb2e9927eb07a6a2e1488f3011b062753231b
5
5
  SHA512:
6
- metadata.gz: ed79ae488893ad0fd4e4fceebbbeb28074f1b8825dae4b23827db946e3d332b199ce29212de4d48970d2a54316a7aacf9121e9f58581aa57d3be7e75047dcad2
7
- data.tar.gz: dbcc2289dcc8dafbd1dc157fdcfcdb6e11712c89a7c1f1ba35ddd280a54a33ef8e382cf5926da276286a24eeb5b15b766ff72be81b07d6bc914ab0677b75fbdb
6
+ metadata.gz: 307a816a9baaa8d1309f6f941e1a6ffa56010dc94a3efa237c32db8d0c9bd7f30765434ef1206b12048f938e676e1870d7815ccbe54b09383b7ac95979809b33
7
+ data.tar.gz: 9e2275da4ce370ae82a4d70f2080a676c30dcc7800f9323fdbd924048491ff45bf05ab33ce10dbc1248b8a925710c1b6d287cd12791d478900fca391f0fdbdbe
data/README.md CHANGED
@@ -1,12 +1,12 @@
1
1
  # Peddler
2
2
 
3
- [![Build Status](https://travis-ci.org/hakanensari/peddler.svg)](https://travis-ci.org/hakanensari/peddler)
3
+ [![Build](https://github.com/hakanensari/peddler/workflows/build/badge.svg)](https://github.com/hakanensari/peddler/actions)
4
4
  [![Maintainability](https://api.codeclimate.com/v1/badges/281e6176048f3c0a1ed3/maintainability)](https://codeclimate.com/github/hakanensari/peddler/maintainability)
5
5
  [![Test Coverage](https://api.codeclimate.com/v1/badges/281e6176048f3c0a1ed3/test_coverage)](https://codeclimate.com/github/hakanensari/peddler/test_coverage)
6
6
 
7
7
  **Peddler** is a Ruby interface to the [Amazon MWS API](https://developer.amazonservices.com/), a collection of web services that help Amazon sellers programmatically exchange data on their listings, orders, payments, reports, and more.
8
8
 
9
- To use Amazon MWS, you must have an eligible seller account and register as an [application developer](https://docs.developer.amazonservices.com/en_US/dev_guide/DG_Registering.html#DG_Registering__RegisteringAsADeveloper).
9
+ To use Amazon MWS, you must have an eligible seller account and [register as a developer](https://docs.developer.amazonservices.com/en_US/dev_guide/DG_Registering.html#DG_Registering__RegisteringAsADeveloper). You can then access your own selling account using its merchant ID—note that Amazon also refers to this as seller ID or merchant token in different places.
10
10
 
11
11
  Amazon has [multiple regions](https://docs.developer.amazonservices.com/en_US/dev_guide/DG_Endpoints.html). Each region requires application developers to register individually. Some MWS API sections may require additional authorisation from Amazon.
12
12
 
@@ -120,7 +120,7 @@ Read [tips on how to avoid throttling](https://docs.developer.amazonservices.com
120
120
 
121
121
  ### Debugging
122
122
 
123
- If you are having trouble with a request, read the [Amazon documentation](https://developer.amazonservices.com/gp/mws/docs.html). [Peddler's source](http://www.rubydoc.info/github/hakanensari/peddler) also links individual operations to their corresponding entries in the Amazon docs.
123
+ If you are having trouble with a request, read the [Amazon documentation](https://developer.amazonservices.com/gp/mws/docs.html). [Peddler's source](https://www.rubydoc.info/github/hakanensari/peddler) also links individual operations to their corresponding entries in the Amazon docs.
124
124
 
125
125
  Note that some optional keywords have default values.
126
126
 
@@ -138,34 +138,41 @@ You can access the same attributes on `error.response`. See <a href="#throttling
138
138
 
139
139
  ## The APIs
140
140
 
141
+ ### Easy Ship
142
+
143
+ With the Easy Ship API, you can build applications that help sellers in India manage and ship their Amazon Easy Ship orders. Your Amazon Easy Ship applications can get available pickup slots; schedule, reschedule, and cancel pickups; and print labels, invoices, and warranties.
144
+
145
+ - [Amazon references](https://docs.developer.amazonservices.com/en_US/easy_ship/EasyShip_Overview.html)
146
+ - [Peddler API docs](https://www.rubydoc.info/gems/peddler/MWS/EasyShip/Client)
147
+
141
148
  ### Feeds
142
149
 
143
150
  The MWS Feeds API lets you upload inventory and order data to Amazon. You can also use this API to get information about the processing of feeds.
144
151
 
145
- - [Amazon references](https://developer.amazonservices.com/gp/mws/api.html?group=bde&section=feeds)
146
- - [Peddler API docs](http://www.rubydoc.info/gems/peddler/MWS/Feeds/Client)
152
+ - [Amazon references](https://docs.developer.amazonservices.com/en_US/feeds/Feeds_Overview.html)
153
+ - [Peddler API docs](https://www.rubydoc.info/gems/peddler/MWS/Feeds/Client)
147
154
  - [XML schema docs](https://sellercentral.amazon.com/gp/help/help-page.html?itemID=1611)
148
155
 
149
156
  ### Finances
150
157
 
151
158
  The MWS Finances API enables you to obtain financial information relevant to your business with Amazon. You can obtain financial events for a given order, financial event group, or date range without having to wait until a statement period closes. You can also obtain financial event groups for a given date range.
152
159
 
153
- - [Amazon references](https://developer.amazonservices.com/gp/mws/api.html?group=finances&section=finances)
154
- - [Peddler API docs](http://www.rubydoc.info/gems/peddler/MWS/Finances/Client)
160
+ - [Amazon references](https://docs.developer.amazonservices.com/en_US/finances/Finances_Overview.html)
161
+ - [Peddler API docs](https://www.rubydoc.info/gems/peddler/MWS/Finances/Client)
155
162
 
156
163
  ### Fulfillment Inbound Shipment
157
164
 
158
165
  With the MWS Fulfillment Inbound Shipment API, you can create and update inbound shipments of inventory in the Amazon Fulfillment Network. You can also also request lists of inbound shipments or inbound shipment items based on criteria that you specify.
159
166
 
160
- - [Amazon references](https://developer.amazonservices.com/gp/mws/api.html?group=fulfillment&section=inbound)
161
- - [Peddler API docs](http://www.rubydoc.info/gems/peddler/MWS/FulfillmentInboundShipment/Client)
167
+ - [Amazon references](https://docs.developer.amazonservices.com/en_US/fba_inbound/FBAInbound_Overview.html)
168
+ - [Peddler API docs](https://www.rubydoc.info/gems/peddler/MWS/FulfillmentInboundShipment/Client)
162
169
 
163
170
  ### Fulfillment Inventory
164
171
 
165
172
  The MWS Fulfillment Inventory API can help you stay up-to-date on the availability of your inventory in the Amazon Fulfillment Network. The Fulfillment Inventory API reports real-time availability information for your Amazon Fulfillment Network inventory regardless of whether you are selling your inventory on Amazon's retail web site or through other retail channels.
166
173
 
167
- - [Amazon references](https://developer.amazonservices.com/gp/mws/api.html?group=fulfillment&section=inventory)
168
- - [Peddler API docs](http://www.rubydoc.info/gems/peddler/MWS/FulfillmentInventory/Client)
174
+ - [Amazon references](https://docs.developer.amazonservices.com/en_US/fba_inventory/FBAInventory_Overview.html)
175
+ - [Peddler API docs](https://www.rubydoc.info/gems/peddler/MWS/FulfillmentInventory/Client)
169
176
 
170
177
  ### Fulfillment Outbound Shipment
171
178
 
@@ -173,68 +180,63 @@ The MWS Fulfillment Outbound Shipment API enables you to fulfill orders placed t
173
180
 
174
181
  Support for creating and cancelling fulfillment orders has been implemented, but the rest of the API is not supported yet.
175
182
 
176
- - [Amazon references](https://developer.amazonservices.com/gp/mws/api.html?group=fulfillment&section=outbound)
177
- - [Peddler API docs](http://www.rubydoc.info/gems/peddler/MWS/FulfillmentOutboundShipment/Client)
183
+ - [Amazon references](https://docs.developer.amazonservices.com/en_US/fba_outbound/FBAOutbound_Overview.html)
184
+ - [Peddler API docs](https://www.rubydoc.info/gems/peddler/MWS/FulfillmentOutboundShipment/Client)
178
185
 
179
186
  ### Merchant Fulfillment
180
187
 
181
188
  The Merchant Fulfillment API provides programmatic access to Amazon’s fulfillment shipping services for sellers, including competitive rates with Amazon-partnered carriers. Sellers can find out what shipping services are available by submitting information about a proposed fulfillment shipment, such as package size and weight; shipment origin and destination; and delivery date requirements. Sellers can choose from the shipping service options returned by Amazon, and then receive shipping labels for fulfilling their orders.
182
189
 
183
- - [Amazon references](https://developer.amazonservices.com/gp/mws/api.html?group=merchantfulfillment&section=merchantfulfillment)
184
- - [Peddler API docs](http://www.rubydoc.info/gems/peddler/MWS/MerchantFulfillment/Client)
185
-
186
- ### Off Amazon Payments
187
-
188
- The MWS Off-Amazon Payments API helps you to process payments for purchases made by buyers on your website using the Login and Pay with Amazon service. This API enables you to programmatically retrieve shipping and payment information provided by the buyer from their Amazon account. It allows you to authorize, capture, and refund payments, enabling a variety of payments scenarios.
189
-
190
- You can switch the client to the sandbox environment:
191
-
192
- ```ruby
193
- client = MWS.off_amazon_payments.sandbox
194
- ```
195
-
196
- - [Amazon references](https://developer.amazonservices.com/gp/mws/api.html?group=offamazonpayments&section=offamazonpayments)
197
- - [Official Ruby client](https://github.com/amzn/login-and-pay-with-amazon-sdk-ruby)
198
- - [Peddler API docs](http://www.rubydoc.info/gems/peddler/MWS/OffAmazonPayments/Client)
190
+ - [Amazon references](https://docs.developer.amazonservices.com/en_US/merch_fulfill/MerchFulfill_Overview.html)
191
+ - [Peddler API docs](https://www.rubydoc.info/gems/peddler/MWS/MerchantFulfillment/Client)
199
192
 
200
193
  ### Orders
201
194
 
202
195
  With the MWS Orders API, you can list orders created or updated during a time frame you specify or retrieve information about specific orders.
203
196
 
204
- - [Amazon references](https://developer.amazonservices.com/gp/mws/api.html?group=orders&section=orders)
205
- - [Peddler API docs](http://www.rubydoc.info/gems/peddler/MWS/Orders/Client)
197
+ - [Amazon references](https://docs.developer.amazonservices.com/en_US/orders-2013-09-01/Orders_Overview.html)
198
+ - [Peddler API docs](https://www.rubydoc.info/gems/peddler/MWS/Orders/Client)
206
199
 
207
200
  ### Products
208
201
 
209
202
  The MWS Products API helps you get information to match your products to existing product listings on Amazon Marketplace websites and to make sourcing and pricing decisions for listing those products on Amazon Marketplace websites.
210
203
 
211
- - [Amazon references](https://developer.amazonservices.com/gp/mws/api.html?group=products&section=products)
212
- - [Peddler API docs](http://www.rubydoc.info/gems/peddler/MWS/Products/Client)
204
+ - [Amazon references](https://docs.developer.amazonservices.com/en_US/products/Products_Overview.html)
205
+ - [Peddler API docs](https://www.rubydoc.info/gems/peddler/MWS/Products/Client)
213
206
 
214
207
  ### Recommendations
215
208
 
216
209
  The Recommendations API enables you to programmatically retrieve Amazon Selling Coach recommendations by recommendation category. A recommendation is an actionable, timely, and personalized opportunity to increase your sales and performance.
217
210
 
218
- - [Amazon references](https://developer.amazonservices.com/gp/mws/api.html?group=recommendations&section=recommendations)
219
- - [Peddler API docs](http://www.rubydoc.info/gems/peddler/MWS/Recommendations/Client)
211
+ - [Amazon references](https://docs.developer.amazonservices.com/en_US/recommendations/Recommendations_Overview.html)
212
+ - [Peddler API docs](https://www.rubydoc.info/gems/peddler/MWS/Recommendations/Client)
220
213
 
221
214
  ### Reports
222
215
 
223
216
  The Reports API lets you request reports about your inventory and orders.
224
217
 
225
- - [Amazon references](https://developer.amazonservices.com/gp/mws/api.html?group=bde&section=reports)
226
- - [Peddler API docs](http://www.rubydoc.info/gems/peddler/MWS/Reports/Client)
218
+ - [Amazon references](https://docs.developer.amazonservices.com/en_US/reports/Reports_Overview.html)
219
+ - [Peddler API docs](https://www.rubydoc.info/gems/peddler/MWS/Reports/Client)
227
220
 
228
221
  ### Sellers
229
222
 
230
223
  The Sellers API lets sellers retrieve information about their seller account, such as the marketplaces they participate in.
231
224
 
232
- - [Amazon references](https://developer.amazonservices.com/gp/mws/api.html?group=sellers&section=sellers)
233
- - [Peddler API docs](http://www.rubydoc.info/gems/peddler/MWS/Sellers/Client)
225
+ - [Amazon references](https://docs.developer.amazonservices.com/en_US/subscriptions/Subscriptions_Overview.html)
226
+ - [Peddler API docs](https://www.rubydoc.info/gems/peddler/MWS/Sellers/Client)
227
+
228
+ ### Shipment Invoicing
229
+
230
+ With the Shipment Invoicing API section (in conjunction with the FBAOutboundShipmentStatus notification), you can integrate invoicing into Amazon’s shipping process for a seller’s Fulfillment by Amazon (FBA) orders.
231
+
232
+ This functionality is available only in the Brazil marketplace.
233
+
234
+ - [Amazon references](https://docs.developer.amazonservices.com/en_US/shipment_invoicing/ShipmentInvoicing_Overview.html)
235
+ - [Peddler API docs](https://www.rubydoc.info/gems/peddler/MWS/ShipmentInvoicing/Client)
234
236
 
235
237
  ### Subscriptions
236
238
 
237
239
  The Amazon MWS Subscriptions API section enables you to subscribe to receive notifications that are relevant to your business with Amazon. With the operations in the Subscriptions API section, you can register to receive important information from Amazon without having to poll the Amazon MWS service. Instead, the information is sent directly to you when an event occurs to which you are subscribed.
238
240
 
239
- - [Amazon references](https://developer.amazonservices.com/gp/mws/api.html?group=subscriptions&section=subscriptions)
240
- - [Peddler API docs](http://www.rubydoc.info/gems/peddler/MWS/Subscriptions/Client)
241
+ - [Amazon references](https://docs.developer.amazonservices.com/en_US/subscriptions/Subscriptions_Overview.html)
242
+ - [Peddler API docs](https://www.rubydoc.info/gems/peddler/MWS/Subscriptions/Client)
data/lib/mws.rb CHANGED
@@ -1,18 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'forwardable'
4
+ require 'mws/easy_ship'
4
5
  require 'mws/feeds'
5
6
  require 'mws/finances'
6
7
  require 'mws/fulfillment_inbound_shipment'
7
8
  require 'mws/fulfillment_inventory'
8
9
  require 'mws/fulfillment_outbound_shipment'
9
10
  require 'mws/merchant_fulfillment'
10
- require 'mws/off_amazon_payments'
11
11
  require 'mws/orders'
12
12
  require 'mws/products'
13
13
  require 'mws/recommendations'
14
14
  require 'mws/reports'
15
15
  require 'mws/sellers'
16
+ require 'mws/shipment_invoicing'
16
17
  require 'mws/subscriptions'
17
18
 
18
19
  # The various Amazon MWS API sections.
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'mws/easy_ship/client'
@@ -0,0 +1,93 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'peddler/client'
4
+
5
+ module MWS
6
+ module EasyShip
7
+ # With the Easy Ship API section, you can build applications that help
8
+ # sellers in India manage and ship their Amazon Easy Ship orders.
9
+ #
10
+ # @note This functionality is available only in the India marketplace.
11
+ class Client < ::Peddler::Client
12
+ self.version = '2018-09-01'
13
+ self.path = "/EasyShip/#{version}"
14
+
15
+ # Returns time slots for Amazon Easy Ship package pickup
16
+ #
17
+ # @see https://docs.developer.amazonservices.com/en_US/easy_ship/EasyShip_ListPickupSlots.html
18
+ # @param [String] marketplace_id
19
+ # @param [String] amazon_order_id
20
+ # @param [Struct, Hash] package_dimensions
21
+ # @param [Struct, Hash] package_weight
22
+ # @return [Peddler::XMLParser]
23
+ def list_pickup_slots(marketplace_id, amazon_order_id, package_dimensions,
24
+ package_weight)
25
+ operation('ListPickupSlots')
26
+ .add('MarketplaceId' => marketplace_id,
27
+ 'AmazonOrderId' => amazon_order_id,
28
+ 'PackageDimensions' => package_dimensions,
29
+ 'PackageWeight' => package_weight)
30
+
31
+ run
32
+ end
33
+
34
+ # Schedules an Amazon Easy Ship pickup slot
35
+ #
36
+ # @see https://docs.developer.amazonservices.com/en_US/easy_ship/EasyShip_CreateScheduledPackage.html
37
+ # @param [String] marketplace_id
38
+ # @param [String] amazon_order_id
39
+ # @param [Struct, Hash] package_request_details
40
+ # @return [Peddler::XMLParser]
41
+ def create_scheduled_package(marketplace_id, amazon_order_id,
42
+ package_request_details)
43
+ operation('CreateScheduledPackage')
44
+ .add('MarketplaceId' => marketplace_id,
45
+ 'AmazonOrderId' => amazon_order_id,
46
+ 'PackageRequestDetails' => package_request_details)
47
+
48
+ run
49
+ end
50
+
51
+ # Updates an Amazon Easy Ship pickup slot
52
+ #
53
+ # @see https://docs.developer.amazonservices.com/en_US/easy_ship/EasyShip_UpdateScheduledPackages.html
54
+ # @param [String] marketplace_id
55
+ # @param [Array<Struct, Hash>] scheduled_package_update_details_list
56
+ # @return [Peddler::XMLParser]
57
+ def update_scheduled_packages(marketplace_id,
58
+ scheduled_package_update_details_list)
59
+ operation('UpdateScheduledPackages')
60
+ .add('MarketplaceId' => marketplace_id,
61
+ 'ScheduledPackageUpdateDetailsList' =>
62
+ scheduled_package_update_details_list)
63
+ .structure!('ScheduledPackageUpdateDetailsList',
64
+ 'PackageUpdateDetails')
65
+
66
+ run
67
+ end
68
+
69
+ # Returns information about a scheduled package
70
+ #
71
+ # @see https://docs.developer.amazonservices.com/en_US/easy_ship/EasyShip_GetScheduledPackage.html
72
+ # @param [String] marketplace_id
73
+ # @param [Struct, Hash] scheduled_package_id
74
+ # @return [Peddler::XMLParser]
75
+ def get_scheduled_package(marketplace_id, scheduled_package_id)
76
+ operation('GetScheduledPackage')
77
+ .add('MarketplaceId' => marketplace_id,
78
+ 'ScheduledPackageId' => scheduled_package_id)
79
+
80
+ run
81
+ end
82
+
83
+ # Returns the operational status of the API
84
+ #
85
+ # @see https://docs.developer.amazonservices.com/en_US/shipment_invoicing/ShipmentInvoicing_GetServiceStatus.html
86
+ # @return [Peddler::XMLParser]
87
+ def get_service_status
88
+ operation('GetServiceStatus')
89
+ run
90
+ end
91
+ end
92
+ end
93
+ end
@@ -32,7 +32,7 @@ module MWS
32
32
  .add(opts)
33
33
  .add('Address' => address, 'Items' => items)
34
34
  .structure!('Items', 'member')
35
- .structure!('ShippingSpeedCategories')
35
+ .structure!('ShippingSpeedCategories', 'member')
36
36
 
37
37
  run
38
38
  end
@@ -15,7 +15,7 @@ module MWS
15
15
  # @note When calling this operation, you must specify a time frame using
16
16
  # either created_after or last_updated_after. When requesting orders by
17
17
  # "Unshipped" status you must also request "PartiallyShipped" orders.
18
- # @see https://docs.developer.amazonservices.com/en_US/orders/2013-09-01/Orders_ListOrders.html
18
+ # @see https://docs.developer.amazonservices.com/en_US/orders-2013-09-01/Orders_ListOrders.html
19
19
  # @overload list_orders(*marketplace_id, opts = {})
20
20
  # @param [Array<String>] marketplace_id
21
21
  # @param [Hash] opts
@@ -53,7 +53,7 @@ module MWS
53
53
 
54
54
  # Lists the next page of orders
55
55
  #
56
- # @see https://docs.developer.amazonservices.com/en_US/orders/2013-09-01/Orders_ListOrdersByNextToken.html
56
+ # @see https://docs.developer.amazonservices.com/en_US/orders-2013-09-01/Orders_ListOrdersByNextToken.html
57
57
  # @param [String] next_token
58
58
  # @return [Peddler::XMLParser]
59
59
  def list_orders_by_next_token(next_token)
@@ -65,7 +65,7 @@ module MWS
65
65
 
66
66
  # Gets one or more orders
67
67
  #
68
- # @see https://docs.developer.amazonservices.com/en_US/orders/2013-09-01/Orders_GetOrder.html
68
+ # @see https://docs.developer.amazonservices.com/en_US/orders-2013-09-01/Orders_GetOrder.html
69
69
  # @param [Array<String>] amazon_order_ids
70
70
  # @return [Peddler::XMLParser]
71
71
  def get_order(*amazon_order_ids)
@@ -78,7 +78,7 @@ module MWS
78
78
 
79
79
  # Lists order items for an order
80
80
  #
81
- # @see https://docs.developer.amazonservices.com/en_US/orders/2013-09-01/Orders_ListOrderItems.html
81
+ # @see https://docs.developer.amazonservices.com/en_US/orders-2013-09-01/Orders_ListOrderItems.html
82
82
  # @param [String] amazon_order_id
83
83
  # @return [Peddler::XMLParser]
84
84
  def list_order_items(amazon_order_id)
@@ -90,7 +90,7 @@ module MWS
90
90
 
91
91
  # Lists the next page of order items for an order
92
92
  #
93
- # @see https://docs.developer.amazonservices.com/en_US/orders/2013-09-01/Orders_ListOrderItemsByNextToken.html
93
+ # @see https://docs.developer.amazonservices.com/en_US/orders-2013-09-01/Orders_ListOrderItemsByNextToken.html
94
94
  # @param [String] next_token
95
95
  # @return [Peddler::XMLParser]
96
96
  def list_order_items_by_next_token(next_token)
@@ -102,7 +102,7 @@ module MWS
102
102
 
103
103
  # Gets the service status of the API
104
104
  #
105
- # @see https://docs.developer.amazonservices.com/en_US/orders/2013-09-01/MWS_GetServiceStatus.html
105
+ # @see https://docs.developer.amazonservices.com/en_US/orders-2013-09-01/MWS_GetServiceStatus.html
106
106
  # @return [Peddler::XMLParser]
107
107
  def get_service_status
108
108
  operation('GetServiceStatus')
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'mws/shipment_invoicing/client'
@@ -0,0 +1,74 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'peddler/client'
4
+
5
+ module MWS
6
+ module ShipmentInvoicing
7
+ # With the Shipment Invoicing API section, you can integrate invoicing into
8
+ # Amazon's shipping process for a seller's FBA order.
9
+ #
10
+ # @note This functionality is available only in the Brazil marketplace.
11
+ class Client < ::Peddler::Client
12
+ self.version = '2018-09-01'
13
+ self.path = "/ShipmentInvoicing/#{version}"
14
+
15
+ # Returns the information required to generate an invoice for the shipment
16
+ # of a Fulfillment by Amazon order
17
+ #
18
+ # @see https://docs.developer.amazonservices.com/en_US/shipment_invoicing/ShipmentInvoicing_GetFBAOutboundShipmentDetail.html
19
+ # @param [String] marketplace_id
20
+ # @param [String] amazon_shipment_id
21
+ # @return [Peddler::XMLParser]
22
+ def get_fba_outbound_shipment_detail(marketplace_id, amazon_shipment_id)
23
+ operation('GetFBAOutboundShipmentDetail')
24
+ .add('MarketplaceId' => marketplace_id,
25
+ 'AmazonShipmentId' => amazon_shipment_id)
26
+
27
+ run
28
+ end
29
+
30
+ # Submits shipment invoice data for a given shipment
31
+ #
32
+ # @see https://docs.developer.amazonservices.com/en_US/shipment_invoicing/ShipmentInvoicing_SubmitFBAOutboundShipmentInvoice.html
33
+ # @param [String] marketplace_id
34
+ # @param [String] amazon_shipment_id
35
+ # @param [String] invoice_content
36
+ # @return [Peddler::XMLParser]
37
+ def submit_fba_outbound_shipment_invoice(marketplace_id,
38
+ amazon_shipment_id,
39
+ invoice_content)
40
+ self.body = invoice_content
41
+
42
+ operation('SubmitFBAOutboundShipmentInvoice')
43
+ .add('MarketplaceId' => marketplace_id,
44
+ 'AmazonShipmentId' => amazon_shipment_id)
45
+
46
+ run
47
+ end
48
+
49
+ # Gets the invoice processing status for the shipments that you specify
50
+ #
51
+ # @see https://docs.developer.amazonservices.com/en_US/shipment_invoicing/ShipmentInvoicing_GetFBAOutboundShipmentInvoiceStatus.html
52
+ # @param [String] marketplace_id
53
+ # @param [String] amazon_shipment_id
54
+ # @return [Peddler::XMLParser]
55
+ def get_fba_outbound_shipment_invoice_status(marketplace_id,
56
+ amazon_shipment_id)
57
+ operation('GetFBAOutboundShipmentInvoiceStatus')
58
+ .add('MarketplaceId' => marketplace_id,
59
+ 'AmazonShipmentId' => amazon_shipment_id)
60
+
61
+ run
62
+ end
63
+
64
+ # Gets the operational status of the API
65
+ #
66
+ # @see https://docs.developer.amazonservices.com/en_US/shipment_invoicing/ShipmentInvoicing_GetServiceStatus.html
67
+ # @return [Peddler::XMLParser]
68
+ def get_service_status
69
+ operation('GetServiceStatus')
70
+ run
71
+ end
72
+ end
73
+ end
74
+ end
@@ -16,7 +16,7 @@ module Peddler
16
16
  include Jeff
17
17
 
18
18
  class << self
19
- # @api private
19
+ # @!visibility private
20
20
  attr_accessor :parser, :path, :version
21
21
 
22
22
  private
@@ -52,6 +52,7 @@ module Peddler
52
52
  attr_accessor :auth_token
53
53
 
54
54
  # The seller's Merchant ID
55
+ # @note Amazon also refers to this as Seller ID or Merchant Token
55
56
  # @return [String]
56
57
  attr_accessor :merchant_id
57
58
 
@@ -80,38 +81,38 @@ module Peddler
80
81
  str ? add_content(str) : clear_content!
81
82
  end
82
83
 
83
- # @api private
84
+ # @!visibility private
84
85
  attr_writer :path
85
86
 
86
- # @api private
87
+ # @!visibility private
87
88
  def path
88
89
  @path ||= self.class.path
89
90
  end
90
91
 
91
- # @api private
92
+ # @!visibility private
92
93
  def defaults
93
94
  @defaults ||= { expects: 200 }
94
95
  end
95
96
 
96
- # @api private
97
+ # @!visibility private
97
98
  def headers
98
99
  @headers ||= {}
99
100
  end
100
101
 
101
- # @api private
102
+ # @!visibility private
102
103
  def aws_endpoint
103
104
  "https://#{host}#{path}"
104
105
  end
105
106
 
106
- # @api private
107
+ # @!visibility private
107
108
  def operation(action = nil)
108
109
  action ? @operation = Operation.new(action) : @operation
109
110
  end
110
111
 
111
- # @api private
112
- def run
112
+ # @!visibility private
113
+ def run(&block)
113
114
  opts = build_options
114
- opts.store(:response_block, Proc.new) if block_given?
115
+ opts.store(:response_block, block) if block_given?
115
116
  res = post(opts)
116
117
  self.body = nil if res.status == 200
117
118