peddler 0.8.0 → 0.9.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 +15 -14
- data/lib/mws/cart_information/client.rb +72 -0
- data/lib/mws/cart_information.rb +1 -69
- data/lib/mws/customer_information/client.rb +79 -0
- data/lib/mws/customer_information.rb +1 -77
- data/lib/mws/feeds/client.rb +112 -0
- data/lib/mws/feeds.rb +1 -110
- data/lib/mws/fulfillment_inbound_shipment/client.rb +233 -0
- data/lib/mws/fulfillment_inbound_shipment.rb +1 -231
- data/lib/mws/fulfillment_inventory/client.rb +53 -0
- data/lib/mws/fulfillment_inventory.rb +1 -51
- data/lib/mws/fulfillment_outbound_shipment/client.rb +171 -0
- data/lib/mws/fulfillment_outbound_shipment.rb +1 -168
- data/lib/mws/off_amazon_payments/client.rb +362 -0
- data/lib/mws/off_amazon_payments.rb +1 -360
- data/lib/mws/orders/client.rb +102 -0
- data/lib/mws/orders.rb +1 -98
- data/lib/mws/products/client.rb +234 -0
- data/lib/mws/products.rb +1 -232
- data/lib/mws/recommendations/client.rb +71 -0
- data/lib/mws/recommendations.rb +1 -66
- data/lib/mws/reports/client.rb +220 -0
- data/lib/mws/reports.rb +1 -220
- data/lib/mws/sellers/client.rb +42 -0
- data/lib/mws/sellers.rb +1 -40
- data/lib/mws/subscriptions/client.rb +177 -0
- data/lib/mws/subscriptions.rb +1 -169
- data/lib/mws.rb +2 -2
- data/lib/peddler/client.rb +3 -3
- data/lib/peddler/flat_file_parser.rb +3 -3
- data/lib/peddler/operation.rb +2 -3
- data/lib/peddler/structured_list.rb +1 -3
- data/lib/peddler/version.rb +1 -1
- data/lib/peddler/xml_parser.rb +1 -1
- data/test/integration/test_cart_information.rb +2 -2
- data/test/integration/test_customer_information.rb +2 -2
- data/test/integration/test_feeds.rb +2 -2
- data/test/integration/test_fulfillment_inbound_shipment.rb +2 -2
- data/test/integration/test_fulfillment_inventory.rb +3 -7
- data/test/integration/test_fulfillment_outbound_shipment.rb +2 -49
- data/test/integration/test_off_amazon_payments.rb +2 -2
- data/test/integration/test_orders.rb +2 -13
- data/test/integration/test_products.rb +2 -2
- data/test/integration/test_recommendations.rb +2 -11
- data/test/integration/test_reports.rb +2 -3
- data/test/integration/test_sellers.rb +2 -9
- data/test/integration/test_subscriptions.rb +2 -2
- data/test/integration_test_helper.rb +49 -0
- data/test/mws.yml +16 -0
- data/test/mws.yml.bak +16 -0
- data/test/test_helper.rb +7 -0
- data/test/unit/mws/test_off_amazon_payments_client.rb +9 -0
- data/test/unit/mws/test_products_client.rb +9 -0
- data/test/unit/peddler/test_client.rb +2 -2
- data/test/unit/peddler/test_flat_file_parser.rb +2 -2
- data/test/unit/peddler/test_operation.rb +2 -2
- data/test/unit/peddler/test_parser.rb +2 -2
- data/test/unit/peddler/test_structured_list.rb +2 -2
- data/test/unit/peddler/test_xml_parser.rb +2 -2
- data/test/unit/test_mws.rb +3 -3
- data/test/vcr_cassettes/CartInformation.yml +37 -725
- data/test/vcr_cassettes/CustomerInformation.yml +37 -728
- data/test/vcr_cassettes/Feeds.yml +100 -528
- data/test/vcr_cassettes/FulfillmentInboundShipment.yml +39 -728
- data/test/vcr_cassettes/FulfillmentInventory.yml +96 -997
- data/test/vcr_cassettes/FulfillmentOutboundShipment.yml +39 -725
- data/test/vcr_cassettes/OffAmazonPayments.yml +36 -727
- data/test/vcr_cassettes/Orders.yml +38 -29855
- data/test/vcr_cassettes/Products.yml +1300 -3871
- data/test/vcr_cassettes/Recommendations.yml +8934 -15590
- data/test/vcr_cassettes/Reports.yml +288 -1326
- data/test/vcr_cassettes/Sellers.yml +38 -1178
- data/test/vcr_cassettes/Subscriptions.yml +244 -1066
- metadata +27 -98
- data/test/helper.rb +0 -3
- data/test/integration_helper.rb +0 -49
- data/test/mws.yml.1 +0 -32
- data/test/mws.yml.example +0 -4
- data/test/unit/mws/test_off_amazon_payments.rb +0 -9
- data/test/unit/mws/test_products.rb +0 -9
@@ -1,14 +1,7 @@
|
|
1
|
-
require '
|
1
|
+
require 'integration_test_helper'
|
2
2
|
require 'mws/sellers'
|
3
3
|
|
4
|
-
class
|
5
|
-
def test_lists_marketplace_participations
|
6
|
-
clients.each do |client|
|
7
|
-
res = client.list_marketplace_participations
|
8
|
-
refute_empty res.parse
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
4
|
+
class TestSellers < IntegrationTest
|
12
5
|
def test_gets_service_status
|
13
6
|
clients.each do |client|
|
14
7
|
res = client.get_service_status
|
@@ -1,7 +1,7 @@
|
|
1
|
-
require '
|
1
|
+
require 'integration_test_helper'
|
2
2
|
require 'mws/subscriptions'
|
3
3
|
|
4
|
-
class
|
4
|
+
class TestSubscriptions < IntegrationTest
|
5
5
|
def test_lists_registered_destinations
|
6
6
|
clients.each do |client|
|
7
7
|
res = client.list_registered_destinations
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'vcr'
|
3
|
+
require 'test_helper'
|
4
|
+
|
5
|
+
class IntegrationTest < MiniTest::Test
|
6
|
+
ACCOUNTS = YAML.load_file(File.expand_path('../mws.yml', __FILE__))
|
7
|
+
|
8
|
+
def api_name
|
9
|
+
self.class.name.match(/Test(.*)/)[1]
|
10
|
+
end
|
11
|
+
|
12
|
+
def clients
|
13
|
+
ACCOUNTS.map do |account|
|
14
|
+
MWS.const_get(api_name).const_get(:Client).new(account)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def setup
|
19
|
+
ENV['LIVE'] ? VCR.turn_off! : VCR.insert_cassette(api_name)
|
20
|
+
end
|
21
|
+
|
22
|
+
def teardown
|
23
|
+
VCR.eject_cassette if VCR.turned_on?
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
VCR.configure do |c|
|
28
|
+
c.hook_into :excon
|
29
|
+
c.cassette_library_dir = 'test/vcr_cassettes'
|
30
|
+
|
31
|
+
c.before_record do |interaction|
|
32
|
+
interaction.ignore! if interaction.response.status.code >= 400
|
33
|
+
end
|
34
|
+
|
35
|
+
matcher = VCR.request_matchers.uri_without_param(
|
36
|
+
'AWSAccessKeyId', 'SellerId', 'Signature', 'Timestamp', 'StartDate',
|
37
|
+
'CreatedAfter', 'QueryStartDateTime'
|
38
|
+
)
|
39
|
+
c.default_cassette_options = {
|
40
|
+
match_requests_on: [:method, matcher],
|
41
|
+
record: :none
|
42
|
+
}
|
43
|
+
|
44
|
+
IntegrationTest::ACCOUNTS.each do |account|
|
45
|
+
c.filter_sensitive_data('MERCHANT_ID') { account.fetch('merchant_id') }
|
46
|
+
c.filter_sensitive_data('AWS_SECRET_ACCESS_KEY') { account.fetch('aws_secret_access_key') }
|
47
|
+
c.filter_sensitive_data('AWS_ACCESS_KEY_ID') { account.fetch('aws_access_key_id') }
|
48
|
+
end
|
49
|
+
end
|
data/test/mws.yml
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
- marketplace_id: A2EUQ1WTGCTBG2
|
2
|
+
aws_access_key_id: AWS_ACCESS_KEY_ID
|
3
|
+
aws_secret_access_key: AWS_SECRET_ACCESS_KEY
|
4
|
+
merchant_id: MERCHANT_ID
|
5
|
+
- marketplace_id: A1PA6795UKMFR9
|
6
|
+
aws_access_key_id: AWS_ACCESS_KEY_ID
|
7
|
+
aws_secret_access_key: AWS_SECRET_ACCESS_KEY
|
8
|
+
merchant_id: MERCHANT_ID
|
9
|
+
- marketplace_id: A1VC38T7YXB528
|
10
|
+
aws_access_key_id: AWS_ACCESS_KEY_ID
|
11
|
+
aws_secret_access_key: AWS_SECRET_ACCESS_KEY
|
12
|
+
merchant_id: MERCHANT_ID
|
13
|
+
- marketplace_id: ATVPDKIKX0DER
|
14
|
+
aws_access_key_id: AWS_ACCESS_KEY_ID
|
15
|
+
aws_secret_access_key: AWS_SECRET_ACCESS_KEY
|
16
|
+
merchant_id: MERCHANT_ID
|
data/test/mws.yml.bak
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
- marketplace_id: A2EUQ1WTGCTBG2
|
2
|
+
aws_access_key_id: AKIAITHQMZUJROSOP27Q
|
3
|
+
aws_secret_access_key: YDCmgpYmM5q2ucqLAeFUEbYKOAADvorsfJOgY5N6
|
4
|
+
merchant_id: A2A7WNXBU01UJW
|
5
|
+
- marketplace_id: A1PA6795UKMFR9
|
6
|
+
aws_access_key_id: AKIAIORT7554FEBW7UBQ
|
7
|
+
aws_secret_access_key: P2ocOVChe/dQUpxRfA1n3TmP+wHrF6GaSzXslvEG
|
8
|
+
merchant_id: A7ZXDJZD3UIRG
|
9
|
+
- marketplace_id: A1VC38T7YXB528
|
10
|
+
aws_access_key_id: AKIAJ5RDDSRROM6GXQ5Q
|
11
|
+
aws_secret_access_key: WGPMtwkUvlRXg22byoI+ceXyhnDQOMozUoFmsHzW
|
12
|
+
merchant_id: A7BU5WGNVGQ1I
|
13
|
+
- marketplace_id: ATVPDKIKX0DER
|
14
|
+
aws_access_key_id: AKIAJ767ZET2BZR4UDDQ
|
15
|
+
aws_secret_access_key: rONa3ydPBTJ5JD0bxERTOX0Fv0fBK6Q986/cfMRO
|
16
|
+
merchant_id: A2H6NH4SQYFZ4M
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'mws/off_amazon_payments/client'
|
3
|
+
|
4
|
+
class TestMWSOffAmazonPaymentsClient < MiniTest::Test
|
5
|
+
def test_sandbox
|
6
|
+
client = MWS::OffAmazonPayments::Client.new(marketplace_id: 'A1F83G8C2ARO7P').sandbox
|
7
|
+
assert_includes client.aws_endpoint, 'OffAmazonPayments_Sandbox'
|
8
|
+
end
|
9
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
|
-
require '
|
1
|
+
require 'test_helper'
|
2
2
|
require 'peddler/flat_file_parser'
|
3
3
|
|
4
|
-
class
|
4
|
+
class TestPeddlerFlatFileParser < MiniTest::Test
|
5
5
|
def setup
|
6
6
|
body = "Feed Processing Summary:\n\tNumber of records processed\t\t11006\n\tNumber of records successful\t\t11006\n\noriginal-record-number\tsku\terror-code\terror-type\terror-message\n1822\t85da472e-ba6c-11e3-95af-002590a74356\t5000\tWarning\tThe update for Sku '85da472e-ba6c-11e3-95af-002590a74356' was skipped because it is identical to the update in feed '9518995390'.\n"
|
7
7
|
body.encode!('ASCII-8BIT')
|
@@ -1,7 +1,7 @@
|
|
1
|
-
require '
|
1
|
+
require 'test_helper'
|
2
2
|
require 'peddler/parser'
|
3
3
|
|
4
|
-
class
|
4
|
+
class TestPeddlerParser < MiniTest::Test
|
5
5
|
def assert_parser(klass, *content_types)
|
6
6
|
content_types.each do |content_type|
|
7
7
|
res = OpenStruct.new(headers: { 'Content-Type' => content_type }, body: '')
|
@@ -1,7 +1,7 @@
|
|
1
|
-
require '
|
1
|
+
require 'test_helper'
|
2
2
|
require 'peddler/xml_parser'
|
3
3
|
|
4
|
-
class
|
4
|
+
class TestPeddlerXMLParser < MiniTest::Test
|
5
5
|
def setup
|
6
6
|
body = '<Response><Result><NextToken>123</NextToken><Foo>Bar</Foo></Result></Response>'
|
7
7
|
res = OpenStruct.new(body: body, headers: { 'Content-Type' => 'text/xml', 'Content-Length' => '78'})
|
data/test/unit/test_mws.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
require '
|
1
|
+
require 'test_helper'
|
2
2
|
require 'mws'
|
3
3
|
|
4
|
-
class
|
4
|
+
class TestMWS < MiniTest::Test
|
5
5
|
def test_delegates_to_apis
|
6
6
|
assert_equal MWS.methods(false).size, MWS.constants.size
|
7
|
-
assert_kind_of MWS::Products, MWS.products
|
7
|
+
assert_kind_of MWS::Products::Client, MWS.products
|
8
8
|
end
|
9
9
|
end
|