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
@@ -0,0 +1,234 @@
1
+ require 'peddler/client'
2
+
3
+ module MWS
4
+ module Products
5
+ # The MWS Products API helps you get information to match your products to
6
+ # existing product listings on Amazon Marketplace websites and to make
7
+ # sourcing and pricing decisions for listing those products on Amazon
8
+ # Marketplace websites.
9
+ class Client < ::Peddler::Client
10
+ path '/Products/2011-10-01'
11
+
12
+ # Lists products and their attributes, based on a search query
13
+ #
14
+ # @see http://docs.developer.amazonservices.com/en_US/products/Products_ListMatchingProducts.html
15
+ # @overload list_matching_products(query, opts = { marketplace_id: marketplace_id })
16
+ # @param query [String]
17
+ # @param opts [Hash]
18
+ # @option opts [String] :marketplace_id
19
+ # @option opts [String] :query_context_id
20
+ # @return [Peddler::XMLParser]
21
+ def list_matching_products(query, opts = {})
22
+ operation('ListMatchingProducts')
23
+ .add(opts.merge('Query' => query))
24
+
25
+ run
26
+ end
27
+
28
+ # Lists products and their attributes, based on a list of ASIN, GCID,
29
+ # SellerSKU, UPC, EAN, ISBN, and JAN values
30
+ #
31
+ # @see http://docs.developer.amazonservices.com/en_US/products/Products_GetMatchingProduct.html
32
+ # @overload get_matching_product_for_id(id_type, *id_list, opts = { marketplace_id: marketplace_id })
33
+ # @param id_type [String]
34
+ # @param id_list [Array<String>]
35
+ # @param opts [Hash]
36
+ # @option opts [String] :marketplace_id
37
+ # @return [Peddler::XMLParser]
38
+ def get_matching_product_for_id(id_type, *id_list)
39
+ opts = extract_options(id_list)
40
+
41
+ operation('GetMatchingProductForId')
42
+ .add(opts.merge('IdType' => id_type, 'IdList' => id_list))
43
+ .structure!('IdList', 'Id')
44
+
45
+ run
46
+ end
47
+
48
+ # Lists products and their attributes, based on a list of ASIN values
49
+ #
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>]
53
+ # @param opts [Hash]
54
+ # @option opts [String] :marketplace_id
55
+ # @return [Peddler::XMLParser]
56
+ def get_matching_product(*asins)
57
+ opts = extract_options(asins)
58
+
59
+ operation('GetMatchingProduct')
60
+ .add(opts.merge('ASINList' => asins))
61
+ .structure!('ASINList', 'ASIN')
62
+
63
+ run
64
+ end
65
+
66
+ # Gets the current competitive price of a product, based on Seller SKU
67
+ #
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>]
71
+ # @param opts [Hash]
72
+ # @option opts [String] :marketplace_id
73
+ # @return [Peddler::XMLParser]
74
+ def get_competitive_pricing_for_sku(*skus)
75
+ opts = extract_options(skus)
76
+
77
+ operation('GetCompetitivePricingForSKU')
78
+ .add(opts.merge('SellerSKUList' => skus))
79
+ .structure!('SellerSKUList', 'SellerSKU')
80
+
81
+ run
82
+ end
83
+
84
+ # Gets the current competitive price of a product, identified by its ASIN
85
+ #
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>]
89
+ # @param opts [Hash]
90
+ # @option opts [String] :marketplace_id
91
+ # @return [Peddler::XMLParser]
92
+ def get_competitive_pricing_for_asin(*asins)
93
+ opts = extract_options(asins)
94
+
95
+ operation('GetCompetitivePricingForASIN')
96
+ .add(opts.merge('ASINList' => asins))
97
+ .structure!('ASINList', 'ASIN')
98
+
99
+ run
100
+ end
101
+
102
+ # Gets pricing information for the lowest-price active offer listings for
103
+ # a product, based on Seller SKU
104
+ #
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>]
108
+ # @param opts [Hash]
109
+ # @option opts [String] :marketplace_id
110
+ # @option opts [String] :item_condition
111
+ # @option opts [Boolean] :exclude_me
112
+ # @return [Peddler::XMLParser]
113
+ def get_lowest_offer_listings_for_sku(*skus)
114
+ opts = extract_options(skus)
115
+
116
+ operation('GetLowestOfferListingsForSKU')
117
+ .add(opts.merge('SellerSKUList' => skus))
118
+ .structure!('SellerSKUList', 'SellerSKU')
119
+
120
+ run
121
+ end
122
+
123
+ # Gets pricing information for the lowest-price active offer listings for
124
+ # a product, identified by its ASIN
125
+ #
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>]
129
+ # @param opts [Hash]
130
+ # @option opts [String] :marketplace_id
131
+ # @option opts [String] :item_condition
132
+ # @option opts [Boolean] :exclude_me
133
+ # @return [Peddler::XMLParser]
134
+ def get_lowest_offer_listings_for_asin(*asins)
135
+ opts = extract_options(asins)
136
+
137
+ operation('GetLowestOfferListingsForASIN')
138
+ .add(opts.merge('ASINList' => asins))
139
+ .structure!('ASINList', 'ASIN')
140
+
141
+ run
142
+ end
143
+
144
+ # Gets pricing information for seller's own offer listings, based on
145
+ # Seller SKU
146
+ #
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>]
150
+ # @param opts [Hash]
151
+ # @option opts [String] :marketplace_id
152
+ # @option opts [String] :item_condition
153
+ # @return [Peddler::XMLParser]
154
+ def get_my_price_for_sku(*skus)
155
+ opts = extract_options(skus)
156
+
157
+ operation('GetMyPriceForSKU')
158
+ .add(opts.merge('SellerSKUList' => skus))
159
+ .structure!('SellerSKUList', 'SellerSKU')
160
+
161
+ run
162
+ end
163
+
164
+ # Gets pricing information for seller's own offer listings, identified by
165
+ # its ASIN
166
+ #
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>]
170
+ # @param opts [Hash]
171
+ # @option opts [String] :marketplace_id
172
+ # @option opts [String] :item_condition
173
+ # @return [Peddler::XMLParser]
174
+ def get_my_price_for_asin(*asins)
175
+ opts = extract_options(asins)
176
+
177
+ operation('GetMyPriceForASIN')
178
+ .add(opts.merge('ASINList' => asins))
179
+ .structure!('ASINList', 'ASIN')
180
+
181
+ run
182
+ end
183
+
184
+ # Gets parent product categories that a product belongs to, based on
185
+ # Seller`SKU
186
+ #
187
+ # @see http://docs.developer.amazonservices.com/en_US/products/Products_GetProductCategoriesForSKU.html
188
+ # @overload get_product_categories_for_sku(sku, opts = { marketplace_id: marketplace_id })
189
+ # @param sku [String]
190
+ # @param opts [Hash]
191
+ # @option opts [String] :marketplace_id
192
+ # @return [Peddler::XMLParser]
193
+ def get_product_categories_for_sku(sku, opts = {})
194
+ operation('GetProductCategoriesForSKU')
195
+ .add(opts.merge('SellerSKU' => sku))
196
+
197
+ run
198
+ end
199
+
200
+ # Gets parent product categories that a product belongs to, based on ASIN
201
+ #
202
+ # @see http://docs.developer.amazonservices.com/en_US/products/Products_GetProductCategoriesForASIN.html
203
+ # @overload get_product_categories_for_asin(asin, opts = { marketplace_id: marketplace_id })
204
+ # @param asin [String]
205
+ # @param opts [Hash]
206
+ # @option opts [String] :marketplace_id
207
+ # @return [Peddler::XMLParser]
208
+ def get_product_categories_for_asin(asin, opts = {})
209
+ operation('GetProductCategoriesForASIN')
210
+ .add(opts.merge('ASIN' => asin))
211
+
212
+ run
213
+ end
214
+
215
+ # Gets the service status of the API
216
+ #
217
+ # @see http://docs.developer.amazonservices.com/en_US/products/Products_GetServiceStatus.html
218
+ # @return [Peddler::XMLParser]
219
+ def get_service_status
220
+ operation('GetServiceStatus')
221
+ run
222
+ end
223
+
224
+ # @api private
225
+ def operation(*)
226
+ super.tap do |opts|
227
+ unless opts.key?('MarketplaceId')
228
+ opts.store('MarketplaceId', marketplace_id)
229
+ end
230
+ end
231
+ end
232
+ end
233
+ end
234
+ end
data/lib/mws/products.rb CHANGED
@@ -1,232 +1 @@
1
- require 'peddler/client'
2
-
3
- module MWS
4
- # The MWS Products API helps you get information to match your products to
5
- # existing product listings on Amazon Marketplace websites and to make
6
- # sourcing and pricing decisions for listing those products on Amazon
7
- # Marketplace websites.
8
- class Products < ::Peddler::Client
9
- path '/Products/2011-10-01'
10
-
11
- # Lists products and their attributes, based on a search query
12
- #
13
- # @see http://docs.developer.amazonservices.com/en_US/products/Products_ListMatchingProducts.html
14
- # @overload list_matching_products(query, opts = { marketplace_id: marketplace_id })
15
- # @param query [String]
16
- # @param opts [Hash]
17
- # @option opts [String] :marketplace_id
18
- # @option opts [String] :query_context_id
19
- # @return [Peddler::XMLParser]
20
- def list_matching_products(query, opts = {})
21
- operation('ListMatchingProducts')
22
- .add(opts.merge('Query' => query))
23
-
24
- run
25
- end
26
-
27
- # Lists products and their attributes, based on a list of ASIN, GCID,
28
- # SellerSKU, UPC, EAN, ISBN, and JAN values
29
- #
30
- # @see http://docs.developer.amazonservices.com/en_US/products/Products_GetMatchingProduct.html
31
- # @overload get_matching_product_for_id(id_type, *id_list, opts = { marketplace_id: marketplace_id })
32
- # @param id_type [String]
33
- # @param id_list [Array<String>]
34
- # @param opts [Hash]
35
- # @option opts [String] :marketplace_id
36
- # @return [Peddler::XMLParser]
37
- def get_matching_product_for_id(id_type, *id_list)
38
- opts = extract_options(id_list)
39
-
40
- operation('GetMatchingProductForId')
41
- .add(opts.merge('IdType' => id_type, 'IdList' => id_list))
42
- .structure!('IdList', 'Id')
43
-
44
- run
45
- end
46
-
47
- # Lists products and their attributes, based on a list of ASIN values
48
- #
49
- # @see http://docs.developer.amazonservices.com/en_US/products/Products_GetMatchingProductForId.html
50
- # @overload get_matching_product(*asins, opts = { marketplace_id: marketplace_id })
51
- # @param asins [Array<String>]
52
- # @param opts [Hash]
53
- # @option opts [String] :marketplace_id
54
- # @return [Peddler::XMLParser]
55
- def get_matching_product(*asins)
56
- opts = extract_options(asins)
57
-
58
- operation('GetMatchingProduct')
59
- .add(opts.merge('ASINList' => asins))
60
- .structure!('ASINList', 'ASIN')
61
-
62
- run
63
- end
64
-
65
- # Gets the current competitive price of a product, based on Seller SKU
66
- #
67
- # @see http://docs.developer.amazonservices.com/en_US/products/Products_GetCompetitivePricingForSKU.html
68
- # @overload get_competitive_pricing_for_sku(*skus, opts = { marketplace_id: marketplace_id })
69
- # @param skus [Array<String>]
70
- # @param opts [Hash]
71
- # @option opts [String] :marketplace_id
72
- # @return [Peddler::XMLParser]
73
- def get_competitive_pricing_for_sku(*skus)
74
- opts = extract_options(skus)
75
-
76
- operation('GetCompetitivePricingForSKU')
77
- .add(opts.merge('SellerSKUList' => skus))
78
- .structure!('SellerSKUList', 'SellerSKU')
79
-
80
- run
81
- end
82
-
83
- # Gets the current competitive price of a product, identified by its ASIN
84
- #
85
- # @see http://docs.developer.amazonservices.com/en_US/products/Products_GetCompetitivePricingForASIN.html
86
- # @overload get_competitive_pricing_for_asin(*asins, opts = { marketplace_id: marketplace_id })
87
- # @param asins [Array<String>]
88
- # @param opts [Hash]
89
- # @option opts [String] :marketplace_id
90
- # @return [Peddler::XMLParser]
91
- def get_competitive_pricing_for_asin(*asins)
92
- opts = extract_options(asins)
93
-
94
- operation('GetCompetitivePricingForASIN')
95
- .add(opts.merge('ASINList' => asins))
96
- .structure!('ASINList', 'ASIN')
97
-
98
- run
99
- end
100
-
101
- # Gets pricing information for the lowest-price active offer listings for a
102
- # product, based on Seller SKU
103
- #
104
- # @see http://docs.developer.amazonservices.com/en_US/products/Products_GetLowestOfferListingsForSKU.html
105
- # @overload get_lowest_offer_listings_for_sku(*skus, opts = { marketplace_id: marketplace_id })
106
- # @param skus [Array<String>]
107
- # @param opts [Hash]
108
- # @option opts [String] :marketplace_id
109
- # @option opts [String] :item_condition
110
- # @option opts [Boolean] :exclude_me
111
- # @return [Peddler::XMLParser]
112
- def get_lowest_offer_listings_for_sku(*skus)
113
- opts = extract_options(skus)
114
-
115
- operation('GetLowestOfferListingsForSKU')
116
- .add(opts.merge('SellerSKUList' => skus))
117
- .structure!('SellerSKUList', 'SellerSKU')
118
-
119
- run
120
- end
121
-
122
- # Gets pricing information for the lowest-price active offer listings for a
123
- # product, identified by its ASIN
124
- #
125
- # @see http://docs.developer.amazonservices.com/en_US/products/Products_GetLowestOfferListingsForASIN.html
126
- # @overload get_lowest_offer_listings_for_asin(*asins, opts = { marketplace_id: marketplace_id })
127
- # @param asins [Array<String>]
128
- # @param opts [Hash]
129
- # @option opts [String] :marketplace_id
130
- # @option opts [String] :item_condition
131
- # @option opts [Boolean] :exclude_me
132
- # @return [Peddler::XMLParser]
133
- def get_lowest_offer_listings_for_asin(*asins)
134
- opts = extract_options(asins)
135
-
136
- operation('GetLowestOfferListingsForASIN')
137
- .add(opts.merge('ASINList' => asins))
138
- .structure!('ASINList', 'ASIN')
139
-
140
- run
141
- end
142
-
143
- # Gets pricing information for seller's own offer listings, based on Seller
144
- # SKU
145
- #
146
- # @see http://docs.developer.amazonservices.com/en_US/products/Products_GetMyPriceForSKU.html
147
- # @overload get_my_price_for_sku(*skus, opts = { marketplace_id: marketplace_id })
148
- # @param skus [Array<String>]
149
- # @param opts [Hash]
150
- # @option opts [String] :marketplace_id
151
- # @option opts [String] :item_condition
152
- # @return [Peddler::XMLParser]
153
- def get_my_price_for_sku(*skus)
154
- opts = extract_options(skus)
155
-
156
- operation('GetMyPriceForSKU')
157
- .add(opts.merge('SellerSKUList' => skus))
158
- .structure!('SellerSKUList', 'SellerSKU')
159
-
160
- run
161
- end
162
-
163
- # Gets pricing information for seller's own offer listings, identified by
164
- # its ASIN
165
- #
166
- # @see http://docs.developer.amazonservices.com/en_US/products/Products_GetMyPriceForASIN.html
167
- # @overload get_my_price_for_asin(*skus, opts = { marketplace_id: marketplace_id })
168
- # @param asins [Array<String>]
169
- # @param opts [Hash]
170
- # @option opts [String] :marketplace_id
171
- # @option opts [String] :item_condition
172
- # @return [Peddler::XMLParser]
173
- def get_my_price_for_asin(*asins)
174
- opts = extract_options(asins)
175
-
176
- operation('GetMyPriceForASIN')
177
- .add(opts.merge('ASINList' => asins))
178
- .structure!('ASINList', 'ASIN')
179
-
180
- run
181
- end
182
-
183
- # Gets parent product categories that a product belongs to, based on
184
- # Seller`SKU
185
- #
186
- # @see http://docs.developer.amazonservices.com/en_US/products/Products_GetProductCategoriesForSKU.html
187
- # @overload get_product_categories_for_sku(sku, opts = { marketplace_id: marketplace_id })
188
- # @param sku [String]
189
- # @param opts [Hash]
190
- # @option opts [String] :marketplace_id
191
- # @return [Peddler::XMLParser]
192
- def get_product_categories_for_sku(sku, opts = {})
193
- operation('GetProductCategoriesForSKU')
194
- .add(opts.merge('SellerSKU' => sku))
195
-
196
- run
197
- end
198
-
199
- # Gets parent product categories that a product belongs to, based on ASIN
200
- #
201
- # @see http://docs.developer.amazonservices.com/en_US/products/Products_GetProductCategoriesForASIN.html
202
- # @overload get_product_categories_for_asin(asin, opts = { marketplace_id: marketplace_id })
203
- # @param asin [String]
204
- # @param opts [Hash]
205
- # @option opts [String] :marketplace_id
206
- # @return [Peddler::XMLParser]
207
- def get_product_categories_for_asin(asin, opts = {})
208
- operation('GetProductCategoriesForASIN')
209
- .add(opts.merge('ASIN' => asin))
210
-
211
- run
212
- end
213
-
214
- # Gets the service status of the API
215
- #
216
- # @see http://docs.developer.amazonservices.com/en_US/products/Products_GetServiceStatus.html
217
- # @return [Peddler::XMLParser]
218
- def get_service_status
219
- operation('GetServiceStatus')
220
- run
221
- end
222
-
223
- # @api private
224
- def operation(*)
225
- super.tap do |opts|
226
- unless opts.has_key?('MarketplaceId')
227
- opts.store('MarketplaceId', marketplace_id)
228
- end
229
- end
230
- end
231
- end
232
- end
1
+ require 'mws/products/client'
@@ -0,0 +1,71 @@
1
+ require 'peddler/client'
2
+
3
+ module MWS
4
+ module Recommendations
5
+ # The Recommendations API enables you to programmatically retrieve Amazon
6
+ # Selling Coach recommendations by recommendation category. A recommendation
7
+ # is an actionable, timely, and personalized opportunity to increase your
8
+ # sales and performance.
9
+ class Client < ::Peddler::Client
10
+ path '/Recommendations/2013-04-01'
11
+
12
+ # Checks whether there are active recommendations for each category for
13
+ # the given marketplace, and if there are, returns the time when
14
+ # recommendations were last updated for each category
15
+ #
16
+ # @see http://docs.developer.amazonservices.com/en_US/recommendations/Recommendations_GetLastUpdatedTimeForRecommendations.html
17
+ # @param marketplace_id [String]
18
+ # @return [Peddler::XMLParser]
19
+ def get_last_updated_time_for_recommendations(marketplace_id = marketplace_id)
20
+ operation('GetLastUpdatedTimeForRecommendations')
21
+ .add('MarketplaceId' => marketplace_id)
22
+
23
+ run
24
+ end
25
+
26
+ # Lists active recommendations for a specific category or for all
27
+ # categories for a specific marketplace
28
+ #
29
+ # @see http://docs.developer.amazonservices.com/en_US/recommendations/Recommendations_ListRecommendations.html
30
+ # @overload list_recommendations(opts = { marketplace_id: marketplace_id })
31
+ # @param opts [Hash]
32
+ # @option opts [String] :marketplace_id
33
+ # @option opts [String] :recommendation_category
34
+ # @option opts [String] :category_query_list
35
+ # @return [Peddler::XMLParser]
36
+ def list_recommendations(opts = {})
37
+ opts[:marketplace_id] ||= marketplace_id
38
+
39
+ operation('ListRecommendations')
40
+ .add(opts)
41
+ .structure!(
42
+ 'CategoryQueryList', 'CategoryQuery', '1', 'FilterOptions',
43
+ 'FilterOption'
44
+ )
45
+
46
+ run
47
+ end
48
+
49
+ # Lists the next page of active recommendations
50
+ #
51
+ # @see http://docs.developer.amazonservices.com/en_US/recommendations/Recommendations_ListRecommendationsByNextToken.html
52
+ # @param next_token [String]
53
+ # @return [Peddler::XMLParser]
54
+ def list_recommendations_by_next_token(next_token)
55
+ operation('ListRecommendationsByNextToken')
56
+ .add('NextToken' => next_token)
57
+
58
+ run
59
+ end
60
+
61
+ # Gets the service status of the API
62
+ #
63
+ # @see http://docs.developer.amazonservices.com/en_US/recommendations/Recommendations_GetServiceStatus.html
64
+ # @return [Peddler::XMLParser]
65
+ def get_service_status
66
+ operation('GetServiceStatus')
67
+ run
68
+ end
69
+ end
70
+ end
71
+ end
@@ -1,66 +1 @@
1
- require 'peddler/client'
2
-
3
- module MWS
4
- # The Recommendations API enables you to programmatically retrieve Amazon
5
- # Selling Coach recommendations by recommendation category. A recommendation
6
- # is an actionable, timely, and personalized opportunity to increase your
7
- # sales and performance.
8
- class Recommendations < ::Peddler::Client
9
- path '/Recommendations/2013-04-01'
10
-
11
- # Checks whether there are active recommendations for each category for the
12
- # given marketplace, and if there are, returns the time when recommendations
13
- # were last updated for each category
14
- #
15
- # @see http://docs.developer.amazonservices.com/en_US/recommendations/Recommendations_GetLastUpdatedTimeForRecommendations.html
16
- # @param marketplace_id [String]
17
- # @return [Peddler::XMLParser]
18
- def get_last_updated_time_for_recommendations(marketplace_id = marketplace_id)
19
- operation('GetLastUpdatedTimeForRecommendations')
20
- .add('MarketplaceId' => marketplace_id)
21
-
22
- run
23
- end
24
-
25
- # Lists active recommendations for a specific category or for all categories
26
- # for a specific marketplace
27
- #
28
- # @see http://docs.developer.amazonservices.com/en_US/recommendations/Recommendations_ListRecommendations.html
29
- # @overload list_recommendations(opts = { marketplace_id: marketplace_id })
30
- # @param opts [Hash]
31
- # @option opts [String] :marketplace_id
32
- # @option opts [String] :recommendation_category
33
- # @option opts [String] :category_query_list
34
- # @return [Peddler::XMLParser]
35
- def list_recommendations(opts = {})
36
- opts[:marketplace_id] ||= marketplace_id
37
-
38
- operation('ListRecommendations')
39
- .add(opts)
40
- .structure!('CategoryQueryList', 'CategoryQuery', '1', 'FilterOptions', 'FilterOption')
41
-
42
- run
43
- end
44
-
45
- # Lists the next page of active recommendations
46
- #
47
- # @see http://docs.developer.amazonservices.com/en_US/recommendations/Recommendations_ListRecommendationsByNextToken.html
48
- # @param next_token [String]
49
- # @return [Peddler::XMLParser]
50
- def list_recommendations_by_next_token(next_token)
51
- operation('ListRecommendationsByNextToken')
52
- .add('NextToken' => next_token)
53
-
54
- run
55
- end
56
-
57
- # Gets the service status of the API
58
- #
59
- # @see http://docs.developer.amazonservices.com/en_US/recommendations/Recommendations_GetServiceStatus.html
60
- # @return [Peddler::XMLParser]
61
- def get_service_status
62
- operation('GetServiceStatus')
63
- run
64
- end
65
- end
66
- end
1
+ require 'mws/recommendations/client'