peddler 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/README.md +15 -14
  4. data/lib/mws/cart_information/client.rb +72 -0
  5. data/lib/mws/cart_information.rb +1 -69
  6. data/lib/mws/customer_information/client.rb +79 -0
  7. data/lib/mws/customer_information.rb +1 -77
  8. data/lib/mws/feeds/client.rb +112 -0
  9. data/lib/mws/feeds.rb +1 -110
  10. data/lib/mws/fulfillment_inbound_shipment/client.rb +233 -0
  11. data/lib/mws/fulfillment_inbound_shipment.rb +1 -231
  12. data/lib/mws/fulfillment_inventory/client.rb +53 -0
  13. data/lib/mws/fulfillment_inventory.rb +1 -51
  14. data/lib/mws/fulfillment_outbound_shipment/client.rb +171 -0
  15. data/lib/mws/fulfillment_outbound_shipment.rb +1 -168
  16. data/lib/mws/off_amazon_payments/client.rb +362 -0
  17. data/lib/mws/off_amazon_payments.rb +1 -360
  18. data/lib/mws/orders/client.rb +102 -0
  19. data/lib/mws/orders.rb +1 -98
  20. data/lib/mws/products/client.rb +234 -0
  21. data/lib/mws/products.rb +1 -232
  22. data/lib/mws/recommendations/client.rb +71 -0
  23. data/lib/mws/recommendations.rb +1 -66
  24. data/lib/mws/reports/client.rb +220 -0
  25. data/lib/mws/reports.rb +1 -220
  26. data/lib/mws/sellers/client.rb +42 -0
  27. data/lib/mws/sellers.rb +1 -40
  28. data/lib/mws/subscriptions/client.rb +177 -0
  29. data/lib/mws/subscriptions.rb +1 -169
  30. data/lib/mws.rb +2 -2
  31. data/lib/peddler/client.rb +3 -3
  32. data/lib/peddler/flat_file_parser.rb +3 -3
  33. data/lib/peddler/operation.rb +2 -3
  34. data/lib/peddler/structured_list.rb +1 -3
  35. data/lib/peddler/version.rb +1 -1
  36. data/lib/peddler/xml_parser.rb +1 -1
  37. data/test/integration/test_cart_information.rb +2 -2
  38. data/test/integration/test_customer_information.rb +2 -2
  39. data/test/integration/test_feeds.rb +2 -2
  40. data/test/integration/test_fulfillment_inbound_shipment.rb +2 -2
  41. data/test/integration/test_fulfillment_inventory.rb +3 -7
  42. data/test/integration/test_fulfillment_outbound_shipment.rb +2 -49
  43. data/test/integration/test_off_amazon_payments.rb +2 -2
  44. data/test/integration/test_orders.rb +2 -13
  45. data/test/integration/test_products.rb +2 -2
  46. data/test/integration/test_recommendations.rb +2 -11
  47. data/test/integration/test_reports.rb +2 -3
  48. data/test/integration/test_sellers.rb +2 -9
  49. data/test/integration/test_subscriptions.rb +2 -2
  50. data/test/integration_test_helper.rb +49 -0
  51. data/test/mws.yml +16 -0
  52. data/test/mws.yml.bak +16 -0
  53. data/test/test_helper.rb +7 -0
  54. data/test/unit/mws/test_off_amazon_payments_client.rb +9 -0
  55. data/test/unit/mws/test_products_client.rb +9 -0
  56. data/test/unit/peddler/test_client.rb +2 -2
  57. data/test/unit/peddler/test_flat_file_parser.rb +2 -2
  58. data/test/unit/peddler/test_operation.rb +2 -2
  59. data/test/unit/peddler/test_parser.rb +2 -2
  60. data/test/unit/peddler/test_structured_list.rb +2 -2
  61. data/test/unit/peddler/test_xml_parser.rb +2 -2
  62. data/test/unit/test_mws.rb +3 -3
  63. data/test/vcr_cassettes/CartInformation.yml +37 -725
  64. data/test/vcr_cassettes/CustomerInformation.yml +37 -728
  65. data/test/vcr_cassettes/Feeds.yml +100 -528
  66. data/test/vcr_cassettes/FulfillmentInboundShipment.yml +39 -728
  67. data/test/vcr_cassettes/FulfillmentInventory.yml +96 -997
  68. data/test/vcr_cassettes/FulfillmentOutboundShipment.yml +39 -725
  69. data/test/vcr_cassettes/OffAmazonPayments.yml +36 -727
  70. data/test/vcr_cassettes/Orders.yml +38 -29855
  71. data/test/vcr_cassettes/Products.yml +1300 -3871
  72. data/test/vcr_cassettes/Recommendations.yml +8934 -15590
  73. data/test/vcr_cassettes/Reports.yml +288 -1326
  74. data/test/vcr_cassettes/Sellers.yml +38 -1178
  75. data/test/vcr_cassettes/Subscriptions.yml +244 -1066
  76. metadata +27 -98
  77. data/test/helper.rb +0 -3
  78. data/test/integration_helper.rb +0 -49
  79. data/test/mws.yml.1 +0 -32
  80. data/test/mws.yml.example +0 -4
  81. data/test/unit/mws/test_off_amazon_payments.rb +0 -9
  82. data/test/unit/mws/test_products.rb +0 -9
@@ -1,360 +1 @@
1
- require 'peddler/client'
2
-
3
- module MWS
4
- # The Off-Amazon Payments API helps you to process payments for purchases
5
- # made by buyers on your website using the Login and Pay with Amazon service.
6
- # This API enables you to programmatically retrieve shipping and payment
7
- # information provided by the buyer from their Amazon account. It allows you
8
- # to authorize, capture, and refund payments, enabling a variety of payments
9
- # scenarios.
10
- #
11
- # @note The Off-Amazon Payments API section is only applicable to payments
12
- # made through the Login and Pay with Amazon service offered by Amazon
13
- # Payments. You cannot use this API section to process payments for Amazon
14
- # Marketplace, Amazon Webstore, or Checkout by Amazon.
15
- class OffAmazonPayments < ::Peddler::Client
16
- path '/OffAmazonPayments/2013-01-01/'
17
-
18
- # Switches the client to the sandbox environment
19
- #
20
- # @see https://payments.amazon.com/help/Checkout-by-Amazon/Using-the-Checkout-by-Amazon-Sandbox/Overview-of-the-Sandbox
21
- # @return [self]
22
- def sandbox
23
- self.path = '/OffAmazonPayments_Sandbox/2013-01-01/'
24
- self
25
- end
26
-
27
- # Creates an order reference for the given object
28
- #
29
- # @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_CreateOrderReferenceForId.html
30
- # @param id [String]
31
- # @param id_type [String]
32
- # @param opts [Hash]
33
- # @option opts [Boolean] :inherit_shipping_address
34
- # @option opts [Boolean] :confirm_now
35
- # @return [Peddler::XMLParser]
36
- def create_order_reference_for_id(id, id_type, opts = {})
37
- operation('CreateOrderReferenceForId')
38
- .add(opts.merge(
39
- 'Id' => id,
40
- 'IdType' => id_type
41
- ))
42
-
43
- run
44
- end
45
-
46
- # Returns details about the Billing Agreement object and its current state
47
- #
48
- # @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_GetBillingAgreementDetails.html
49
- # @param amazon_billing_agreement_id [String]
50
- # @param opts [Hash]
51
- # @option opts [String] :address_consent_token
52
- # @return [Peddler::XMLParser]
53
- def get_billing_agreement_details(amazon_billing_agreement_id, opts = {})
54
- operation('GetBillingAgreementDetails')
55
- .add(opts.merge(
56
- 'AmazonBillingAgreementId' => amazon_billing_agreement_id
57
- ))
58
-
59
- run
60
- end
61
-
62
- # Sets billing agreement details such as a description of the agreement and
63
- # other information about the seller
64
- #
65
- # @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_SetBillingAgreementDetails.html
66
- # @param amazon_billing_agreement_id [String]
67
- # @param billing_agreement_attributes [Struct, Hash]
68
- # @return [Peddler::XMLParser]
69
- def set_billing_agreement_details(amazon_billing_agreement_id, billing_agreement_attributes)
70
- operation('SetBillingAgreementDetails')
71
- .add(
72
- 'AmazonBillingAgreementId' => amazon_billing_agreement_id,
73
- 'BillingAgreementAttributes' => billing_agreement_attributes
74
- )
75
-
76
- run
77
- end
78
-
79
- # Confirms that the billing agreement is free of constraints and all
80
- # required information has been set on the billing agreement
81
- #
82
- # @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_ConfirmBillingAgreement.html
83
- # @param amazon_billing_agreement_id [String]
84
- # @return [Peddler::XMLParser]
85
- def confirm_billing_agreement(amazon_billing_agreement_id)
86
- operation('ConfirmBillingAgreement')
87
- .add(
88
- 'AmazonBillingAgreementId' => amazon_billing_agreement_id
89
- )
90
-
91
- run
92
- end
93
-
94
- # Validates the status of the BillingAgreement object and the payment method
95
- # associated with it
96
- #
97
- # @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_ValidateBillingAgreement.html
98
- # @param amazon_billing_agreement_id [String]
99
- # @return [Peddler::XMLParser]
100
- def validate_billing_agreement(amazon_billing_agreement_id)
101
- operation('ValidateBillingAgreement')
102
- .add(
103
- 'AmazonBillingAgreementId' => amazon_billing_agreement_id
104
- )
105
-
106
- run
107
- end
108
-
109
- # Reserves a specified amount against the payment method(s) stored in the
110
- # billing agreement
111
- #
112
- # @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_AuthorizeOnBillingAgreement.html
113
- # @param amazon_billing_agreement_id [String]
114
- # @param authorization_reference_id [String]
115
- # @param authorization_amount [Hash, Struct]
116
- # @param opts [Hash]
117
- # @option opts [String] :seller_authorization_note
118
- # @option opts [Integer] :transaction_timeout
119
- # @option opts [Boolean] :capture_now
120
- # @option opts [String] :soft_descriptor
121
- # @option opts [String] :seller_note
122
- # @option opts [String] :platform_id
123
- # @option opts [Hash, Struct] :seller_order_attributes
124
- # @option opts [Boolean] :inherit_shipping_address
125
- # @return [Peddler::XMLParser]
126
- def authorize_on_billing_agreement(amazon_billing_agreement_id, authorization_reference_id, authorization_amount, opts = {})
127
- operation('AuthorizeOnBillingAgreement')
128
- .add(opts.merge(
129
- 'AmazonBillingAgreementId' => amazon_billing_agreement_id,
130
- 'AuthorizationReferenceId' => authorization_reference_id,
131
- 'AuthorizationAmount' => authorization_amount
132
- ))
133
-
134
- run
135
- end
136
-
137
- # Confirms that you want to terminate the billing agreement with the buyer
138
- # and that you do not expect to create any new order references or
139
- # authorizations on this billing agreement
140
- #
141
- # @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_CloseBillingAgreement.html
142
- # @param amazon_billing_agreement_id [String]
143
- # @param opts [Hash]
144
- # @option opts [String] :closure_reason
145
- # @return [Peddler::XMLParser]
146
- def close_billing_agreement(amazon_billing_agreement_id, opts = {})
147
- operation('CloseBillingAgreement')
148
- .add(opts.merge(
149
- 'AmazonBillingAgreementId' => amazon_billing_agreement_id
150
- ))
151
-
152
- run
153
- end
154
-
155
- # Sets order reference details such as the order total and a description for
156
- # the order
157
- #
158
- # @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_SetOrderReferenceDetails.html
159
- # @param amazon_order_reference_id [String]
160
- # @param order_total [Struct, Hash]
161
- # @param opts [Hash]
162
- # @option opts [String] :platform_id
163
- # @option opts [String] :seller_note
164
- # @option opts [Struct, Hash] :seller_order_attributes
165
- # @return [Peddler::XMLParser]
166
- def set_order_reference_details(amazon_order_reference_id, order_total, opts = {})
167
- operation('SetOrderReferenceDetails')
168
- .add(
169
- 'AmazonOrderReferenceId' => amazon_order_reference_id,
170
- 'OrderReferenceAttributes' => opts.merge('OrderTotal' => order_total)
171
- )
172
-
173
- run
174
- end
175
-
176
- # Returns details about the Order Reference object and its current state
177
- #
178
- # @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_GetOrderReferenceDetails.html
179
- # @param amazon_order_reference_id [String]
180
- # @param opts [Hash]
181
- # @option opts [String] address_consent_token
182
- # @return [Peddler::XMLParser]
183
- def get_order_reference_details(amazon_order_reference_id, opts = {})
184
- operation('GetOrderReferenceDetails')
185
- .add(opts.merge('AmazonOrderReferenceId' => amazon_order_reference_id))
186
-
187
- run
188
- end
189
-
190
- # Confirms that the order reference is free of constraints and all required
191
- # information has been set on the order reference
192
- #
193
- # @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_ConfirmOrderReference.html
194
- # @param amazon_order_reference_id [String]
195
- # @return [Peddler::XMLParser]
196
- def confirm_order_reference(amazon_order_reference_id)
197
- operation('ConfirmOrderReference')
198
- .add('AmazonOrderReferenceId' => amazon_order_reference_id)
199
-
200
- run
201
- end
202
-
203
- # Cancels a previously confirmed order reference
204
- #
205
- # @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_CancelOrderReference.html
206
- # @param amazon_order_reference_id [String]
207
- # @param opts [Hash]
208
- # @option opts [String] cancelation_reason
209
- # @return [Peddler::XMLParser]
210
- def cancel_order_reference(amazon_order_reference_id, opts = {})
211
- operation('CancelOrderReference')
212
- .add(opts.merge('AmazonOrderReferenceId' => amazon_order_reference_id))
213
-
214
- run
215
- end
216
-
217
- # Confirms that an order reference has been fulfilled (fully or partially)
218
- # and that you do not expect to create any new authorizations on this order
219
- # reference
220
- #
221
- # @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_CloseOrderReference.html
222
- # @param amazon_order_reference_id [String]
223
- # @param opts [Hash]
224
- # @option opts [String] closure_reason
225
- # @return [Peddler::XMLParser]
226
- def close_order_reference(amazon_order_reference_id, opts = {})
227
- operation('CloseOrderReference')
228
- .add(opts.merge('AmazonOrderReferenceId' => amazon_order_reference_id))
229
-
230
- run
231
- end
232
-
233
- # Reserves a specified amount against the payment method(s) stored in the
234
- # order reference
235
- #
236
- # @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_Authorize.html
237
- # @param amazon_order_reference_id [String]
238
- # @param authorization_reference_id [String]
239
- # @param authorization_amount [Struct, Hash]
240
- # @param opts [Hash]
241
- # @option opts [String] :seller_authorization_note
242
- # @option opts [Integer] :transaction_timeout
243
- # @option opts [Boolean] :capture_now
244
- # @option opts [String] :soft_descriptor
245
- # @return [Peddler::XMLParser]
246
- def authorize(amazon_order_reference_id, authorization_reference_id, authorization_amount, opts = {})
247
- operation('Authorize')
248
- .add(opts.merge(
249
- 'AmazonOrderReferenceId' => amazon_order_reference_id,
250
- 'AuthorizationReferenceId' => authorization_reference_id,
251
- 'AuthorizationAmount' => authorization_amount
252
- ))
253
-
254
- run
255
- end
256
-
257
- # Returns the status of a particular authorization and the total amount
258
- # captured on the authorization
259
- #
260
- # @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_GetAuthorizationDetails.html
261
- # @param amazon_authorization_id [String]
262
- # @return [Peddler::XMLParser]
263
- def get_authorization_details(amazon_authorization_id)
264
- operation('GetAuthorizationDetails')
265
- .add('AmazonAuthorizationId' => amazon_authorization_id)
266
-
267
- run
268
- end
269
-
270
- # Captures funds from an authorized payment instrument
271
- #
272
- # @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_Capture.html
273
- # @param amazon_authorization_id [String]
274
- # @param capture_reference_id [String]
275
- # @param capture_amount [Struct, Hash]
276
- # @param opts [Hash]
277
- # @option opts [String] :seller_capture_note
278
- # @option opts [String] :soft_descriptor
279
- # @return [Peddler::XMLParser]
280
- def capture(amazon_authorization_id, capture_reference_id, capture_amount, opts = {})
281
- operation('Capture')
282
- .add(opts.merge(
283
- 'AmazonAuthorizationId' => amazon_authorization_id,
284
- 'CaptureReferenceId' => capture_reference_id,
285
- 'CaptureAmount' => capture_amount
286
- ))
287
-
288
- run
289
- end
290
-
291
- # Returns the status of a particular capture and the total amount refunded
292
- # on the capture
293
- #
294
- # @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_GetCaptureDetails.html
295
- # @param amazon_capture_id [String]
296
- # @return [Peddler::XMLParser]
297
- def get_capture_details(amazon_capture_id)
298
- operation('GetAuthorizationDetails')
299
- .add('AmazonCaptureId' => amazon_capture_id)
300
-
301
- run
302
- end
303
-
304
- # Closes an authorization
305
- #
306
- # @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_CloseAuthorization.html
307
- # @param amazon_authorization_id [String]
308
- # @param opts [Hash]
309
- # @option opts [String] closure_reason
310
- # @return [Peddler::XMLParser]
311
- def close_authorization(amazon_authorization_id, opts = {})
312
- operation('CloseAuthorization')
313
- .add(opts.merge('AmazonAuthorizationId' => amazon_authorization_id))
314
-
315
- run
316
- end
317
-
318
- # Refunds a previously captured amount
319
- #
320
- # @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_Refund.html
321
- # @param amazon_capture_id [String]
322
- # @param refund_reference_id [String]
323
- # @param refund_amount [Struct, Hash]
324
- # @param opts [Hash]
325
- # @option opts [String] :seller_refund_note
326
- # @option opts [String] :soft_descriptor
327
- # @return [Peddler::XMLParser]
328
- def refund(amazon_capture_id, refund_reference_id, refund_amount, opts ={})
329
- operation('Refund')
330
- .add(opts.merge(
331
- 'AmazonCaptureId' => amazon_capture_id,
332
- 'RefundReferenceId' => refund_reference_id,
333
- 'RefundAmount' => refund_amount
334
- ))
335
-
336
- run
337
- end
338
-
339
- # Returns the status of a particular refund
340
- #
341
- # @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_GetRefundDetails.html
342
- # @param amazon_refund_id [String]
343
- # @return [Peddler::XMLParser]
344
- def get_refund_details(amazon_refund_id)
345
- operation('GetRefundDetails')
346
- .add('AmazonRefundId' => 'amazon_refund_id')
347
-
348
- run
349
- end
350
-
351
- # Gets the operational status of the API
352
- #
353
- # @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_GetServiceStatus.html
354
- # @return [Peddler::XMLParser]
355
- def get_service_status
356
- operation('GetServiceStatus')
357
- run
358
- end
359
- end
360
- end
1
+ require 'mws/off_amazon_payments/client'
@@ -0,0 +1,102 @@
1
+ require 'peddler/client'
2
+
3
+ module MWS
4
+ module Orders
5
+ # With the MWS Orders API, you can list orders created or updated during a
6
+ # time frame you specify or retrieve information about specific orders.
7
+ class Client < ::Peddler::Client
8
+ path '/Orders/2013-09-01'
9
+
10
+ # Lists orders
11
+ #
12
+ # @see http://docs.developer.amazonservices.com/en_US/orders/2013-09-01/Orders_ListOrders.html
13
+ # @param opts [Hash]
14
+ # @option opts [String, #iso8601] :created_after
15
+ # @option opts [String, #iso8601] :created_before
16
+ # @option opts [String, #iso8601] :last_updated_after
17
+ # @option opts [String, #iso8601] :last_updated_before
18
+ # @option opts [Array<String>, String] :order_status
19
+ # @option opts [Array<String>, String] :marketplace_id
20
+ # @option opts [Array<String>, String] :fulfillment_channel
21
+ # @option opts [Array<String>, String] :payment_method
22
+ # @option opts [String] :buyer_email
23
+ # @option opts [String] :seller_order_id
24
+ # @option opts [String] :max_results_per_page
25
+ # @option opts [String] :tfm_shipment_status
26
+ # @return [Peddler::XMLParser]
27
+ def list_orders(opts = {})
28
+ opts[:marketplace_id] ||= marketplace_id
29
+ if opts.key?(:tfm_shipment_status)
30
+ opts['TFMShipmentStatus'] = opts.delete(:tfm_shipment_status)
31
+ end
32
+
33
+ operation('ListOrders')
34
+ .add(opts)
35
+ .structure!('OrderStatus', 'Status')
36
+ .structure!('MarketplaceId', 'Id')
37
+ .structure!('PaymentMethod')
38
+ .structure!('TFMShipmentStatus', 'Status')
39
+
40
+ run
41
+ end
42
+
43
+ # Lists the next page of orders
44
+ #
45
+ # @see http://docs.developer.amazonservices.com/en_US/orders/2013-09-01/Orders_ListOrdersByNextToken.html
46
+ # @param next_token [String]
47
+ # @return [Peddler::XMLParser]
48
+ def list_orders_by_next_token(next_token)
49
+ operation('ListOrdersByNextToken')
50
+ .add('NextToken' => next_token)
51
+
52
+ run
53
+ end
54
+
55
+ # Gets one or more orders
56
+ #
57
+ # @see http://docs.developer.amazonservices.com/en_US/orders/2013-09-01/Orders_GetOrder.html
58
+ # @param amazon_order_ids [Array<String>]
59
+ # @return [Peddler::XMLParser]
60
+ def get_order(*amazon_order_ids)
61
+ operation('GetOrder')
62
+ .add('AmazonOrderId' => amazon_order_ids)
63
+ .structure!('AmazonOrderId', 'Id')
64
+
65
+ run
66
+ end
67
+
68
+ # Lists order items for an order
69
+ #
70
+ # @see http://docs.developer.amazonservices.com/en_US/orders/2013-09-01/Orders_ListOrderItems.html
71
+ # @param amazon_order_id [String]
72
+ # @return [Peddler::XMLParser]
73
+ def list_order_items(amazon_order_id)
74
+ operation('ListOrderItems')
75
+ .add('AmazonOrderId' => amazon_order_id)
76
+
77
+ run
78
+ end
79
+
80
+ # Lists the next page of order items for an order
81
+ #
82
+ # @see http://docs.developer.amazonservices.com/en_US/orders/2013-09-01/Orders_ListOrderItemsByNextToken.html
83
+ # @param next_token [String]
84
+ # @return [Peddler::XMLParser]
85
+ def list_order_items_by_next_token(next_token)
86
+ operation('ListOrderItemsByNextToken')
87
+ .add('NextToken' => next_token)
88
+
89
+ run
90
+ end
91
+
92
+ # Gets the service status of the API
93
+ #
94
+ # @see http://docs.developer.amazonservices.com/en_US/orders/2013-09-01/MWS_GetServiceStatus.html
95
+ # @return [Peddler::XMLParser]
96
+ def get_service_status
97
+ operation('GetServiceStatus')
98
+ run
99
+ end
100
+ end
101
+ end
102
+ end
data/lib/mws/orders.rb CHANGED
@@ -1,98 +1 @@
1
- require 'peddler/client'
2
-
3
- module MWS
4
- # With the MWS Orders API, you can list orders created or updated during a
5
- # time frame you specify or retrieve information about specific orders.
6
- class Orders < ::Peddler::Client
7
- path '/Orders/2013-09-01'
8
-
9
- # Lists orders
10
- #
11
- # @see http://docs.developer.amazonservices.com/en_US/orders/2013-09-01/Orders_ListOrders.html
12
- # @param opts [Hash]
13
- # @option opts [String, #iso8601] :created_after
14
- # @option opts [String, #iso8601] :created_before
15
- # @option opts [String, #iso8601] :last_updated_after
16
- # @option opts [String, #iso8601] :last_updated_before
17
- # @option opts [Array<String>, String] :order_status
18
- # @option opts [Array<String>, String] :marketplace_id
19
- # @option opts [Array<String>, String] :fulfillment_channel
20
- # @option opts [Array<String>, String] :payment_method
21
- # @option opts [String] :buyer_email
22
- # @option opts [String] :seller_order_id
23
- # @option opts [String] :max_results_per_page
24
- # @option opts [String] :tfm_shipment_status
25
- # @return [Peddler::XMLParser]
26
- def list_orders(opts = {})
27
- opts[:marketplace_id] ||= marketplace_id
28
- opts['TFMShipmentStatus'] = opts.delete(:tfm_shipment_status) if opts.has_key?(:tfm_shipment_status)
29
-
30
- operation('ListOrders')
31
- .add(opts)
32
- .structure!('OrderStatus', 'Status')
33
- .structure!('MarketplaceId', 'Id')
34
- .structure!('PaymentMethod')
35
- .structure!('TFMShipmentStatus', 'Status')
36
-
37
- run
38
- end
39
-
40
- # Lists the next page of orders
41
- #
42
- # @see http://docs.developer.amazonservices.com/en_US/orders/2013-09-01/Orders_ListOrdersByNextToken.html
43
- # @param next_token [String]
44
- # @return [Peddler::XMLParser]
45
- def list_orders_by_next_token(next_token)
46
- operation('ListOrdersByNextToken')
47
- .add('NextToken' => next_token)
48
-
49
- run
50
- end
51
-
52
- # Gets one or more orders
53
- #
54
- # @see http://docs.developer.amazonservices.com/en_US/orders/2013-09-01/Orders_GetOrder.html
55
- # @param amazon_order_ids [Array<String>]
56
- # @return [Peddler::XMLParser]
57
- def get_order(*amazon_order_ids)
58
- operation('GetOrder')
59
- .add('AmazonOrderId' => amazon_order_ids)
60
- .structure!('AmazonOrderId', 'Id')
61
-
62
- run
63
- end
64
-
65
- # Lists order items for an order
66
- #
67
- # @see http://docs.developer.amazonservices.com/en_US/orders/2013-09-01/Orders_ListOrderItems.html
68
- # @param amazon_order_id [String]
69
- # @return [Peddler::XMLParser]
70
- def list_order_items(amazon_order_id)
71
- operation('ListOrderItems')
72
- .add('AmazonOrderId' => amazon_order_id)
73
-
74
- run
75
- end
76
-
77
- # Lists the next page of order items for an order
78
- #
79
- # @see http://docs.developer.amazonservices.com/en_US/orders/2013-09-01/Orders_ListOrderItemsByNextToken.html
80
- # @param next_token [String]
81
- # @return [Peddler::XMLParser]
82
- def list_order_items_by_next_token(next_token)
83
- operation('ListOrderItemsByNextToken')
84
- .add('NextToken' => next_token)
85
-
86
- run
87
- end
88
-
89
- # Gets the service status of the API
90
- #
91
- # @see http://docs.developer.amazonservices.com/en_US/orders/2013-09-01/MWS_GetServiceStatus.html
92
- # @return [Peddler::XMLParser]
93
- def get_service_status
94
- operation('GetServiceStatus')
95
- run
96
- end
97
- end
98
- end
1
+ require 'mws/orders/client'