peddler 2.1.1 → 2.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +45 -41
- data/lib/mws.rb +2 -1
- data/lib/mws/easy_ship.rb +3 -0
- data/lib/mws/easy_ship/client.rb +93 -0
- data/lib/mws/fulfillment_outbound_shipment/client.rb +1 -1
- data/lib/mws/orders/client.rb +7 -9
- data/lib/mws/shipment_invoicing.rb +3 -0
- data/lib/mws/shipment_invoicing/client.rb +74 -0
- data/lib/mws/subscriptions/client.rb +2 -2
- data/lib/peddler/client.rb +17 -13
- data/lib/peddler/errors/builder.rb +7 -2
- data/lib/peddler/errors/class_generator.rb +9 -4
- data/lib/peddler/errors/error.rb +6 -2
- data/lib/peddler/errors/parser.rb +1 -1
- data/lib/peddler/flat_file_parser.rb +5 -3
- data/lib/peddler/headers.rb +6 -1
- data/lib/peddler/marketplace.rb +25 -19
- data/lib/peddler/operation.rb +17 -11
- data/lib/peddler/parser.rb +1 -1
- data/lib/peddler/structured_list.rb +1 -1
- data/lib/peddler/vcr_matcher.rb +7 -7
- data/lib/peddler/version.rb +1 -1
- data/lib/peddler/xml_parser.rb +1 -1
- data/lib/peddler/xml_response_parser.rb +3 -2
- metadata +15 -152
- data/lib/mws/off_amazon_payments/client.rb +0 -362
- data/lib/peddler/content.rb +0 -69
- data/lib/peddler/mws.rb +0 -58
- data/test/credentials.rb +0 -23
- data/test/helper.rb +0 -15
- data/test/integration/internals/test_errors.rb +0 -17
- data/test/integration/internals/test_multibyte_queries.rb +0 -17
- data/test/integration/internals/test_mws_headers.rb +0 -21
- data/test/integration/internals/test_string_encodings.rb +0 -38
- data/test/integration/test_feeds.rb +0 -37
- data/test/integration/test_fulfillment_inbound_shipment.rb +0 -35
- data/test/integration/test_fulfillment_inventory.rb +0 -20
- data/test/integration/test_fulfillment_outbound_shipment.rb +0 -13
- data/test/integration/test_merchant_fulfillment.rb +0 -69
- data/test/integration/test_off_amazon_payments.rb +0 -13
- data/test/integration/test_orders.rb +0 -30
- data/test/integration/test_products.rb +0 -97
- data/test/integration/test_recommendations.rb +0 -20
- data/test/integration/test_reports.rb +0 -51
- data/test/integration/test_sellers.rb +0 -13
- data/test/integration/test_subscriptions.rb +0 -27
- data/test/integration_helper.rb +0 -53
- data/test/mws.yml +0 -36
- data/test/mws.yml.example +0 -32
- data/test/null_client.rb +0 -25
- data/test/recorder.rb +0 -39
- data/test/unit/mws/test_feeds_client.rb +0 -103
- data/test/unit/mws/test_finances_client.rb +0 -74
- data/test/unit/mws/test_fulfillment_inbound_shipment_client.rb +0 -426
- data/test/unit/mws/test_fulfillment_inventory_client.rb +0 -48
- data/test/unit/mws/test_fulfillment_outbound_shipment_client.rb +0 -202
- data/test/unit/mws/test_merchant_fulfillment_client.rb +0 -109
- data/test/unit/mws/test_off_amazon_payments_client.rb +0 -286
- data/test/unit/mws/test_orders_client.rb +0 -111
- data/test/unit/mws/test_products_client.rb +0 -248
- data/test/unit/mws/test_recommendations_client.rb +0 -62
- data/test/unit/mws/test_reports_client.rb +0 -209
- data/test/unit/mws/test_sellers_client.rb +0 -47
- data/test/unit/mws/test_subscriptions_client.rb +0 -182
- data/test/unit/peddler/errors/test_builder.rb +0 -65
- data/test/unit/peddler/errors/test_class_generator.rb +0 -18
- data/test/unit/peddler/errors/test_error.rb +0 -33
- data/test/unit/peddler/errors/test_parser.rb +0 -44
- data/test/unit/peddler/test_client.rb +0 -203
- data/test/unit/peddler/test_flat_file_parser.rb +0 -111
- data/test/unit/peddler/test_headers.rb +0 -103
- data/test/unit/peddler/test_marketplace.rb +0 -47
- data/test/unit/peddler/test_operation.rb +0 -87
- data/test/unit/peddler/test_parser.rb +0 -36
- data/test/unit/peddler/test_structured_list.rb +0 -39
- data/test/unit/peddler/test_vcr_matcher.rb +0 -55
- data/test/unit/peddler/test_xml_parser.rb +0 -37
- data/test/unit/peddler/test_xml_response_parser.rb +0 -39
- data/test/unit/test_mws.rb +0 -11
- data/test/vcr_cassettes/CartInformation.yml +0 -433
- data/test/vcr_cassettes/CustomerInformation.yml +0 -433
- data/test/vcr_cassettes/Errors.yml +0 -444
- data/test/vcr_cassettes/Feeds.yml +0 -9957
- data/test/vcr_cassettes/FulfillmentInboundShipment.yml +0 -6166
- data/test/vcr_cassettes/FulfillmentInventory.yml +0 -850
- data/test/vcr_cassettes/FulfillmentOutboundShipment.yml +0 -433
- data/test/vcr_cassettes/MWSHeaders.yml +0 -2964
- data/test/vcr_cassettes/MerchantFulfillment.yml +0 -753
- data/test/vcr_cassettes/MultibyteQueries.yml +0 -437
- data/test/vcr_cassettes/OffAmazonPayments.yml +0 -433
- data/test/vcr_cassettes/Orders.yml +0 -4740
- data/test/vcr_cassettes/PeddlerVCRMatcher.yml +0 -41
- data/test/vcr_cassettes/Products.yml +0 -7139
- data/test/vcr_cassettes/Recommendations.yml +0 -3145
- data/test/vcr_cassettes/Reports.yml +0 -5549
- data/test/vcr_cassettes/Sellers.yml +0 -433
- data/test/vcr_cassettes/Subscriptions.yml +0 -1529
@@ -1,13 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'integration_helper'
|
4
|
-
require 'mws/off_amazon_payments'
|
5
|
-
|
6
|
-
class TestOffAmazonPayments < IntegrationTest
|
7
|
-
def test_getting_service_status
|
8
|
-
clients.each do |client|
|
9
|
-
res = client.get_service_status
|
10
|
-
refute_empty res.parse
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'integration_helper'
|
4
|
-
require 'mws/orders'
|
5
|
-
|
6
|
-
class TestOrders < IntegrationTest
|
7
|
-
def test_getting_orders
|
8
|
-
clients.each do |client|
|
9
|
-
order_ids = client.list_orders(client.marketplace.id,
|
10
|
-
created_after: Date.new(2015),
|
11
|
-
max_results_per_page: 5)
|
12
|
-
.dig('Orders', 'Order')
|
13
|
-
.map { |order| order['AmazonOrderId'] }
|
14
|
-
|
15
|
-
next if order_ids.count < 2
|
16
|
-
|
17
|
-
res = client.get_order(*order_ids)
|
18
|
-
orders = res.dig('Orders', 'Order')
|
19
|
-
|
20
|
-
assert_equal order_ids.count, orders.count
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_getting_service_status
|
25
|
-
clients.each do |client|
|
26
|
-
res = client.get_service_status
|
27
|
-
refute_empty res.parse
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
@@ -1,97 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'integration_helper'
|
4
|
-
require 'mws/products'
|
5
|
-
|
6
|
-
class TestProducts < IntegrationTest
|
7
|
-
def test_listing_matching_products
|
8
|
-
clients.each do |client|
|
9
|
-
res = client.list_matching_products(client.marketplace.id, 'architecture')
|
10
|
-
refute_empty res.parse
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_getting_matching_product
|
15
|
-
clients.each do |client|
|
16
|
-
res = client.get_matching_product(client.marketplace.id, '1780935374')
|
17
|
-
refute_empty res.parse
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_getting_matching_product_for_id
|
22
|
-
clients.each do |client|
|
23
|
-
res = client.get_matching_product_for_id(client.marketplace.id, 'ISBN', '9781780935379')
|
24
|
-
refute_empty res.parse
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def test_getting_competitive_pricing_for_asin
|
29
|
-
clients.each do |client|
|
30
|
-
res = client.get_competitive_pricing_for_asin(client.marketplace.id, '1780935374')
|
31
|
-
refute_empty res.parse
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def test_getting_lowest_offer_listings_for_asin
|
36
|
-
clients.each do |client|
|
37
|
-
res = client.get_lowest_offer_listings_for_asin(client.marketplace.id, '1780935374')
|
38
|
-
refute_empty res.parse
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
def test_getting_lowest_priced_offers_for_asin
|
43
|
-
clients.each do |client|
|
44
|
-
res = client.get_lowest_priced_offers_for_asin(client.marketplace.id, '1780935374', 'New')
|
45
|
-
refute_empty res.parse
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
def test_getting_product_categories_for_asin
|
50
|
-
clients.each do |client|
|
51
|
-
res = client.get_product_categories_for_asin(client.marketplace.id, '1780935374')
|
52
|
-
refute_empty res.parse
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
def test_getting_my_fees_estimate
|
57
|
-
clients.each do |client|
|
58
|
-
res = client.get_my_fees_estimate(
|
59
|
-
marketplace_id: client.marketplace.id,
|
60
|
-
id_type: 'ASIN',
|
61
|
-
id_value: '1780935374',
|
62
|
-
price_to_estimate_fees: {
|
63
|
-
listing_price: {
|
64
|
-
currency_code: currency_code_for(client.marketplace.id),
|
65
|
-
amount: 100
|
66
|
-
}
|
67
|
-
},
|
68
|
-
identifier: '123',
|
69
|
-
is_amazon_fulfilled: false
|
70
|
-
)
|
71
|
-
assert res.dig('FeesEstimateResultList', 'FeesEstimateResult', 'FeesEstimate')
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
def test_getting_service_status
|
76
|
-
clients.each do |client|
|
77
|
-
res = client.get_service_status
|
78
|
-
refute_empty res.parse
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
private
|
83
|
-
|
84
|
-
CURRENCY_CODES = {
|
85
|
-
'A2EUQ1WTGCTBG2' => 'CAD',
|
86
|
-
'AAHKV2X7AFYLW' => 'CNY',
|
87
|
-
'A1F83G8C2ARO7P' => 'GBP',
|
88
|
-
'A21TJRUUN4KGV' => 'INR',
|
89
|
-
'A1VC38T7YXB528' => 'JPY',
|
90
|
-
'A1AM78C64UM0Y8' => 'MXN',
|
91
|
-
'ATVPDKIKX0DER' => 'USD'
|
92
|
-
}.freeze
|
93
|
-
|
94
|
-
def currency_code_for(marketplace_id)
|
95
|
-
CURRENCY_CODES.fetch(marketplace_id, 'EUR')
|
96
|
-
end
|
97
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'integration_helper'
|
4
|
-
require 'mws/recommendations'
|
5
|
-
|
6
|
-
class TestRecommendations < IntegrationTest
|
7
|
-
def test_listing_recommendations
|
8
|
-
clients.each do |client|
|
9
|
-
res = client.list_recommendations(client.marketplace.id)
|
10
|
-
refute_empty res.parse
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_getting_service_status
|
15
|
-
clients.each do |client|
|
16
|
-
res = client.get_service_status
|
17
|
-
refute_empty res.parse
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'integration_helper'
|
4
|
-
require 'mws/reports'
|
5
|
-
|
6
|
-
class TestReports < IntegrationTest
|
7
|
-
def test_getting_report_request_count
|
8
|
-
clients.each do |client|
|
9
|
-
res = client.get_report_request_count
|
10
|
-
refute_empty res.parse
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_getting_report_request_list
|
15
|
-
clients.each do |client|
|
16
|
-
res = client.get_report_request_list
|
17
|
-
refute_empty res.parse
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_getting_report_schedule_count
|
22
|
-
clients.each do |client|
|
23
|
-
res = client.get_report_schedule_count
|
24
|
-
refute_empty res.parse
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def test_listing_report_schedules
|
29
|
-
clients.each do |client|
|
30
|
-
res = client.get_report_schedule_list
|
31
|
-
refute_empty res.parse
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def test_getting_report_count
|
36
|
-
clients.each do |client|
|
37
|
-
res = client.get_report_count
|
38
|
-
refute_empty res.parse
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
def test_getting_report
|
43
|
-
clients.each do |client|
|
44
|
-
res = client.get_report_list(max_count: 1)
|
45
|
-
id = res.parse['ReportInfo']['ReportId']
|
46
|
-
res = client.get_report(id)
|
47
|
-
assert res.valid?
|
48
|
-
assert res.records_count || res.parse
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'integration_helper'
|
4
|
-
require 'mws/sellers'
|
5
|
-
|
6
|
-
class TestSellers < IntegrationTest
|
7
|
-
def test_getting_service_status
|
8
|
-
clients.each do |client|
|
9
|
-
res = client.get_service_status
|
10
|
-
refute_empty res.parse
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'integration_helper'
|
4
|
-
require 'mws/subscriptions'
|
5
|
-
|
6
|
-
class TestSubscriptions < IntegrationTest
|
7
|
-
def test_listing_registered_destinations
|
8
|
-
clients.each do |client|
|
9
|
-
res = client.list_registered_destinations(client.marketplace.id)
|
10
|
-
refute_empty res.parse
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_listing_subscriptions
|
15
|
-
clients.each do |client|
|
16
|
-
res = client.list_subscriptions(client.marketplace.id)
|
17
|
-
refute_empty res.parse
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_getting_service_status
|
22
|
-
clients.each do |client|
|
23
|
-
res = client.get_service_status
|
24
|
-
refute_empty res.parse
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
data/test/integration_helper.rb
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'credentials'
|
4
|
-
require 'helper'
|
5
|
-
require 'recorder'
|
6
|
-
|
7
|
-
class IntegrationTest < MiniTest::Test
|
8
|
-
include Recorder
|
9
|
-
|
10
|
-
class << self
|
11
|
-
def use(endpoint)
|
12
|
-
@current_endpoint = endpoint
|
13
|
-
end
|
14
|
-
|
15
|
-
def clients
|
16
|
-
klass = MWS.const_get("#{current_endpoint}::Client")
|
17
|
-
::Credentials.to_a.shuffle.each_with_object([]) do |credentials, memo|
|
18
|
-
client = klass.new(credentials)
|
19
|
-
country_code = client.marketplace.country_code
|
20
|
-
memo.define_singleton_method(country_code.downcase) { client }
|
21
|
-
memo << client
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
private
|
26
|
-
|
27
|
-
def current_endpoint
|
28
|
-
@current_endpoint ||= name.sub('Test', '')
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def clients
|
33
|
-
self.class.clients
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
::Peddler::VCRMatcher.ignore_seller!
|
38
|
-
|
39
|
-
VCR.configure do |c|
|
40
|
-
c.before_record do |interaction|
|
41
|
-
%w[
|
42
|
-
BuyerName BuyerEmail Name AddressLine1 City StateOrProvinceCode PostalCode
|
43
|
-
Phone Amount AmazonOrderId SellerOrderId
|
44
|
-
].each do |key|
|
45
|
-
interaction.response.body.gsub!(/<#{key}>[^<]+</, "<#{key}>FILTERED<")
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
Credentials.each do |record|
|
50
|
-
c.filter_sensitive_data('MERCHANT_ID') { record['merchant_id'] }
|
51
|
-
c.filter_sensitive_data('AWS_ACCESS_KEY_ID') { record['aws_access_key_id'] }
|
52
|
-
end
|
53
|
-
end
|
data/test/mws.yml
DELETED
@@ -1,36 +0,0 @@
|
|
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
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
- marketplace: US
|
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: GB
|
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: DE
|
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: CA
|
14
|
-
aws_access_key_id: AWS_ACCESS_KEY_ID
|
15
|
-
aws_secret_access_key: AWS_SECRET_ACCESS_KEY
|
16
|
-
merchant_id: MERCHANT_ID
|
17
|
-
- marketplace: FR
|
18
|
-
aws_access_key_id: AWS_ACCESS_KEY_ID
|
19
|
-
aws_secret_access_key: AWS_SECRET_ACCESS_KEY
|
20
|
-
merchant_id: MERCHANT_ID
|
21
|
-
- marketplace: JP
|
22
|
-
aws_access_key_id: AWS_ACCESS_KEY_ID
|
23
|
-
aws_secret_access_key: AWS_SECRET_ACCESS_KEY
|
24
|
-
merchant_id: MERCHANT_ID
|
25
|
-
- marketplace: ES
|
26
|
-
aws_access_key_id: AWS_ACCESS_KEY_ID
|
27
|
-
aws_secret_access_key: AWS_SECRET_ACCESS_KEY
|
28
|
-
merchant_id: MERCHANT_ID
|
29
|
-
- marketplace: IT
|
30
|
-
aws_access_key_id: AWS_ACCESS_KEY_ID
|
31
|
-
aws_secret_access_key: AWS_SECRET_ACCESS_KEY
|
32
|
-
merchant_id: MERCHANT_ID
|
data/test/null_client.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'peddler/client'
|
4
|
-
require 'securerandom'
|
5
|
-
|
6
|
-
module Null
|
7
|
-
module Parser
|
8
|
-
def self.new(res, *)
|
9
|
-
res
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
class Client < ::Peddler::Client
|
14
|
-
self.path = '/'
|
15
|
-
|
16
|
-
def configure_with_mock_data!
|
17
|
-
self.aws_access_key_id = SecureRandom.hex
|
18
|
-
self.aws_secret_access_key = SecureRandom.hex
|
19
|
-
self.merchant_id = SecureRandom.hex
|
20
|
-
self.marketplace = 'US'
|
21
|
-
end
|
22
|
-
|
23
|
-
self.parser = Parser
|
24
|
-
end
|
25
|
-
end
|
data/test/recorder.rb
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'peddler/vcr_matcher'
|
4
|
-
require 'yaml'
|
5
|
-
require 'vcr'
|
6
|
-
|
7
|
-
# So we can continue testing against old Content-MD5 header
|
8
|
-
::Peddler::VCRMatcher.ignored_params << 'ContentMD5Value'
|
9
|
-
|
10
|
-
VCR.configure do |c|
|
11
|
-
c.hook_into :excon
|
12
|
-
c.cassette_library_dir = 'test/vcr_cassettes'
|
13
|
-
|
14
|
-
c.default_cassette_options = {
|
15
|
-
match_requests_on: [::Peddler::VCRMatcher],
|
16
|
-
record: ENV['RECORD'] ? :new_episodes : :none
|
17
|
-
}
|
18
|
-
|
19
|
-
# c.before_record do |interaction|
|
20
|
-
# code = interaction.response.status.code
|
21
|
-
# interaction.ignore! if code >= 400 && code != 414
|
22
|
-
# end
|
23
|
-
end
|
24
|
-
|
25
|
-
module Recorder
|
26
|
-
def setup
|
27
|
-
ENV['LIVE'] ? VCR.turn_off! : VCR.insert_cassette(test_name)
|
28
|
-
end
|
29
|
-
|
30
|
-
def teardown
|
31
|
-
VCR.eject_cassette if VCR.turned_on?
|
32
|
-
end
|
33
|
-
|
34
|
-
private
|
35
|
-
|
36
|
-
def test_name
|
37
|
-
self.class.name.sub('Test', '')
|
38
|
-
end
|
39
|
-
end
|