peddler 0.6.5 → 0.7.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.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/README.md +62 -81
- data/lib/mws/cart_information.rb +13 -0
- data/lib/mws/customer_information.rb +16 -0
- data/lib/mws/feeds.rb +110 -1
- data/lib/mws/fulfillment_inbound_shipment.rb +13 -1
- data/lib/mws/fulfillment_inventory.rb +15 -1
- data/lib/mws/fulfillment_outbound_shipment.rb +17 -1
- data/lib/mws/off_amazon_payments.rb +15 -1
- data/lib/mws/orders.rb +100 -1
- data/lib/mws/products.rb +238 -1
- data/lib/mws/recommendations.rb +13 -1
- data/lib/mws/reports.rb +221 -1
- data/lib/mws/sellers.rb +40 -1
- data/lib/mws/subscriptions.rb +175 -1
- data/lib/peddler/client.rb +77 -37
- data/lib/peddler/csv_parser.rb +42 -0
- data/lib/peddler/operation.rb +44 -0
- data/lib/peddler/parser.rb +21 -0
- data/lib/peddler/structured_list.rb +22 -0
- data/lib/peddler/version.rb +1 -1
- data/lib/peddler/xml_parser.rb +25 -0
- data/lib/peddler.rb +2 -0
- data/test/helper.rb +1 -1
- data/test/integration/test_feeds.rb +18 -0
- data/test/integration/test_orders.rb +22 -0
- data/test/integration/test_products.rb +53 -0
- data/test/integration/test_reports.rb +47 -0
- data/test/integration/test_sellers.rb +18 -0
- data/test/integration/test_subscriptions.rb +26 -0
- data/test/integration_helper.rb +41 -8
- data/test/mws.yml +32 -0
- data/test/mws.yml.example +4 -0
- data/test/unit/peddler/test_client.rb +97 -0
- data/test/unit/peddler/test_csv_parser.rb +24 -0
- data/test/unit/peddler/test_operation.rb +34 -0
- data/test/{peddler/request → unit/peddler}/test_structured_list.rb +5 -5
- data/test/unit/peddler/test_xml_parser.rb +19 -0
- data/test/{test_peddler.rb → unit/test_peddler.rb} +2 -2
- data/test/vcr_cassettes/Feeds.yml +695 -0
- data/test/vcr_cassettes/Orders.yml +29855 -0
- data/test/vcr_cassettes/Products.yml +8597 -0
- data/test/vcr_cassettes/Reports.yml +1881 -0
- data/test/vcr_cassettes/Sellers.yml +697 -0
- data/test/vcr_cassettes/Subscriptions.yml +1369 -0
- metadata +91 -297
- data/lib/mws/feeds/client.rb +0 -116
- data/lib/mws/feeds/parsers/feed.rb +0 -14
- data/lib/mws/feeds/parsers/feed_submission_count.rb +0 -10
- data/lib/mws/feeds/parsers/feed_submission_info.rb +0 -25
- data/lib/mws/feeds/parsers/feed_submission_list.rb +0 -23
- data/lib/mws/feeds/parsers/feed_submission_result.rb +0 -10
- data/lib/mws/feeds/parsers/feed_submissions.rb +0 -18
- data/lib/mws/feeds/requests/feed.rb +0 -38
- data/lib/mws/feeds/requests/feed_submission_count.rb +0 -20
- data/lib/mws/feeds/requests/feed_submission_list.rb +0 -30
- data/lib/mws/feeds/requests/feed_submission_result.rb +0 -18
- data/lib/mws/feeds/requests/feed_submissions.rb +0 -20
- data/lib/mws/fulfillment_inbound_shipment/client.rb +0 -7
- data/lib/mws/fulfillment_inventory/client.rb +0 -7
- data/lib/mws/fulfillment_outbound_shipment/client.rb +0 -7
- data/lib/mws/off_amazon_payments/client.rb +0 -7
- data/lib/mws/orders/client.rb +0 -98
- data/lib/mws/orders/parsers/invoice_data.rb +0 -25
- data/lib/mws/orders/parsers/order.rb +0 -113
- data/lib/mws/orders/parsers/order_item.rb +0 -110
- data/lib/mws/orders/parsers/order_items.rb +0 -23
- data/lib/mws/orders/parsers/orders.rb +0 -23
- data/lib/mws/orders/parsers/payment_execution_detail.rb +0 -20
- data/lib/mws/orders/parsers/payment_execution_detail_item.rb +0 -17
- data/lib/mws/orders/parsers/service_status.rb +0 -36
- data/lib/mws/orders/parsers/service_status_message.rb +0 -17
- data/lib/mws/orders/parsers/shipping_address.rb +0 -37
- data/lib/mws/orders/requests/order_items.rb +0 -28
- data/lib/mws/orders/requests/orders.rb +0 -41
- data/lib/mws/orders/requests/service_status.rb +0 -15
- data/lib/mws/products/client.rb +0 -7
- data/lib/mws/recommendations/client.rb +0 -7
- data/lib/mws/reports/client.rb +0 -249
- data/lib/mws/reports/parsers/report.rb +0 -10
- data/lib/mws/reports/parsers/report_acknowledgements.rb +0 -20
- data/lib/mws/reports/parsers/report_count.rb +0 -10
- data/lib/mws/reports/parsers/report_info.rb +0 -29
- data/lib/mws/reports/parsers/report_list.rb +0 -23
- data/lib/mws/reports/parsers/report_request.rb +0 -14
- data/lib/mws/reports/parsers/report_request_count.rb +0 -10
- data/lib/mws/reports/parsers/report_request_info.rb +0 -49
- data/lib/mws/reports/parsers/report_request_list.rb +0 -23
- data/lib/mws/reports/parsers/report_requests.rb +0 -18
- data/lib/mws/reports/parsers/report_schedule.rb +0 -21
- data/lib/mws/reports/parsers/report_schedule_count.rb +0 -10
- data/lib/mws/reports/parsers/report_schedule_list.rb +0 -23
- data/lib/mws/reports/parsers/report_scheduler.rb +0 -19
- data/lib/mws/reports/requests/report.rb +0 -18
- data/lib/mws/reports/requests/report_acknowledgements.rb +0 -27
- data/lib/mws/reports/requests/report_count.rb +0 -20
- data/lib/mws/reports/requests/report_list.rb +0 -30
- data/lib/mws/reports/requests/report_request.rb +0 -21
- data/lib/mws/reports/requests/report_request_count.rb +0 -20
- data/lib/mws/reports/requests/report_request_list.rb +0 -30
- data/lib/mws/reports/requests/report_requests.rb +0 -20
- data/lib/mws/reports/requests/report_schedule_count.rb +0 -19
- data/lib/mws/reports/requests/report_schedule_list.rb +0 -23
- data/lib/mws/reports/requests/report_scheduler.rb +0 -29
- data/lib/mws/sellers/client.rb +0 -53
- data/lib/mws/sellers/parsers/marketplace.rb +0 -33
- data/lib/mws/sellers/parsers/marketplace_participations.rb +0 -32
- data/lib/mws/sellers/parsers/participation.rb +0 -21
- data/lib/mws/sellers/parsers/service_status.rb +0 -36
- data/lib/mws/sellers/parsers/service_status_message.rb +0 -17
- data/lib/mws/sellers/requests/marketplace_participations.rb +0 -27
- data/lib/mws/sellers/requests/service_status.rb +0 -15
- data/lib/mws/subscriptions/client.rb +0 -7
- data/lib/peddler/parsers/base.rb +0 -15
- data/lib/peddler/parsers/collection.rb +0 -23
- data/lib/peddler/parsers/counter.rb +0 -13
- data/lib/peddler/parsers/model.rb +0 -42
- data/lib/peddler/parsers/text.rb +0 -8
- data/lib/peddler/parsers/tokenable.rb +0 -13
- data/lib/peddler/parsers/xml.rb +0 -30
- data/lib/peddler/request/parameters.rb +0 -57
- data/lib/peddler/request/structured_list.rb +0 -48
- data/lib/peddler/request.rb +0 -52
- data/lib/peddler/response/base.rb +0 -0
- data/lib/peddler/response/payload/base.rb +0 -0
- data/lib/peddler/response/payload/csv.rb +0 -0
- data/lib/peddler/response/payload/xml.rb +0 -0
- data/lib/peddler/response.rb +0 -27
- data/test/fixtures/feeds/feed_submission.xml +0 -14
- data/test/fixtures/feeds/feed_submission_count.xml +0 -9
- data/test/fixtures/feeds/feed_submission_list.xml +0 -17
- data/test/fixtures/feeds/feed_submissions.xml +0 -15
- data/test/fixtures/mws.yml +0 -12
- data/test/fixtures/mws.yml.example +0 -4
- data/test/fixtures/orders/order_items.xml +0 -83
- data/test/fixtures/orders/orders.xml +0 -109
- data/test/fixtures/orders/service_status.xml +0 -19
- data/test/fixtures/reports/report.xml +0 -8
- data/test/fixtures/reports/report_acknowledgements.xml +0 -18
- data/test/fixtures/reports/report_count.xml +0 -9
- data/test/fixtures/reports/report_list.xml +0 -17
- data/test/fixtures/reports/report_request_count.xml +0 -9
- data/test/fixtures/reports/report_request_list.xml +0 -24
- data/test/fixtures/reports/report_requests.xml +0 -19
- data/test/fixtures/reports/report_schedule_count.xml +0 -10
- data/test/fixtures/reports/report_schedule_list.xml +0 -16
- data/test/fixtures/reports/report_scheduler.xml +0 -15
- data/test/fixtures/sellers/market_participations.xml +0 -27
- data/test/fixtures/sellers/service_status.xml +0 -9
- data/test/integration/feeds/test_feed_submission_count.rb +0 -13
- data/test/integration/feeds/test_feed_submission_list.rb +0 -17
- data/test/integration/feeds/test_feed_submission_result.rb +0 -15
- data/test/integration/orders/test_order_items.rb +0 -19
- data/test/integration/orders/test_orders.rb +0 -23
- data/test/integration/orders/test_service_status.rb +0 -12
- data/test/integration/reports/test_report.rb +0 -15
- data/test/integration/reports/test_report_count.rb +0 -13
- data/test/integration/reports/test_report_list.rb +0 -17
- data/test/integration/reports/test_report_request_count.rb +0 -13
- data/test/integration/reports/test_report_request_list.rb +0 -17
- data/test/integration/reports/test_report_schedule_count.rb +0 -13
- data/test/integration/reports/test_report_schedule_list.rb +0 -13
- data/test/integration/reports/test_report_scheduler.rb +0 -16
- data/test/integration/sellers/test_marketplace_participations.rb +0 -13
- data/test/integration/sellers/test_service_status.rb +0 -12
- data/test/mws/feeds/parsers/test_feed.rb +0 -13
- data/test/mws/feeds/parsers/test_feed_submission_count.rb +0 -13
- data/test/mws/feeds/parsers/test_feed_submission_info.rb +0 -25
- data/test/mws/feeds/parsers/test_feed_submission_list.rb +0 -18
- data/test/mws/feeds/parsers/test_feed_submission_result.rb +0 -13
- data/test/mws/feeds/parsers/test_feed_submissions.rb +0 -17
- data/test/mws/feeds/requests/test_feed.rb +0 -63
- data/test/mws/feeds/requests/test_feed_submission_count.rb +0 -23
- data/test/mws/feeds/requests/test_feed_submission_list.rb +0 -37
- data/test/mws/feeds/requests/test_feed_submissions.rb +0 -29
- data/test/mws/orders/parsers/test_order.rb +0 -86
- data/test/mws/orders/parsers/test_order_item.rb +0 -69
- data/test/mws/orders/parsers/test_order_items.rb +0 -18
- data/test/mws/orders/parsers/test_orders.rb +0 -18
- data/test/mws/orders/parsers/test_payment_execution_detail.rb +0 -14
- data/test/mws/orders/parsers/test_payment_execution_detail_item.rb +0 -17
- data/test/mws/orders/parsers/test_service_status.rb +0 -39
- data/test/mws/orders/parsers/test_service_status_message.rb +0 -17
- data/test/mws/orders/parsers/test_shipping_address.rb +0 -36
- data/test/mws/orders/requests/test_order_items.rb +0 -36
- data/test/mws/orders/requests/test_orders.rb +0 -46
- data/test/mws/orders/requests/test_service_status.rb +0 -25
- data/test/mws/reports/parsers/test_report_acknowledgments.rb +0 -14
- data/test/mws/reports/parsers/test_report_count.rb +0 -13
- data/test/mws/reports/parsers/test_report_info.rb +0 -29
- data/test/mws/reports/parsers/test_report_list.rb +0 -18
- data/test/mws/reports/parsers/test_report_request.rb +0 -13
- data/test/mws/reports/parsers/test_report_request_count.rb +0 -13
- data/test/mws/reports/parsers/test_report_request_info.rb +0 -49
- data/test/mws/reports/parsers/test_report_request_list.rb +0 -18
- data/test/mws/reports/parsers/test_report_requests.rb +0 -17
- data/test/mws/reports/parsers/test_report_schedule_count.rb +0 -13
- data/test/mws/reports/parsers/test_report_schedule_list.rb +0 -18
- data/test/mws/reports/parsers/test_report_scheduler.rb +0 -17
- data/test/mws/reports/requests/test_acknowledgements.rb +0 -36
- data/test/mws/reports/requests/test_report_count.rb +0 -23
- data/test/mws/reports/requests/test_report_list.rb +0 -39
- data/test/mws/reports/requests/test_report_request.rb +0 -31
- data/test/mws/reports/requests/test_report_request_count.rb +0 -23
- data/test/mws/reports/requests/test_report_request_list.rb +0 -44
- data/test/mws/reports/requests/test_report_requests.rb +0 -29
- data/test/mws/reports/requests/test_report_schedule_count.rb +0 -22
- data/test/mws/reports/requests/test_report_schedule_list.rb +0 -36
- data/test/mws/reports/requests/test_report_scheduler.rb +0 -33
- data/test/mws/sellers/parsers/test_market_participations.rb +0 -19
- data/test/mws/sellers/parsers/test_service_status.rb +0 -35
- data/test/mws/sellers/requests/test_marketplace_participation_list.rb +0 -39
- data/test/mws/sellers/requests/test_service_status.rb +0 -25
- data/test/parser_helper.rb +0 -11
- data/test/peddler/parsers/test_collection.rb +0 -8
- data/test/peddler/parsers/test_model.rb +0 -70
- data/test/peddler/request/test_parameters.rb +0 -35
- data/test/peddler/test_client.rb +0 -42
- data/test/request_helper.rb +0 -20
data/lib/mws/products.rb
CHANGED
|
@@ -1 +1,238 @@
|
|
|
1
|
-
require '
|
|
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
|
+
# @method list_matching_products
|
|
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::Parser]
|
|
21
|
+
def list_matching_products(query, opts = {})
|
|
22
|
+
opts[:marketplace_id] ||= marketplace_id
|
|
23
|
+
|
|
24
|
+
operation('ListMatchingProducts')
|
|
25
|
+
.add(opts.merge('Query' => query))
|
|
26
|
+
|
|
27
|
+
run
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Lists products and their attributes, based on a list of ASIN, GCID,
|
|
31
|
+
# SellerSKU, UPC, EAN, ISBN, and JAN values
|
|
32
|
+
#
|
|
33
|
+
# @see http://docs.developer.amazonservices.com/en_US/products/Products_GetMatchingProduct.html
|
|
34
|
+
# @overload get_matching_product_for_id(id_type, *id_list, opts = { marketplace_id: marketplace_id })
|
|
35
|
+
# @param id_type [String]
|
|
36
|
+
# @param id_list [Array<String>]
|
|
37
|
+
# @param opts [Hash]
|
|
38
|
+
# @option opts [String] :marketplace_id
|
|
39
|
+
# @return [Peddler::Parser]
|
|
40
|
+
def get_matching_product_for_id(id_type, *id_list)
|
|
41
|
+
opts = extract_options(id_list)
|
|
42
|
+
opts[:marketplace_id] ||= marketplace_id
|
|
43
|
+
|
|
44
|
+
operation('GetMatchingProductForId')
|
|
45
|
+
.add(opts.merge('IdType' => id_type, 'IdList' => id_list))
|
|
46
|
+
.structure!('IdList', 'Id')
|
|
47
|
+
|
|
48
|
+
run
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Lists products and their attributes, based on a list of ASIN values
|
|
52
|
+
#
|
|
53
|
+
# @see http://docs.developer.amazonservices.com/en_US/products/Products_GetMatchingProductForId.html
|
|
54
|
+
# @overload get_matching_product(*asins, opts = { marketplace_id: marketplace_id })
|
|
55
|
+
# @param asins [Array<String>]
|
|
56
|
+
# @param opts [Hash]
|
|
57
|
+
# @option opts [String] :marketplace_id
|
|
58
|
+
# @return [Peddler::Parser]
|
|
59
|
+
def get_matching_product(*asins)
|
|
60
|
+
opts = extract_options(asins)
|
|
61
|
+
opts[:marketplace_id] ||= marketplace_id
|
|
62
|
+
|
|
63
|
+
operation('GetMatchingProduct')
|
|
64
|
+
.add(opts.merge('ASINList' => asins))
|
|
65
|
+
.structure!('ASINList', 'ASIN')
|
|
66
|
+
|
|
67
|
+
run
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# Gets the current competitive price of a product, based on Seller SKU
|
|
71
|
+
#
|
|
72
|
+
# @see http://docs.developer.amazonservices.com/en_US/products/Products_GetCompetitivePricingForSKU.html
|
|
73
|
+
# @overload get_competitive_pricing_for_sku(*skus, opts = { marketplace_id: marketplace_id })
|
|
74
|
+
# @param skus [Array<String>]
|
|
75
|
+
# @param opts [Hash]
|
|
76
|
+
# @option opts [String] :marketplace_id
|
|
77
|
+
# @return [Peddler::Parser]
|
|
78
|
+
def get_competitive_pricing_for_sku(*skus)
|
|
79
|
+
opts = extract_options(skus)
|
|
80
|
+
opts[:marketplace_id] ||= marketplace_id
|
|
81
|
+
|
|
82
|
+
operation('GetCompetitivePricingForSKU')
|
|
83
|
+
.add(opts.merge('SellerSKUList' => skus))
|
|
84
|
+
.structure!('SellerSKUList', 'SellerSKU')
|
|
85
|
+
|
|
86
|
+
run
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
# Gets the current competitive price of a product, identified by its ASIN
|
|
90
|
+
#
|
|
91
|
+
# @see http://docs.developer.amazonservices.com/en_US/products/Products_GetCompetitivePricingForASIN.html
|
|
92
|
+
# @overload get_competitive_pricing_for_asin(*asins, opts = { marketplace_id: marketplace_id })
|
|
93
|
+
# @param asins [Array<String>]
|
|
94
|
+
# @param opts [Hash]
|
|
95
|
+
# @option opts [String] :marketplace_id
|
|
96
|
+
# @return [Peddler::Parser]
|
|
97
|
+
def get_competitive_pricing_for_asin(*asins)
|
|
98
|
+
opts = extract_options(asins)
|
|
99
|
+
opts[:marketplace_id] ||= marketplace_id
|
|
100
|
+
|
|
101
|
+
operation('GetCompetitivePricingForASIN')
|
|
102
|
+
.add(opts.merge('ASINList' => asins))
|
|
103
|
+
.structure!('ASINList', 'ASIN')
|
|
104
|
+
|
|
105
|
+
run
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
# Gets pricing information for the lowest-price active offer listings for a
|
|
109
|
+
# product, based on Seller SKU
|
|
110
|
+
#
|
|
111
|
+
# @see http://docs.developer.amazonservices.com/en_US/products/Products_GetLowestOfferListingsForSKU.html
|
|
112
|
+
# @overload get_lowest_offer_listings_for_sku(*skus, opts = { marketplace_id: marketplace_id })
|
|
113
|
+
# @param skus [Array<String>]
|
|
114
|
+
# @param opts [Hash]
|
|
115
|
+
# @option opts [String] :marketplace_id
|
|
116
|
+
# @option opts [String] :item_condition
|
|
117
|
+
# @option opts [Boolean] :exclude_me
|
|
118
|
+
# @return [Peddler::Parser]
|
|
119
|
+
def get_lowest_offer_listings_for_sku(*skus)
|
|
120
|
+
opts = extract_options(skus)
|
|
121
|
+
opts[:marketplace_id] ||= marketplace_id
|
|
122
|
+
|
|
123
|
+
operation('GetLowestOfferListingsForSKU')
|
|
124
|
+
.add(opts.merge('SellerSKUList' => skus))
|
|
125
|
+
.structure!('SellerSKUList', 'SellerSKU')
|
|
126
|
+
|
|
127
|
+
run
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
# Gets pricing information for the lowest-price active offer listings for a
|
|
131
|
+
# product, identified by its ASIN
|
|
132
|
+
#
|
|
133
|
+
# @see http://docs.developer.amazonservices.com/en_US/products/Products_GetLowestOfferListingsForASIN.html
|
|
134
|
+
# @overload get_lowest_offer_listings_for_asin(*asins, opts = { marketplace_id: marketplace_id })
|
|
135
|
+
# @param asins [Array<String>]
|
|
136
|
+
# @param opts [Hash]
|
|
137
|
+
# @option opts [String] :marketplace_id
|
|
138
|
+
# @option opts [String] :item_condition
|
|
139
|
+
# @option opts [Boolean] :exclude_me
|
|
140
|
+
# @return [Peddler::Parser]
|
|
141
|
+
def get_lowest_offer_listings_for_asin(*asins)
|
|
142
|
+
opts = extract_options(asins)
|
|
143
|
+
opts[:marketplace_id] ||= marketplace_id
|
|
144
|
+
|
|
145
|
+
operation('GetLowestOfferListingsForASIN')
|
|
146
|
+
.add(opts.merge('ASINList' => asins))
|
|
147
|
+
.structure!('ASINList', 'ASIN')
|
|
148
|
+
|
|
149
|
+
run
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
# Gets pricing information for seller's own offer listings, based on Seller
|
|
153
|
+
# SKU
|
|
154
|
+
#
|
|
155
|
+
# @see http://docs.developer.amazonservices.com/en_US/products/Products_GetMyPriceForSKU.html
|
|
156
|
+
# @overload get_my_price_for_sku(*skus, opts = { marketplace_id: marketplace_id })
|
|
157
|
+
# @param skus [Array<String>]
|
|
158
|
+
# @param opts [Hash]
|
|
159
|
+
# @option opts [String] :marketplace_id
|
|
160
|
+
# @option opts [String] :item_condition
|
|
161
|
+
# @return [Peddler::Parser]
|
|
162
|
+
def get_my_price_for_sku(*skus)
|
|
163
|
+
opts = extract_options(skus)
|
|
164
|
+
opts[:marketplace_id] ||= marketplace_id
|
|
165
|
+
|
|
166
|
+
operation('GetMyPriceForSKU')
|
|
167
|
+
.add(opts.merge('SellerSKUList' => skus))
|
|
168
|
+
.structure!('SellerSKUList', 'SellerSKU')
|
|
169
|
+
|
|
170
|
+
run
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
# Gets pricing information for seller's own offer listings, identified by
|
|
174
|
+
# its ASIN
|
|
175
|
+
#
|
|
176
|
+
# @see http://docs.developer.amazonservices.com/en_US/products/Products_GetMyPriceForASIN.html
|
|
177
|
+
# @overload get_my_price_for_asin(*skus, opts = { marketplace_id: marketplace_id })
|
|
178
|
+
# @param asins [Array<String>]
|
|
179
|
+
# @param opts [Hash]
|
|
180
|
+
# @option opts [String] :marketplace_id
|
|
181
|
+
# @option opts [String] :item_condition
|
|
182
|
+
# @return [Peddler::Parser]
|
|
183
|
+
def get_my_price_for_asin(*asins)
|
|
184
|
+
opts = extract_options(asins)
|
|
185
|
+
opts[:marketplace_id] ||= marketplace_id
|
|
186
|
+
|
|
187
|
+
operation('GetMyPriceForASIN')
|
|
188
|
+
.add(opts.merge('ASINList' => asins))
|
|
189
|
+
.structure!('ASINList', 'ASIN')
|
|
190
|
+
|
|
191
|
+
run
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
# Gets parent product categories that a product belongs to, based on
|
|
195
|
+
# Seller`SKU
|
|
196
|
+
#
|
|
197
|
+
# @see http://docs.developer.amazonservices.com/en_US/products/Products_GetProductCategoriesForSKU.html
|
|
198
|
+
# @overload get_product_categories_for_sku(sku, opts = { marketplace_id: marketplace_id })
|
|
199
|
+
# @param sku [String]
|
|
200
|
+
# @param opts [Hash]
|
|
201
|
+
# @option opts [String] :marketplace_id
|
|
202
|
+
# @return [Peddler::Parser]
|
|
203
|
+
def get_product_categories_for_sku(sku, opts = {})
|
|
204
|
+
opts[:marketplace_id] ||= marketplace_id
|
|
205
|
+
|
|
206
|
+
operation('GetProductCategoriesForSKU')
|
|
207
|
+
.add(opts.merge('SellerSKU' => sku))
|
|
208
|
+
|
|
209
|
+
run
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
# Gets parent product categories that a product belongs to, based on ASIN
|
|
213
|
+
#
|
|
214
|
+
# @see http://docs.developer.amazonservices.com/en_US/products/Products_GetProductCategoriesForASIN.html
|
|
215
|
+
# @overload get_product_categories_for_asin(asin, opts = { marketplace_id: marketplace_id })
|
|
216
|
+
# @param asin [String]
|
|
217
|
+
# @param opts [Hash]
|
|
218
|
+
# @option opts [String] :marketplace_id
|
|
219
|
+
# @return [Peddler::Parser]
|
|
220
|
+
def get_product_categories_for_asin(asin, opts = {})
|
|
221
|
+
opts[:marketplace_id] ||= marketplace_id
|
|
222
|
+
|
|
223
|
+
operation('GetProductCategoriesForASIN')
|
|
224
|
+
.add(opts.merge('ASIN' => asin))
|
|
225
|
+
|
|
226
|
+
run
|
|
227
|
+
end
|
|
228
|
+
|
|
229
|
+
# Gets the service status of the API
|
|
230
|
+
#
|
|
231
|
+
# @see http://docs.developer.amazonservices.com/en_US/products/Products_GetServiceStatus.html
|
|
232
|
+
# @return Peddler::Parser
|
|
233
|
+
def get_service_status
|
|
234
|
+
operation('GetServiceStatus')
|
|
235
|
+
run
|
|
236
|
+
end
|
|
237
|
+
end
|
|
238
|
+
end
|
data/lib/mws/recommendations.rb
CHANGED
|
@@ -1 +1,13 @@
|
|
|
1
|
-
require '
|
|
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
|
+
#
|
|
9
|
+
# @todo Not implemented
|
|
10
|
+
class Recommendations < ::Peddler::Client
|
|
11
|
+
path 'Recommendations/2013-04-01'
|
|
12
|
+
end
|
|
13
|
+
end
|
data/lib/mws/reports.rb
CHANGED
|
@@ -1 +1,221 @@
|
|
|
1
|
-
require '
|
|
1
|
+
require 'peddler/client'
|
|
2
|
+
|
|
3
|
+
module MWS
|
|
4
|
+
# The Reports API lets you request reports about your inventory and orders.
|
|
5
|
+
class Reports < ::Peddler::Client
|
|
6
|
+
# Creates a report request
|
|
7
|
+
#
|
|
8
|
+
# @see http://docs.developer.amazonservices.com/en_US/reports/Reports_RequestReport.html
|
|
9
|
+
# @param report_type [String]
|
|
10
|
+
# @param opts [Hash]
|
|
11
|
+
# @option opts [String, #iso8601] :start_date
|
|
12
|
+
# @option opts [String, #iso8601] :end_date
|
|
13
|
+
# @option opts [String] :report_options
|
|
14
|
+
# @option opts [Array<String>, String] :marketplace_id
|
|
15
|
+
# @return [Peddler::Parser]
|
|
16
|
+
def request_report(report_type, opts = {})
|
|
17
|
+
operation('RequestReport')
|
|
18
|
+
.add(opts.merge('ReportType' => report_type))
|
|
19
|
+
.structure!('MarketplaceIdList', 'Id')
|
|
20
|
+
|
|
21
|
+
run
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Lists report requests
|
|
25
|
+
#
|
|
26
|
+
# @see http://docs.developer.amazonservices.com/en_US/reports/Reports_GetReportRequestList.html
|
|
27
|
+
# @param opts [Hash]
|
|
28
|
+
# @option opts [Array<String>, String] :report_request_id_list
|
|
29
|
+
# @option opts [Array<String>, String] :report_type_list
|
|
30
|
+
# @option opts [Array<String>, String] :report_processing_status_list
|
|
31
|
+
# @option opts [Integer] :max_count
|
|
32
|
+
# @option opts [String, #iso8601] :requested_from_date
|
|
33
|
+
# @option opts [String, #iso8601] :requested_to_date
|
|
34
|
+
# @return [Peddler::Parser]
|
|
35
|
+
def get_report_request_list(opts = {})
|
|
36
|
+
operation('GetReportRequestList')
|
|
37
|
+
.add(opts)
|
|
38
|
+
.structure!('ReportRequestIdList', 'Id')
|
|
39
|
+
.structure!('ReportTypeList', 'Type')
|
|
40
|
+
.structure!('ReportProcessingStatusList', 'Status')
|
|
41
|
+
|
|
42
|
+
run
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Lists the next page of the report requests
|
|
46
|
+
#
|
|
47
|
+
# @see http://docs.developer.amazonservices.com/en_US/reports/Reports_GetReportRequestListByNextToken.html
|
|
48
|
+
# @param next_token [String]
|
|
49
|
+
# @return [Peddler::Parser]
|
|
50
|
+
# @return false if there are no more pages
|
|
51
|
+
def get_report_request_list_by_next_token(next_token)
|
|
52
|
+
operation('GetReportRequestListByNextToken')
|
|
53
|
+
.add('NextToken' => next_token)
|
|
54
|
+
|
|
55
|
+
run
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# Counts requested reports
|
|
59
|
+
#
|
|
60
|
+
# @see http://docs.developer.amazonservices.com/en_US/reports/Reports_GetReportRequestCount.html
|
|
61
|
+
# @param opts [Hash]
|
|
62
|
+
# @option opts [Array<String>, String] :report_type_list
|
|
63
|
+
# @option opts [Array<String>, String] :report_processing_status_list
|
|
64
|
+
# @option opts [String, #iso8601] :requested_from_date
|
|
65
|
+
# @option opts [String, #iso8601] :requested_to_date
|
|
66
|
+
# @return [Peddler::Parser]
|
|
67
|
+
def get_report_request_count(opts = {})
|
|
68
|
+
operation('GetReportRequestCount')
|
|
69
|
+
.add(opts)
|
|
70
|
+
.structure!('ReportTypeList', 'Type')
|
|
71
|
+
.structure!('ReportProcessingStatusList', 'Status')
|
|
72
|
+
|
|
73
|
+
run
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# Cancels one or more report requests
|
|
77
|
+
#
|
|
78
|
+
# @see http://docs.developer.amazonservices.com/en_US/reports/Reports_CancelReportRequests.html
|
|
79
|
+
# @param opts [Hash]
|
|
80
|
+
# @option opts [Array<String>, String] :report_type_list
|
|
81
|
+
# @option opts [Array<String>, String] :report_processing_status_list
|
|
82
|
+
# @option opts [String, #iso8601] :requested_from_date
|
|
83
|
+
# @option opts [String, #iso8601] :requested_to_date
|
|
84
|
+
# @return [Peddler::Parser]
|
|
85
|
+
def cancel_report_requests(opts = {})
|
|
86
|
+
operation('CancelReportRequests')
|
|
87
|
+
.add(opts)
|
|
88
|
+
.structure!('ReportTypeList', 'Type')
|
|
89
|
+
.structure!('ReportProcessingStatusList', 'Status')
|
|
90
|
+
|
|
91
|
+
run
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# Lists reports
|
|
95
|
+
#
|
|
96
|
+
# @see http://docs.developer.amazonservices.com/en_US/reports/Reports_GetReportList.html
|
|
97
|
+
# @param opts [Hash]
|
|
98
|
+
# @option opts [Integer] :max_count
|
|
99
|
+
# @option opts [Array<String>, String] :report_type_list
|
|
100
|
+
# @option opts [Boolean] :acknowledged
|
|
101
|
+
# @option opts [String, #iso8601] :available_from_date
|
|
102
|
+
# @option opts [String, #iso8601] :available_to_date
|
|
103
|
+
# @option opts [Array<String>, String] :report_request_id_list
|
|
104
|
+
# @return [Peddler::Parser]
|
|
105
|
+
def get_report_list(opts = {})
|
|
106
|
+
operation('GetReportList')
|
|
107
|
+
.add(opts)
|
|
108
|
+
.structure!('ReportTypeList', 'Type')
|
|
109
|
+
.structure!('ReportRequestIdList', 'Id')
|
|
110
|
+
|
|
111
|
+
run
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
# Lists the next page of reports
|
|
115
|
+
#
|
|
116
|
+
# @see http://docs.developer.amazonservices.com/en_US/reports/Reports_GetReportListByNextToken.html
|
|
117
|
+
# @param next_token [String]
|
|
118
|
+
# @return [Peddler::Parser]
|
|
119
|
+
# @return false if there are no more pages
|
|
120
|
+
def get_report_list_by_next_token(next_token)
|
|
121
|
+
operation('GetReportListByNextToken')
|
|
122
|
+
.add('NextToken' => next_token)
|
|
123
|
+
|
|
124
|
+
run
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
# Counts reports
|
|
128
|
+
#
|
|
129
|
+
# @see http://docs.developer.amazonservices.com/en_US/reports/Reports_GetReportCount.html
|
|
130
|
+
# @param opts [Hash]
|
|
131
|
+
# @option opts [Array<String>, String] :report_type_list
|
|
132
|
+
# @option opts [Boolean] :acknowledged
|
|
133
|
+
# @option opts [String, #iso8601] :available_from_date
|
|
134
|
+
# @option opts [String, #iso8601] :available_to_date
|
|
135
|
+
# @return [Peddler::Parser]
|
|
136
|
+
def get_report_count(opts = {})
|
|
137
|
+
operation('GetReportCount')
|
|
138
|
+
.add(opts)
|
|
139
|
+
.structure!('ReportTypeList', 'Type')
|
|
140
|
+
|
|
141
|
+
run
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
# Gets a report and its Content-MD5 header
|
|
145
|
+
#
|
|
146
|
+
# @see http://docs.developer.amazonservices.com/en_US/reports/Reports_GetReport.html
|
|
147
|
+
# @param report_id [String]
|
|
148
|
+
# @return [Peddler::Parser]
|
|
149
|
+
def get_report(report_id, &blk)
|
|
150
|
+
operation('GetReport')
|
|
151
|
+
.add('ReportId' => report_id)
|
|
152
|
+
|
|
153
|
+
run(&blk)
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
# Creates, updates, or deletes a report request schedule
|
|
158
|
+
#
|
|
159
|
+
# @see http://docs.developer.amazonservices.com/en_US/reports/Reports_ManageReportSchedule.html
|
|
160
|
+
# @param report_type [String]
|
|
161
|
+
# @param schedule [String]
|
|
162
|
+
# @param opts [Hash]
|
|
163
|
+
# @option opts [String, #iso8601] :schedule_date
|
|
164
|
+
# @return [Peddler::Parser]
|
|
165
|
+
def manage_report_schedule(report_type, schedule, opts = {})
|
|
166
|
+
operation('ManageReportSchedule')
|
|
167
|
+
.add(opts.merge('ReportType' => report_type, 'Schedule' => schedule))
|
|
168
|
+
|
|
169
|
+
run
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
# List scheduled reports
|
|
173
|
+
#
|
|
174
|
+
# @see http://docs.developer.amazonservices.com/en_US/reports/Reports_GetReportScheduleList.html
|
|
175
|
+
# @param report_type_list [*Array<String>]
|
|
176
|
+
# @return [Peddler::Parser]
|
|
177
|
+
def get_report_schedule_list(*report_type_list)
|
|
178
|
+
operation('GetReportScheduleList')
|
|
179
|
+
.add('ReportTypeList' => report_type_list)
|
|
180
|
+
.structure!('ReportTypeList', 'Type')
|
|
181
|
+
|
|
182
|
+
run
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
# List next page of scheduled reports
|
|
186
|
+
#
|
|
187
|
+
# @see http://docs.developer.amazonservices.com/en_US/reports/Reports_GetReportScheduleListByNextToken.html
|
|
188
|
+
# @param next_token [String]
|
|
189
|
+
# @raise [NotImplementedError]
|
|
190
|
+
def get_report_schedule_list_by_next_token(token = next_token)
|
|
191
|
+
raise NotImplementedError
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
# Count scheduled reports
|
|
195
|
+
#
|
|
196
|
+
# @see http://docs.developer.amazonservices.com/en_US/reports/Reports_GetReportScheduleCount.html
|
|
197
|
+
# @param report_type_list [Array<String>]
|
|
198
|
+
# @return [Peddler::Parser]
|
|
199
|
+
def get_report_schedule_count(*report_type_list)
|
|
200
|
+
operation('GetReportScheduleCount')
|
|
201
|
+
.add('ReportTypeList' => report_type_list)
|
|
202
|
+
.structure!('ReportTypeList', 'Type')
|
|
203
|
+
|
|
204
|
+
run
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
# Update acknowledged status of one or more reports
|
|
208
|
+
#
|
|
209
|
+
# @see http://docs.developer.amazonservices.com/en_US/reports/Reports_UpdateReportAcknowledgements.html
|
|
210
|
+
# @param acknowledged [Boolean]
|
|
211
|
+
# @param report_id_list [Array<String>]
|
|
212
|
+
# @return [Peddler::Parser]
|
|
213
|
+
def update_report_acknowledgements(acknowledged, *report_id_list)
|
|
214
|
+
operation('UpdateReportAcknowledgement')
|
|
215
|
+
.add('ReportIdList' => report_id_list, 'Acknowledged' => acknowledged)
|
|
216
|
+
.structure!('ReportIdList', 'Id')
|
|
217
|
+
|
|
218
|
+
run
|
|
219
|
+
end
|
|
220
|
+
end
|
|
221
|
+
end
|
data/lib/mws/sellers.rb
CHANGED
|
@@ -1 +1,40 @@
|
|
|
1
|
-
require '
|
|
1
|
+
require 'peddler/client'
|
|
2
|
+
|
|
3
|
+
module MWS
|
|
4
|
+
# The Sellers API lets sellers retrieve information about their seller
|
|
5
|
+
# account, such as the marketplaces they participate in.
|
|
6
|
+
class Sellers < ::Peddler::Client
|
|
7
|
+
path 'Sellers/2011-07-01'
|
|
8
|
+
|
|
9
|
+
# Lists the marketplaces the seller participates in
|
|
10
|
+
#
|
|
11
|
+
# @see http://docs.developer.amazonservices.com/en_US/sellers/Sellers_ListMarketplaceParticipations.html
|
|
12
|
+
# @param next_token [String]
|
|
13
|
+
# @return [Peddler::Parser]
|
|
14
|
+
def list_marketplace_participations
|
|
15
|
+
operation('ListMarketplaceParticipations')
|
|
16
|
+
run
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# Lists the next page of marketplaces the seller participates in
|
|
20
|
+
#
|
|
21
|
+
# @see http://docs.developer.amazonservices.com/en_US/sellers/Sellers_ListMarketplaceParticipationsByNextToken.html
|
|
22
|
+
# @param next_token [String]
|
|
23
|
+
# @return [Peddler::Parser]
|
|
24
|
+
def list_marketplace_participations_by_next_token(next_token)
|
|
25
|
+
operation('ListMarketplaceParticipationsByNextToken')
|
|
26
|
+
.add('NextToken' => next_token)
|
|
27
|
+
|
|
28
|
+
run
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Gets the service status of the API
|
|
32
|
+
#
|
|
33
|
+
# @see http://docs.developer.amazonservices.com/en_US/sellers/MWS_GetServiceStatus.html
|
|
34
|
+
# @return [Peddler::Parser]
|
|
35
|
+
def get_service_status
|
|
36
|
+
operation('GetServiceStatus')
|
|
37
|
+
run
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
data/lib/mws/subscriptions.rb
CHANGED
|
@@ -1 +1,175 @@
|
|
|
1
|
-
require '
|
|
1
|
+
require 'peddler/client'
|
|
2
|
+
|
|
3
|
+
module MWS
|
|
4
|
+
# The Amazon MWS Subscriptions API section enables you to subscribe to
|
|
5
|
+
# receive notifications that are relevant to your business with Amazon. With
|
|
6
|
+
# the operations in the Subscriptions API section, you can register to
|
|
7
|
+
# receive important information from Amazon without having to poll the
|
|
8
|
+
# Amazon MWS service. Instead, the information is sent directly to you when
|
|
9
|
+
# an event occurs to which you are subscribed.
|
|
10
|
+
class Subscriptions < ::Peddler::Client
|
|
11
|
+
path 'Subscriptions/2013-07-01'
|
|
12
|
+
|
|
13
|
+
# Registers a new destination to receive notifications
|
|
14
|
+
#
|
|
15
|
+
# @see http://docs.developer.amazonservices.com/en_US/subscriptions/Subscriptions_RegisterDestination.html
|
|
16
|
+
# @method register_destination
|
|
17
|
+
# @overload register_destination(sqs_queue_url, marketplace_id = marketplace_id)
|
|
18
|
+
# @param sqs_queue_url [String]
|
|
19
|
+
# @param marketplace_id [String]
|
|
20
|
+
# @return [Peddler::Parser]
|
|
21
|
+
def register_destination(sqs_queue_url, marketplace_id = marketplace_id)
|
|
22
|
+
operation('RegisterDestination')
|
|
23
|
+
.add('MarketplaceId' => marketplace_id)
|
|
24
|
+
.add(build_destination(sqs_queue_url))
|
|
25
|
+
|
|
26
|
+
run
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Removes an existing destination from the list of registered destinations
|
|
30
|
+
#
|
|
31
|
+
# @see http://docs.developer.amazonservices.com/en_US/subscriptions/Subscriptions_DeregisterDestination.html
|
|
32
|
+
# @method deregister_destination
|
|
33
|
+
# @overload deregister_destination(sqs_queue_url, marketplace_id = marketplace_id)
|
|
34
|
+
# @param sqs_queue_url [String]
|
|
35
|
+
# @param marketplace_id [String]
|
|
36
|
+
# @return [Peddler::Parser]
|
|
37
|
+
def deregister_destination(sqs_queue_url, marketplace_id = marketplace_id)
|
|
38
|
+
operation('DeregisterDestination')
|
|
39
|
+
.add('MarketplaceId' => marketplace_id)
|
|
40
|
+
.add(build_destination(sqs_queue_url))
|
|
41
|
+
|
|
42
|
+
run
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Lists all registered destinations
|
|
46
|
+
#
|
|
47
|
+
# @see http://docs.developer.amazonservices.com/en_US/subscriptions/Subscriptions_ListRegisteredDestinations.html
|
|
48
|
+
# @param marketplace_id [String]
|
|
49
|
+
# @return [Peddler::Parser]
|
|
50
|
+
def list_registered_destinations( marketplace_id = marketplace_id)
|
|
51
|
+
operation('ListRegisteredDestinations')
|
|
52
|
+
.add('MarketplaceId' => marketplace_id)
|
|
53
|
+
|
|
54
|
+
run
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Sends a test notification to an existing destination
|
|
58
|
+
#
|
|
59
|
+
# @see http://docs.developer.amazonservices.com/en_US/subscriptions/Subscriptions_SendTestNotificationToDestination.html
|
|
60
|
+
# @method send_test_notification_to_destination
|
|
61
|
+
# @overload send_test_notification_to_destination(sqs_queue_url, marketplace_id = marketplace_id)
|
|
62
|
+
# @param sqs_queue_url [String]
|
|
63
|
+
# @param marketplace_id [String]
|
|
64
|
+
# @return [Peddler::Parser]
|
|
65
|
+
def send_test_notification_to_destination(sqs_queue_url, marketplace_id = marketplace_id)
|
|
66
|
+
operation('SendTestNotificationToDestination')
|
|
67
|
+
.add('MarketplaceId' => marketplace_id)
|
|
68
|
+
.add(build_destination(sqs_queue_url))
|
|
69
|
+
|
|
70
|
+
run
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Creates a new subscription
|
|
74
|
+
#
|
|
75
|
+
# @see http://docs.developer.amazonservices.com/en_US/subscriptions/Subscriptions_CreateSubscription.html
|
|
76
|
+
# @param notification_type [String]
|
|
77
|
+
# @param sqs_queue_url [String]
|
|
78
|
+
# @param marketplace_id [String]
|
|
79
|
+
# @return [Peddler::Parser]
|
|
80
|
+
def create_subscription(notification_type, sqs_queue_url, marketplace_id = marketplace_id)
|
|
81
|
+
operation('CreateSubscription')
|
|
82
|
+
.add('MarketplaceId' => marketplace_id)
|
|
83
|
+
.add(build_subscription(notification_type, sqs_queue_url))
|
|
84
|
+
|
|
85
|
+
run
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# Gets a subscription
|
|
89
|
+
#
|
|
90
|
+
# @see http://docs.developer.amazonservices.com/en_US/subscriptions/Subscriptions_GetSubscription.html
|
|
91
|
+
# @param notification_type [String]
|
|
92
|
+
# @param sqs_queue_url [String]
|
|
93
|
+
# @param marketplace_id [String]
|
|
94
|
+
# @return [Peddler::Parser]
|
|
95
|
+
def get_subscription(notification_type, sqs_queue_url, marketplace_id = marketplace_id)
|
|
96
|
+
operation('GetSubscription')
|
|
97
|
+
.add('MarketplaceId' => marketplace_id, 'NotificationType' => notification_type)
|
|
98
|
+
.add(build_destination(sqs_queue_url))
|
|
99
|
+
|
|
100
|
+
run
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# Deletes a subscription
|
|
104
|
+
#
|
|
105
|
+
# @see http://docs.developer.amazonservices.com/en_US/subscriptions/Subscriptions_DeleteSubscription.html
|
|
106
|
+
# @param notification_type [String]
|
|
107
|
+
# @param sqs_queue_url [String]
|
|
108
|
+
# @param marketplace_id [String]
|
|
109
|
+
# @return [Peddler::Parser]
|
|
110
|
+
def delete_subscription(notification_type, sqs_queue_url, marketplace_id = marketplace_id)
|
|
111
|
+
operation('DeleteSubscription')
|
|
112
|
+
.add('MarketplaceId' => marketplace_id, 'NotificationType' => notification_type)
|
|
113
|
+
.add(build_destination(sqs_queue_url))
|
|
114
|
+
|
|
115
|
+
run
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
# Lists current subscriptions
|
|
119
|
+
#
|
|
120
|
+
# @see http://docs.developer.amazonservices.com/en_US/subscriptions/Subscriptions_ListSubscriptions.html
|
|
121
|
+
# @param marketplace_id [String]
|
|
122
|
+
# @return [Peddler::Parser]
|
|
123
|
+
def list_subscriptions(marketplace_id = marketplace_id)
|
|
124
|
+
operation('ListSubscriptions')
|
|
125
|
+
.add('MarketplaceId' => marketplace_id)
|
|
126
|
+
|
|
127
|
+
run
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
# Updates a subscription
|
|
131
|
+
#
|
|
132
|
+
# @see http://docs.developer.amazonservices.com/en_US/subscriptions/Subscriptions_UpdateSubscription.html
|
|
133
|
+
# @param notification_type [String]
|
|
134
|
+
# @param sqs_queue_url [String]
|
|
135
|
+
# @param enabled [Boolean]
|
|
136
|
+
# @param marketplace_id [String]
|
|
137
|
+
# @return [Peddler::Parser]
|
|
138
|
+
def update_subscription(notification_type, sqs_queue_url, enabled, marketplace_id = marketplace_id)
|
|
139
|
+
operation('CreateSubscription')
|
|
140
|
+
.add('MarketplaceId' => marketplace_id)
|
|
141
|
+
.add(build_subscription(notification_type, sqs_queue_url, enabled))
|
|
142
|
+
|
|
143
|
+
run
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
# Gets the service status of the API
|
|
147
|
+
#
|
|
148
|
+
# @see http://docs.developer.amazonservices.com/en_US/subscriptions/Subscriptions_GetServiceStatus.html
|
|
149
|
+
# @return [Peddler::Parser]
|
|
150
|
+
def get_service_status
|
|
151
|
+
operation('GetServiceStatus')
|
|
152
|
+
run
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
private
|
|
156
|
+
|
|
157
|
+
def build_destination(sqs_queue_url)
|
|
158
|
+
{
|
|
159
|
+
'Destination.DeliveryChannel' => 'SQS',
|
|
160
|
+
'Destination.AttributeList.member.1.Key' => 'sqsQueueUrl',
|
|
161
|
+
'Destination.AttributeList.member.1.Value' => sqs_queue_url
|
|
162
|
+
}
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
def build_subscription(notification_type, sqs_queue_url, enabled = true)
|
|
166
|
+
{
|
|
167
|
+
'Subscription.IsEnabled' => enabled,
|
|
168
|
+
'Subscription.NotificationType' => notification_type,
|
|
169
|
+
'Subscription.Destination.DeliveryChannel' => 'SQS',
|
|
170
|
+
'Subscription.Destination.AttributeList.member.1.Key' => 'sqsQueueUrl',
|
|
171
|
+
'Subscription.Destination.AttributeList.member.1.Value' => sqs_queue_url
|
|
172
|
+
}
|
|
173
|
+
end
|
|
174
|
+
end
|
|
175
|
+
end
|