peddler 0.12.4 → 0.12.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ec42e17ad462c8a7355752afaed4ac3ef6fdca6d
4
- data.tar.gz: b025ac50458589b79191880e800e2ee766d66232
3
+ metadata.gz: 4211dcab3a4f1c013f7fe9ab4faf010df8c57115
4
+ data.tar.gz: 17e694bcc21a74005d63f1ff6eb238dadb68d5e0
5
5
  SHA512:
6
- metadata.gz: 3f0ffaf0e2b0856a902ba08116495caef5d11eb62ff24c5ffa87102673a719706ad0dc2058fb4c0f67611c02cddff770f87d10edcba42b6b3d4a5f715b221ed0
7
- data.tar.gz: 76bd5b7a6d5a6af1103ad55cbe85e3f2003c4a5be235e24f9860f9486fd17026eeab16fd65fd428ff097a3ec1137f2cd6c678df2da4071e9ec9e337566db680e
6
+ metadata.gz: 0073a4510d9d067a4916bff357cbfe66909857ef112f94b207343d880784a5a25183ba9749f8236bd96e2c1434e83cb955de8ec90be0c4170bc847e53eaaab9b
7
+ data.tar.gz: 19dd1e5f4a79ef387e3445348ce6b6ff68b5bb09f50dbb4e104023cc4e4f1b26139317098e4fe647d5e835d4940055bc911a6370b3d96f9ad4fb754d2de6f27c
@@ -31,7 +31,7 @@ module MWS
31
31
  # @param opts [Hash]
32
32
  # @option opts [String] :marketplace_id
33
33
  # @option opts [String] :recommendation_category
34
- # @option opts [String] :category_query_list
34
+ # @option opts [Array<Struct, Hash>] :category_query_list
35
35
  # @return [Peddler::XMLParser]
36
36
  def list_recommendations(opts = {})
37
37
  opts[:marketplace_id] ||= marketplace_id
@@ -209,7 +209,7 @@ module MWS
209
209
  # @param report_id_list [Array<String>]
210
210
  # @return [Peddler::XMLParser]
211
211
  def update_report_acknowledgements(acknowledged, *report_id_list)
212
- operation('UpdateReportAcknowledgement')
212
+ operation('UpdateReportAcknowledgements')
213
213
  .add('ReportIdList' => report_id_list, 'Acknowledged' => acknowledged)
214
214
  .structure!('ReportIdList', 'Id')
215
215
 
@@ -1,3 +1,3 @@
1
1
  module Peddler
2
- VERSION = '0.12.4'
2
+ VERSION = '0.12.5'
3
3
  end
@@ -0,0 +1,61 @@
1
+ require 'test_helper'
2
+ require 'mws/cart_information/client'
3
+
4
+ class TestCartInformationClient < 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
@@ -0,0 +1,59 @@
1
+ require 'test_helper'
2
+ require 'mws/customer_information/client'
3
+
4
+ class TestCustomerInformationClient < 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
@@ -6,46 +6,93 @@ class TestFeedsClient < MiniTest::Test
6
6
  @client = MWS::Feeds::Client.new
7
7
  end
8
8
 
9
- def test_submit_feed_has_marketplace_id_list
9
+ def test_submits_feed
10
+ operation = {
11
+ 'Action' => 'SubmitFeed',
12
+ 'FeedType' => 'type',
13
+ 'MarketplaceIdList.Id.1' => '1'
14
+ }
15
+
10
16
  @client.stub(:run, nil) do
11
17
  @client.marketplace_id = 'A1F83G8C2ARO7P'
12
18
  @client.submit_feed('content', 'type', marketplace_id_list: '1')
13
- @client.operation.key?('MarketplaceIdList.Id.1')
14
19
  end
20
+
21
+ assert_equal operation, @client.operation
22
+ assert_equal 'content', @client.body
15
23
  end
16
24
 
17
- def test_get_feed_submission_list_has_feed_submission_id_list
25
+ def test_gets_feed_submission_list
26
+ operation = {
27
+ 'Action' => 'GetFeedSubmissionList',
28
+ 'FeedSubmissionIdList.Id.1' => '1',
29
+ 'FeedTypeList.Type.1' => '2',
30
+ 'FeedProcessingStatusList.Status.1' => '3'
31
+ }
32
+
18
33
  @client.stub(:run, nil) do
19
- @client.get_feed_submission_list(feed_submission_id_list: '1')
20
- @client.operation.key?('FeedSubmissionIdList.Status.1')
34
+ @client.get_feed_submission_list(
35
+ feed_submission_id_list: '1',
36
+ feed_type_list: '2',
37
+ feed_processing_status_list: '3'
38
+ )
21
39
  end
40
+
41
+ assert_equal operation, @client.operation
22
42
  end
23
43
 
24
- def test_get_feed_submission_list_has_feed_type_list
44
+ def test_gets_feed_submission_list_by_next_token
45
+ operation = {
46
+ 'Action' => 'GetFeedSubmissionListByNextToken',
47
+ 'NextToken' => '1'
48
+ }
49
+
25
50
  @client.stub(:run, nil) do
26
- @client.get_feed_submission_list(feed_type_list: '1')
27
- @client.operation.key?('FeedTypeList.Type.1')
51
+ @client.get_feed_submission_list_by_next_token('1')
28
52
  end
53
+
54
+ assert_equal operation, @client.operation
29
55
  end
30
56
 
31
- def test_get_feed_submission_list_has_feed_processing_status_list
57
+ def test_gets_feed_submission_count
58
+ operation = {
59
+ 'Action' => 'GetFeedSubmissionCount',
60
+ 'FeedTypeList.Type.1' => '1',
61
+ 'FeedProcessingStatusList.Status.1' => '2'
62
+ }
63
+
32
64
  @client.stub(:run, nil) do
33
- @client.get_feed_submission_list(feed_processing_status_list: '1')
34
- @client.operation.key?('FeedProcessingStatusList.Status.1')
65
+ @client.get_feed_submission_count(
66
+ feed_type_list: '1',
67
+ feed_processing_status_list: '2'
68
+ )
35
69
  end
70
+
71
+ assert_equal operation, @client.operation
36
72
  end
37
73
 
38
- def test_get_feed_submission_count_has_feed_type_list
74
+ def test_cancels_feed_submissions
75
+ operation = {
76
+ 'Action' => 'CancelFeedSubmissions'
77
+ }
78
+
39
79
  @client.stub(:run, nil) do
40
- @client.get_feed_submission_count(feed_type_list: '1')
41
- @client.operation.key?('FeedTypeList.Type.1')
80
+ @client.cancel_feed_submissions
42
81
  end
82
+
83
+ assert_equal operation, @client.operation
43
84
  end
44
85
 
45
- def test_get_feed_submission_count_has_feed_processing_status_list
86
+ def test_gets_feed_submission_result
87
+ operation = {
88
+ 'Action' => 'GetFeedSubmissionResult',
89
+ 'FeedSubmissionId' => '1'
90
+ }
91
+
46
92
  @client.stub(:run, nil) do
47
- @client.get_feed_submission_count(feed_processing_status_list: '1')
48
- @client.operation.key?('FeedProcessingStatusList.Status.1')
93
+ @client.get_feed_submission_result('1')
49
94
  end
95
+
96
+ assert_equal operation, @client.operation
50
97
  end
51
98
  end
@@ -0,0 +1,213 @@
1
+ require 'test_helper'
2
+ require 'mws/fulfillment_inbound_shipment/client'
3
+
4
+ class TestFulfillmentInboundShipmentClient < MiniTest::Test
5
+ def setup
6
+ @client = MWS::FulfillmentInboundShipment::Client.new
7
+ end
8
+
9
+ def test_creates_inbound_shipment_plan
10
+ operation = {
11
+ 'Action' => 'CreateInboundShipmentPlan',
12
+ 'ShipFromAddress.Foo' => '1',
13
+ 'InboundShipmentPlanRequestItems.member.1.Bar' => '2'
14
+ }
15
+
16
+ @client.stub(:run, nil) do
17
+ @client.create_inbound_shipment_plan({ 'Foo' => '1' }, [{ 'Bar' => '2' }])
18
+ end
19
+
20
+ assert_equal operation, @client.operation
21
+ end
22
+
23
+ def test_creates_inbound_shipment
24
+ operation = {
25
+ 'Action' => 'CreateInboundShipment',
26
+ 'ShipmentId' => '1',
27
+ 'InboundShipmentHeader.Foo' => '1',
28
+ 'InboundShipmentItems.member.1.Bar' => '2'
29
+ }
30
+
31
+ @client.stub(:run, nil) do
32
+ @client.create_inbound_shipment('1', { 'Foo' => '1' }, inbound_shipment_items: [{ 'Bar' => '2' }])
33
+ end
34
+
35
+ assert_equal operation, @client.operation
36
+ end
37
+
38
+ def test_updates_inbound_shipment
39
+ operation = {
40
+ 'Action' => 'UpdateInboundShipment',
41
+ 'ShipmentId' => '1',
42
+ 'InboundShipmentHeader.Foo' => '1',
43
+ 'InboundShipmentItems.member.1.Bar' => '2'
44
+ }
45
+
46
+ @client.stub(:run, nil) do
47
+ @client.update_inbound_shipment('1', { 'Foo' => '1' }, inbound_shipment_items: [{ 'Bar' => '2' }])
48
+ end
49
+
50
+ assert_equal operation, @client.operation
51
+ end
52
+
53
+ def test_puts_transport_content
54
+ operation = {
55
+ 'Action' => 'PutTransportContent',
56
+ 'ShipmentId' => '1',
57
+ 'IsPartnered' => true,
58
+ 'ShipmentType' => 'Foo',
59
+ 'TransportDetails.Foo' => '1'
60
+ }
61
+
62
+ @client.stub(:run, nil) do
63
+ @client.put_transport_content('1', true, 'Foo', { 'Foo' => '1' })
64
+ end
65
+
66
+ assert_equal operation, @client.operation
67
+ end
68
+
69
+ def test_estimates_transport_request
70
+ operation = {
71
+ 'Action' => 'EstimateTransportRequest',
72
+ 'ShipmentId' => '1'
73
+ }
74
+
75
+ @client.stub(:run, nil) do
76
+ @client.estimate_transport_request('1')
77
+ end
78
+
79
+ assert_equal operation, @client.operation
80
+ end
81
+
82
+ def test_gets_transport_request
83
+ operation = {
84
+ 'Action' => 'GetTransportContent',
85
+ 'ShipmentId' => '1'
86
+ }
87
+
88
+ @client.stub(:run, nil) do
89
+ @client.get_transport_content('1')
90
+ end
91
+
92
+ assert_equal operation, @client.operation
93
+ end
94
+
95
+ def test_confirms_transport_request
96
+ operation = {
97
+ 'Action' => 'ConfirmTransportRequest',
98
+ 'ShipmentId' => '1'
99
+ }
100
+
101
+ @client.stub(:run, nil) do
102
+ @client.confirm_transport_request('1')
103
+ end
104
+
105
+ assert_equal operation, @client.operation
106
+ end
107
+
108
+ def test_voids_transport_request
109
+ operation = {
110
+ 'Action' => 'VoidTransportRequest',
111
+ 'ShipmentId' => '1'
112
+ }
113
+
114
+ @client.stub(:run, nil) do
115
+ @client.void_transport_request('1')
116
+ end
117
+
118
+ assert_equal operation, @client.operation
119
+ end
120
+
121
+ def test_gets_package_labels
122
+ operation = {
123
+ 'Action' => 'GetPackageLabels',
124
+ 'ShipmentId' => '1',
125
+ 'PageType' => '2'
126
+ }
127
+
128
+ @client.stub(:run, nil) do
129
+ @client.get_package_labels('1', '2')
130
+ end
131
+
132
+ assert_equal operation, @client.operation
133
+ end
134
+
135
+ def test_gets_bill_of_lading
136
+ operation = {
137
+ 'Action' => 'GetBillOfLading',
138
+ 'ShipmentId' => '1'
139
+ }
140
+
141
+ @client.stub(:run, nil) do
142
+ @client.get_bill_of_lading('1')
143
+ end
144
+
145
+ assert_equal operation, @client.operation
146
+ end
147
+
148
+ def test_lists_inbound_shipments
149
+ operation = {
150
+ 'Action' => 'ListInboundShipments',
151
+ 'ShipmentStatusList.member.1.Foo' => '1',
152
+ 'ShipmentIdList.member.1.Bar' => '2'
153
+ }
154
+
155
+ @client.stub(:run, nil) do
156
+ @client.list_inbound_shipments(
157
+ shipment_status_list: [{ 'Foo' => '1' }],
158
+ shipment_id_list: [{ 'Bar' => '2' }])
159
+ end
160
+
161
+ assert_equal operation, @client.operation
162
+ end
163
+
164
+ def test_lists_inbound_shipments_by_next_token
165
+ operation = {
166
+ 'Action' => 'ListInboundShipmentsByNextToken',
167
+ 'NextToken' => '1'
168
+ }
169
+
170
+ @client.stub(:run, nil) do
171
+ @client.list_inbound_shipments_by_next_token('1')
172
+ end
173
+
174
+ assert_equal operation, @client.operation
175
+ end
176
+
177
+ def test_lists_inbound_shipment_items
178
+ operation = {
179
+ 'Action' => 'ListInboundShipmentItems'
180
+ }
181
+
182
+ @client.stub(:run, nil) do
183
+ @client.list_inbound_shipment_items
184
+ end
185
+
186
+ assert_equal operation, @client.operation
187
+ end
188
+
189
+ def test_lists_inbound_shipment_items_by_next_token
190
+ operation = {
191
+ 'Action' => 'ListInboundShipmentItemsByNextToken',
192
+ 'NextToken' => '1'
193
+ }
194
+
195
+ @client.stub(:run, nil) do
196
+ @client.list_inbound_shipment_items_by_next_token('1')
197
+ end
198
+
199
+ assert_equal operation, @client.operation
200
+ end
201
+
202
+ def test_gets_service_status
203
+ operation = {
204
+ 'Action' => 'GetServiceStatus'
205
+ }
206
+
207
+ @client.stub(:run, nil) do
208
+ @client.get_service_status
209
+ end
210
+
211
+ assert_equal operation, @client.operation
212
+ end
213
+ end
@@ -6,10 +6,41 @@ class TestFulfillmentInventoryClient < MiniTest::Test
6
6
  @client = MWS::FulfillmentInventory::Client.new
7
7
  end
8
8
 
9
- def test_list_inventory_supply_has_seller_skus
9
+ def test_lists_inventory_supply
10
+ operation = {
11
+ 'Action' => 'ListInventorySupply',
12
+ 'SellerSkus.member.1' => '1'
13
+ }
14
+
10
15
  @client.stub(:run, nil) do
11
16
  @client.list_inventory_supply(seller_skus: '1')
12
- assert @client.operation.key?('SellerSkus.member.1')
13
17
  end
18
+
19
+ assert_equal operation, @client.operation
20
+ end
21
+
22
+ def test_lists_inventory_supply_by_next_token
23
+ operation = {
24
+ 'Action' => 'ListInventorySupplyByNextToken',
25
+ 'NextToken' => '1'
26
+ }
27
+
28
+ @client.stub(:run, nil) do
29
+ @client.list_inventory_supply_by_next_token('1')
30
+ end
31
+
32
+ assert_equal operation, @client.operation
33
+ end
34
+
35
+ def test_gets_service_status
36
+ operation = {
37
+ 'Action' => 'GetServiceStatus'
38
+ }
39
+
40
+ @client.stub(:run, nil) do
41
+ @client.get_service_status
42
+ end
43
+
44
+ assert_equal operation, @client.operation
14
45
  end
15
46
  end
@@ -0,0 +1,127 @@
1
+ require 'test_helper'
2
+ require 'mws/fulfillment_outbound_shipment/client'
3
+
4
+ class TestFulfillmentOutboundShipmentClient < MiniTest::Test
5
+ def setup
6
+ @client = MWS::FulfillmentOutboundShipment::Client.new
7
+ end
8
+
9
+ def test_gets_fulfillment_preview
10
+ operation = {
11
+ 'Action' => 'GetFulfillmentPreview',
12
+ 'Address.Foo' => '1',
13
+ 'Items.member.1.Bar' => '2',
14
+ 'ShippingSpeedCategories.1' => '3'
15
+ }
16
+
17
+ @client.stub(:run, nil) do
18
+ @client.get_fulfillment_preview(
19
+ { 'Foo' => '1' },
20
+ [{ 'Bar' => '2' }],
21
+ shipping_speed_categories: ['3']
22
+ )
23
+ end
24
+
25
+ assert_equal operation, @client.operation
26
+ end
27
+
28
+ def test_creates_fulfillment_order
29
+ operation = {
30
+ 'Action' => 'CreateFulfillmentOrder',
31
+ 'SellerFulfillmentOrderId' => '1',
32
+ 'DisplayableOrderId' => '2',
33
+ 'DisplayableOrderDateTime' => '3',
34
+ 'DisplayableOrderComment' => '4',
35
+ 'ShippingSpeedCategory' => '5',
36
+ 'DestinationAddress.Foo' => '1',
37
+ 'Items.member.1.Bar' => '2',
38
+ 'NotificationEmailList.member.1' => '1'
39
+ }
40
+
41
+ @client.stub(:run, nil) do
42
+ @client.create_fulfillment_order(
43
+ '1', '2', '3', '4', '5',
44
+ { 'Foo' => '1' },
45
+ [{ 'Bar' => '2' }],
46
+ notification_email_list: ['1']
47
+ )
48
+ end
49
+
50
+ assert_equal operation, @client.operation
51
+ end
52
+
53
+ def test_updates_fulfillment_order
54
+ operation = {
55
+ 'Action' => 'UpdateFulfillmentOrder',
56
+ 'SellerFulfillmentOrderId' => '1',
57
+ 'Items.member.1.Bar' => '2',
58
+ 'NotificationEmailList.member.1' => '1'
59
+ }
60
+
61
+ @client.stub(:run, nil) do
62
+ @client.update_fulfillment_order(
63
+ '1',
64
+ items: [{ 'Bar' => '2' }],
65
+ notification_email_list: ['1']
66
+ )
67
+ end
68
+
69
+ assert_equal operation, @client.operation
70
+ end
71
+
72
+ def test_gets_fulfillment_order
73
+ operation = {
74
+ 'Action' => 'GetFulfillmentOrder',
75
+ 'SellerFulfillmentOrderId' => '1'
76
+ }
77
+
78
+ @client.stub(:run, nil) do
79
+ @client.get_fulfillment_order('1')
80
+ end
81
+
82
+ assert_equal operation, @client.operation
83
+ end
84
+
85
+ def test_lists_all_fulfillment_orders
86
+ operation = {
87
+ 'Action' => 'ListAllFulfillmentOrders'
88
+ }
89
+
90
+ @client.stub(:run, nil) do
91
+ @client.list_all_fulfillment_orders
92
+ end
93
+
94
+ assert_equal operation, @client.operation
95
+ end
96
+
97
+ def test_gets_package_tracking_details
98
+ assert_raises(NotImplementedError) do
99
+ @client.get_package_tracking_details
100
+ end
101
+ end
102
+
103
+ def test_cancels_fulfillment_order
104
+ operation = {
105
+ 'Action' => 'CancelFulfillmentOrder',
106
+ 'SellerFulfillmentOrderId' => '1'
107
+ }
108
+
109
+ @client.stub(:run, nil) do
110
+ @client.cancel_fulfillment_order('1')
111
+ end
112
+
113
+ assert_equal operation, @client.operation
114
+ end
115
+
116
+ def test_gets_service_status
117
+ operation = {
118
+ 'Action' => 'GetServiceStatus'
119
+ }
120
+
121
+ @client.stub(:run, nil) do
122
+ @client.get_service_status
123
+ end
124
+
125
+ assert_equal operation, @client.operation
126
+ end
127
+ end
@@ -6,17 +6,266 @@ class TestMWSOffAmazonPaymentsClient < MiniTest::Test
6
6
  @client = MWS::OffAmazonPayments::Client.new
7
7
  end
8
8
 
9
- def test_sandbox
9
+ def test_sandboxes
10
10
  @client.marketplace_id = 'A1F83G8C2ARO7P'
11
11
  refute_includes @client.aws_endpoint, 'Sandbox'
12
12
  assert_includes @client.sandbox.aws_endpoint, 'Sandbox'
13
13
  end
14
14
 
15
+ def test_creates_order_reference_for_id
16
+ operation = {
17
+ 'Action' => 'CreateOrderReferenceForId',
18
+ 'Id' => '1',
19
+ 'IdType' => '2'
20
+ }
21
+
22
+ @client.stub(:run, nil) do
23
+ @client.create_order_reference_for_id('1', '2')
24
+ end
25
+
26
+ assert_equal operation, @client.operation
27
+ end
28
+
29
+ def test_gets_billing_agreement_details
30
+ operation = {
31
+ 'Action' => 'GetBillingAgreementDetails',
32
+ 'AmazonBillingAgreementId' => '1'
33
+ }
34
+
35
+ @client.stub(:run, nil) do
36
+ @client.get_billing_agreement_details('1')
37
+ end
38
+
39
+ assert_equal operation, @client.operation
40
+ end
41
+
42
+ def test_sets_billing_agreement_details
43
+ operation = {
44
+ 'Action' => 'SetBillingAgreementDetails',
45
+ 'AmazonBillingAgreementId' => '1',
46
+ 'BillingAgreementAttributes.Foo' => '1'
47
+ }
48
+
49
+ @client.stub(:run, nil) do
50
+ @client.set_billing_agreement_details('1', 'Foo' => '1')
51
+ end
52
+
53
+ assert_equal operation, @client.operation
54
+ end
55
+
56
+ def test_confirms_billing_agreement
57
+ operation = {
58
+ 'Action' => 'ConfirmBillingAgreement',
59
+ 'AmazonBillingAgreementId' => '1'
60
+ }
61
+
62
+ @client.stub(:run, nil) do
63
+ @client.confirm_billing_agreement('1')
64
+ end
65
+
66
+ assert_equal operation, @client.operation
67
+ end
68
+
69
+ def test_validates_billing_agreement
70
+ operation = {
71
+ 'Action' => 'ValidateBillingAgreement',
72
+ 'AmazonBillingAgreementId' => '1'
73
+ }
74
+
75
+ @client.stub(:run, nil) do
76
+ @client.validate_billing_agreement('1')
77
+ end
78
+
79
+ assert_equal operation, @client.operation
80
+ end
81
+
82
+ def test_authorizes_on_billing_agreement
83
+ operation = {
84
+ 'Action' => 'AuthorizeOnBillingAgreement',
85
+ 'AmazonBillingAgreementId' => '1',
86
+ 'AuthorizationReferenceId' => '2',
87
+ 'AuthorizationAmount.Foo' => '1'
88
+ }
89
+
90
+ @client.stub(:run, nil) do
91
+ @client.authorize_on_billing_agreement('1', '2', 'Foo' => '1')
92
+ end
93
+
94
+ assert_equal operation, @client.operation
95
+ end
96
+
97
+ def test_closes_billing_agreement
98
+ operation = {
99
+ 'Action' => 'CloseBillingAgreement',
100
+ 'AmazonBillingAgreementId' => '1'
101
+ }
102
+
103
+ @client.stub(:run, nil) do
104
+ @client.close_billing_agreement('1')
105
+ end
106
+
107
+ assert_equal operation, @client.operation
108
+ end
109
+
110
+ def test_sets_order_reference_details
111
+ operation = {
112
+ 'Action' => 'SetOrderReferenceDetails',
113
+ 'AmazonOrderReferenceId' => '1',
114
+ 'OrderReferenceAttributes.OrderTotal' => '2'
115
+ }
116
+
117
+ @client.stub(:run, nil) do
118
+ @client.set_order_reference_details('1', '2')
119
+ end
120
+
121
+ assert_equal operation, @client.operation
122
+ end
123
+
124
+ def test_gets_order_reference_details
125
+ operation = {
126
+ 'Action' => 'GetOrderReferenceDetails',
127
+ 'AmazonOrderReferenceId' => '1'
128
+ }
129
+
130
+ @client.stub(:run, nil) do
131
+ @client.get_order_reference_details('1')
132
+ end
133
+
134
+ assert_equal operation, @client.operation
135
+ end
136
+
137
+ def test_confirms_order_reference
138
+ operation = {
139
+ 'Action' => 'ConfirmOrderReference',
140
+ 'AmazonOrderReferenceId' => '1'
141
+ }
142
+
143
+ @client.stub(:run, nil) do
144
+ @client.confirm_order_reference('1')
145
+ end
146
+
147
+ assert_equal operation, @client.operation
148
+ end
149
+
150
+ def test_cancels_order_reference
151
+ operation = {
152
+ 'Action' => 'CancelOrderReference',
153
+ 'AmazonOrderReferenceId' => '1'
154
+ }
155
+
156
+ @client.stub(:run, nil) do
157
+ @client.cancel_order_reference('1')
158
+ end
159
+
160
+ assert_equal operation, @client.operation
161
+ end
162
+
163
+ def test_closes_order_reference
164
+ operation = {
165
+ 'Action' => 'CloseOrderReference',
166
+ 'AmazonOrderReferenceId' => '1'
167
+ }
168
+
169
+ @client.stub(:run, nil) do
170
+ @client.close_order_reference('1')
171
+ end
172
+
173
+ assert_equal operation, @client.operation
174
+ end
175
+
176
+ def test_authorizes
177
+ operation = {
178
+ 'Action' => 'Authorize',
179
+ 'AmazonOrderReferenceId' => '1',
180
+ 'AuthorizationReferenceId' => '2',
181
+ 'AuthorizationAmount' => '3'
182
+ }
183
+
184
+ @client.stub(:run, nil) do
185
+ @client.authorize('1', '2', '3')
186
+ end
187
+
188
+ assert_equal operation, @client.operation
189
+ end
190
+
191
+ def test_captures
192
+ operation = {
193
+ 'Action' => 'Capture',
194
+ 'AmazonAuthorizationId' => '1',
195
+ 'CaptureReferenceId' => '2',
196
+ 'CaptureAmount' => '3'
197
+ }
198
+
199
+ @client.stub(:run, nil) do
200
+ @client.capture('1', '2', '3')
201
+ end
202
+
203
+ assert_equal operation, @client.operation
204
+ end
205
+
15
206
  def test_gets_capture_details
207
+ operation = {
208
+ 'Action' => 'GetCaptureDetails',
209
+ 'AmazonCaptureId' => '1'
210
+ }
211
+
16
212
  @client.stub(:run, nil) do
17
213
  @client.get_capture_details('1')
18
- assert_equal 'GetCaptureDetails', @client.operation.fetch('Action')
19
- assert_equal '1', @client.operation.fetch('AmazonCaptureId')
20
214
  end
215
+
216
+ assert_equal operation, @client.operation
217
+ end
218
+
219
+ def test_closes_authorization
220
+ operation = {
221
+ 'Action' => 'CloseAuthorization',
222
+ 'AmazonAuthorizationId' => '1'
223
+ }
224
+
225
+ @client.stub(:run, nil) do
226
+ @client.close_authorization('1')
227
+ end
228
+
229
+ assert_equal operation, @client.operation
230
+ end
231
+
232
+ def test_refunds
233
+ operation = {
234
+ 'Action' => 'Refund',
235
+ 'AmazonCaptureId' => '1',
236
+ 'RefundReferenceId' => '2',
237
+ 'RefundAmount' => '3'
238
+ }
239
+
240
+ @client.stub(:run, nil) do
241
+ @client.refund('1', '2', '3')
242
+ end
243
+
244
+ assert_equal operation, @client.operation
245
+ end
246
+
247
+ def test_gets_refund_details
248
+ operation = {
249
+ 'Action' => 'GetRefundDetails',
250
+ 'AmazonRefundId' => '1'
251
+ }
252
+
253
+ @client.stub(:run, nil) do
254
+ @client.get_refund_details('1')
255
+ end
256
+
257
+ assert_equal operation, @client.operation
258
+ end
259
+
260
+ def test_gets_service_status
261
+ operation = {
262
+ 'Action' => 'GetServiceStatus'
263
+ }
264
+
265
+ @client.stub(:run, nil) do
266
+ @client.get_service_status
267
+ end
268
+
269
+ assert_equal operation, @client.operation
21
270
  end
22
271
  end
@@ -6,39 +6,89 @@ class TestOrdersClient < MiniTest::Test
6
6
  @client = MWS::Orders::Client.new
7
7
  end
8
8
 
9
- def test_list_orders_has_marketplace_id
9
+ def test_lists_orders
10
+ operation = {
11
+ 'Action' => 'ListOrders',
12
+ 'OrderStatus.Status.1' => '1',
13
+ 'MarketplaceId.Id.1' => '1',
14
+ 'PaymentMethod.1' => '1',
15
+ 'TFMShipmentStatus.Status.1' => '1'
16
+ }
17
+
10
18
  @client.stub(:run, nil) do
11
- @client.list_orders(marketplace_id: '1')
12
- @client.operation.key?('MarketplaceId.Id.1')
19
+ @client.list_orders(
20
+ marketplace_id: '1',
21
+ order_status: '1',
22
+ tfm_shipment_status: '1',
23
+ payment_method: '1'
24
+ )
13
25
  end
26
+
27
+ assert_equal operation, @client.operation
14
28
  end
15
29
 
16
- def test_list_orders_has_order_status
30
+ def test_lists_orders_by_next_token
31
+ operation = {
32
+ 'Action' => 'ListOrdersByNextToken',
33
+ 'NextToken' => '1'
34
+ }
35
+
36
+ @client.stub(:run, nil) do
37
+ @client.list_orders_by_next_token('1')
38
+ end
39
+
40
+ assert_equal operation, @client.operation
41
+ end
42
+
43
+ def test_gets_order
44
+ operation = {
45
+ 'Action' => 'GetOrder',
46
+ 'AmazonOrderId.Id.1' => '1',
47
+ 'AmazonOrderId.Id.2' => '2'
48
+ }
49
+
17
50
  @client.stub(:run, nil) do
18
- @client.list_orders(order_status: '1')
19
- @client.operation.key?('OrderStatus.Status.1')
51
+ @client.get_order('1', '2')
20
52
  end
53
+
54
+ assert_equal operation, @client.operation
21
55
  end
22
56
 
23
- def test_list_orders_has_tfm_shipment_status
57
+ def test_lists_order_items
58
+ operation = {
59
+ 'Action' => 'ListOrderItems',
60
+ 'AmazonOrderId' => '1'
61
+ }
62
+
24
63
  @client.stub(:run, nil) do
25
- @client.list_orders(tfm_shipment_status: '1')
26
- @client.operation.key?('TFMShipmentStatus.Status.1')
64
+ @client.list_order_items('1')
27
65
  end
66
+
67
+ assert_equal operation, @client.operation
28
68
  end
29
69
 
30
- def test_list_orders_has_payment_method
70
+ def test_lists_order_items_by_next_token
71
+ operation = {
72
+ 'Action' => 'ListOrderItemsByNextToken',
73
+ 'NextToken' => '1'
74
+ }
75
+
31
76
  @client.stub(:run, nil) do
32
- @client.list_orders(payment_method: '1')
33
- @client.operation.key?('PaymentMethod.1')
77
+ @client.list_order_items_by_next_token('1')
34
78
  end
79
+
80
+ assert_equal operation, @client.operation
35
81
  end
36
82
 
37
- def test_get_order_has_amazon_order_ids
83
+ def test_gets_service_status
84
+ operation = {
85
+ 'Action' => 'GetServiceStatus'
86
+ }
87
+
38
88
  @client.stub(:run, nil) do
39
- @client.get_order('1', '2')
40
- @client.operation.key?('AmazonOrderId.Id.1')
41
- @client.operation.key?('AmazonOrderId.Id.2')
89
+ @client.get_service_status
42
90
  end
91
+
92
+ assert_equal operation, @client.operation
43
93
  end
44
94
  end
@@ -2,8 +2,26 @@ require 'test_helper'
2
2
  require 'mws/products/client'
3
3
 
4
4
  class TestProductsClient < MiniTest::Test
5
+ def setup
6
+ @client = MWS::Products::Client.new
7
+ end
8
+
5
9
  def test_operation_includes_marketplace_id
6
10
  client = MWS::Products::Client.new
7
11
  assert client.operation_with_marketplace('Foo').has_key?('MarketplaceId')
8
12
  end
13
+
14
+ def test_gets_service_status
15
+ operation = {
16
+ 'Action' => 'GetServiceStatus'
17
+ }
18
+
19
+ @client.stub(:run, nil) do
20
+ @client.get_service_status
21
+ end
22
+
23
+ assert_equal operation, @client.operation
24
+ end
25
+
26
+ # FIXME Fill in tests for operations
9
27
  end
@@ -0,0 +1,61 @@
1
+ require 'test_helper'
2
+ require 'mws/recommendations/client'
3
+
4
+ class TestRecommendationsClient < MiniTest::Test
5
+ def setup
6
+ @client = MWS::Recommendations::Client.new
7
+ end
8
+
9
+ def test_gets_last_updated_time_for_recommendations
10
+ operation = {
11
+ 'Action' => 'GetLastUpdatedTimeForRecommendations',
12
+ 'MarketplaceId' => '1'
13
+ }
14
+
15
+ @client.stub(:run, nil) do
16
+ @client.get_last_updated_time_for_recommendations('1')
17
+ end
18
+
19
+ assert_equal operation, @client.operation
20
+ end
21
+
22
+ def test_lists_recommendations
23
+ operation = {
24
+ 'Action' => 'ListRecommendations',
25
+ 'CategoryQueryList.CategoryQuery.1.FilterOptions.FilterOption.1.Foo' => '1',
26
+ 'MarketplaceId' => '123'
27
+ }
28
+
29
+ @client.marketplace_id = '123'
30
+ @client.stub(:run, nil) do
31
+ @client.list_recommendations(category_query_list: [{ 'Foo' => '1' }])
32
+ end
33
+
34
+ assert_equal operation, @client.operation
35
+ end
36
+
37
+ def test_lists_recommendations_by_next_token
38
+ operation = {
39
+ 'Action' => 'ListRecommendationsByNextToken',
40
+ 'NextToken' => '1'
41
+ }
42
+
43
+ @client.stub(:run, nil) do
44
+ @client.list_recommendations_by_next_token('1')
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
@@ -0,0 +1,24 @@
1
+ require 'test_helper'
2
+ require 'mws/reports/client'
3
+
4
+ class TestReportsClient < MiniTest::Test
5
+ def setup
6
+ @client = MWS::Reports::Client.new
7
+ end
8
+
9
+ def test_updates_report_acknowledgements
10
+ operation = {
11
+ 'Action' => 'UpdateReportAcknowledgements',
12
+ 'Acknowledged' => true,
13
+ 'ReportIdList.Id.1' => '1'
14
+ }
15
+
16
+ @client.stub(:run, nil) do
17
+ @client.update_report_acknowledgements(true, '1')
18
+ end
19
+
20
+ assert_equal operation, @client.operation
21
+ end
22
+
23
+ # FIXME Fill in tests for operations
24
+ end
@@ -0,0 +1,45 @@
1
+ require 'test_helper'
2
+ require 'mws/sellers/client'
3
+
4
+ class TestSellersClient < MiniTest::Test
5
+ def setup
6
+ @client = MWS::Sellers::Client.new
7
+ end
8
+
9
+ def test_lists_marketplace_participations
10
+ operation = {
11
+ 'Action' => 'ListMarketplaceParticipations'
12
+ }
13
+
14
+ @client.stub(:run, nil) do
15
+ @client.list_marketplace_participations
16
+ end
17
+
18
+ assert_equal operation, @client.operation
19
+ end
20
+
21
+ def test_lists_marketplace_participations_by_next_token
22
+ operation = {
23
+ 'Action' => 'ListMarketplaceParticipationsByNextToken',
24
+ 'NextToken' => '1'
25
+ }
26
+
27
+ @client.stub(:run, nil) do
28
+ @client.list_marketplace_participations_by_next_token('1')
29
+ end
30
+
31
+ assert_equal operation, @client.operation
32
+ end
33
+
34
+ def test_gets_service_status
35
+ operation = {
36
+ 'Action' => 'GetServiceStatus'
37
+ }
38
+
39
+ @client.stub(:run, nil) do
40
+ @client.get_service_status
41
+ end
42
+
43
+ assert_equal operation, @client.operation
44
+ end
45
+ end
@@ -0,0 +1,22 @@
1
+ require 'test_helper'
2
+ require 'mws/subscriptions/client'
3
+
4
+ class TestSubscriptionsClient < MiniTest::Test
5
+ def setup
6
+ @client = MWS::Subscriptions::Client.new
7
+ end
8
+
9
+ def test_gets_service_status
10
+ operation = {
11
+ 'Action' => 'GetServiceStatus'
12
+ }
13
+
14
+ @client.stub(:run, nil) do
15
+ @client.get_service_status
16
+ end
17
+
18
+ assert_equal operation, @client.operation
19
+ end
20
+
21
+ # FIXME Fill in tests for operations
22
+ end
@@ -0,0 +1,22 @@
1
+ require 'test_helper'
2
+ require 'mws/webstore/client'
3
+
4
+ class TestWebstoreClient < MiniTest::Test
5
+ def setup
6
+ @client = MWS::Webstore::Client.new
7
+ end
8
+
9
+ def test_gets_service_status
10
+ operation = {
11
+ 'Action' => 'GetServiceStatus'
12
+ }
13
+
14
+ @client.stub(:run, nil) do
15
+ @client.get_service_status
16
+ end
17
+
18
+ assert_equal operation, @client.operation
19
+ end
20
+
21
+ # FIXME Fill in tests for operations
22
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: peddler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.4
4
+ version: 0.12.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hakan Ensari
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-12 00:00:00.000000000 Z
11
+ date: 2015-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jeff
@@ -102,11 +102,20 @@ files:
102
102
  - test/integration_test_helper.rb
103
103
  - test/mws.yml
104
104
  - test/test_helper.rb
105
+ - test/unit/mws/test_cart_information_client.rb
106
+ - test/unit/mws/test_customer_information_client.rb
105
107
  - test/unit/mws/test_feeds_client.rb
108
+ - test/unit/mws/test_fulfillment_inbound_shipment_client.rb
106
109
  - test/unit/mws/test_fulfillment_inventory_client.rb
110
+ - test/unit/mws/test_fulfillment_outbound_shipment_client.rb
107
111
  - test/unit/mws/test_off_amazon_payments_client.rb
108
112
  - test/unit/mws/test_orders_client.rb
109
113
  - test/unit/mws/test_products_client.rb
114
+ - test/unit/mws/test_recommendations_client.rb
115
+ - test/unit/mws/test_reports_client.rb
116
+ - test/unit/mws/test_sellers_client.rb
117
+ - test/unit/mws/test_subscriptions_client.rb
118
+ - test/unit/mws/test_webstore_client.rb
110
119
  - test/unit/peddler/test_client.rb
111
120
  - test/unit/peddler/test_flat_file_parser.rb
112
121
  - test/unit/peddler/test_marketplace.rb
@@ -171,11 +180,20 @@ test_files:
171
180
  - test/integration_test_helper.rb
172
181
  - test/mws.yml
173
182
  - test/test_helper.rb
183
+ - test/unit/mws/test_cart_information_client.rb
184
+ - test/unit/mws/test_customer_information_client.rb
174
185
  - test/unit/mws/test_feeds_client.rb
186
+ - test/unit/mws/test_fulfillment_inbound_shipment_client.rb
175
187
  - test/unit/mws/test_fulfillment_inventory_client.rb
188
+ - test/unit/mws/test_fulfillment_outbound_shipment_client.rb
176
189
  - test/unit/mws/test_off_amazon_payments_client.rb
177
190
  - test/unit/mws/test_orders_client.rb
178
191
  - test/unit/mws/test_products_client.rb
192
+ - test/unit/mws/test_recommendations_client.rb
193
+ - test/unit/mws/test_reports_client.rb
194
+ - test/unit/mws/test_sellers_client.rb
195
+ - test/unit/mws/test_subscriptions_client.rb
196
+ - test/unit/mws/test_webstore_client.rb
179
197
  - test/unit/peddler/test_client.rb
180
198
  - test/unit/peddler/test_flat_file_parser.rb
181
199
  - test/unit/peddler/test_marketplace.rb