peddler 1.6.7 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +69 -67
- data/lib/mws/feeds/client.rb +15 -12
- data/lib/mws/finances/client.rb +12 -11
- data/lib/mws/fulfillment_inbound_shipment/client.rb +79 -107
- data/lib/mws/fulfillment_inventory/client.rb +5 -5
- data/lib/mws/fulfillment_outbound_shipment/client.rb +36 -44
- data/lib/mws/merchant_fulfillment/client.rb +11 -17
- data/lib/mws/off_amazon_payments/client.rb +38 -68
- data/lib/mws/orders/client.rb +28 -24
- data/lib/mws/products/client.rb +118 -153
- data/lib/mws/recommendations/client.rb +13 -17
- data/lib/mws/reports/client.rb +24 -23
- data/lib/mws/sellers/client.rb +5 -5
- data/lib/mws/subscriptions/client.rb +25 -36
- data/lib/peddler/client.rb +47 -124
- data/lib/peddler/errors/builder.rb +40 -14
- data/lib/peddler/errors/class_generator.rb +34 -0
- data/lib/peddler/errors/error.rb +13 -3
- data/lib/peddler/headers.rb +27 -11
- data/lib/peddler/marketplace.rb +30 -11
- data/lib/peddler/vcr_matcher.rb +11 -1
- data/lib/peddler/version.rb +1 -1
- data/lib/peddler/xml_parser.rb +4 -2
- data/lib/peddler/xml_response_parser.rb +1 -1
- data/test/helper.rb +0 -1
- data/test/integration/test_errors.rb +2 -14
- data/test/integration/test_feeds.rb +0 -3
- data/test/integration/test_multibyte_queries.rb +1 -1
- data/test/integration/test_mws_headers.rb +3 -2
- data/test/integration/test_orders.rb +2 -1
- data/test/integration/test_products.rb +9 -9
- data/test/integration/test_recommendations.rb +1 -1
- data/test/integration/test_subscriptions.rb +2 -2
- data/test/integration_helper.rb +1 -1
- data/test/mws.yml +36 -0
- data/test/mws.yml.example +8 -12
- data/test/null_client.rb +10 -8
- data/test/unit/mws/test_feeds_client.rb +1 -2
- data/test/unit/mws/test_fulfillment_outbound_shipment_client.rb +1 -1
- data/test/unit/mws/test_off_amazon_payments_client.rb +1 -1
- data/test/unit/mws/test_orders_client.rb +7 -6
- data/test/unit/mws/test_products_client.rb +13 -28
- data/test/unit/mws/test_recommendations_client.rb +1 -2
- data/test/unit/mws/test_reports_client.rb +1 -1
- data/test/unit/mws/test_subscriptions_client.rb +1 -130
- data/test/unit/peddler/errors/test_builder.rb +54 -7
- data/test/unit/peddler/errors/test_class_generator.rb +18 -0
- data/test/unit/peddler/errors/test_error.rb +7 -2
- data/test/unit/peddler/test_client.rb +136 -190
- data/test/unit/peddler/test_flat_file_parser.rb +2 -2
- data/test/unit/peddler/test_headers.rb +19 -9
- data/test/unit/peddler/test_marketplace.rb +18 -5
- data/test/unit/peddler/test_vcr_matcher.rb +3 -1
- data/test/vcr_cassettes/Feeds.yml +4816 -5224
- data/test/vcr_cassettes/Reports.yml +3278 -2604
- metadata +8 -9
- data/lib/peddler/errors.rb +0 -12
- data/lib/peddler/errors/handler.rb +0 -59
- data/test/unit/peddler/errors/test_handler.rb +0 -62
- data/test/unit/peddler/test_errors.rb +0 -26
@@ -6,7 +6,7 @@ require 'mws/recommendations'
|
|
6
6
|
class TestRecommendations < IntegrationTest
|
7
7
|
def test_lists_recommendations
|
8
8
|
clients.each do |client|
|
9
|
-
res = client.list_recommendations
|
9
|
+
res = client.list_recommendations(client.marketplace.id)
|
10
10
|
refute_empty res.parse
|
11
11
|
end
|
12
12
|
end
|
@@ -6,14 +6,14 @@ require 'mws/subscriptions'
|
|
6
6
|
class TestSubscriptions < IntegrationTest
|
7
7
|
def test_lists_registered_destinations
|
8
8
|
clients.each do |client|
|
9
|
-
res = client.list_registered_destinations
|
9
|
+
res = client.list_registered_destinations(client.marketplace.id)
|
10
10
|
refute_empty res.parse
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
14
|
def test_lists_subscriptions
|
15
15
|
clients.each do |client|
|
16
|
-
res = client.list_subscriptions
|
16
|
+
res = client.list_subscriptions(client.marketplace.id)
|
17
17
|
refute_empty res.parse
|
18
18
|
end
|
19
19
|
end
|
data/test/integration_helper.rb
CHANGED
data/test/mws.yml
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
- marketplace: CA
|
2
|
+
merchant_id: A2A7WNXBU01UJW
|
3
|
+
aws_access_key_id: AKIAILJW7BWJ6YBK4JUQ
|
4
|
+
aws_secret_access_key: aWkRC0uiw/njt7HbycxYEw7FnejK24I8a+v+BqRs
|
5
|
+
- marketplace: ES
|
6
|
+
merchant_id: A2NEU7G6RGUKF
|
7
|
+
aws_access_key_id: AKIAJAMAR367FRSYNOPA
|
8
|
+
aws_secret_access_key: sYY0puX7lT3lY3jA35CgTcSjcIspzx9WexUl04J6
|
9
|
+
- marketplace: MX
|
10
|
+
merchant_id: A1PCFAUFK3U94S
|
11
|
+
aws_access_key_id: AKIAIHE4A3HDKICFHP4A
|
12
|
+
aws_secret_access_key: Jg8a9DlgPbsQVsY0CzP2X0ph3vPAfQT2Gn+amdoo
|
13
|
+
- marketplace: JP
|
14
|
+
merchant_id: A7BU5WGNVGQ1I
|
15
|
+
aws_access_key_id: AKIAJZ6EOLNDLSOEOLBA
|
16
|
+
aws_secret_access_key: YwD/Y/ihoYPDhl4+u9aoHvuvUpyRrUys1nTHlYSI
|
17
|
+
- marketplace: IT
|
18
|
+
merchant_id: A2APQUVDBVWV7E
|
19
|
+
aws_access_key_id: AKIAIHE4YSF4UF7CDR6Q
|
20
|
+
aws_secret_access_key: yhS//40dfrQ/nIXiyvZCrPXfXLobXFfJGYetTHmp
|
21
|
+
- marketplace: FR
|
22
|
+
merchant_id: A2DP6GIDYN6OTH
|
23
|
+
aws_access_key_id: AKIAIOYKJRT4WIH3P72A
|
24
|
+
aws_secret_access_key: NrpJKu+kndIviLLZnIagpZXhxvgaOp8NZeTtwqcL
|
25
|
+
- marketplace: US
|
26
|
+
merchant_id: A2H6NH4SQYFZ4M
|
27
|
+
aws_access_key_id: AKIAJ25X7BKNXKVCYJXA
|
28
|
+
aws_secret_access_key: hguX3TMfKMrqKm71/dQLKqbv2VGCyZANnCXeHAsC
|
29
|
+
- marketplace: GB
|
30
|
+
merchant_id: A2D9DZ30GEWP6N
|
31
|
+
aws_access_key_id: AKIAJCJNB4MASX5JUMUA
|
32
|
+
aws_secret_access_key: mtCsco7E7tLMFcHfQQ7Wpal+vZxtNBKo+PjTkvm5
|
33
|
+
- marketplace: DE
|
34
|
+
merchant_id: A7ZXDJZD3UIRG
|
35
|
+
aws_access_key_id: AKIAIORT7554FEBW7UBQ
|
36
|
+
aws_secret_access_key: P2ocOVChe/dQUpxRfA1n3TmP+wHrF6GaSzXslvEG
|
data/test/mws.yml.example
CHANGED
@@ -1,36 +1,32 @@
|
|
1
|
-
-
|
1
|
+
- marketplace: US
|
2
2
|
aws_access_key_id: AWS_ACCESS_KEY_ID
|
3
3
|
aws_secret_access_key: AWS_SECRET_ACCESS_KEY
|
4
4
|
merchant_id: MERCHANT_ID
|
5
|
-
-
|
5
|
+
- marketplace: GB
|
6
6
|
aws_access_key_id: AWS_ACCESS_KEY_ID
|
7
7
|
aws_secret_access_key: AWS_SECRET_ACCESS_KEY
|
8
8
|
merchant_id: MERCHANT_ID
|
9
|
-
-
|
9
|
+
- marketplace: DE
|
10
10
|
aws_access_key_id: AWS_ACCESS_KEY_ID
|
11
11
|
aws_secret_access_key: AWS_SECRET_ACCESS_KEY
|
12
12
|
merchant_id: MERCHANT_ID
|
13
|
-
-
|
13
|
+
- marketplace: CA
|
14
14
|
aws_access_key_id: AWS_ACCESS_KEY_ID
|
15
15
|
aws_secret_access_key: AWS_SECRET_ACCESS_KEY
|
16
16
|
merchant_id: MERCHANT_ID
|
17
|
-
-
|
17
|
+
- marketplace: FR
|
18
18
|
aws_access_key_id: AWS_ACCESS_KEY_ID
|
19
19
|
aws_secret_access_key: AWS_SECRET_ACCESS_KEY
|
20
20
|
merchant_id: MERCHANT_ID
|
21
|
-
-
|
21
|
+
- marketplace: JP
|
22
22
|
aws_access_key_id: AWS_ACCESS_KEY_ID
|
23
23
|
aws_secret_access_key: AWS_SECRET_ACCESS_KEY
|
24
24
|
merchant_id: MERCHANT_ID
|
25
|
-
-
|
25
|
+
- marketplace: ES
|
26
26
|
aws_access_key_id: AWS_ACCESS_KEY_ID
|
27
27
|
aws_secret_access_key: AWS_SECRET_ACCESS_KEY
|
28
28
|
merchant_id: MERCHANT_ID
|
29
|
-
-
|
30
|
-
aws_access_key_id: AWS_ACCESS_KEY_ID
|
31
|
-
aws_secret_access_key: AWS_SECRET_ACCESS_KEY
|
32
|
-
merchant_id: MERCHANT_ID
|
33
|
-
- primary_marketplace_id: ATVPDKIKX0DER
|
29
|
+
- marketplace: IT
|
34
30
|
aws_access_key_id: AWS_ACCESS_KEY_ID
|
35
31
|
aws_secret_access_key: AWS_SECRET_ACCESS_KEY
|
36
32
|
merchant_id: MERCHANT_ID
|
data/test/null_client.rb
CHANGED
@@ -4,20 +4,22 @@ require 'peddler/client'
|
|
4
4
|
require 'securerandom'
|
5
5
|
|
6
6
|
module Null
|
7
|
+
module Parser
|
8
|
+
def self.new(res, *)
|
9
|
+
res
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
7
13
|
class Client < ::Peddler::Client
|
14
|
+
self.path = '/'
|
15
|
+
|
8
16
|
def configure_with_mock_data!
|
9
17
|
self.aws_access_key_id = SecureRandom.hex
|
10
18
|
self.aws_secret_access_key = SecureRandom.hex
|
11
19
|
self.merchant_id = SecureRandom.hex
|
12
|
-
self.
|
20
|
+
self.marketplace = 'US'
|
13
21
|
end
|
14
|
-
end
|
15
22
|
|
16
|
-
|
17
|
-
def self.new(res, *)
|
18
|
-
res
|
19
|
-
end
|
23
|
+
self.parser = Parser
|
20
24
|
end
|
21
|
-
|
22
|
-
Client.parser = Parser
|
23
25
|
end
|
@@ -5,7 +5,7 @@ require 'mws/feeds/client'
|
|
5
5
|
|
6
6
|
class TestMWSFeedsClient < MiniTest::Test
|
7
7
|
def setup
|
8
|
-
@client = MWS::Feeds::Client.new
|
8
|
+
@client = MWS::Feeds::Client.new(marketplace: 'GB')
|
9
9
|
end
|
10
10
|
|
11
11
|
def test_submits_feed
|
@@ -16,7 +16,6 @@ class TestMWSFeedsClient < MiniTest::Test
|
|
16
16
|
}
|
17
17
|
|
18
18
|
@client.stub(:run, nil) do
|
19
|
-
@client.primary_marketplace_id = 'A1F83G8C2ARO7P'
|
20
19
|
@client.submit_feed('content', 'type', marketplace_id_list: '1')
|
21
20
|
end
|
22
21
|
|
@@ -97,7 +97,7 @@ class TestMWSFulfillmentOutboundShipmentClient < MiniTest::Test
|
|
97
97
|
}
|
98
98
|
|
99
99
|
@client.stub(:run, nil) do
|
100
|
-
@client.list_all_fulfillment_orders(started_at)
|
100
|
+
@client.list_all_fulfillment_orders(query_start_date_time: started_at)
|
101
101
|
end
|
102
102
|
|
103
103
|
assert_equal operation, @client.operation
|
@@ -9,7 +9,7 @@ class TestMWSOffAmazonPaymentsClient < MiniTest::Test
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def test_sandboxes
|
12
|
-
@client.
|
12
|
+
@client.marketplace = 'GB'
|
13
13
|
refute_includes @client.aws_endpoint, 'Sandbox'
|
14
14
|
assert_includes @client.sandbox.aws_endpoint, 'Sandbox'
|
15
15
|
end
|
@@ -13,7 +13,7 @@ class TestMWSOrdersClient < MiniTest::Test
|
|
13
13
|
'Action' => 'ListOrders',
|
14
14
|
'CreatedAfter' => '2016-01-01',
|
15
15
|
'OrderStatus.Status.1' => '1',
|
16
|
-
'MarketplaceId.Id.1' => '
|
16
|
+
'MarketplaceId.Id.1' => '123',
|
17
17
|
'PaymentMethod.1' => '1',
|
18
18
|
'TFMShipmentStatus.Status.1' => '1',
|
19
19
|
'FulfillmentChannel.Channel.1' => 'MFN'
|
@@ -21,7 +21,7 @@ class TestMWSOrdersClient < MiniTest::Test
|
|
21
21
|
|
22
22
|
@client.stub(:run, nil) do
|
23
23
|
@client.list_orders(
|
24
|
-
|
24
|
+
'123',
|
25
25
|
created_after: '2016-01-01',
|
26
26
|
order_status: '1',
|
27
27
|
tfm_shipment_status: '1',
|
@@ -35,11 +35,12 @@ class TestMWSOrdersClient < MiniTest::Test
|
|
35
35
|
|
36
36
|
def test_requires_start_time_keyword_when_listing_orders
|
37
37
|
@client.stub(:run, nil) do
|
38
|
-
assert_raises
|
39
|
-
@client.list_orders
|
38
|
+
error = assert_raises ArgumentError do
|
39
|
+
@client.list_orders('123')
|
40
40
|
end
|
41
|
-
|
42
|
-
@client.list_orders(
|
41
|
+
assert_equal 'specify created_after or last_updated_after', error.message
|
42
|
+
@client.list_orders('123', created_after: '2016-01-01')
|
43
|
+
@client.list_orders('123', last_updated_after: '2016-01-01')
|
43
44
|
end
|
44
45
|
end
|
45
46
|
|
@@ -6,7 +6,6 @@ require 'mws/products/client'
|
|
6
6
|
class TestMWSProductsClient < MiniTest::Test
|
7
7
|
def setup
|
8
8
|
@client = MWS::Products::Client.new
|
9
|
-
@client.primary_marketplace_id = '123'
|
10
9
|
end
|
11
10
|
|
12
11
|
def test_lists_matching_products
|
@@ -17,7 +16,7 @@ class TestMWSProductsClient < MiniTest::Test
|
|
17
16
|
}
|
18
17
|
|
19
18
|
@client.stub(:run, nil) do
|
20
|
-
@client.list_matching_products('foo')
|
19
|
+
@client.list_matching_products('123', 'foo')
|
21
20
|
end
|
22
21
|
|
23
22
|
assert_equal operation, @client.operation
|
@@ -32,7 +31,7 @@ class TestMWSProductsClient < MiniTest::Test
|
|
32
31
|
}
|
33
32
|
|
34
33
|
@client.stub(:run, nil) do
|
35
|
-
@client.get_matching_product_for_id('foo', '1')
|
34
|
+
@client.get_matching_product_for_id('123', 'foo', '1')
|
36
35
|
end
|
37
36
|
|
38
37
|
assert_equal operation, @client.operation
|
@@ -46,7 +45,7 @@ class TestMWSProductsClient < MiniTest::Test
|
|
46
45
|
}
|
47
46
|
|
48
47
|
@client.stub(:run, nil) do
|
49
|
-
@client.get_matching_product('1')
|
48
|
+
@client.get_matching_product('123', '1')
|
50
49
|
end
|
51
50
|
|
52
51
|
assert_equal operation, @client.operation
|
@@ -60,7 +59,7 @@ class TestMWSProductsClient < MiniTest::Test
|
|
60
59
|
}
|
61
60
|
|
62
61
|
@client.stub(:run, nil) do
|
63
|
-
@client.get_competitive_pricing_for_sku('1')
|
62
|
+
@client.get_competitive_pricing_for_sku('123', '1')
|
64
63
|
end
|
65
64
|
|
66
65
|
assert_equal operation, @client.operation
|
@@ -74,7 +73,7 @@ class TestMWSProductsClient < MiniTest::Test
|
|
74
73
|
}
|
75
74
|
|
76
75
|
@client.stub(:run, nil) do
|
77
|
-
@client.get_competitive_pricing_for_asin('1')
|
76
|
+
@client.get_competitive_pricing_for_asin('123', '1')
|
78
77
|
end
|
79
78
|
|
80
79
|
assert_equal operation, @client.operation
|
@@ -88,7 +87,7 @@ class TestMWSProductsClient < MiniTest::Test
|
|
88
87
|
}
|
89
88
|
|
90
89
|
@client.stub(:run, nil) do
|
91
|
-
@client.get_lowest_offer_listings_for_sku('1')
|
90
|
+
@client.get_lowest_offer_listings_for_sku('123', '1')
|
92
91
|
end
|
93
92
|
|
94
93
|
assert_equal operation, @client.operation
|
@@ -103,7 +102,7 @@ class TestMWSProductsClient < MiniTest::Test
|
|
103
102
|
}
|
104
103
|
|
105
104
|
@client.stub(:run, nil) do
|
106
|
-
@client.get_lowest_priced_offers_for_sku('1', 'New')
|
105
|
+
@client.get_lowest_priced_offers_for_sku('123', '1', 'New')
|
107
106
|
end
|
108
107
|
|
109
108
|
assert_equal operation, @client.operation
|
@@ -118,7 +117,7 @@ class TestMWSProductsClient < MiniTest::Test
|
|
118
117
|
}
|
119
118
|
|
120
119
|
@client.stub(:run, nil) do
|
121
|
-
@client.get_lowest_priced_offers_for_asin('1', 'New')
|
120
|
+
@client.get_lowest_priced_offers_for_asin('123', '1', 'New')
|
122
121
|
end
|
123
122
|
|
124
123
|
assert_equal operation, @client.operation
|
@@ -132,7 +131,7 @@ class TestMWSProductsClient < MiniTest::Test
|
|
132
131
|
}
|
133
132
|
|
134
133
|
@client.stub(:run, nil) do
|
135
|
-
@client.get_lowest_offer_listings_for_asin('1')
|
134
|
+
@client.get_lowest_offer_listings_for_asin('123', '1')
|
136
135
|
end
|
137
136
|
|
138
137
|
assert_equal operation, @client.operation
|
@@ -187,7 +186,7 @@ class TestMWSProductsClient < MiniTest::Test
|
|
187
186
|
}
|
188
187
|
|
189
188
|
@client.stub(:run, nil) do
|
190
|
-
@client.get_my_price_for_sku('1')
|
189
|
+
@client.get_my_price_for_sku('123', '1')
|
191
190
|
end
|
192
191
|
|
193
192
|
assert_equal operation, @client.operation
|
@@ -201,7 +200,7 @@ class TestMWSProductsClient < MiniTest::Test
|
|
201
200
|
}
|
202
201
|
|
203
202
|
@client.stub(:run, nil) do
|
204
|
-
@client.get_my_price_for_asin('1')
|
203
|
+
@client.get_my_price_for_asin('123', '1')
|
205
204
|
end
|
206
205
|
|
207
206
|
assert_equal operation, @client.operation
|
@@ -215,7 +214,7 @@ class TestMWSProductsClient < MiniTest::Test
|
|
215
214
|
}
|
216
215
|
|
217
216
|
@client.stub(:run, nil) do
|
218
|
-
@client.get_product_categories_for_sku('1')
|
217
|
+
@client.get_product_categories_for_sku('123', '1')
|
219
218
|
end
|
220
219
|
|
221
220
|
assert_equal operation, @client.operation
|
@@ -229,21 +228,7 @@ class TestMWSProductsClient < MiniTest::Test
|
|
229
228
|
}
|
230
229
|
|
231
230
|
@client.stub(:run, nil) do
|
232
|
-
@client.get_product_categories_for_asin('1')
|
233
|
-
end
|
234
|
-
|
235
|
-
assert_equal operation, @client.operation
|
236
|
-
end
|
237
|
-
|
238
|
-
def test_queries_nonprimary_marketplaces
|
239
|
-
operation = {
|
240
|
-
'Action' => 'GetProductCategoriesForASIN',
|
241
|
-
'MarketplaceId' => '321',
|
242
|
-
'ASIN' => '1'
|
243
|
-
}
|
244
|
-
|
245
|
-
@client.stub(:run, nil) do
|
246
|
-
@client.get_product_categories_for_asin('1', marketplace_id: '321')
|
231
|
+
@client.get_product_categories_for_asin('123', '1')
|
247
232
|
end
|
248
233
|
|
249
234
|
assert_equal operation, @client.operation
|
@@ -28,9 +28,8 @@ class TestMWSRecommendationsClient < MiniTest::Test
|
|
28
28
|
'MarketplaceId' => '123'
|
29
29
|
}
|
30
30
|
|
31
|
-
@client.primary_marketplace_id = '123'
|
32
31
|
@client.stub(:run, nil) do
|
33
|
-
@client.list_recommendations(category_query_list: [{ 'Foo' => '1' }])
|
32
|
+
@client.list_recommendations('123', category_query_list: [{ 'Foo' => '1' }])
|
34
33
|
end
|
35
34
|
|
36
35
|
assert_equal operation, @client.operation
|
@@ -175,7 +175,7 @@ class TestMWSReportsClient < MiniTest::Test
|
|
175
175
|
end
|
176
176
|
|
177
177
|
def test_gets_report_schedule_list_by_next_token
|
178
|
-
assert_raises
|
178
|
+
assert_raises NotImplementedError do
|
179
179
|
@client.get_report_schedule_list_by_next_token
|
180
180
|
end
|
181
181
|
end
|
@@ -6,26 +6,9 @@ require 'mws/subscriptions/client'
|
|
6
6
|
class TestMWSSubscriptionsClient < MiniTest::Test
|
7
7
|
def setup
|
8
8
|
@client = MWS::Subscriptions::Client.new
|
9
|
-
@client.primary_marketplace_id = '123'
|
10
9
|
end
|
11
10
|
|
12
11
|
def test_registers_destination
|
13
|
-
operation = {
|
14
|
-
'Action' => 'RegisterDestination',
|
15
|
-
'MarketplaceId' => '123',
|
16
|
-
'Destination.DeliveryChannel' => 'SQS',
|
17
|
-
'Destination.AttributeList.member.1.Key' => 'sqsQueueUrl',
|
18
|
-
'Destination.AttributeList.member.1.Value' => 'foo'
|
19
|
-
}
|
20
|
-
|
21
|
-
@client.stub(:run, nil) do
|
22
|
-
@client.register_destination('foo')
|
23
|
-
end
|
24
|
-
|
25
|
-
assert_equal operation, @client.operation
|
26
|
-
end
|
27
|
-
|
28
|
-
def test_registers_destination_with_alternate_marketplace
|
29
12
|
operation = {
|
30
13
|
'Action' => 'RegisterDestination',
|
31
14
|
'MarketplaceId' => '321',
|
@@ -51,7 +34,7 @@ class TestMWSSubscriptionsClient < MiniTest::Test
|
|
51
34
|
}
|
52
35
|
|
53
36
|
@client.stub(:run, nil) do
|
54
|
-
@client.deregister_destination('foo')
|
37
|
+
@client.deregister_destination('foo', '123')
|
55
38
|
end
|
56
39
|
|
57
40
|
assert_equal operation, @client.operation
|
@@ -74,19 +57,6 @@ class TestMWSSubscriptionsClient < MiniTest::Test
|
|
74
57
|
end
|
75
58
|
|
76
59
|
def test_lists_registered_destinations
|
77
|
-
operation = {
|
78
|
-
'Action' => 'ListRegisteredDestinations',
|
79
|
-
'MarketplaceId' => '123'
|
80
|
-
}
|
81
|
-
|
82
|
-
@client.stub(:run, nil) do
|
83
|
-
@client.list_registered_destinations
|
84
|
-
end
|
85
|
-
|
86
|
-
assert_equal operation, @client.operation
|
87
|
-
end
|
88
|
-
|
89
|
-
def test_lists_registered_destinations_with_alternate_marketplace
|
90
60
|
operation = {
|
91
61
|
'Action' => 'ListRegisteredDestinations',
|
92
62
|
'MarketplaceId' => '321'
|
@@ -100,22 +70,6 @@ class TestMWSSubscriptionsClient < MiniTest::Test
|
|
100
70
|
end
|
101
71
|
|
102
72
|
def test_sends_test_notification_to_destination
|
103
|
-
operation = {
|
104
|
-
'Action' => 'SendTestNotificationToDestination',
|
105
|
-
'MarketplaceId' => '123',
|
106
|
-
'Destination.DeliveryChannel' => 'SQS',
|
107
|
-
'Destination.AttributeList.member.1.Key' => 'sqsQueueUrl',
|
108
|
-
'Destination.AttributeList.member.1.Value' => 'foo'
|
109
|
-
}
|
110
|
-
|
111
|
-
@client.stub(:run, nil) do
|
112
|
-
@client.send_test_notification_to_destination('foo')
|
113
|
-
end
|
114
|
-
|
115
|
-
assert_equal operation, @client.operation
|
116
|
-
end
|
117
|
-
|
118
|
-
def test_send_test_notification_to_destination_with_alternate_marketplace
|
119
73
|
operation = {
|
120
74
|
'Action' => 'SendTestNotificationToDestination',
|
121
75
|
'MarketplaceId' => '321',
|
@@ -132,24 +86,6 @@ class TestMWSSubscriptionsClient < MiniTest::Test
|
|
132
86
|
end
|
133
87
|
|
134
88
|
def test_creates_subscription
|
135
|
-
operation = {
|
136
|
-
'Action' => 'CreateSubscription',
|
137
|
-
'MarketplaceId' => '123',
|
138
|
-
'Subscription.IsEnabled' => true,
|
139
|
-
'Subscription.NotificationType' => 'foo',
|
140
|
-
'Subscription.Destination.DeliveryChannel' => 'SQS',
|
141
|
-
'Subscription.Destination.AttributeList.member.1.Key' => 'sqsQueueUrl',
|
142
|
-
'Subscription.Destination.AttributeList.member.1.Value' => 'bar'
|
143
|
-
}
|
144
|
-
|
145
|
-
@client.stub(:run, nil) do
|
146
|
-
@client.create_subscription('foo', 'bar')
|
147
|
-
end
|
148
|
-
|
149
|
-
assert_equal operation, @client.operation
|
150
|
-
end
|
151
|
-
|
152
|
-
def test_creates_subscription_with_alternate_marketplace
|
153
89
|
operation = {
|
154
90
|
'Action' => 'CreateSubscription',
|
155
91
|
'MarketplaceId' => '321',
|
@@ -168,23 +104,6 @@ class TestMWSSubscriptionsClient < MiniTest::Test
|
|
168
104
|
end
|
169
105
|
|
170
106
|
def test_gets_subscription
|
171
|
-
operation = {
|
172
|
-
'Action' => 'GetSubscription',
|
173
|
-
'MarketplaceId' => '123',
|
174
|
-
'NotificationType' => 'foo',
|
175
|
-
'Destination.DeliveryChannel' => 'SQS',
|
176
|
-
'Destination.AttributeList.member.1.Key' => 'sqsQueueUrl',
|
177
|
-
'Destination.AttributeList.member.1.Value' => 'bar'
|
178
|
-
}
|
179
|
-
|
180
|
-
@client.stub(:run, nil) do
|
181
|
-
@client.get_subscription('foo', 'bar')
|
182
|
-
end
|
183
|
-
|
184
|
-
assert_equal operation, @client.operation
|
185
|
-
end
|
186
|
-
|
187
|
-
def test_gets_subscription_with_alternate_marketplace
|
188
107
|
operation = {
|
189
108
|
'Action' => 'GetSubscription',
|
190
109
|
'MarketplaceId' => '321',
|
@@ -202,23 +121,6 @@ class TestMWSSubscriptionsClient < MiniTest::Test
|
|
202
121
|
end
|
203
122
|
|
204
123
|
def test_deletes_subscription
|
205
|
-
operation = {
|
206
|
-
'Action' => 'DeleteSubscription',
|
207
|
-
'MarketplaceId' => '123',
|
208
|
-
'NotificationType' => 'foo',
|
209
|
-
'Destination.DeliveryChannel' => 'SQS',
|
210
|
-
'Destination.AttributeList.member.1.Key' => 'sqsQueueUrl',
|
211
|
-
'Destination.AttributeList.member.1.Value' => 'bar'
|
212
|
-
}
|
213
|
-
|
214
|
-
@client.stub(:run, nil) do
|
215
|
-
@client.delete_subscription('foo', 'bar')
|
216
|
-
end
|
217
|
-
|
218
|
-
assert_equal operation, @client.operation
|
219
|
-
end
|
220
|
-
|
221
|
-
def test_deletes_subscription_with_alternate_marketplace
|
222
124
|
operation = {
|
223
125
|
'Action' => 'DeleteSubscription',
|
224
126
|
'MarketplaceId' => '321',
|
@@ -236,19 +138,6 @@ class TestMWSSubscriptionsClient < MiniTest::Test
|
|
236
138
|
end
|
237
139
|
|
238
140
|
def test_lists_subscriptions
|
239
|
-
operation = {
|
240
|
-
'Action' => 'ListSubscriptions',
|
241
|
-
'MarketplaceId' => '123'
|
242
|
-
}
|
243
|
-
|
244
|
-
@client.stub(:run, nil) do
|
245
|
-
@client.list_subscriptions
|
246
|
-
end
|
247
|
-
|
248
|
-
assert_equal operation, @client.operation
|
249
|
-
end
|
250
|
-
|
251
|
-
def test_lists_subscriptions_with_alternate_marketplace
|
252
141
|
operation = {
|
253
142
|
'Action' => 'ListSubscriptions',
|
254
143
|
'MarketplaceId' => '321'
|
@@ -262,24 +151,6 @@ class TestMWSSubscriptionsClient < MiniTest::Test
|
|
262
151
|
end
|
263
152
|
|
264
153
|
def test_updates_subscription
|
265
|
-
operation = {
|
266
|
-
'Action' => 'UpdateSubscription',
|
267
|
-
'MarketplaceId' => '123',
|
268
|
-
'Subscription.IsEnabled' => true,
|
269
|
-
'Subscription.NotificationType' => 'foo',
|
270
|
-
'Subscription.Destination.DeliveryChannel' => 'SQS',
|
271
|
-
'Subscription.Destination.AttributeList.member.1.Key' => 'sqsQueueUrl',
|
272
|
-
'Subscription.Destination.AttributeList.member.1.Value' => 'bar'
|
273
|
-
}
|
274
|
-
|
275
|
-
@client.stub(:run, nil) do
|
276
|
-
@client.update_subscription('foo', 'bar', true)
|
277
|
-
end
|
278
|
-
|
279
|
-
assert_equal operation, @client.operation
|
280
|
-
end
|
281
|
-
|
282
|
-
def test_updates_subscription_with_alternate_marketplace
|
283
154
|
operation = {
|
284
155
|
'Action' => 'UpdateSubscription',
|
285
156
|
'MarketplaceId' => '321',
|