peddler 0.10.0 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 07a989e34449ab73ff6adc3cd7299ac218394f9e
4
- data.tar.gz: cc04a47b2d89407875b67728a0067b84fa8e1e72
3
+ metadata.gz: 5d3d2f97e4921804281141fbef03ae8dbc4f8211
4
+ data.tar.gz: 273371a4e4156f588578468a2f363e0e3311dd24
5
5
  SHA512:
6
- metadata.gz: 631af106e16507f94106ac30855787fc8b4dba465859863ee7fe5d057aef1ba8273aaefe8c34e985884d4ad14ce1332fad7730a19166e763072b7941a15f9cbd
7
- data.tar.gz: b6db581788899e2da6f3aa24f16d9aa7a085eefc09d90ea38cbddb852f3aa8475bbd85104ac1d682d311a77a6a266ebdd7037e35c5307c130573e94b6db98b83
6
+ metadata.gz: 9f297c76d67a21b08eb4e0977c2a14e9592adae4f65521e00d9d892deb6da11fca5d881fc4ab8855eca0442843a7bbf137850339e1fe3d83ce1f4252a3749533
7
+ data.tar.gz: cbe9393121495054938b834bc9e83c1fbed9992b70e471ecdfcd67dd47c3a2d10e8653fcd40116bf975c26677086f542f41fe658a421de48d7e2468d014140d4
data/README.md CHANGED
@@ -21,16 +21,6 @@ parser = client.get_service_status
21
21
  parser.parse
22
22
  ```
23
23
 
24
- You can handle HTTP client errors by rescuing API calls individually or defining a global handler on the client level:
25
-
26
- ```ruby
27
- client.on_error do |request, response|
28
- if response.status == 503
29
- # handle throttling by backing off and retrying
30
- end
31
- end
32
- ```
33
-
34
24
  ## Credentials
35
25
 
36
26
  You can set up credentials when instantiating:
@@ -140,3 +130,9 @@ The Sellers API lets sellers retrieve information about their seller account, su
140
130
  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.
141
131
 
142
132
  [Read the API](http://www.rubydoc.info/gems/peddler/MWS/Subscriptions/Client)
133
+
134
+ ### Webstore
135
+
136
+ With the Webstore API section of Amazon Marketplace Web Service (Amazon MWS), you can get “Email Me When Available” subscription information for items listed on your Amazon Webstore. The Webstore API section can help you plan your inventory replenishment cycle by enabling you to query for items that your customers subscribed to when they clicked the Email Me When Available button on your Webstore. The Webstore API section can also return information about the notifications that were sent to your customers when out-of-stock items came back in stock. This information, when combined with sales information that your Webstore tracks, can help you determine how many notifications were converted into sales.
137
+
138
+ [Read the API](http://www.rubydoc.info/gems/peddler/MWS/Webstore/Client)
@@ -28,7 +28,7 @@ module MWS
28
28
  # @return [Peddler::XMLParser]
29
29
  def list_carts(date_range_start, opts = {})
30
30
  operation('ListCarts')
31
- .add(opts.merge('DateRangeStart' => date_range_start))
31
+ .add(opts.update('DateRangeStart' => date_range_start))
32
32
 
33
33
  run
34
34
  end
@@ -60,7 +60,7 @@ module MWS
60
60
  def get_customers_for_customer_id(*customer_id_list)
61
61
  opts = extract_options(customer_id_list)
62
62
  operation('GetCustomersForCustomerId')
63
- .add(opts.merge('CustomerIdList' => customer_id_list))
63
+ .add(opts.update('CustomerIdList' => customer_id_list))
64
64
  .structure!('CustomerIdList', 'CustomerId')
65
65
 
66
66
  run
@@ -19,7 +19,7 @@ module MWS
19
19
  def submit_feed(feed_content, feed_type, opts = {})
20
20
  self.body = feed_content
21
21
  operation('SubmitFeed')
22
- .add(opts.merge('FeedType' => feed_type))
22
+ .add(opts.update('FeedType' => feed_type))
23
23
  .structure!('MarketplaceId', 'Id')
24
24
 
25
25
  run
@@ -19,12 +19,10 @@ module MWS
19
19
  # @return [Peddler::XMLParser]
20
20
  def create_inbound_shipment_plan(ship_from_address, inbound_shipment_plan_request_items, opts = {})
21
21
  operation('CreateInboundShipmentPlan')
22
- .add(
23
- opts.merge(
24
- 'ShipFromAddress' => ship_from_address,
25
- 'InboundShipmentPlanRequestItems' => inbound_shipment_plan_request_items
26
- )
27
- )
22
+ .add(opts.update(
23
+ 'ShipFromAddress' => ship_from_address,
24
+ 'InboundShipmentPlanRequestItems' => inbound_shipment_plan_request_items
25
+ ))
28
26
  .structure!('InboundShipmentPlanRequestItems', 'member')
29
27
 
30
28
  run
@@ -40,12 +38,10 @@ module MWS
40
38
  # @return [Peddler::XMLParser]
41
39
  def create_inbound_shipment(shipment_id, inbound_shipment_header, opts = {})
42
40
  operation('CreateInboundShipment')
43
- .add(
44
- opts.merge(
45
- 'ShipmentId' => shipment_id,
46
- 'InboundShipmentHeader' => inbound_shipment_header
47
- )
48
- )
41
+ .add(opts.update(
42
+ 'ShipmentId' => shipment_id,
43
+ 'InboundShipmentHeader' => inbound_shipment_header
44
+ ))
49
45
  .structure!('InboundShipmentItems', 'member')
50
46
 
51
47
  run
@@ -61,12 +57,10 @@ module MWS
61
57
  # @return [Peddler::XMLParser]
62
58
  def update_inbound_shipment(shipment_id, inbound_shipment_header, opts = {})
63
59
  operation('UpdateInboundShipment')
64
- .add(
65
- opts.merge(
66
- 'ShipmentId' => shipment_id,
67
- 'InboundShipmentHeader' => inbound_shipment_header
68
- )
69
- )
60
+ .add(opts.update(
61
+ 'ShipmentId' => shipment_id,
62
+ 'InboundShipmentHeader' => inbound_shipment_header
63
+ ))
70
64
  .structure!('InboundShipmentItems', 'member')
71
65
 
72
66
  run
@@ -145,7 +139,7 @@ module MWS
145
139
  # @return [Peddler::XMLParser]
146
140
  def get_package_labels(shipment_id, page_type, opts = {})
147
141
  operation('GetPackageLabels')
148
- .add(opts.merge(
142
+ .add(opts.update(
149
143
  'ShipmentId' => shipment_id,
150
144
  'PageType' => page_type
151
145
  ))
@@ -15,7 +15,7 @@ module MWS
15
15
  #
16
16
  # @see http://docs.developer.amazonservices.com/en_US/fba_inventory/FBAInventory_ListInventorySupply.html
17
17
  # @param opts [Hash]
18
- # @option opts [Array<String>, String] :seller_skus
18
+ # @option opts [Array<String>, String] :seller_sku_list
19
19
  # @option opts [String, #iso8601] :query_start_date_time
20
20
  # @option opts [String] :response_group
21
21
  # @return [Peddler::XMLParser]
@@ -30,7 +30,7 @@ module MWS
30
30
  end
31
31
 
32
32
  operation('GetFulfillmentPreview')
33
- .add(opts.merge('Address' => address, 'Items' => items))
33
+ .add(opts.update('Address' => address, 'Items' => items))
34
34
  .structure!('Items', 'member')
35
35
  .structure!('ShippingSpeedCategories')
36
36
 
@@ -95,7 +95,7 @@ module MWS
95
95
  # @return [Peddler::XMLParser]
96
96
  def update_fulfillment_order(seller_fulfillment_order_id, opts = {})
97
97
  operation('UpdateFulfillmentOrder')
98
- .add(opts.merge('SellerFulfillmentOrderId' => seller_fulfillment_order_id))
98
+ .add(opts.update('SellerFulfillmentOrderId' => seller_fulfillment_order_id))
99
99
  .structure!('NotificationEmailList', 'member')
100
100
  .structure!('Items', 'member')
101
101
 
@@ -36,7 +36,7 @@ module MWS
36
36
  # @return [Peddler::XMLParser]
37
37
  def create_order_reference_for_id(id, id_type, opts = {})
38
38
  operation('CreateOrderReferenceForId')
39
- .add(opts.merge(
39
+ .add(opts.update(
40
40
  'Id' => id,
41
41
  'IdType' => id_type
42
42
  ))
@@ -53,7 +53,7 @@ module MWS
53
53
  # @return [Peddler::XMLParser]
54
54
  def get_billing_agreement_details(amazon_billing_agreement_id, opts = {})
55
55
  operation('GetBillingAgreementDetails')
56
- .add(opts.merge(
56
+ .add(opts.update(
57
57
  'AmazonBillingAgreementId' => amazon_billing_agreement_id
58
58
  ))
59
59
 
@@ -126,7 +126,7 @@ module MWS
126
126
  # @return [Peddler::XMLParser]
127
127
  def authorize_on_billing_agreement(amazon_billing_agreement_id, authorization_reference_id, authorization_amount, opts = {})
128
128
  operation('AuthorizeOnBillingAgreement')
129
- .add(opts.merge(
129
+ .add(opts.update(
130
130
  'AmazonBillingAgreementId' => amazon_billing_agreement_id,
131
131
  'AuthorizationReferenceId' => authorization_reference_id,
132
132
  'AuthorizationAmount' => authorization_amount
@@ -146,7 +146,7 @@ module MWS
146
146
  # @return [Peddler::XMLParser]
147
147
  def close_billing_agreement(amazon_billing_agreement_id, opts = {})
148
148
  operation('CloseBillingAgreement')
149
- .add(opts.merge(
149
+ .add(opts.update(
150
150
  'AmazonBillingAgreementId' => amazon_billing_agreement_id
151
151
  ))
152
152
 
@@ -168,7 +168,7 @@ module MWS
168
168
  operation('SetOrderReferenceDetails')
169
169
  .add(
170
170
  'AmazonOrderReferenceId' => amazon_order_reference_id,
171
- 'OrderReferenceAttributes' => opts.merge('OrderTotal' => order_total)
171
+ 'OrderReferenceAttributes' => opts.update('OrderTotal' => order_total)
172
172
  )
173
173
 
174
174
  run
@@ -183,7 +183,7 @@ module MWS
183
183
  # @return [Peddler::XMLParser]
184
184
  def get_order_reference_details(amazon_order_reference_id, opts = {})
185
185
  operation('GetOrderReferenceDetails')
186
- .add(opts.merge('AmazonOrderReferenceId' => amazon_order_reference_id))
186
+ .add(opts.update('AmazonOrderReferenceId' => amazon_order_reference_id))
187
187
 
188
188
  run
189
189
  end
@@ -210,7 +210,7 @@ module MWS
210
210
  # @return [Peddler::XMLParser]
211
211
  def cancel_order_reference(amazon_order_reference_id, opts = {})
212
212
  operation('CancelOrderReference')
213
- .add(opts.merge('AmazonOrderReferenceId' => amazon_order_reference_id))
213
+ .add(opts.update('AmazonOrderReferenceId' => amazon_order_reference_id))
214
214
 
215
215
  run
216
216
  end
@@ -226,7 +226,7 @@ module MWS
226
226
  # @return [Peddler::XMLParser]
227
227
  def close_order_reference(amazon_order_reference_id, opts = {})
228
228
  operation('CloseOrderReference')
229
- .add(opts.merge('AmazonOrderReferenceId' => amazon_order_reference_id))
229
+ .add(opts.update('AmazonOrderReferenceId' => amazon_order_reference_id))
230
230
 
231
231
  run
232
232
  end
@@ -246,7 +246,7 @@ module MWS
246
246
  # @return [Peddler::XMLParser]
247
247
  def authorize(amazon_order_reference_id, authorization_reference_id, authorization_amount, opts = {})
248
248
  operation('Authorize')
249
- .add(opts.merge(
249
+ .add(opts.update(
250
250
  'AmazonOrderReferenceId' => amazon_order_reference_id,
251
251
  'AuthorizationReferenceId' => authorization_reference_id,
252
252
  'AuthorizationAmount' => authorization_amount
@@ -280,7 +280,7 @@ module MWS
280
280
  # @return [Peddler::XMLParser]
281
281
  def capture(amazon_authorization_id, capture_reference_id, capture_amount, opts = {})
282
282
  operation('Capture')
283
- .add(opts.merge(
283
+ .add(opts.update(
284
284
  'AmazonAuthorizationId' => amazon_authorization_id,
285
285
  'CaptureReferenceId' => capture_reference_id,
286
286
  'CaptureAmount' => capture_amount
@@ -311,7 +311,7 @@ module MWS
311
311
  # @return [Peddler::XMLParser]
312
312
  def close_authorization(amazon_authorization_id, opts = {})
313
313
  operation('CloseAuthorization')
314
- .add(opts.merge('AmazonAuthorizationId' => amazon_authorization_id))
314
+ .add(opts.update('AmazonAuthorizationId' => amazon_authorization_id))
315
315
 
316
316
  run
317
317
  end
@@ -328,7 +328,7 @@ module MWS
328
328
  # @return [Peddler::XMLParser]
329
329
  def refund(amazon_capture_id, refund_reference_id, refund_amount, opts = {})
330
330
  operation('Refund')
331
- .add(opts.merge(
331
+ .add(opts.update(
332
332
  'AmazonCaptureId' => amazon_capture_id,
333
333
  'RefundReferenceId' => refund_reference_id,
334
334
  'RefundAmount' => refund_amount
@@ -19,8 +19,8 @@ module MWS
19
19
  # @option opts [String] :query_context_id
20
20
  # @return [Peddler::XMLParser]
21
21
  def list_matching_products(query, opts = {})
22
- operation('ListMatchingProducts')
23
- .add(opts.merge('Query' => query))
22
+ operation_with_marketplace('ListMatchingProducts')
23
+ .add(opts.update('Query' => query))
24
24
 
25
25
  run
26
26
  end
@@ -38,8 +38,8 @@ module MWS
38
38
  def get_matching_product_for_id(id_type, *id_list)
39
39
  opts = extract_options(id_list)
40
40
 
41
- operation('GetMatchingProductForId')
42
- .add(opts.merge('IdType' => id_type, 'IdList' => id_list))
41
+ operation_with_marketplace('GetMatchingProductForId')
42
+ .add(opts.update('IdType' => id_type, 'IdList' => id_list))
43
43
  .structure!('IdList', 'Id')
44
44
 
45
45
  run
@@ -48,16 +48,16 @@ module MWS
48
48
  # Lists products and their attributes, based on a list of ASIN values
49
49
  #
50
50
  # @see http://docs.developer.amazonservices.com/en_US/products/Products_GetMatchingProductForId.html
51
- # @overload get_matching_product(*asins, opts = { marketplace_id: marketplace_id })
52
- # @param asins [Array<String>]
51
+ # @overload get_matching_product(*asin_list, opts = { marketplace_id: marketplace_id })
52
+ # @param asin_list [Array<String>]
53
53
  # @param opts [Hash]
54
54
  # @option opts [String] :marketplace_id
55
55
  # @return [Peddler::XMLParser]
56
- def get_matching_product(*asins)
57
- opts = extract_options(asins)
56
+ def get_matching_product(*asin_list)
57
+ opts = extract_options(asin_list)
58
58
 
59
- operation('GetMatchingProduct')
60
- .add(opts.merge('ASINList' => asins))
59
+ operation_with_marketplace('GetMatchingProduct')
60
+ .add(opts.update('ASINList' => asin_list))
61
61
  .structure!('ASINList', 'ASIN')
62
62
 
63
63
  run
@@ -66,16 +66,16 @@ module MWS
66
66
  # Gets the current competitive price of a product, based on Seller SKU
67
67
  #
68
68
  # @see http://docs.developer.amazonservices.com/en_US/products/Products_GetCompetitivePricingForSKU.html
69
- # @overload get_competitive_pricing_for_sku(*skus, opts = { marketplace_id: marketplace_id })
70
- # @param skus [Array<String>]
69
+ # @overload get_competitive_pricing_for_sku(*seller_sku_list, opts = { marketplace_id: marketplace_id })
70
+ # @param seller_sku_list [Array<String>]
71
71
  # @param opts [Hash]
72
72
  # @option opts [String] :marketplace_id
73
73
  # @return [Peddler::XMLParser]
74
- def get_competitive_pricing_for_sku(*skus)
75
- opts = extract_options(skus)
74
+ def get_competitive_pricing_for_sku(*seller_sku_list)
75
+ opts = extract_options(seller_sku_list)
76
76
 
77
- operation('GetCompetitivePricingForSKU')
78
- .add(opts.merge('SellerSKUList' => skus))
77
+ operation_with_marketplace('GetCompetitivePricingForSKU')
78
+ .add(opts.update('SellerSKUList' => seller_sku_list))
79
79
  .structure!('SellerSKUList', 'SellerSKU')
80
80
 
81
81
  run
@@ -84,16 +84,16 @@ module MWS
84
84
  # Gets the current competitive price of a product, identified by its ASIN
85
85
  #
86
86
  # @see http://docs.developer.amazonservices.com/en_US/products/Products_GetCompetitivePricingForASIN.html
87
- # @overload get_competitive_pricing_for_asin(*asins, opts = { marketplace_id: marketplace_id })
88
- # @param asins [Array<String>]
87
+ # @overload get_competitive_pricing_for_asin(*asin_list, opts = { marketplace_id: marketplace_id })
88
+ # @param asin_list [Array<String>]
89
89
  # @param opts [Hash]
90
90
  # @option opts [String] :marketplace_id
91
91
  # @return [Peddler::XMLParser]
92
- def get_competitive_pricing_for_asin(*asins)
93
- opts = extract_options(asins)
92
+ def get_competitive_pricing_for_asin(*asin_list)
93
+ opts = extract_options(asin_list)
94
94
 
95
- operation('GetCompetitivePricingForASIN')
96
- .add(opts.merge('ASINList' => asins))
95
+ operation_with_marketplace('GetCompetitivePricingForASIN')
96
+ .add(opts.update('ASINList' => asin_list))
97
97
  .structure!('ASINList', 'ASIN')
98
98
 
99
99
  run
@@ -103,18 +103,18 @@ module MWS
103
103
  # a product, based on Seller SKU
104
104
  #
105
105
  # @see http://docs.developer.amazonservices.com/en_US/products/Products_GetLowestOfferListingsForSKU.html
106
- # @overload get_lowest_offer_listings_for_sku(*skus, opts = { marketplace_id: marketplace_id })
107
- # @param skus [Array<String>]
106
+ # @overload get_lowest_offer_listings_for_sku(*seller_sku_list, opts = { marketplace_id: marketplace_id })
107
+ # @param seller_sku_list [Array<String>]
108
108
  # @param opts [Hash]
109
109
  # @option opts [String] :marketplace_id
110
110
  # @option opts [String] :item_condition
111
111
  # @option opts [Boolean] :exclude_me
112
112
  # @return [Peddler::XMLParser]
113
- def get_lowest_offer_listings_for_sku(*skus)
114
- opts = extract_options(skus)
113
+ def get_lowest_offer_listings_for_sku(*seller_sku_list)
114
+ opts = extract_options(seller_sku_list)
115
115
 
116
- operation('GetLowestOfferListingsForSKU')
117
- .add(opts.merge('SellerSKUList' => skus))
116
+ operation_with_marketplace('GetLowestOfferListingsForSKU')
117
+ .add(opts.update('SellerSKUList' => seller_sku_list))
118
118
  .structure!('SellerSKUList', 'SellerSKU')
119
119
 
120
120
  run
@@ -124,18 +124,18 @@ module MWS
124
124
  # a product, identified by its ASIN
125
125
  #
126
126
  # @see http://docs.developer.amazonservices.com/en_US/products/Products_GetLowestOfferListingsForASIN.html
127
- # @overload get_lowest_offer_listings_for_asin(*asins, opts = { marketplace_id: marketplace_id })
128
- # @param asins [Array<String>]
127
+ # @overload get_lowest_offer_listings_for_asin(*asin_list, opts = { marketplace_id: marketplace_id })
128
+ # @param asin_list [Array<String>]
129
129
  # @param opts [Hash]
130
130
  # @option opts [String] :marketplace_id
131
131
  # @option opts [String] :item_condition
132
132
  # @option opts [Boolean] :exclude_me
133
133
  # @return [Peddler::XMLParser]
134
- def get_lowest_offer_listings_for_asin(*asins)
135
- opts = extract_options(asins)
134
+ def get_lowest_offer_listings_for_asin(*asin_list)
135
+ opts = extract_options(asin_list)
136
136
 
137
- operation('GetLowestOfferListingsForASIN')
138
- .add(opts.merge('ASINList' => asins))
137
+ operation_with_marketplace('GetLowestOfferListingsForASIN')
138
+ .add(opts.update('ASINList' => asin_list))
139
139
  .structure!('ASINList', 'ASIN')
140
140
 
141
141
  run
@@ -145,17 +145,17 @@ module MWS
145
145
  # Seller SKU
146
146
  #
147
147
  # @see http://docs.developer.amazonservices.com/en_US/products/Products_GetMyPriceForSKU.html
148
- # @overload get_my_price_for_sku(*skus, opts = { marketplace_id: marketplace_id })
149
- # @param skus [Array<String>]
148
+ # @overload get_my_price_for_sku(*seller_sku_list, opts = { marketplace_id: marketplace_id })
149
+ # @param seller_sku_list [Array<String>]
150
150
  # @param opts [Hash]
151
151
  # @option opts [String] :marketplace_id
152
152
  # @option opts [String] :item_condition
153
153
  # @return [Peddler::XMLParser]
154
- def get_my_price_for_sku(*skus)
155
- opts = extract_options(skus)
154
+ def get_my_price_for_sku(*seller_sku_list)
155
+ opts = extract_options(seller_sku_list)
156
156
 
157
- operation('GetMyPriceForSKU')
158
- .add(opts.merge('SellerSKUList' => skus))
157
+ operation_with_marketplace('GetMyPriceForSKU')
158
+ .add(opts.update('SellerSKUList' => seller_sku_list))
159
159
  .structure!('SellerSKUList', 'SellerSKU')
160
160
 
161
161
  run
@@ -165,17 +165,17 @@ module MWS
165
165
  # its ASIN
166
166
  #
167
167
  # @see http://docs.developer.amazonservices.com/en_US/products/Products_GetMyPriceForASIN.html
168
- # @overload get_my_price_for_asin(*skus, opts = { marketplace_id: marketplace_id })
169
- # @param asins [Array<String>]
168
+ # @overload get_my_price_for_asin(*seller_sku_list, opts = { marketplace_id: marketplace_id })
169
+ # @param asin_list [Array<String>]
170
170
  # @param opts [Hash]
171
171
  # @option opts [String] :marketplace_id
172
172
  # @option opts [String] :item_condition
173
173
  # @return [Peddler::XMLParser]
174
- def get_my_price_for_asin(*asins)
175
- opts = extract_options(asins)
174
+ def get_my_price_for_asin(*asin_list)
175
+ opts = extract_options(asin_list)
176
176
 
177
- operation('GetMyPriceForASIN')
178
- .add(opts.merge('ASINList' => asins))
177
+ operation_with_marketplace('GetMyPriceForASIN')
178
+ .add(opts.update('ASINList' => asin_list))
179
179
  .structure!('ASINList', 'ASIN')
180
180
 
181
181
  run
@@ -186,13 +186,13 @@ module MWS
186
186
  #
187
187
  # @see http://docs.developer.amazonservices.com/en_US/products/Products_GetProductCategoriesForSKU.html
188
188
  # @overload get_product_categories_for_sku(sku, opts = { marketplace_id: marketplace_id })
189
- # @param sku [String]
189
+ # @param seller_sku [String]
190
190
  # @param opts [Hash]
191
191
  # @option opts [String] :marketplace_id
192
192
  # @return [Peddler::XMLParser]
193
- def get_product_categories_for_sku(sku, opts = {})
194
- operation('GetProductCategoriesForSKU')
195
- .add(opts.merge('SellerSKU' => sku))
193
+ def get_product_categories_for_sku(seller_sku, opts = {})
194
+ operation_with_marketplace('GetProductCategoriesForSKU')
195
+ .add(opts.update('SellerSKU' => seller_sku))
196
196
 
197
197
  run
198
198
  end
@@ -206,8 +206,8 @@ module MWS
206
206
  # @option opts [String] :marketplace_id
207
207
  # @return [Peddler::XMLParser]
208
208
  def get_product_categories_for_asin(asin, opts = {})
209
- operation('GetProductCategoriesForASIN')
210
- .add(opts.merge('ASIN' => asin))
209
+ operation_with_marketplace('GetProductCategoriesForASIN')
210
+ .add(opts.update('ASIN' => asin))
211
211
 
212
212
  run
213
213
  end
@@ -222,8 +222,8 @@ module MWS
222
222
  end
223
223
 
224
224
  # @api private
225
- def operation(*)
226
- super.tap do |opts|
225
+ def operation_with_marketplace(*args)
226
+ operation(*args).tap do |opts|
227
227
  unless opts.key?('MarketplaceId')
228
228
  opts.store('MarketplaceId', marketplace_id)
229
229
  end
@@ -16,7 +16,7 @@ module MWS
16
16
  # @return [Peddler::XMLParser]
17
17
  def request_report(report_type, opts = {})
18
18
  operation('RequestReport')
19
- .add(opts.merge('ReportType' => report_type))
19
+ .add(opts.update('ReportType' => report_type))
20
20
  .structure!('MarketplaceIdList', 'Id')
21
21
 
22
22
  run
@@ -163,7 +163,7 @@ module MWS
163
163
  # @return [Peddler::XMLParser]
164
164
  def manage_report_schedule(report_type, schedule, opts = {})
165
165
  operation('ManageReportSchedule')
166
- .add(opts.merge('ReportType' => report_type, 'Schedule' => schedule))
166
+ .add(opts.update('ReportType' => report_type, 'Schedule' => schedule))
167
167
 
168
168
  run
169
169
  end
@@ -0,0 +1,88 @@
1
+ require 'peddler/client'
2
+
3
+ module MWS
4
+ module Webstore
5
+ # With the Webstore API section of Amazon MWS, you can get “Email Me When
6
+ # Available” subscription information for items listed on your Amazon
7
+ # Webstore. The Webstore API section can help you plan your inventory
8
+ # replenishment cycle by enabling you to query for items that your customers
9
+ # subscribed to when they clicked the Email Me When Available button on your
10
+ # Webstore. The Webstore API section can also return information about the
11
+ # notifications that were sent to your customers when out-of-stock items
12
+ # came back in stock. This information, when combined with sales information
13
+ # that your Webstore tracks, can help you determine how many notifications
14
+ # were converted into sales.
15
+ class Client < ::Peddler::Client
16
+ path '/Webstore/2014-09-01/'
17
+
18
+ # Lists subscription counts of subscriptions in a specified state,
19
+ # including the items that are subscribed to
20
+ #
21
+ # @see http://docs.developer.amazonservices.com/en_US/webstore/Webstore_ListSubscriptionsCount.html
22
+ # @overload list_subscriptions_count(subscription_state, opts = { marketplace_id: marketplace_id })
23
+ # @param subscription_state [String]
24
+ # @param opts [Hash]
25
+ # @option opts [String] :marketplace_id
26
+ # @option opts [String, #iso8601] :date_range_start
27
+ # @option opts [String, #iso8601] :date_range_end
28
+ # @option opts [Array<String>] :seller_sku_list
29
+ # @return [Peddler::XMLParser]
30
+ def list_subscriptions_count(subscription_state, opts = {})
31
+ opts[:marketplace_id] ||= marketplace_id
32
+ if opts.key?(:seller_sku_list)
33
+ opts['SellerSKUList'] = opts.delete(:seller_sku_list)
34
+ end
35
+ operation('ListSubscriptionsCount')
36
+ .add(opts.update('SubscriptionState' => subscription_state))
37
+ .structure!('SellerSKUList', 'SellerSKU')
38
+
39
+ run
40
+ end
41
+
42
+ # Lists the next page of subscription counts
43
+ #
44
+ # @see http://docs.developer.amazonservices.com/en_US/webstore/Webstore_ListSubscriptionsCountByNextToken.html
45
+ # @param next_token [String]
46
+ # @return [Peddler::XMLParser]
47
+ def list_subscriptions_count_by_next_token(next_token)
48
+ operation('ListSubscriptionsCountByNextToken')
49
+ .add('NextToken' => next_token)
50
+
51
+ run
52
+ end
53
+
54
+ # Gets the number of subscriptions that were created or notifications that
55
+ # were sent for an item within a date range
56
+ #
57
+ # @see http://docs.developer.amazonservices.com/en_US/webstore/Webstore_ListSubscriptionsCount.html
58
+ # @overload get_subscription_details(seller_sku, subscription_state, date_range_start, opts = { marketplace_id: marketplace_id })
59
+ # @param seller_sku [String]
60
+ # @param subscription_state [String]
61
+ # @param date_range_start [String, #iso8601]
62
+ # @param opts [Hash]
63
+ # @option opts [String] :marketplace_id
64
+ # @option opts [String, #iso8601] :date_range_end
65
+ # @return [Peddler::XMLParser]
66
+ def get_subscription_details(seller_sku, subscription_state, date_range_start, opts = {})
67
+ opts[:marketplace_id] ||= marketplace_id
68
+ operation('GetSubscriptionDetails')
69
+ .add(opts.update(
70
+ 'SellerSKU' => seller_sku,
71
+ 'SubscriptionState' => subscription_state,
72
+ 'DateRangeStart' => date_range_start
73
+ ))
74
+
75
+ run
76
+ end
77
+
78
+ # Gets the service status of the API
79
+ #
80
+ # @see http://docs.developer.amazonservices.com/en_US/webstore/MWS_GetServiceStatus.html
81
+ # @return [Peddler::XMLParser]
82
+ def get_service_status
83
+ operation('GetServiceStatus')
84
+ run
85
+ end
86
+ end
87
+ end
88
+ end
@@ -0,0 +1 @@
1
+ require 'mws/webstore/client'
data/lib/mws.rb CHANGED
@@ -12,6 +12,7 @@ require 'mws/recommendations'
12
12
  require 'mws/reports'
13
13
  require 'mws/sellers'
14
14
  require 'mws/subscriptions'
15
+ require 'mws/webstore'
15
16
 
16
17
  module MWS
17
18
  class << self
@@ -1,3 +1,3 @@
1
1
  module Peddler
2
- VERSION = '0.10.0'
2
+ VERSION = '0.11.0'
3
3
  end
@@ -0,0 +1,18 @@
1
+ require 'integration_test_helper'
2
+ require 'mws/webstore'
3
+
4
+ class TestWebstore < IntegrationTest
5
+ def test_lists_subscriptions_counts
6
+ clients.each do |client|
7
+ res = client.list_subscriptions_count('Subscribed')
8
+ refute_empty res.parse
9
+ end
10
+ end
11
+
12
+ def test_gets_service_status
13
+ clients.each do |client|
14
+ res = client.get_service_status
15
+ refute_empty res.parse
16
+ end
17
+ end
18
+ end
@@ -4,6 +4,6 @@ require 'mws/products/client'
4
4
  class TestProductsClient < MiniTest::Test
5
5
  def test_operation_includes_marketplace_id
6
6
  client = MWS::Products::Client.new
7
- assert client.operation('Foo').has_key?('MarketplaceId')
7
+ assert client.operation_with_marketplace('Foo').has_key?('MarketplaceId')
8
8
  end
9
9
  end