peddler 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/README.md +15 -14
  4. data/lib/mws/cart_information/client.rb +72 -0
  5. data/lib/mws/cart_information.rb +1 -69
  6. data/lib/mws/customer_information/client.rb +79 -0
  7. data/lib/mws/customer_information.rb +1 -77
  8. data/lib/mws/feeds/client.rb +112 -0
  9. data/lib/mws/feeds.rb +1 -110
  10. data/lib/mws/fulfillment_inbound_shipment/client.rb +233 -0
  11. data/lib/mws/fulfillment_inbound_shipment.rb +1 -231
  12. data/lib/mws/fulfillment_inventory/client.rb +53 -0
  13. data/lib/mws/fulfillment_inventory.rb +1 -51
  14. data/lib/mws/fulfillment_outbound_shipment/client.rb +171 -0
  15. data/lib/mws/fulfillment_outbound_shipment.rb +1 -168
  16. data/lib/mws/off_amazon_payments/client.rb +362 -0
  17. data/lib/mws/off_amazon_payments.rb +1 -360
  18. data/lib/mws/orders/client.rb +102 -0
  19. data/lib/mws/orders.rb +1 -98
  20. data/lib/mws/products/client.rb +234 -0
  21. data/lib/mws/products.rb +1 -232
  22. data/lib/mws/recommendations/client.rb +71 -0
  23. data/lib/mws/recommendations.rb +1 -66
  24. data/lib/mws/reports/client.rb +220 -0
  25. data/lib/mws/reports.rb +1 -220
  26. data/lib/mws/sellers/client.rb +42 -0
  27. data/lib/mws/sellers.rb +1 -40
  28. data/lib/mws/subscriptions/client.rb +177 -0
  29. data/lib/mws/subscriptions.rb +1 -169
  30. data/lib/mws.rb +2 -2
  31. data/lib/peddler/client.rb +3 -3
  32. data/lib/peddler/flat_file_parser.rb +3 -3
  33. data/lib/peddler/operation.rb +2 -3
  34. data/lib/peddler/structured_list.rb +1 -3
  35. data/lib/peddler/version.rb +1 -1
  36. data/lib/peddler/xml_parser.rb +1 -1
  37. data/test/integration/test_cart_information.rb +2 -2
  38. data/test/integration/test_customer_information.rb +2 -2
  39. data/test/integration/test_feeds.rb +2 -2
  40. data/test/integration/test_fulfillment_inbound_shipment.rb +2 -2
  41. data/test/integration/test_fulfillment_inventory.rb +3 -7
  42. data/test/integration/test_fulfillment_outbound_shipment.rb +2 -49
  43. data/test/integration/test_off_amazon_payments.rb +2 -2
  44. data/test/integration/test_orders.rb +2 -13
  45. data/test/integration/test_products.rb +2 -2
  46. data/test/integration/test_recommendations.rb +2 -11
  47. data/test/integration/test_reports.rb +2 -3
  48. data/test/integration/test_sellers.rb +2 -9
  49. data/test/integration/test_subscriptions.rb +2 -2
  50. data/test/integration_test_helper.rb +49 -0
  51. data/test/mws.yml +16 -0
  52. data/test/mws.yml.bak +16 -0
  53. data/test/test_helper.rb +7 -0
  54. data/test/unit/mws/test_off_amazon_payments_client.rb +9 -0
  55. data/test/unit/mws/test_products_client.rb +9 -0
  56. data/test/unit/peddler/test_client.rb +2 -2
  57. data/test/unit/peddler/test_flat_file_parser.rb +2 -2
  58. data/test/unit/peddler/test_operation.rb +2 -2
  59. data/test/unit/peddler/test_parser.rb +2 -2
  60. data/test/unit/peddler/test_structured_list.rb +2 -2
  61. data/test/unit/peddler/test_xml_parser.rb +2 -2
  62. data/test/unit/test_mws.rb +3 -3
  63. data/test/vcr_cassettes/CartInformation.yml +37 -725
  64. data/test/vcr_cassettes/CustomerInformation.yml +37 -728
  65. data/test/vcr_cassettes/Feeds.yml +100 -528
  66. data/test/vcr_cassettes/FulfillmentInboundShipment.yml +39 -728
  67. data/test/vcr_cassettes/FulfillmentInventory.yml +96 -997
  68. data/test/vcr_cassettes/FulfillmentOutboundShipment.yml +39 -725
  69. data/test/vcr_cassettes/OffAmazonPayments.yml +36 -727
  70. data/test/vcr_cassettes/Orders.yml +38 -29855
  71. data/test/vcr_cassettes/Products.yml +1300 -3871
  72. data/test/vcr_cassettes/Recommendations.yml +8934 -15590
  73. data/test/vcr_cassettes/Reports.yml +288 -1326
  74. data/test/vcr_cassettes/Sellers.yml +38 -1178
  75. data/test/vcr_cassettes/Subscriptions.yml +244 -1066
  76. metadata +27 -98
  77. data/test/helper.rb +0 -3
  78. data/test/integration_helper.rb +0 -49
  79. data/test/mws.yml.1 +0 -32
  80. data/test/mws.yml.example +0 -4
  81. data/test/unit/mws/test_off_amazon_payments.rb +0 -9
  82. data/test/unit/mws/test_products.rb +0 -9
@@ -1,14 +1,7 @@
1
- require 'integration_helper'
1
+ require 'integration_test_helper'
2
2
  require 'mws/sellers'
3
3
 
4
- class SellersTest < IntegrationTest
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 'integration_helper'
1
+ require 'integration_test_helper'
2
2
  require 'mws/subscriptions'
3
3
 
4
- class SubscriptionsTest < IntegrationTest
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: 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
4
+ merchant_id: A2A7WNXBU01UJW
5
+ - marketplace_id: A1PA6795UKMFR9
6
+ aws_access_key_id: AKIAIORT7554FEBW7UBQ
7
+ aws_secret_access_key: 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
8
+ merchant_id: A7ZXDJZD3UIRG
9
+ - marketplace_id: A1VC38T7YXB528
10
+ aws_access_key_id: AKIAJ5RDDSRROM6GXQ5Q
11
+ aws_secret_access_key: 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
12
+ merchant_id: A7BU5WGNVGQ1I
13
+ - marketplace_id: ATVPDKIKX0DER
14
+ aws_access_key_id: AKIAJ767ZET2BZR4UDDQ
15
+ aws_secret_access_key: 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
16
+ merchant_id: A2H6NH4SQYFZ4M
@@ -0,0 +1,7 @@
1
+ require 'coveralls'
2
+ Coveralls.wear!
3
+ require 'minitest/autorun'
4
+ begin
5
+ require 'pry'
6
+ rescue LoadError
7
+ end
@@ -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
@@ -0,0 +1,9 @@
1
+ require 'test_helper'
2
+ require 'mws/products/client'
3
+
4
+ class TestProductsClient < MiniTest::Test
5
+ def test_operation_includes_marketplace_id
6
+ client = MWS::Products::Client.new
7
+ assert client.operation('Foo').has_key?('MarketplaceId')
8
+ end
9
+ end
@@ -1,8 +1,8 @@
1
- require 'helper'
1
+ require 'test_helper'
2
2
  require 'excon'
3
3
  require 'peddler/client'
4
4
 
5
- class PeddlerClientTest < MiniTest::Test
5
+ class TestPeddlerClient < MiniTest::Test
6
6
  module Parser
7
7
  def self.parse(res, *); res; end
8
8
  end
@@ -1,7 +1,7 @@
1
- require 'helper'
1
+ require 'test_helper'
2
2
  require 'peddler/flat_file_parser'
3
3
 
4
- class PeddlerFlatFileParserTest < MiniTest::Test
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 'helper'
1
+ require 'test_helper'
2
2
  require 'peddler/operation'
3
3
 
4
- class PeddlerOperationTest < MiniTest::Test
4
+ class TestPeddlerOperation < MiniTest::Test
5
5
  def setup
6
6
  @operation = Peddler::Operation.new('Foo')
7
7
  end
@@ -1,7 +1,7 @@
1
- require 'helper'
1
+ require 'test_helper'
2
2
  require 'peddler/parser'
3
3
 
4
- class PeddlerParserTest < MiniTest::Test
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 'helper'
1
+ require 'test_helper'
2
2
  require 'peddler/structured_list'
3
3
 
4
- class PeddlerStructuredListTest < MiniTest::Test
4
+ class TestPeddlerStructuredList < MiniTest::Test
5
5
  def setup
6
6
  @list = Peddler::StructuredList.new('OrderStatus', 'Status')
7
7
  end
@@ -1,7 +1,7 @@
1
- require 'helper'
1
+ require 'test_helper'
2
2
  require 'peddler/xml_parser'
3
3
 
4
- class PeddlerXMLParserTest < MiniTest::Test
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'})
@@ -1,9 +1,9 @@
1
- require 'helper'
1
+ require 'test_helper'
2
2
  require 'mws'
3
3
 
4
- class MWSTest < MiniTest::Test
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