peddler 1.6.3 → 1.6.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +14 -16
  3. data/lib/mws.rb +2 -0
  4. data/lib/mws/feeds.rb +2 -0
  5. data/lib/mws/feeds/client.rb +2 -0
  6. data/lib/mws/finances.rb +2 -0
  7. data/lib/mws/finances/client.rb +6 -2
  8. data/lib/mws/fulfillment_inbound_shipment.rb +2 -0
  9. data/lib/mws/fulfillment_inbound_shipment/client.rb +23 -10
  10. data/lib/mws/fulfillment_inventory.rb +2 -0
  11. data/lib/mws/fulfillment_inventory/client.rb +2 -0
  12. data/lib/mws/fulfillment_outbound_shipment.rb +2 -0
  13. data/lib/mws/fulfillment_outbound_shipment/client.rb +21 -5
  14. data/lib/mws/merchant_fulfillment.rb +2 -0
  15. data/lib/mws/merchant_fulfillment/client.rb +4 -1
  16. data/lib/mws/off_amazon_payments.rb +2 -0
  17. data/lib/mws/off_amazon_payments/client.rb +51 -23
  18. data/lib/mws/orders.rb +2 -0
  19. data/lib/mws/orders/client.rb +6 -3
  20. data/lib/mws/products.rb +2 -0
  21. data/lib/mws/products/client.rb +30 -14
  22. data/lib/mws/recommendations.rb +2 -0
  23. data/lib/mws/recommendations/client.rb +6 -2
  24. data/lib/mws/reports.rb +2 -0
  25. data/lib/mws/reports/client.rb +2 -0
  26. data/lib/mws/sellers.rb +2 -0
  27. data/lib/mws/sellers/client.rb +2 -0
  28. data/lib/mws/subscriptions.rb +2 -0
  29. data/lib/mws/subscriptions/client.rb +21 -9
  30. data/lib/peddler.rb +2 -0
  31. data/lib/peddler/client.rb +2 -0
  32. data/lib/peddler/errors/builder.rb +2 -0
  33. data/lib/peddler/errors/error.rb +4 -0
  34. data/lib/peddler/errors/handler.rb +2 -0
  35. data/lib/peddler/errors/parser.rb +2 -0
  36. data/lib/peddler/flat_file_parser.rb +4 -1
  37. data/lib/peddler/headers.rb +2 -0
  38. data/lib/peddler/marketplace.rb +2 -0
  39. data/lib/peddler/operation.rb +2 -0
  40. data/lib/peddler/parser.rb +2 -0
  41. data/lib/peddler/structured_list.rb +2 -0
  42. data/lib/peddler/vcr_matcher.rb +2 -0
  43. data/lib/peddler/version.rb +1 -1
  44. data/lib/peddler/xml_parser.rb +2 -0
  45. data/lib/peddler/xml_response_parser.rb +2 -0
  46. data/test/credentials.rb +23 -0
  47. data/test/helper.rb +2 -0
  48. data/test/integration/test_errors.rb +6 -5
  49. data/test/integration/test_feeds.rb +2 -0
  50. data/test/integration/test_fulfillment_inbound_shipment.rb +2 -0
  51. data/test/integration/test_fulfillment_inventory.rb +2 -0
  52. data/test/integration/test_fulfillment_outbound_shipment.rb +2 -0
  53. data/test/integration/test_merchant_fulfillment.rb +2 -0
  54. data/test/integration/test_multibyte_queries.rb +3 -4
  55. data/test/integration/test_mws_headers.rb +3 -4
  56. data/test/integration/test_off_amazon_payments.rb +2 -0
  57. data/test/integration/test_orders.rb +8 -10
  58. data/test/integration/test_products.rb +2 -0
  59. data/test/integration/test_recommendations.rb +2 -0
  60. data/test/integration/test_reports.rb +2 -0
  61. data/test/integration/test_sellers.rb +2 -0
  62. data/test/integration/test_subscriptions.rb +2 -0
  63. data/test/integration_helper.rb +25 -12
  64. data/test/null_client.rb +2 -0
  65. data/test/recorder.rb +2 -0
  66. data/test/unit/mws/test_feeds_client.rb +2 -0
  67. data/test/unit/mws/test_finances_client.rb +2 -0
  68. data/test/unit/mws/test_fulfillment_inbound_shipment_client.rb +2 -0
  69. data/test/unit/mws/test_fulfillment_inventory_client.rb +2 -0
  70. data/test/unit/mws/test_fulfillment_outbound_shipment_client.rb +7 -2
  71. data/test/unit/mws/test_merchant_fulfillment_client.rb +2 -0
  72. data/test/unit/mws/test_off_amazon_payments_client.rb +2 -0
  73. data/test/unit/mws/test_orders_client.rb +2 -0
  74. data/test/unit/mws/test_products_client.rb +2 -0
  75. data/test/unit/mws/test_recommendations_client.rb +2 -0
  76. data/test/unit/mws/test_reports_client.rb +2 -0
  77. data/test/unit/mws/test_sellers_client.rb +2 -0
  78. data/test/unit/mws/test_subscriptions_client.rb +2 -0
  79. data/test/unit/peddler/errors/test_builder.rb +2 -0
  80. data/test/unit/peddler/errors/test_error.rb +2 -0
  81. data/test/unit/peddler/errors/test_handler.rb +2 -0
  82. data/test/unit/peddler/errors/test_parser.rb +2 -0
  83. data/test/unit/peddler/test_client.rb +6 -2
  84. data/test/unit/peddler/test_flat_file_parser.rb +27 -24
  85. data/test/unit/peddler/test_headers.rb +2 -0
  86. data/test/unit/peddler/test_marketplace.rb +2 -0
  87. data/test/unit/peddler/test_operation.rb +2 -0
  88. data/test/unit/peddler/test_parser.rb +2 -0
  89. data/test/unit/peddler/test_structured_list.rb +2 -0
  90. data/test/unit/peddler/test_vcr_matcher.rb +2 -0
  91. data/test/unit/peddler/test_xml_parser.rb +3 -1
  92. data/test/unit/peddler/test_xml_response_parser.rb +2 -0
  93. data/test/unit/test_mws.rb +2 -0
  94. metadata +58 -58
  95. data/test/mws.yml +0 -36
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 85f658ea57943c161a25cd0c6b0576dfd8c41090
4
- data.tar.gz: ba083f88dd8a1d37cc4d997ac711bee5c9e7ec0a
3
+ metadata.gz: 24131e63ed4c505abe9a67d704cdfa6de9e6afe0
4
+ data.tar.gz: 4970aa802cfc5140e6fa7626e1152120874249c9
5
5
  SHA512:
6
- metadata.gz: 0a83a2d55e68860d271967dfdc14bfc6ef9b538a25b198b20b34f45ce73eaa41327b1648d5ed3ff36ed78d8ce711c00c17589ecb9e9d90699768fc37d84deb00
7
- data.tar.gz: 02d264e02386dbd6f17f71b8fdba7be9dad871b050e248877b4ad16c1374b0476ef095d7f48f4886017607e791be9393f6ae7c273e406d243e6c369425c485f3
6
+ metadata.gz: f682a3c30974949ff13eed060fe3047ae3afccbcb021651315ef0975cda29db29e2b7091ea9978f94d26224d62dc8a62f5dee267a61df950a208db5373b65d9b
7
+ data.tar.gz: bcb9aee34b6512db490b30304790b50c5605098479af9009f846114c72bba0cc01c857becc46d1efb464b56271569b6e46edff8cb9fece1d1a238d24982daef3
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # Peddler
2
2
 
3
3
  [![Build Status](https://travis-ci.org/hakanensari/peddler.svg)](https://travis-ci.org/hakanensari/peddler)
4
- [![Code Climate](https://codeclimate.com/github/hakanensari/peddler/badges/gpa.svg)](https://codeclimate.com/github/hakanensari/peddler)
5
- [![Test Coverage](https://codeclimate.com/github/hakanensari/peddler/badges/coverage.svg)](https://codeclimate.com/github/hakanensari/peddler/coverage)
4
+ [![Maintainability](https://api.codeclimate.com/v1/badges/281e6176048f3c0a1ed3/maintainability)](https://codeclimate.com/github/hakanensari/peddler/maintainability)
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
 
@@ -29,7 +29,7 @@ client = MWS::Orders::Client.new
29
29
  client = MWS.orders
30
30
  ```
31
31
 
32
- Each client requires valid MWS credentials. You can set these globally in the shell.
32
+ Each client requires valid MWS credentials. Set these globally in the shell.
33
33
 
34
34
  ```bash
35
35
  export MWS_MARKETPLACE_ID=YOUR_MARKETPLACE_ID
@@ -38,15 +38,23 @@ export AWS_ACCESS_KEY_ID=YOUR_AWS_ACCESS_KEY_ID
38
38
  export AWS_SECRET_ACCESS_KEY=YOUR_AWS_SECRET_ACCESS_KEY
39
39
  ```
40
40
 
41
- You can now instantiate a client.
41
+ You can now instantiate a client. The client will pick up credentials automatically from the environment.
42
42
 
43
43
  ```ruby
44
44
  client = MWS.orders
45
45
  ```
46
46
 
47
- The client will pick up credentials automatically from the environment.
47
+ If you are creating a [client for another seller](https://developer.amazonservices.com/gp/mws/faq.html#developForSeller), pass the latter's Merchant (Seller) ID and Marketplace ID along with the `MWSAuthToken` they obtained for you.
48
+
49
+ ```ruby
50
+ client = MWS.orders(
51
+ primary_marketplace_id: "Seller's Marketplace ID",
52
+ merchant_id: "Seller's Merchant or Seller ID",
53
+ auth_token: "Seller's MWS Authorisation Token"
54
+ )
55
+ ```
48
56
 
49
- Alternatively, if you do not rely on environment variables, you can set some or all credentials when or after creating the client.
57
+ Finally, if you do not want to use environment variables at all, you can set all credentials when or after creating the client.
50
58
 
51
59
  ```ruby
52
60
  client = MWS.orders(
@@ -59,16 +67,6 @@ client = MWS.orders(
59
67
  client.primary_marketplace_id = "Another Marketplace ID"
60
68
  ```
61
69
 
62
- If you are creating a [client for another seller](https://developer.amazonservices.com/gp/mws/faq.html#developForSeller), pass the latter's Merchant (Seller) ID and Marketplace ID along with the `MWSAuthToken` they obtained for you.
63
-
64
- ```ruby
65
- client = MWS.orders(
66
- primary_marketplace_id: "Seller's Marketplace ID",
67
- merchant_id: "Seller's Merchant or Seller ID",
68
- auth_token: "Seller's MWS Authorisation Token"
69
- )
70
- ```
71
-
72
70
  Once you have a client with valid credentials, you should be able to make requests to the API. Clients map operation names in a flat structure. Methods have positional arguments for required input and keyword arguments for optional parameters. Both method and argument names are underscored but otherwise identical to the names of the corresponding operations and parameters documented in the API.
73
71
 
74
72
  ### Parser
data/lib/mws.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'forwardable'
2
4
  require 'mws/feeds'
3
5
  require 'mws/finances'
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'mws/feeds/client'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'peddler/client'
2
4
 
3
5
  module MWS
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'mws/finances/client'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'peddler/client'
2
4
 
3
5
  module MWS
@@ -43,9 +45,11 @@ module MWS
43
45
  # @option opts [Integer] :max_results_per_page
44
46
  # @option opts [String, #iso8601] :financial_event_group_started_before
45
47
  # @return [Peddler::XMLParser]
46
- def list_financial_event_groups(financial_event_group_started_after, opts = {})
48
+ def list_financial_event_groups(financial_event_group_started_after,
49
+ opts = {})
47
50
  operation('ListFinancialEventGroups')
48
- .add('FinancialEventGroupStartedAfter' => financial_event_group_started_after)
51
+ .add('FinancialEventGroupStartedAfter' =>
52
+ financial_event_group_started_after)
49
53
  .add(opts)
50
54
 
51
55
  run
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'mws/fulfillment_inbound_shipment/client'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'peddler/client'
2
4
 
3
5
  module MWS
@@ -52,12 +54,15 @@ module MWS
52
54
  # @param [Hash] opts
53
55
  # @option opts [String] :label_prep_preference
54
56
  # @return [Peddler::XMLParser]
55
- def create_inbound_shipment_plan(ship_from_address, inbound_shipment_plan_request_items, opts = {})
57
+ def create_inbound_shipment_plan(ship_from_address,
58
+ inbound_shipment_plan_request_items,
59
+ opts = {})
56
60
  operation('CreateInboundShipmentPlan')
57
61
  .add(
58
62
  opts.update(
59
63
  'ShipFromAddress' => ship_from_address,
60
- 'InboundShipmentPlanRequestItems' => inbound_shipment_plan_request_items
64
+ 'InboundShipmentPlanRequestItems' =>
65
+ inbound_shipment_plan_request_items
61
66
  )
62
67
  )
63
68
  .structure!('InboundShipmentPlanRequestItems', 'member')
@@ -73,7 +78,8 @@ module MWS
73
78
  # @param [Hash] opts
74
79
  # @option opts [Array<Struct, Hash>] :inbound_shipment_items
75
80
  # @return [Peddler::XMLParser]
76
- def create_inbound_shipment(shipment_id, inbound_shipment_header, opts = {})
81
+ def create_inbound_shipment(shipment_id, inbound_shipment_header,
82
+ opts = {})
77
83
  build_inbound_shipment_operation(
78
84
  'CreateInboundShipment',
79
85
  shipment_id,
@@ -92,7 +98,8 @@ module MWS
92
98
  # @param [Hash] opts
93
99
  # @option opts [Array<Struct, Hash>] :inbound_shipment_items
94
100
  # @return [Peddler::XMLParser]
95
- def update_inbound_shipment(shipment_id, inbound_shipment_header, opts = {})
101
+ def update_inbound_shipment(shipment_id, inbound_shipment_header,
102
+ opts = {})
96
103
  build_inbound_shipment_operation(
97
104
  'UpdateInboundShipment',
98
105
  shipment_id,
@@ -133,7 +140,8 @@ module MWS
133
140
  run
134
141
  end
135
142
 
136
- # Returns labeling requirements and item preparation instructions to help you prepare items for an inbound shipment
143
+ # Returns labeling requirements and item preparation instructions to help
144
+ # you prepare items for an inbound shipment
137
145
  #
138
146
  # @see http://docs.developer.amazonservices.com/en_US/fba_inbound/FBAInbound_GetPrepInstructionsForSKU.html
139
147
  # @param [String] ship_to_country_code
@@ -150,7 +158,8 @@ module MWS
150
158
  run
151
159
  end
152
160
 
153
- # Returns item preparation instructions to help with item sourcing decisions
161
+ # Returns item preparation instructions to help with item sourcing
162
+ # decisions
154
163
  #
155
164
  # @see http://docs.developer.amazonservices.com/en_US/fba_inbound/FBAInbound_GetPrepInstructionsForASIN.html
156
165
  # @param [String] ship_to_country_code
@@ -175,7 +184,8 @@ module MWS
175
184
  # @param [String] shipment_type
176
185
  # @param [Struct, Hash] transport_details
177
186
  # @return [Peddler::XMLParser]
178
- def put_transport_content(shipment_id, is_partnered, shipment_type, transport_details)
187
+ def put_transport_content(shipment_id, is_partnered, shipment_type,
188
+ transport_details)
179
189
  operation('PutTransportContent')
180
190
  .add(
181
191
  'ShipmentId' => shipment_id,
@@ -250,14 +260,16 @@ module MWS
250
260
  run
251
261
  end
252
262
 
253
- # Returns unique package labels for faster and more accurate shipment processing at the Amazon fulfillment centre
263
+ # Returns unique package labels for faster and more accurate shipment
264
+ # processing at the Amazon fulfillment centre
254
265
  #
255
266
  # @see http://docs.developer.amazonservices.com/en_US/fba_inbound/FBAInbound_GetUniquePackageLabels.html
256
267
  # @param [String] shipment_id
257
268
  # @param [String] page_type
258
269
  # @param [Array<String>] package_labels_to_print
259
270
  # @return [Peddler::XMLParser]
260
- def get_unique_package_labels(shipment_id, page_type, package_labels_to_print)
271
+ def get_unique_package_labels(shipment_id, page_type,
272
+ package_labels_to_print)
261
273
  operation('GetUniquePackageLabels')
262
274
  .add(
263
275
  'ShipmentId' => shipment_id,
@@ -365,7 +377,8 @@ module MWS
365
377
 
366
378
  private
367
379
 
368
- def build_inbound_shipment_operation(operation_name, shipment_id, inbound_shipment_header, opts)
380
+ def build_inbound_shipment_operation(operation_name, shipment_id,
381
+ inbound_shipment_header, opts)
369
382
  operation(operation_name)
370
383
  .add(
371
384
  opts.update(
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'mws/fulfillment_inventory/client'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'peddler/client'
2
4
 
3
5
  module MWS
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'mws/fulfillment_outbound_shipment/client'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'peddler/client'
2
4
  require 'excon'
3
5
 
@@ -27,7 +29,8 @@ module MWS
27
29
  # @return [Peddler::XMLParser]
28
30
  def get_fulfillment_preview(address, items, opts = {})
29
31
  if opts.key?(:include_cod_fulfillment_preview)
30
- opts['IncludeCODFulfillmentPreview'] = opts.delete(:include_cod_fulfillment_preview)
32
+ opts['IncludeCODFulfillmentPreview'] =
33
+ opts.delete(:include_cod_fulfillment_preview)
31
34
  end
32
35
 
33
36
  operation('GetFulfillmentPreview')
@@ -55,7 +58,12 @@ module MWS
55
58
  # @option opts [Array<String>] :notification_email_list
56
59
  # @option opts [Struct, Hash] :cod_settings
57
60
  # @return [Peddler::XMLParser]
58
- def create_fulfillment_order(seller_fulfillment_order_id, displayable_order_id, displayable_order_date_time, displayable_order_comment, shipping_speed_category, destination_address, items, opts = {})
61
+ def create_fulfillment_order(seller_fulfillment_order_id,
62
+ displayable_order_id,
63
+ displayable_order_date_time,
64
+ displayable_order_comment,
65
+ shipping_speed_category,
66
+ destination_address, items, opts = {})
59
67
  if opts.key?(:cod_settings)
60
68
  opts['CODSettings'] = opts.delete(:cod_settings)
61
69
  end
@@ -96,7 +104,11 @@ module MWS
96
104
  # @return [Peddler::XMLParser]
97
105
  def update_fulfillment_order(seller_fulfillment_order_id, opts = {})
98
106
  operation('UpdateFulfillmentOrder')
99
- .add(opts.update('SellerFulfillmentOrderId' => seller_fulfillment_order_id))
107
+ .add(
108
+ opts.update(
109
+ 'SellerFulfillmentOrderId' => seller_fulfillment_order_id
110
+ )
111
+ )
100
112
  .structure!('NotificationEmailList', 'member')
101
113
  .structure!('Items', 'member')
102
114
 
@@ -121,7 +133,10 @@ module MWS
121
133
  # @param [String, #iso8601] query_start_date_time
122
134
  # @return [Peddler::XMLParser]
123
135
  def list_all_fulfillment_orders(query_start_date_time = nil)
124
- opts = query_start_date_time ? { 'QueryStartDateTime' => query_start_date_time } : {}
136
+ opts = {}
137
+ if query_start_date_time
138
+ opts.update('QueryStartDateTime' => query_start_date_time)
139
+ end
125
140
  operation('ListAllFulfillmentOrders').add(opts)
126
141
 
127
142
  run
@@ -165,7 +180,8 @@ module MWS
165
180
  run
166
181
  end
167
182
 
168
- # Returns a list of return reason codes for a seller SKU in a given marketplace.
183
+ # Returns a list of return reason codes for a seller SKU in a given
184
+ # marketplace.
169
185
  #
170
186
  # @see http://docs.developer.amazonservices.com/en_US/fba_outbound/FBAOutbound_ListReturnReasonCodes.html
171
187
  # @param [String] seller_sku
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'mws/merchant_fulfillment/client'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'peddler/client'
2
4
 
3
5
  module MWS
@@ -36,7 +38,8 @@ module MWS
36
38
  # @param [Hash] opts
37
39
  # @option opts [String] :shipping_service_offer_id
38
40
  # @return [Peddler::XMLParser]
39
- def create_shipment(shipment_request_details, shipping_service_id, opts = {})
41
+ def create_shipment(shipment_request_details, shipping_service_id,
42
+ opts = {})
40
43
  operation('CreateShipment')
41
44
  .add(
42
45
  'ShipmentRequestDetails' => shipment_request_details,
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'mws/off_amazon_payments/client'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'peddler/client'
2
4
 
3
5
  module MWS
@@ -39,7 +41,8 @@ module MWS
39
41
  # @option opts [Boolean] :capture_now
40
42
  # @option opts [String] :soft_descriptor
41
43
  # @return [Peddler::XMLParser]
42
- def authorize(amazon_order_reference_id, authorization_reference_id, authorization_amount, opts = {})
44
+ def authorize(amazon_order_reference_id, authorization_reference_id,
45
+ authorization_amount, opts = {})
43
46
  operation('Authorize')
44
47
  .add(opts.update(
45
48
  'AmazonOrderReferenceId' => amazon_order_reference_id,
@@ -59,7 +62,11 @@ module MWS
59
62
  # @return [Peddler::XMLParser]
60
63
  def cancel_order_reference(amazon_order_reference_id, opts = {})
61
64
  operation('CancelOrderReference')
62
- .add(opts.update('AmazonOrderReferenceId' => amazon_order_reference_id))
65
+ .add(
66
+ opts.update(
67
+ 'AmazonOrderReferenceId' => amazon_order_reference_id
68
+ )
69
+ )
63
70
 
64
71
  run
65
72
  end
@@ -74,7 +81,8 @@ module MWS
74
81
  # @option opts [String] :seller_capture_note
75
82
  # @option opts [String] :soft_descriptor
76
83
  # @return [Peddler::XMLParser]
77
- def capture(amazon_authorization_id, capture_reference_id, capture_amount, opts = {})
84
+ def capture(amazon_authorization_id, capture_reference_id, capture_amount,
85
+ opts = {})
78
86
  operation('Capture')
79
87
  .add(opts.update(
80
88
  'AmazonAuthorizationId' => amazon_authorization_id,
@@ -110,13 +118,17 @@ module MWS
110
118
  # @return [Peddler::XMLParser]
111
119
  def close_order_reference(amazon_order_reference_id, opts = {})
112
120
  operation('CloseOrderReference')
113
- .add(opts.update('AmazonOrderReferenceId' => amazon_order_reference_id))
121
+ .add(
122
+ opts.update(
123
+ 'AmazonOrderReferenceId' => amazon_order_reference_id
124
+ )
125
+ )
114
126
 
115
127
  run
116
128
  end
117
129
 
118
- # Confirms that the order reference is free of constraints and all required
119
- # information has been set on the order reference
130
+ # Confirms that the order reference is free of constraints and all
131
+ # required information has been set on the order reference
120
132
  #
121
133
  # @see https://payments.amazon.com/documentation/apireference/201751980
122
134
  # @param [String] amazon_order_reference_id
@@ -183,7 +195,11 @@ module MWS
183
195
  # @return [Peddler::XMLParser]
184
196
  def get_order_reference_details(amazon_order_reference_id, opts = {})
185
197
  operation('GetOrderReferenceDetails')
186
- .add(opts.update('AmazonOrderReferenceId' => amazon_order_reference_id))
198
+ .add(
199
+ opts.update(
200
+ 'AmazonOrderReferenceId' => amazon_order_reference_id
201
+ )
202
+ )
187
203
 
188
204
  run
189
205
  end
@@ -219,7 +235,8 @@ module MWS
219
235
  # @option opts [String] :seller_refund_note
220
236
  # @option opts [String] :soft_descriptor
221
237
  # @return [Peddler::XMLParser]
222
- def refund(amazon_capture_id, refund_reference_id, refund_amount, opts = {})
238
+ def refund(amazon_capture_id, refund_reference_id, refund_amount,
239
+ opts = {})
223
240
  operation('Refund')
224
241
  .add(opts.update(
225
242
  'AmazonCaptureId' => amazon_capture_id,
@@ -241,11 +258,13 @@ module MWS
241
258
  # @option opts [String] :seller_note
242
259
  # @option opts [Struct, Hash] :seller_order_attributes
243
260
  # @return [Peddler::XMLParser]
244
- def set_order_reference_details(amazon_order_reference_id, order_total, opts = {})
261
+ def set_order_reference_details(amazon_order_reference_id, order_total,
262
+ opts = {})
263
+ order_reference_attributes = opts.update('OrderTotal' => order_total)
245
264
  operation('SetOrderReferenceDetails')
246
265
  .add(
247
266
  'AmazonOrderReferenceId' => amazon_order_reference_id,
248
- 'OrderReferenceAttributes' => opts.update('OrderTotal' => order_total)
267
+ 'OrderReferenceAttributes' => order_reference_attributes
249
268
  )
250
269
 
251
270
  run
@@ -268,13 +287,17 @@ module MWS
268
287
  # @option opts [Hash, Struct] :seller_order_attributes
269
288
  # @option opts [Boolean] :inherit_shipping_address
270
289
  # @return [Peddler::XMLParser]
271
- def authorize_on_billing_agreement(amazon_billing_agreement_id, authorization_reference_id, authorization_amount, opts = {})
290
+ def authorize_on_billing_agreement(amazon_billing_agreement_id,
291
+ authorization_reference_id,
292
+ authorization_amount, opts = {})
272
293
  operation('AuthorizeOnBillingAgreement')
273
- .add(opts.update(
274
- 'AmazonBillingAgreementId' => amazon_billing_agreement_id,
275
- 'AuthorizationReferenceId' => authorization_reference_id,
276
- 'AuthorizationAmount' => authorization_amount
277
- ))
294
+ .add(
295
+ opts.update(
296
+ 'AmazonBillingAgreementId' => amazon_billing_agreement_id,
297
+ 'AuthorizationReferenceId' => authorization_reference_id,
298
+ 'AuthorizationAmount' => authorization_amount
299
+ )
300
+ )
278
301
 
279
302
  run
280
303
  end
@@ -290,9 +313,11 @@ module MWS
290
313
  # @return [Peddler::XMLParser]
291
314
  def close_billing_agreement(amazon_billing_agreement_id, opts = {})
292
315
  operation('CloseBillingAgreement')
293
- .add(opts.update(
294
- 'AmazonBillingAgreementId' => amazon_billing_agreement_id
295
- ))
316
+ .add(
317
+ opts.update(
318
+ 'AmazonBillingAgreementId' => amazon_billing_agreement_id
319
+ )
320
+ )
296
321
 
297
322
  run
298
323
  end
@@ -321,9 +346,11 @@ module MWS
321
346
  # @return [Peddler::XMLParser]
322
347
  def get_billing_agreement_details(amazon_billing_agreement_id, opts = {})
323
348
  operation('GetBillingAgreementDetails')
324
- .add(opts.update(
325
- 'AmazonBillingAgreementId' => amazon_billing_agreement_id
326
- ))
349
+ .add(
350
+ opts.update(
351
+ 'AmazonBillingAgreementId' => amazon_billing_agreement_id
352
+ )
353
+ )
327
354
 
328
355
  run
329
356
  end
@@ -335,7 +362,8 @@ module MWS
335
362
  # @param [String] amazon_billing_agreement_id
336
363
  # @param [Struct, Hash] billing_agreement_attributes
337
364
  # @return [Peddler::XMLParser]
338
- def set_billing_agreement_details(amazon_billing_agreement_id, billing_agreement_attributes)
365
+ def set_billing_agreement_details(amazon_billing_agreement_id,
366
+ billing_agreement_attributes)
339
367
  operation('SetBillingAgreementDetails')
340
368
  .add(
341
369
  'AmazonBillingAgreementId' => amazon_billing_agreement_id,