peddler 1.3.0 → 1.4.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/README.md +8 -22
- data/lib/mws/fulfillment_outbound_shipment/client.rb +12 -5
- data/lib/mws/merchant_fulfillment/client.rb +2 -2
- data/lib/mws/orders/client.rb +9 -1
- data/lib/mws/products/client.rb +14 -1
- data/lib/mws/reports/client.rb +1 -1
- data/lib/mws.rb +0 -3
- data/lib/peddler/client.rb +12 -19
- data/lib/peddler/errors/builder.rb +20 -0
- data/lib/peddler/errors/error.rb +13 -0
- data/lib/peddler/errors/handler.rb +45 -0
- data/lib/peddler/errors/parser.rb +28 -0
- data/lib/peddler/flat_file_parser.rb +1 -1
- data/lib/peddler/marketplace.rb +2 -2
- data/lib/peddler/parser.rb +0 -1
- data/lib/peddler/structured_list.rb +1 -0
- data/lib/peddler/version.rb +1 -1
- data/lib/peddler/xml_parser.rb +1 -1
- data/test/helper.rb +1 -82
- data/test/integration/test_errors.rb +36 -0
- data/test/integration/test_feeds.rb +1 -1
- data/test/integration/test_fulfillment_inbound_shipment.rb +1 -1
- data/test/integration/test_fulfillment_inventory.rb +1 -1
- data/test/integration/test_fulfillment_outbound_shipment.rb +1 -1
- data/test/integration/test_merchant_fulfillment.rb +1 -1
- data/test/integration/test_off_amazon_payments.rb +1 -1
- data/test/integration/test_orders.rb +3 -1
- data/test/integration/test_products.rb +1 -1
- data/test/integration/test_recommendations.rb +2 -4
- data/test/integration/test_reports.rb +1 -1
- data/test/integration/test_sellers.rb +1 -1
- data/test/integration/test_subscriptions.rb +1 -1
- data/test/integration_helper.rb +41 -0
- data/test/mws.yml +28 -8
- data/test/mws.yml.example +21 -1
- data/test/recorder.rb +34 -0
- data/test/unit/mws/test_fulfillment_inbound_shipment_client.rb +2 -1
- data/test/unit/mws/test_fulfillment_outbound_shipment_client.rb +9 -2
- data/test/unit/mws/test_orders_client.rb +12 -0
- data/test/unit/mws/test_products_client.rb +37 -0
- data/test/unit/peddler/errors/test_builder.rb +16 -0
- data/test/unit/peddler/errors/test_error.rb +16 -0
- data/test/unit/peddler/errors/test_handler.rb +60 -0
- data/test/unit/peddler/{test_error_parser.rb → errors/test_parser.rb} +3 -3
- data/test/unit/peddler/test_client.rb +3 -3
- data/test/unit/peddler/test_flat_file_parser.rb +39 -30
- data/test/unit/peddler/test_structured_list.rb +5 -0
- data/test/unit/peddler/test_vcr_matcher.rb +4 -0
- data/test/unit/test_mws.rb +1 -1
- data/test/vcr_cassettes/CartInformation.yml +263 -13
- data/test/vcr_cassettes/CustomerInformation.yml +255 -5
- data/test/vcr_cassettes/Errors.yml +885 -0
- data/test/vcr_cassettes/Feeds.yml +5588 -17
- data/test/vcr_cassettes/FulfillmentInboundShipment.yml +3474 -39
- data/test/vcr_cassettes/FulfillmentInventory.yml +504 -9
- data/test/vcr_cassettes/FulfillmentOutboundShipment.yml +255 -5
- data/test/vcr_cassettes/MerchantFulfillment.yml +254 -4
- data/test/vcr_cassettes/OffAmazonPayments.yml +255 -5
- data/test/vcr_cassettes/Orders.yml +2696 -36
- data/test/vcr_cassettes/Products.yml +5534 -180
- data/test/vcr_cassettes/Recommendations.yml +847 -9
- data/test/vcr_cassettes/Reports.yml +3994 -101
- data/test/vcr_cassettes/Sellers.yml +255 -5
- data/test/vcr_cassettes/Subscriptions.yml +875 -13
- metadata +37 -27
- data/lib/mws/cart_information/client.rb +0 -74
- data/lib/mws/cart_information.rb +0 -1
- data/lib/mws/customer_information/client.rb +0 -80
- data/lib/mws/customer_information.rb +0 -1
- data/lib/mws/webstore/client.rb +0 -89
- data/lib/mws/webstore.rb +0 -1
- data/lib/peddler/error_parser.rb +0 -26
- data/test/integration/test_cart_information.rb +0 -11
- data/test/integration/test_customer_information.rb +0 -11
- data/test/integration/test_webstore.rb +0 -18
- data/test/unit/mws/test_cart_information_client.rb +0 -61
- data/test/unit/mws/test_customer_information_client.rb +0 -59
- data/test/unit/mws/test_webstore_client.rb +0 -101
- data/test/vcr_cassettes/Webstore.yml +0 -383
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: peddler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hakan Ensari
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: excon
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.50.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.50.0
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: jeff
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -48,10 +62,6 @@ files:
|
|
48
62
|
- LICENSE
|
49
63
|
- README.md
|
50
64
|
- lib/mws.rb
|
51
|
-
- lib/mws/cart_information.rb
|
52
|
-
- lib/mws/cart_information/client.rb
|
53
|
-
- lib/mws/customer_information.rb
|
54
|
-
- lib/mws/customer_information/client.rb
|
55
65
|
- lib/mws/feeds.rb
|
56
66
|
- lib/mws/feeds/client.rb
|
57
67
|
- lib/mws/finances.rb
|
@@ -78,11 +88,12 @@ files:
|
|
78
88
|
- lib/mws/sellers/client.rb
|
79
89
|
- lib/mws/subscriptions.rb
|
80
90
|
- lib/mws/subscriptions/client.rb
|
81
|
-
- lib/mws/webstore.rb
|
82
|
-
- lib/mws/webstore/client.rb
|
83
91
|
- lib/peddler.rb
|
84
92
|
- lib/peddler/client.rb
|
85
|
-
- lib/peddler/
|
93
|
+
- lib/peddler/errors/builder.rb
|
94
|
+
- lib/peddler/errors/error.rb
|
95
|
+
- lib/peddler/errors/handler.rb
|
96
|
+
- lib/peddler/errors/parser.rb
|
86
97
|
- lib/peddler/flat_file_parser.rb
|
87
98
|
- lib/peddler/marketplace.rb
|
88
99
|
- lib/peddler/operation.rb
|
@@ -93,8 +104,7 @@ files:
|
|
93
104
|
- lib/peddler/xml_parser.rb
|
94
105
|
- lib/peddler/xml_response_parser.rb
|
95
106
|
- test/helper.rb
|
96
|
-
- test/integration/
|
97
|
-
- test/integration/test_customer_information.rb
|
107
|
+
- test/integration/test_errors.rb
|
98
108
|
- test/integration/test_feeds.rb
|
99
109
|
- test/integration/test_fulfillment_inbound_shipment.rb
|
100
110
|
- test/integration/test_fulfillment_inventory.rb
|
@@ -107,12 +117,11 @@ files:
|
|
107
117
|
- test/integration/test_reports.rb
|
108
118
|
- test/integration/test_sellers.rb
|
109
119
|
- test/integration/test_subscriptions.rb
|
110
|
-
- test/
|
120
|
+
- test/integration_helper.rb
|
111
121
|
- test/mws.yml
|
112
122
|
- test/mws.yml.example
|
113
123
|
- test/null_client.rb
|
114
|
-
- test/
|
115
|
-
- test/unit/mws/test_customer_information_client.rb
|
124
|
+
- test/recorder.rb
|
116
125
|
- test/unit/mws/test_feeds_client.rb
|
117
126
|
- test/unit/mws/test_finances_client.rb
|
118
127
|
- test/unit/mws/test_fulfillment_inbound_shipment_client.rb
|
@@ -126,9 +135,11 @@ files:
|
|
126
135
|
- test/unit/mws/test_reports_client.rb
|
127
136
|
- test/unit/mws/test_sellers_client.rb
|
128
137
|
- test/unit/mws/test_subscriptions_client.rb
|
129
|
-
- test/unit/
|
138
|
+
- test/unit/peddler/errors/test_builder.rb
|
139
|
+
- test/unit/peddler/errors/test_error.rb
|
140
|
+
- test/unit/peddler/errors/test_handler.rb
|
141
|
+
- test/unit/peddler/errors/test_parser.rb
|
130
142
|
- test/unit/peddler/test_client.rb
|
131
|
-
- test/unit/peddler/test_error_parser.rb
|
132
143
|
- test/unit/peddler/test_flat_file_parser.rb
|
133
144
|
- test/unit/peddler/test_marketplace.rb
|
134
145
|
- test/unit/peddler/test_operation.rb
|
@@ -140,6 +151,7 @@ files:
|
|
140
151
|
- test/unit/test_mws.rb
|
141
152
|
- test/vcr_cassettes/CartInformation.yml
|
142
153
|
- test/vcr_cassettes/CustomerInformation.yml
|
154
|
+
- test/vcr_cassettes/Errors.yml
|
143
155
|
- test/vcr_cassettes/Feeds.yml
|
144
156
|
- test/vcr_cassettes/FulfillmentInboundShipment.yml
|
145
157
|
- test/vcr_cassettes/FulfillmentInventory.yml
|
@@ -153,7 +165,6 @@ files:
|
|
153
165
|
- test/vcr_cassettes/Reports.yml
|
154
166
|
- test/vcr_cassettes/Sellers.yml
|
155
167
|
- test/vcr_cassettes/Subscriptions.yml
|
156
|
-
- test/vcr_cassettes/Webstore.yml
|
157
168
|
homepage: https://github.com/hakanensari/peddler
|
158
169
|
licenses:
|
159
170
|
- MIT
|
@@ -166,7 +177,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
166
177
|
requirements:
|
167
178
|
- - ">="
|
168
179
|
- !ruby/object:Gem::Version
|
169
|
-
version: '
|
180
|
+
version: '2.0'
|
170
181
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
171
182
|
requirements:
|
172
183
|
- - ">="
|
@@ -180,8 +191,7 @@ specification_version: 4
|
|
180
191
|
summary: Wraps the Amazon MWS APIs
|
181
192
|
test_files:
|
182
193
|
- test/helper.rb
|
183
|
-
- test/integration/
|
184
|
-
- test/integration/test_customer_information.rb
|
194
|
+
- test/integration/test_errors.rb
|
185
195
|
- test/integration/test_feeds.rb
|
186
196
|
- test/integration/test_fulfillment_inbound_shipment.rb
|
187
197
|
- test/integration/test_fulfillment_inventory.rb
|
@@ -194,12 +204,11 @@ test_files:
|
|
194
204
|
- test/integration/test_reports.rb
|
195
205
|
- test/integration/test_sellers.rb
|
196
206
|
- test/integration/test_subscriptions.rb
|
197
|
-
- test/
|
207
|
+
- test/integration_helper.rb
|
198
208
|
- test/mws.yml
|
199
209
|
- test/mws.yml.example
|
200
210
|
- test/null_client.rb
|
201
|
-
- test/
|
202
|
-
- test/unit/mws/test_customer_information_client.rb
|
211
|
+
- test/recorder.rb
|
203
212
|
- test/unit/mws/test_feeds_client.rb
|
204
213
|
- test/unit/mws/test_finances_client.rb
|
205
214
|
- test/unit/mws/test_fulfillment_inbound_shipment_client.rb
|
@@ -213,9 +222,11 @@ test_files:
|
|
213
222
|
- test/unit/mws/test_reports_client.rb
|
214
223
|
- test/unit/mws/test_sellers_client.rb
|
215
224
|
- test/unit/mws/test_subscriptions_client.rb
|
216
|
-
- test/unit/
|
225
|
+
- test/unit/peddler/errors/test_builder.rb
|
226
|
+
- test/unit/peddler/errors/test_error.rb
|
227
|
+
- test/unit/peddler/errors/test_handler.rb
|
228
|
+
- test/unit/peddler/errors/test_parser.rb
|
217
229
|
- test/unit/peddler/test_client.rb
|
218
|
-
- test/unit/peddler/test_error_parser.rb
|
219
230
|
- test/unit/peddler/test_flat_file_parser.rb
|
220
231
|
- test/unit/peddler/test_marketplace.rb
|
221
232
|
- test/unit/peddler/test_operation.rb
|
@@ -227,6 +238,7 @@ test_files:
|
|
227
238
|
- test/unit/test_mws.rb
|
228
239
|
- test/vcr_cassettes/CartInformation.yml
|
229
240
|
- test/vcr_cassettes/CustomerInformation.yml
|
241
|
+
- test/vcr_cassettes/Errors.yml
|
230
242
|
- test/vcr_cassettes/Feeds.yml
|
231
243
|
- test/vcr_cassettes/FulfillmentInboundShipment.yml
|
232
244
|
- test/vcr_cassettes/FulfillmentInventory.yml
|
@@ -240,5 +252,3 @@ test_files:
|
|
240
252
|
- test/vcr_cassettes/Reports.yml
|
241
253
|
- test/vcr_cassettes/Sellers.yml
|
242
254
|
- test/vcr_cassettes/Subscriptions.yml
|
243
|
-
- test/vcr_cassettes/Webstore.yml
|
244
|
-
has_rdoc:
|
@@ -1,74 +0,0 @@
|
|
1
|
-
require 'peddler/client'
|
2
|
-
|
3
|
-
module MWS
|
4
|
-
module CartInformation
|
5
|
-
# With the Cart Information API, you can retrieve shopping carts that your
|
6
|
-
# Amazon Webstore customers have created. The Cart Information API enables
|
7
|
-
# you to programmatically integrate Amazon Webstore cart information with
|
8
|
-
# your CRM systems, marketing applications, and other systems that require
|
9
|
-
# cart data.
|
10
|
-
#
|
11
|
-
# @note The Cart Information API only returns cart information for Webstores
|
12
|
-
# with Seller-Branded Checkout. No cart information is returned for Amazon
|
13
|
-
# Webstores with Amazon.com checkout. If your Webstore offers both
|
14
|
-
# checkout options, cart information is returned only for Seller-Branded
|
15
|
-
# Checkout accounts.
|
16
|
-
# @note In addition to registering for Amazon MWS, you must also request
|
17
|
-
# authorization to use the Cart Information API section.
|
18
|
-
class Client < ::Peddler::Client
|
19
|
-
version '2014-03-01'
|
20
|
-
path "/CartInformation/#{version}"
|
21
|
-
|
22
|
-
# Lists shopping carts
|
23
|
-
#
|
24
|
-
# @see http://docs.developer.amazonservices.com/en_US/cart_info/CartInfo_ListCarts.html
|
25
|
-
# @param [String, #iso8601] date_range_start
|
26
|
-
# @param [Hash] opts
|
27
|
-
# @option opts [String] :marketplace_id
|
28
|
-
# @option opts [String, #iso8601] :date_range_end
|
29
|
-
# @return [Peddler::XMLParser]
|
30
|
-
def list_carts(date_range_start, opts = {})
|
31
|
-
operation('ListCarts')
|
32
|
-
.add(opts.update('DateRangeStart' => date_range_start))
|
33
|
-
|
34
|
-
run
|
35
|
-
end
|
36
|
-
|
37
|
-
# Lists the next page of shopping carts
|
38
|
-
#
|
39
|
-
# @see http://docs.developer.amazonservices.com/en_US/cart_info/CartInfo_ListCartsByNextToken.html
|
40
|
-
# @param [String] next_token
|
41
|
-
# @return [Peddler::XMLParser]
|
42
|
-
def list_carts_by_next_token(next_token)
|
43
|
-
operation('ListCartsByNextToken')
|
44
|
-
.add('NextToken' => next_token)
|
45
|
-
|
46
|
-
run
|
47
|
-
end
|
48
|
-
|
49
|
-
# Returns shopping carts based on specified values
|
50
|
-
#
|
51
|
-
# @see http://docs.developer.amazonservices.com/en_US/cart_info/CartInfo_GetCarts.html
|
52
|
-
# @overload get_carts(marketplace_id, *cart_ids)
|
53
|
-
# @param [String] marketplace_id
|
54
|
-
# @param [String] cart_id one or more cart_ids
|
55
|
-
# @return [Peddler::XMLParser]
|
56
|
-
def get_carts(marketplace_id, *cart_id_list)
|
57
|
-
operation('GetCarts')
|
58
|
-
.add('MarketplaceId' => marketplace_id, 'CartIdList' => cart_id_list)
|
59
|
-
.structure!('CartIdList', 'CartId')
|
60
|
-
|
61
|
-
run
|
62
|
-
end
|
63
|
-
|
64
|
-
# Gets the service status of the API
|
65
|
-
#
|
66
|
-
# @see http://docs.developer.amazonservices.com/en_US/cart_info/MWS_GetServiceStatus.html
|
67
|
-
# @return [Peddler::XMLParser]
|
68
|
-
def get_service_status
|
69
|
-
operation('GetServiceStatus')
|
70
|
-
run
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
data/lib/mws/cart_information.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require 'mws/cart_information/client'
|
@@ -1,80 +0,0 @@
|
|
1
|
-
require 'peddler/client'
|
2
|
-
|
3
|
-
module MWS
|
4
|
-
module CustomerInformation
|
5
|
-
# With the Customer Information API, you can retrieve information from the
|
6
|
-
# customer accounts of your Amazon Webstore customers. This customer
|
7
|
-
# information includes customer name, contact information, customer account
|
8
|
-
# type, and associated Amazon Webstore marketplaces. The Customer
|
9
|
-
# Information API enables you to programmatically integrate Amazon Webstore
|
10
|
-
# customer account information with your CRM systems, marketing
|
11
|
-
# applications, and other systems that require customer data.
|
12
|
-
#
|
13
|
-
# @note The Customer Information API section only returns customer
|
14
|
-
# information for Webstores with Seller-Branded Checkout. No customer
|
15
|
-
# information is returned for Webstores with Amazon.com checkout. If your
|
16
|
-
# Webstore offers both checkout options, customer information is returned
|
17
|
-
# only for Seller-Branded Checkout accounts.
|
18
|
-
# @note In addition to registering for Amazon MWS, you must request
|
19
|
-
# authorization to use the Customer Information API.
|
20
|
-
class Client < ::Peddler::Client
|
21
|
-
version '2014-03-01'
|
22
|
-
path "/CustomerInformation/#{version}"
|
23
|
-
|
24
|
-
# Lists customer accounts based on search criteria that you specify
|
25
|
-
#
|
26
|
-
# @see http://docs.developer.amazonservices.com/en_US/customer_info/CustomerInfo_ListCustomers.html
|
27
|
-
# @param [Hash] opts
|
28
|
-
# @option opts [String] :marketplace_id
|
29
|
-
# @option opts [String, #iso8601] :date_range_start
|
30
|
-
# @option opts [String, #iso8601] :date_range_end
|
31
|
-
# @option opts [String] :date_range_type
|
32
|
-
# @return [Peddler::XMLParser]
|
33
|
-
def list_customers(opts = {})
|
34
|
-
operation('ListCustomers')
|
35
|
-
.add(opts)
|
36
|
-
|
37
|
-
run
|
38
|
-
end
|
39
|
-
|
40
|
-
# Lists the next page of customer accounts
|
41
|
-
#
|
42
|
-
# @see http://docs.developer.amazonservices.com/en_US/customer_info/CustomerInfo_ListCustomersByNextToken.html
|
43
|
-
# @param [String] next_token
|
44
|
-
# @return [Peddler::XMLParser]
|
45
|
-
def list_customers_by_next_token(next_token)
|
46
|
-
operation('ListCustomersByNextToken')
|
47
|
-
.add('NextToken' => next_token)
|
48
|
-
|
49
|
-
run
|
50
|
-
end
|
51
|
-
|
52
|
-
# Returns customer accounts based on the CustomerId values that you
|
53
|
-
# specify
|
54
|
-
#
|
55
|
-
# @see http://docs.developer.amazonservices.com/en_US/customer_info/CustomerInfo_GetCustomersForCustomerId.html
|
56
|
-
# @overload get_customers_for_customer_id(*customer_ids, opts = {})
|
57
|
-
# @param [String] customer_id one or more customer_ids
|
58
|
-
# @param [Hash] opts
|
59
|
-
# @option opts [String] :marketplace_id
|
60
|
-
# @return [Peddler::XMLParser]
|
61
|
-
def get_customers_for_customer_id(*customer_id_list)
|
62
|
-
opts = extract_options(customer_id_list)
|
63
|
-
operation('GetCustomersForCustomerId')
|
64
|
-
.add(opts.update('CustomerIdList' => customer_id_list))
|
65
|
-
.structure!('CustomerIdList', 'CustomerId')
|
66
|
-
|
67
|
-
run
|
68
|
-
end
|
69
|
-
|
70
|
-
# Gets the service status of the API
|
71
|
-
#
|
72
|
-
# @see http://docs.developer.amazonservices.com/en_US/customer_info/MWS_GetServiceStatus.html
|
73
|
-
# @return [Peddler::XMLParser]
|
74
|
-
def get_service_status
|
75
|
-
operation('GetServiceStatus')
|
76
|
-
run
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
require 'mws/customer_information/client'
|
data/lib/mws/webstore/client.rb
DELETED
@@ -1,89 +0,0 @@
|
|
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
|
-
version '2014-09-01'
|
17
|
-
path "/Webstore/#{version}/"
|
18
|
-
|
19
|
-
# Lists subscription counts of subscriptions in a specified state,
|
20
|
-
# including the items that are subscribed to
|
21
|
-
#
|
22
|
-
# @see http://docs.developer.amazonservices.com/en_US/webstore/Webstore_ListSubscriptionsCount.html
|
23
|
-
# @overload list_subscriptions_count(subscription_state, opts = { marketplace_id: primary_marketplace_id })
|
24
|
-
# @param [String] subscription_state
|
25
|
-
# @param [Hash] opts
|
26
|
-
# @option opts [String] :marketplace_id
|
27
|
-
# @option opts [String, #iso8601] :date_range_start
|
28
|
-
# @option opts [String, #iso8601] :date_range_end
|
29
|
-
# @option opts [Array<String>] :seller_sku_list
|
30
|
-
# @return [Peddler::XMLParser]
|
31
|
-
def list_subscriptions_count(subscription_state, opts = {})
|
32
|
-
opts[:marketplace_id] ||= primary_marketplace_id
|
33
|
-
if opts.key?(:seller_sku_list)
|
34
|
-
opts['SellerSKUList'] = opts.delete(:seller_sku_list)
|
35
|
-
end
|
36
|
-
operation('ListSubscriptionsCount')
|
37
|
-
.add(opts.update('SubscriptionState' => subscription_state))
|
38
|
-
.structure!('SellerSKUList', 'SellerSKU')
|
39
|
-
|
40
|
-
run
|
41
|
-
end
|
42
|
-
|
43
|
-
# Lists the next page of subscription counts
|
44
|
-
#
|
45
|
-
# @see http://docs.developer.amazonservices.com/en_US/webstore/Webstore_ListSubscriptionsCountByNextToken.html
|
46
|
-
# @param [String] next_token
|
47
|
-
# @return [Peddler::XMLParser]
|
48
|
-
def list_subscriptions_count_by_next_token(next_token)
|
49
|
-
operation('ListSubscriptionsCountByNextToken')
|
50
|
-
.add('NextToken' => next_token)
|
51
|
-
|
52
|
-
run
|
53
|
-
end
|
54
|
-
|
55
|
-
# Gets the number of subscriptions that were created or notifications that
|
56
|
-
# were sent for an item within a date range
|
57
|
-
#
|
58
|
-
# @see http://docs.developer.amazonservices.com/en_US/webstore/Webstore_ListSubscriptionsCount.html
|
59
|
-
# @overload get_subscription_details(seller_sku, subscription_state, date_range_start, opts = { marketplace_id: marketplace_id })
|
60
|
-
# @param [String] seller_sku
|
61
|
-
# @param [String] subscription_state
|
62
|
-
# @param [String, #iso8601] date_range_start
|
63
|
-
# @param [Hash] opts
|
64
|
-
# @option opts [String] :marketplace_id
|
65
|
-
# @option opts [String, #iso8601] :date_range_end
|
66
|
-
# @return [Peddler::XMLParser]
|
67
|
-
def get_subscription_details(seller_sku, subscription_state, date_range_start, opts = {})
|
68
|
-
opts[:marketplace_id] ||= primary_marketplace_id
|
69
|
-
operation('GetSubscriptionDetails')
|
70
|
-
.add(opts.update(
|
71
|
-
'SellerSKU' => seller_sku,
|
72
|
-
'SubscriptionState' => subscription_state,
|
73
|
-
'DateRangeStart' => date_range_start
|
74
|
-
))
|
75
|
-
|
76
|
-
run
|
77
|
-
end
|
78
|
-
|
79
|
-
# Gets the service status of the API
|
80
|
-
#
|
81
|
-
# @see http://docs.developer.amazonservices.com/en_US/webstore/MWS_GetServiceStatus.html
|
82
|
-
# @return [Peddler::XMLParser]
|
83
|
-
def get_service_status
|
84
|
-
operation('GetServiceStatus')
|
85
|
-
run
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
data/lib/mws/webstore.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require 'mws/webstore/client'
|
data/lib/peddler/error_parser.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
require 'peddler/xml_parser'
|
2
|
-
|
3
|
-
module Peddler
|
4
|
-
# @api private
|
5
|
-
class ErrorParser < XMLParser
|
6
|
-
def message
|
7
|
-
parse['Message']
|
8
|
-
end
|
9
|
-
|
10
|
-
def type
|
11
|
-
parse['Type']
|
12
|
-
end
|
13
|
-
|
14
|
-
def code
|
15
|
-
parse['Code']
|
16
|
-
end
|
17
|
-
|
18
|
-
private
|
19
|
-
|
20
|
-
def find_data
|
21
|
-
xml
|
22
|
-
.fetch('ErrorResponse', {})
|
23
|
-
.fetch('Error', {})
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
require '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
|
@@ -1,61 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
require 'mws/cart_information/client'
|
3
|
-
|
4
|
-
class TestMWSCartInformationClient < MiniTest::Test
|
5
|
-
def setup
|
6
|
-
@client = MWS::CartInformation::Client.new
|
7
|
-
end
|
8
|
-
|
9
|
-
def test_lists_carts
|
10
|
-
operation = {
|
11
|
-
'Action' => 'ListCarts',
|
12
|
-
'DateRangeStart' => '1'
|
13
|
-
}
|
14
|
-
|
15
|
-
@client.stub(:run, nil) do
|
16
|
-
@client.list_carts('1')
|
17
|
-
end
|
18
|
-
|
19
|
-
assert_equal operation, @client.operation
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_lists_carts_by_next_token
|
23
|
-
operation = {
|
24
|
-
'Action' => 'ListCartsByNextToken',
|
25
|
-
'NextToken' => '1'
|
26
|
-
}
|
27
|
-
|
28
|
-
@client.stub(:run, nil) do
|
29
|
-
@client.list_carts_by_next_token('1')
|
30
|
-
end
|
31
|
-
|
32
|
-
assert_equal operation, @client.operation
|
33
|
-
end
|
34
|
-
|
35
|
-
def test_gets_carts
|
36
|
-
operation = {
|
37
|
-
'Action' => 'GetCarts',
|
38
|
-
'MarketplaceId' => '1',
|
39
|
-
'CartIdList.CartId.1' => '2',
|
40
|
-
'CartIdList.CartId.2' => '3'
|
41
|
-
}
|
42
|
-
|
43
|
-
@client.stub(:run, nil) do
|
44
|
-
@client.get_carts('1', '2', '3')
|
45
|
-
end
|
46
|
-
|
47
|
-
assert_equal operation, @client.operation
|
48
|
-
end
|
49
|
-
|
50
|
-
def test_gets_service_status
|
51
|
-
operation = {
|
52
|
-
'Action' => 'GetServiceStatus'
|
53
|
-
}
|
54
|
-
|
55
|
-
@client.stub(:run, nil) do
|
56
|
-
@client.get_service_status
|
57
|
-
end
|
58
|
-
|
59
|
-
assert_equal operation, @client.operation
|
60
|
-
end
|
61
|
-
end
|
@@ -1,59 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
require 'mws/customer_information/client'
|
3
|
-
|
4
|
-
class TestMWSCustomerInformationClient < MiniTest::Test
|
5
|
-
def setup
|
6
|
-
@client = MWS::CustomerInformation::Client.new
|
7
|
-
end
|
8
|
-
|
9
|
-
def test_lists_customers
|
10
|
-
operation = {
|
11
|
-
'Action' => 'ListCustomers'
|
12
|
-
}
|
13
|
-
|
14
|
-
@client.stub(:run, nil) do
|
15
|
-
@client.list_customers
|
16
|
-
end
|
17
|
-
|
18
|
-
assert_equal operation, @client.operation
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_lists_customers_by_next_token
|
22
|
-
operation = {
|
23
|
-
'Action' => 'ListCustomersByNextToken',
|
24
|
-
'NextToken' => '1'
|
25
|
-
}
|
26
|
-
|
27
|
-
@client.stub(:run, nil) do
|
28
|
-
@client.list_customers_by_next_token('1')
|
29
|
-
end
|
30
|
-
|
31
|
-
assert_equal operation, @client.operation
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_gets_customers_for_customer_id
|
35
|
-
operation = {
|
36
|
-
'Action' => 'GetCustomersForCustomerId',
|
37
|
-
'CustomerIdList.CustomerId.1' => '1',
|
38
|
-
'CustomerIdList.CustomerId.2' => '2'
|
39
|
-
}
|
40
|
-
|
41
|
-
@client.stub(:run, nil) do
|
42
|
-
@client.get_customers_for_customer_id('1', '2')
|
43
|
-
end
|
44
|
-
|
45
|
-
assert_equal operation, @client.operation
|
46
|
-
end
|
47
|
-
|
48
|
-
def test_gets_service_status
|
49
|
-
operation = {
|
50
|
-
'Action' => 'GetServiceStatus'
|
51
|
-
}
|
52
|
-
|
53
|
-
@client.stub(:run, nil) do
|
54
|
-
@client.get_service_status
|
55
|
-
end
|
56
|
-
|
57
|
-
assert_equal operation, @client.operation
|
58
|
-
end
|
59
|
-
end
|