peddler 1.6.7 → 2.0.0

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.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +69 -67
  3. data/lib/mws/feeds/client.rb +15 -12
  4. data/lib/mws/finances/client.rb +12 -11
  5. data/lib/mws/fulfillment_inbound_shipment/client.rb +79 -107
  6. data/lib/mws/fulfillment_inventory/client.rb +5 -5
  7. data/lib/mws/fulfillment_outbound_shipment/client.rb +36 -44
  8. data/lib/mws/merchant_fulfillment/client.rb +11 -17
  9. data/lib/mws/off_amazon_payments/client.rb +38 -68
  10. data/lib/mws/orders/client.rb +28 -24
  11. data/lib/mws/products/client.rb +118 -153
  12. data/lib/mws/recommendations/client.rb +13 -17
  13. data/lib/mws/reports/client.rb +24 -23
  14. data/lib/mws/sellers/client.rb +5 -5
  15. data/lib/mws/subscriptions/client.rb +25 -36
  16. data/lib/peddler/client.rb +47 -124
  17. data/lib/peddler/errors/builder.rb +40 -14
  18. data/lib/peddler/errors/class_generator.rb +34 -0
  19. data/lib/peddler/errors/error.rb +13 -3
  20. data/lib/peddler/headers.rb +27 -11
  21. data/lib/peddler/marketplace.rb +30 -11
  22. data/lib/peddler/vcr_matcher.rb +11 -1
  23. data/lib/peddler/version.rb +1 -1
  24. data/lib/peddler/xml_parser.rb +4 -2
  25. data/lib/peddler/xml_response_parser.rb +1 -1
  26. data/test/helper.rb +0 -1
  27. data/test/integration/test_errors.rb +2 -14
  28. data/test/integration/test_feeds.rb +0 -3
  29. data/test/integration/test_multibyte_queries.rb +1 -1
  30. data/test/integration/test_mws_headers.rb +3 -2
  31. data/test/integration/test_orders.rb +2 -1
  32. data/test/integration/test_products.rb +9 -9
  33. data/test/integration/test_recommendations.rb +1 -1
  34. data/test/integration/test_subscriptions.rb +2 -2
  35. data/test/integration_helper.rb +1 -1
  36. data/test/mws.yml +36 -0
  37. data/test/mws.yml.example +8 -12
  38. data/test/null_client.rb +10 -8
  39. data/test/unit/mws/test_feeds_client.rb +1 -2
  40. data/test/unit/mws/test_fulfillment_outbound_shipment_client.rb +1 -1
  41. data/test/unit/mws/test_off_amazon_payments_client.rb +1 -1
  42. data/test/unit/mws/test_orders_client.rb +7 -6
  43. data/test/unit/mws/test_products_client.rb +13 -28
  44. data/test/unit/mws/test_recommendations_client.rb +1 -2
  45. data/test/unit/mws/test_reports_client.rb +1 -1
  46. data/test/unit/mws/test_subscriptions_client.rb +1 -130
  47. data/test/unit/peddler/errors/test_builder.rb +54 -7
  48. data/test/unit/peddler/errors/test_class_generator.rb +18 -0
  49. data/test/unit/peddler/errors/test_error.rb +7 -2
  50. data/test/unit/peddler/test_client.rb +136 -190
  51. data/test/unit/peddler/test_flat_file_parser.rb +2 -2
  52. data/test/unit/peddler/test_headers.rb +19 -9
  53. data/test/unit/peddler/test_marketplace.rb +18 -5
  54. data/test/unit/peddler/test_vcr_matcher.rb +3 -1
  55. data/test/vcr_cassettes/Feeds.yml +4816 -5224
  56. data/test/vcr_cassettes/Reports.yml +3278 -2604
  57. metadata +8 -9
  58. data/lib/peddler/errors.rb +0 -12
  59. data/lib/peddler/errors/handler.rb +0 -59
  60. data/test/unit/peddler/errors/test_handler.rb +0 -62
  61. data/test/unit/peddler/test_errors.rb +0 -26
@@ -7,36 +7,40 @@ module MWS
7
7
  # With the MWS Orders API, you can list orders created or updated during a
8
8
  # time frame you specify or retrieve information about specific orders.
9
9
  class Client < ::Peddler::Client
10
- version '2013-09-01'
11
- path "/Orders/#{version}"
10
+ self.version = '2013-09-01'
11
+ self.path = "/Orders/#{version}"
12
12
 
13
13
  # Lists orders
14
14
  #
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 http://docs.developer.amazonservices.com/en_US/orders/2013-09-01/Orders_ListOrders.html
19
- # @param [Hash] opts
20
- # @option opts [String, #iso8601] :created_after
21
- # @option opts [String, #iso8601] :created_before
22
- # @option opts [String, #iso8601] :last_updated_after
23
- # @option opts [String, #iso8601] :last_updated_before
24
- # @option opts [Array<String>, String] :order_status
25
- # @option opts [Array<String>, String] :marketplace_id
26
- # @option opts [Array<String>, String] :fulfillment_channel
27
- # @option opts [Array<String>, String] :payment_method
28
- # @option opts [String] :buyer_email
29
- # @option opts [String] :seller_order_id
30
- # @option opts [String] :max_results_per_page
31
- # @option opts [String] :tfm_shipment_status
18
+ # @see https://docs.developer.amazonservices.com/en_US/orders/2013-09-01/Orders_ListOrders.html
19
+ # @overload list_orders(*marketplace_id, opts = {})
20
+ # @param [Array<String>] marketplace_id
21
+ # @param [Hash] opts
22
+ # @option opts [String, #iso8601] :created_after
23
+ # @option opts [String, #iso8601] :created_before
24
+ # @option opts [String, #iso8601] :last_updated_after
25
+ # @option opts [String, #iso8601] :last_updated_before
26
+ # @option opts [Array<String>, String] :order_status
27
+ # @option opts [Array<String>, String] :fulfillment_channel
28
+ # @option opts [Array<String>, String] :payment_method
29
+ # @option opts [String] :buyer_email
30
+ # @option opts [String] :seller_order_id
31
+ # @option opts [String] :max_results_per_page
32
+ # @option opts [String] :tfm_shipment_status
32
33
  # @return [Peddler::XMLParser]
33
- def list_orders(opts = {})
34
- opts[:marketplace_id] ||= primary_marketplace_id
34
+ def list_orders(*marketplace_id)
35
+ marketplace_id = marketplace_id.dup
36
+ opts = extract_options(marketplace_id)
35
37
  if opts.key?(:tfm_shipment_status)
36
38
  opts['TFMShipmentStatus'] = opts.delete(:tfm_shipment_status)
37
39
  end
40
+
38
41
  operation('ListOrders')
39
42
  .add(opts)
43
+ .add('MarketplaceId' => marketplace_id)
40
44
  .structure!('OrderStatus', 'Status')
41
45
  .structure!('FulfillmentChannel', 'Channel')
42
46
  .structure!('MarketplaceId', 'Id')
@@ -49,7 +53,7 @@ module MWS
49
53
 
50
54
  # Lists the next page of orders
51
55
  #
52
- # @see http://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
53
57
  # @param [String] next_token
54
58
  # @return [Peddler::XMLParser]
55
59
  def list_orders_by_next_token(next_token)
@@ -61,8 +65,8 @@ module MWS
61
65
 
62
66
  # Gets one or more orders
63
67
  #
64
- # @see http://docs.developer.amazonservices.com/en_US/orders/2013-09-01/Orders_GetOrder.html
65
- # @param [String] amazon_order_id one or more amazon_order_ids
68
+ # @see https://docs.developer.amazonservices.com/en_US/orders/2013-09-01/Orders_GetOrder.html
69
+ # @param [Array<String>] amazon_order_ids
66
70
  # @return [Peddler::XMLParser]
67
71
  def get_order(*amazon_order_ids)
68
72
  operation('GetOrder')
@@ -74,7 +78,7 @@ module MWS
74
78
 
75
79
  # Lists order items for an order
76
80
  #
77
- # @see http://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
78
82
  # @param [String] amazon_order_id
79
83
  # @return [Peddler::XMLParser]
80
84
  def list_order_items(amazon_order_id)
@@ -86,7 +90,7 @@ module MWS
86
90
 
87
91
  # Lists the next page of order items for an order
88
92
  #
89
- # @see http://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
90
94
  # @param [String] next_token
91
95
  # @return [Peddler::XMLParser]
92
96
  def list_order_items_by_next_token(next_token)
@@ -98,7 +102,7 @@ module MWS
98
102
 
99
103
  # Gets the service status of the API
100
104
  #
101
- # @see http://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
102
106
  # @return [Peddler::XMLParser]
103
107
  def get_service_status
104
108
  operation('GetServiceStatus')
@@ -9,80 +9,66 @@ module MWS
9
9
  # sourcing and pricing decisions for listing those products on Amazon
10
10
  # Marketplace websites.
11
11
  class Client < ::Peddler::Client
12
- version '2011-10-01'
13
- path "/Products/#{version}"
12
+ self.version = '2011-10-01'
13
+ self.path = "/Products/#{version}"
14
14
 
15
15
  # Lists products and their attributes, based on a search query
16
16
  #
17
- # @see http://docs.developer.amazonservices.com/en_US/products/Products_ListMatchingProducts.html
18
- # @overload list_matching_products(query, opts = { marketplace_id:
19
- # primary_marketplace_id })
20
- # @param [String] query
21
- # @param [Hash] opts
22
- # @option opts [String] :marketplace_id
23
- # @option opts [String] :query_context_id
17
+ # @see https://docs.developer.amazonservices.com/en_US/products/Products_ListMatchingProducts.html
18
+ # @param [String] marketplace_id
19
+ # @param [String] query
20
+ # @param [Hash] opts
21
+ # @option opts [String] :query_context_id
24
22
  # @return [Peddler::XMLParser]
25
- def list_matching_products(query, opts = {})
26
- operation_with_marketplace('ListMatchingProducts')
27
- .add(opts.update('Query' => query))
23
+ def list_matching_products(marketplace_id, query, opts = {})
24
+ operation('ListMatchingProducts')
25
+ .add(opts)
26
+ .add('MarketplaceId' => marketplace_id, 'Query' => query)
28
27
 
29
28
  run
30
29
  end
31
30
 
32
- # Lists products and their attributes, based on a list of ASIN, GCID,
33
- # SellerSKU, UPC, EAN, ISBN, and JAN values
31
+ # Lists products and their attributes, based on a list of ASIN values
34
32
  #
35
- # @see http://docs.developer.amazonservices.com/en_US/products/Products_GetMatchingProduct.html
36
- # @overload get_matching_product_for_id(id_type, *ids, opts = {
37
- # marketplace_id: primary_marketplace_id })
38
- # @param [String] id_type
39
- # @param [String] id one or more ids
40
- # @param [Hash] opts
41
- # @option opts [String] :marketplace_id
33
+ # @see https://docs.developer.amazonservices.com/en_US/products/Products_GetMatchingProductForId.html
34
+ # @param [String] marketplace_id
35
+ # @param [Array<String>] asin_list
42
36
  # @return [Peddler::XMLParser]
43
- def get_matching_product_for_id(id_type, *id_list)
44
- opts = extract_options(id_list)
45
-
46
- operation_with_marketplace('GetMatchingProductForId')
47
- .add(opts.update('IdType' => id_type, 'IdList' => id_list))
48
- .structure!('IdList', 'Id')
37
+ def get_matching_product(marketplace_id, *asin_list)
38
+ operation('GetMatchingProduct')
39
+ .add('MarketplaceId' => marketplace_id, 'ASINList' => asin_list)
40
+ .structure!('ASINList', 'ASIN')
49
41
 
50
42
  run
51
43
  end
52
44
 
53
- # Lists products and their attributes, based on a list of ASIN values
45
+ # Lists products and their attributes, based on a list of ASIN, GCID,
46
+ # SellerSKU, UPC, EAN, ISBN, and JAN values
54
47
  #
55
- # @see http://docs.developer.amazonservices.com/en_US/products/Products_GetMatchingProductForId.html
56
- # @overload get_matching_product(*asins, opts = { marketplace_id:
57
- # primary_marketplace_id })
58
- # @param [String] asin one or more asins
59
- # @param [Hash] opts
60
- # @option opts [String] :marketplace_id
48
+ # @see https://docs.developer.amazonservices.com/en_US/products/Products_GetMatchingProduct.html
49
+ # @param [String] marketplace_id
50
+ # @param [String] id_type
51
+ # @param [Array<String>] id_list
61
52
  # @return [Peddler::XMLParser]
62
- def get_matching_product(*asin_list)
63
- opts = extract_options(asin_list)
64
-
65
- operation_with_marketplace('GetMatchingProduct')
66
- .add(opts.update('ASINList' => asin_list))
67
- .structure!('ASINList', 'ASIN')
53
+ def get_matching_product_for_id(marketplace_id, id_type, *id_list)
54
+ operation('GetMatchingProductForId')
55
+ .add('MarketplaceId' => marketplace_id, 'IdType' => id_type,
56
+ 'IdList' => id_list)
57
+ .structure!('IdList', 'Id')
68
58
 
69
59
  run
70
60
  end
71
61
 
72
62
  # Gets the current competitive price of a product, based on Seller SKU
73
63
  #
74
- # @see http://docs.developer.amazonservices.com/en_US/products/Products_GetCompetitivePricingForSKU.html
75
- # @overload get_competitive_pricing_for_sku(*seller_skus, opts = {
76
- # marketplace_id: primary_marketplace_id })
77
- # @param [String] seller_sku one or more seller_skus
78
- # @param [Hash] opts
79
- # @option opts [String] :marketplace_id
64
+ # @see https://docs.developer.amazonservices.com/en_US/products/Products_GetCompetitivePricingForSKU.html
65
+ # @param [String] marketplace_id
66
+ # @param [Array<String>] seller_sku_list
80
67
  # @return [Peddler::XMLParser]
81
- def get_competitive_pricing_for_sku(*seller_sku_list)
82
- opts = extract_options(seller_sku_list)
83
-
84
- operation_with_marketplace('GetCompetitivePricingForSKU')
85
- .add(opts.update('SellerSKUList' => seller_sku_list))
68
+ def get_competitive_pricing_for_sku(marketplace_id, *seller_sku_list)
69
+ operation('GetCompetitivePricingForSKU')
70
+ .add('MarketplaceId' => marketplace_id,
71
+ 'SellerSKUList' => seller_sku_list)
86
72
  .structure!('SellerSKUList', 'SellerSKU')
87
73
 
88
74
  run
@@ -90,18 +76,13 @@ module MWS
90
76
 
91
77
  # Gets the current competitive price of a product, identified by its ASIN
92
78
  #
93
- # @see http://docs.developer.amazonservices.com/en_US/products/Products_GetCompetitivePricingForASIN.html
94
- # @overload get_competitive_pricing_for_asin(*asins, opts = {
95
- # marketplace_id: primary_marketplace_id })
96
- # @param [String] asin one or more asins
97
- # @param [Hash] opts
98
- # @option opts [String] :marketplace_id
79
+ # @see https://docs.developer.amazonservices.com/en_US/products/Products_GetCompetitivePricingForASIN.html
80
+ # @param [String] marketplace_id
81
+ # @param [Array<String>] asin_list
99
82
  # @return [Peddler::XMLParser]
100
- def get_competitive_pricing_for_asin(*asin_list)
101
- opts = extract_options(asin_list)
102
-
103
- operation_with_marketplace('GetCompetitivePricingForASIN')
104
- .add(opts.update('ASINList' => asin_list))
83
+ def get_competitive_pricing_for_asin(marketplace_id, *asin_list)
84
+ operation('GetCompetitivePricingForASIN')
85
+ .add('MarketplaceId' => marketplace_id, 'ASINList' => asin_list)
105
86
  .structure!('ASINList', 'ASIN')
106
87
 
107
88
  run
@@ -110,20 +91,22 @@ module MWS
110
91
  # Gets pricing information for the lowest-price active offer listings for
111
92
  # a product, based on Seller SKU
112
93
  #
113
- # @see http://docs.developer.amazonservices.com/en_US/products/Products_GetLowestOfferListingsForSKU.html
114
- # @overload get_lowest_offer_listings_for_sku(*seller_skus, opts = {
115
- # marketplace_id: primary_marketplace_id })
116
- # @param [String] seller_sku one or more seller_skus
94
+ # @see https://docs.developer.amazonservices.com/en_US/products/Products_GetLowestOfferListingsForSKU.html
95
+ # @overload get_lowest_offer_listings_for_sku(marketplace_id, *seller_sku_list, opts = {})
96
+ # @param [String] marketplace_id
97
+ # @param [Array<String>] seller_sku_list
117
98
  # @param [Hash] opts
118
- # @option opts [String] :marketplace_id
119
99
  # @option opts [String] :item_condition
120
100
  # @option opts [Boolean] :exclude_me
121
101
  # @return [Peddler::XMLParser]
122
- def get_lowest_offer_listings_for_sku(*seller_sku_list)
102
+ def get_lowest_offer_listings_for_sku(marketplace_id, *seller_sku_list)
103
+ seller_sku_list = seller_sku_list.dup
123
104
  opts = extract_options(seller_sku_list)
124
105
 
125
- operation_with_marketplace('GetLowestOfferListingsForSKU')
126
- .add(opts.update('SellerSKUList' => seller_sku_list))
106
+ operation('GetLowestOfferListingsForSKU')
107
+ .add(opts)
108
+ .add('MarketplaceId' => marketplace_id,
109
+ 'SellerSKUList' => seller_sku_list)
127
110
  .structure!('SellerSKUList', 'SellerSKU')
128
111
 
129
112
  run
@@ -132,20 +115,21 @@ module MWS
132
115
  # Gets pricing information for the lowest-price active offer listings for
133
116
  # a product, identified by its ASIN
134
117
  #
135
- # @see http://docs.developer.amazonservices.com/en_US/products/Products_GetLowestOfferListingsForASIN.html
136
- # @overload get_lowest_offer_listings_for_asin(*asins, opts = {
137
- # marketplace_id: primary_marketplace_id })
138
- # @param [String] asin one or more asins
118
+ # @see https://docs.developer.amazonservices.com/en_US/products/Products_GetLowestOfferListingsForASIN.html
119
+ # @overload get_lowest_offers_listings_for_asin(marketplace_id, *asin_list, opts = {})
120
+ # @param [String] marketplace_id
121
+ # @param [Array<String>] asin_list
139
122
  # @param [Hash] opts
140
- # @option opts [String] :marketplace_id
141
123
  # @option opts [String] :item_condition
142
124
  # @option opts [Boolean] :exclude_me
143
125
  # @return [Peddler::XMLParser]
144
- def get_lowest_offer_listings_for_asin(*asin_list)
126
+ def get_lowest_offer_listings_for_asin(marketplace_id, *asin_list)
127
+ asin_list = asin_list.dup
145
128
  opts = extract_options(asin_list)
146
129
 
147
- operation_with_marketplace('GetLowestOfferListingsForASIN')
148
- .add(opts.update('ASINList' => asin_list))
130
+ operation('GetLowestOfferListingsForASIN')
131
+ .add(opts)
132
+ .add('MarketplaceId' => marketplace_id, 'ASINList' => asin_list)
149
133
  .structure!('ASINList', 'ASIN')
150
134
 
151
135
  run
@@ -153,52 +137,41 @@ module MWS
153
137
 
154
138
  # Gets lowest priced offers for a single product, based on SellerSKU
155
139
  #
156
- # @see http://docs.developer.amazonservices.com/en_MX/products/Products_GetLowestPricedOffersForSKU.html
157
- # @overload get_lowest_priced_offers_for_sku(seller_sku, item_condition,
158
- # opts = { marketplace_id: primary_marketplace_id })
159
- # @param [String] seller_sku
160
- # @param [String] item_condition
161
- # @param [Hash] opts
162
- # @option opts [String] :marketplace_id
140
+ # @see https://docs.developer.amazonservices.com/en_MX/products/Products_GetLowestPricedOffersForSKU.html
141
+ # @param [String] marketplace_id
142
+ # @param [String] seller_sku
143
+ # @param [String] item_condition
163
144
  # @return [Peddler::XMLParser]
164
- def get_lowest_priced_offers_for_sku(seller_sku, item_condition,
165
- opts = {})
166
- opts.update(
167
- 'SellerSKU' => seller_sku,
168
- 'ItemCondition' => item_condition
169
- )
170
- operation_with_marketplace('GetLowestPricedOffersForSKU')
171
- .add(opts)
145
+ def get_lowest_priced_offers_for_sku(marketplace_id, seller_sku,
146
+ item_condition)
147
+ operation('GetLowestPricedOffersForSKU')
148
+ .add('MarketplaceId' => marketplace_id, 'SellerSKU' => seller_sku,
149
+ 'ItemCondition' => item_condition)
172
150
 
173
151
  run
174
152
  end
175
153
 
176
154
  # Gets lowest priced offers for a single product, based on ASIN
177
155
  #
178
- # @see http://docs.developer.amazonservices.com/en_MX/products/Products_GetLowestPricedOffersForASIN.html
179
- # @overload get_lowest_priced_offers_for_asin(asin, item_condition, opts =
180
- # { marketplace_id: primary_marketplace_id })
181
- # @param [String] asin
182
- # @param [String] item_condition
183
- # @param [Hash] opts
184
- # @option opts [String] :marketplace_id
156
+ # @see https://docs.developer.amazonservices.com/en_MX/products/Products_GetLowestPricedOffersForASIN.html
157
+ # @param [String] marketplace_id
158
+ # @param [String] asin
159
+ # @param [String] item_condition
185
160
  # @return [Peddler::XMLParser]
186
- def get_lowest_priced_offers_for_asin(asin, item_condition, opts = {})
187
- opts.update(
188
- 'ASIN' => asin,
189
- 'ItemCondition' => item_condition
190
- )
191
- operation_with_marketplace('GetLowestPricedOffersForASIN')
192
- .add(opts)
161
+ def get_lowest_priced_offers_for_asin(marketplace_id, asin,
162
+ item_condition)
163
+ operation('GetLowestPricedOffersForASIN')
164
+ .add('MarketplaceId' => marketplace_id, 'ASIN' => asin,
165
+ 'ItemCondition' => item_condition)
193
166
 
194
167
  run
195
168
  end
196
169
 
197
170
  # Gets the estimated fees for a list of products.
198
171
  #
199
- # @see http://docs.developer.amazonservices.com/en_US/products/Products_GetMyFeesEstimate.html
200
- # @see http://docs.developer.amazonservices.com/en_US/products/Products_Datatypes.html#FeesEstimateRequest
201
- # @param [Hash] fees_estimate_request one or more fees estimate requests
172
+ # @see https://docs.developer.amazonservices.com/en_US/products/Products_GetMyFeesEstimate.html
173
+ # @see https://docs.developer.amazonservices.com/en_US/products/Products_Datatypes.html#FeesEstimateRequest
174
+ # @param [Array<Struct, Hash>] fees_estimate_requests
202
175
  # @return [Peddler::XMLParser]
203
176
  def get_my_fees_estimate(*fees_estimate_requests)
204
177
  operation('GetMyFeesEstimate')
@@ -211,19 +184,22 @@ module MWS
211
184
  # Gets pricing information for seller's own offer listings, based on
212
185
  # Seller SKU
213
186
  #
214
- # @see http://docs.developer.amazonservices.com/en_US/products/Products_GetMyPriceForSKU.html
215
- # @overload get_my_price_for_sku(*seller_skus, opts = { marketplace_id:
216
- # primary_marketplace_id })
217
- # @param [String] seller_sku one or more seller_skus
187
+ # @see https://docs.developer.amazonservices.com/en_US/products/Products_GetMyPriceForSKU.html
188
+ # @overload get_my_price_for_sku(marketplace_id, *seller_sku_list,
189
+ # opts = {})
190
+ # @param [String] marketplace_id
191
+ # @param [Array<String>] seller_sku_list
218
192
  # @param [Hash] opts
219
- # @option opts [String] :marketplace_id
220
193
  # @option opts [String] :item_condition
221
194
  # @return [Peddler::XMLParser]
222
- def get_my_price_for_sku(*seller_sku_list)
195
+ def get_my_price_for_sku(marketplace_id, *seller_sku_list)
196
+ seller_sku_list = seller_sku_list.dup
223
197
  opts = extract_options(seller_sku_list)
224
198
 
225
- operation_with_marketplace('GetMyPriceForSKU')
226
- .add(opts.update('SellerSKUList' => seller_sku_list))
199
+ operation('GetMyPriceForSKU')
200
+ .add(opts)
201
+ .add('MarketplaceId' => marketplace_id,
202
+ 'SellerSKUList' => seller_sku_list)
227
203
  .structure!('SellerSKUList', 'SellerSKU')
228
204
 
229
205
  run
@@ -232,72 +208,61 @@ module MWS
232
208
  # Gets pricing information for seller's own offer listings, identified by
233
209
  # its ASIN
234
210
  #
235
- # @see http://docs.developer.amazonservices.com/en_US/products/Products_GetMyPriceForASIN.html
236
- # @overload get_my_price_for_asin(*asins, opts = { marketplace_id:
237
- # primary_marketplace_id })
238
- # @param [String] asin one or more asins
211
+ # @see https://docs.developer.amazonservices.com/en_US/products/Products_GetMyPriceForASIN.html
212
+ # @overload get_my_price_for_asin(marketplace_id, *asin_list, opts = {})
213
+ # @param [String] marketplace_id
214
+ # @param [Array<String>] asin_list
239
215
  # @param [Hash] opts
240
- # @option opts [String] :marketplace_id
241
216
  # @option opts [String] :item_condition
242
217
  # @return [Peddler::XMLParser]
243
- def get_my_price_for_asin(*asin_list)
218
+ def get_my_price_for_asin(marketplace_id, *asin_list)
219
+ asin_list = asin_list.dup
244
220
  opts = extract_options(asin_list)
245
221
 
246
- operation_with_marketplace('GetMyPriceForASIN')
247
- .add(opts.update('ASINList' => asin_list))
222
+ operation('GetMyPriceForASIN')
223
+ .add(opts)
224
+ .add('MarketplaceId' => marketplace_id,
225
+ 'ASINList' => asin_list)
248
226
  .structure!('ASINList', 'ASIN')
249
227
 
250
228
  run
251
229
  end
252
230
 
253
231
  # Gets parent product categories that a product belongs to, based on
254
- # Seller`SKU
232
+ # Seller SKU
255
233
  #
256
- # @see http://docs.developer.amazonservices.com/en_US/products/Products_GetProductCategoriesForSKU.html
257
- # @overload get_product_categories_for_sku(sku, opts = { marketplace_id:
258
- # primary_marketplace_id })
259
- # @param [String] seller_sku
260
- # @param [Hash] opts
261
- # @option opts [String] :marketplace_id
234
+ # @see https://docs.developer.amazonservices.com/en_US/products/Products_GetProductCategoriesForSKU.html
235
+ # @param [String] marketplace_id
236
+ # @param [String] seller_sku
262
237
  # @return [Peddler::XMLParser]
263
- def get_product_categories_for_sku(seller_sku, opts = {})
264
- operation_with_marketplace('GetProductCategoriesForSKU')
265
- .add(opts.update('SellerSKU' => seller_sku))
238
+ def get_product_categories_for_sku(marketplace_id, seller_sku)
239
+ operation('GetProductCategoriesForSKU')
240
+ .add('MarketplaceId' => marketplace_id, 'SellerSKU' => seller_sku)
266
241
 
267
242
  run
268
243
  end
269
244
 
270
245
  # Gets parent product categories that a product belongs to, based on ASIN
271
246
  #
272
- # @see http://docs.developer.amazonservices.com/en_US/products/Products_GetProductCategoriesForASIN.html
273
- # @overload get_product_categories_for_asin(asin, opts = { marketplace_id:
274
- # primary_marketplace_id })
275
- # @param [String] asin
276
- # @param [Hash] opts
277
- # @option opts [String] :marketplace_id
247
+ # @see https://docs.developer.amazonservices.com/en_US/products/Products_GetProductCategoriesForASIN.html
248
+ # @param [String] marketplace_id
249
+ # @param [String] asin
278
250
  # @return [Peddler::XMLParser]
279
- def get_product_categories_for_asin(asin, opts = {})
280
- operation_with_marketplace('GetProductCategoriesForASIN')
281
- .add(opts.update('ASIN' => asin))
251
+ def get_product_categories_for_asin(marketplace_id, asin)
252
+ operation('GetProductCategoriesForASIN')
253
+ .add('MarketplaceId' => marketplace_id, 'ASIN' => asin)
282
254
 
283
255
  run
284
256
  end
285
257
 
286
258
  # Gets the service status of the API
287
259
  #
288
- # @see http://docs.developer.amazonservices.com/en_US/products/Products_GetServiceStatus.html
260
+ # @see https://docs.developer.amazonservices.com/en_US/products/Products_GetServiceStatus.html
289
261
  # @return [Peddler::XMLParser]
290
262
  def get_service_status
291
263
  operation('GetServiceStatus')
292
264
  run
293
265
  end
294
-
295
- # @api private
296
- def operation_with_marketplace(action)
297
- operation(action).tap do |opts|
298
- opts.store('MarketplaceId', primary_marketplace_id)
299
- end
300
- end
301
266
  end
302
267
  end
303
268
  end