peddler 2.4.4 → 3.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +406 -134
- data/lib/peddler/access_token.rb +76 -0
- data/lib/peddler/api/amazon_warehousing_and_distribution_2024_05_09.rb +80 -0
- data/lib/peddler/api/aplus_content_2020_11_01.rb +208 -0
- data/lib/peddler/api/application_management_2023_11_30.rb +25 -0
- data/lib/peddler/api/catalog_items_2020_12_01.rb +70 -0
- data/lib/peddler/api/catalog_items_2022_04_01.rb +83 -0
- data/lib/peddler/api/catalog_items_v0.rb +90 -0
- data/lib/peddler/api/data_kiosk_2023_11_15.rb +92 -0
- data/lib/peddler/api/easy_ship_2022_03_23.rb +108 -0
- data/lib/peddler/api/fba_inbound_eligibility_v1.rb +36 -0
- data/lib/peddler/api/fba_inventory_v1.rb +106 -0
- data/lib/peddler/api/feeds_2021_06_30.rb +104 -0
- data/lib/peddler/api/finances_v0.rb +121 -0
- data/lib/peddler/api/fulfillment_inbound_2024_03_20.rb +660 -0
- data/lib/peddler/api/fulfillment_inbound_v0.rb +314 -0
- data/lib/peddler/api/fulfillment_outbound_2020_07_01.rb +222 -0
- data/lib/peddler/api/listings_items_2020_09_01.rb +84 -0
- data/lib/peddler/api/listings_items_2021_08_01.rb +154 -0
- data/lib/peddler/api/listings_restrictions_2021_08_01.rb +37 -0
- data/lib/peddler/api/merchant_fulfillment_v0.rb +64 -0
- data/lib/peddler/api/messaging_v1.rb +241 -0
- data/lib/peddler/api/notifications_v1.rb +114 -0
- data/lib/peddler/api/orders_v0.rb +264 -0
- data/lib/peddler/api/product_fees_v0.rb +69 -0
- data/lib/peddler/api/product_pricing_2022_05_01.rb +43 -0
- data/lib/peddler/api/product_pricing_v0.rb +144 -0
- data/lib/peddler/api/product_type_definitions_2020_09_01.rb +75 -0
- data/lib/peddler/api/replenishment_2022_11_07.rb +45 -0
- data/lib/peddler/api/reports_2021_06_30.rb +139 -0
- data/lib/peddler/api/sales_v1.rb +69 -0
- data/lib/peddler/api/sellers_v1.rb +33 -0
- data/lib/peddler/api/services_v1.rb +308 -0
- data/lib/peddler/api/shipment_invoicing_v0.rb +46 -0
- data/lib/peddler/api/shipping_v1.rb +107 -0
- data/lib/peddler/api/shipping_v2.rb +267 -0
- data/lib/peddler/api/solicitations_v1.rb +53 -0
- data/lib/peddler/api/supply_sources_2020_07_01.rb +82 -0
- data/lib/peddler/api/tokens_2021_03_01.rb +30 -0
- data/lib/peddler/api/uploads_2020_11_01.rb +40 -0
- data/lib/peddler/api/vendor_direct_fulfillment_inventory_v1.rb +24 -0
- data/lib/peddler/api/vendor_direct_fulfillment_orders_2021_12_28.rb +72 -0
- data/lib/peddler/api/vendor_direct_fulfillment_orders_v1.rb +72 -0
- data/lib/peddler/api/vendor_direct_fulfillment_payments_v1.rb +23 -0
- data/lib/peddler/api/vendor_direct_fulfillment_sandbox_test_data_2021_10_28.rb +35 -0
- data/lib/peddler/api/vendor_direct_fulfillment_shipping_2021_12_28.rb +177 -0
- data/lib/peddler/api/vendor_direct_fulfillment_shipping_v1.rb +165 -0
- data/lib/peddler/api/vendor_direct_fulfillment_transactions_2021_12_28.rb +24 -0
- data/lib/peddler/api/vendor_direct_fulfillment_transactions_v1.rb +24 -0
- data/lib/peddler/api/vendor_invoices_v1.rb +22 -0
- data/lib/peddler/api/vendor_orders_v1.rb +148 -0
- data/lib/peddler/api/vendor_shipments_v1.rb +120 -0
- data/lib/peddler/api/vendor_transaction_status_v1.rb +24 -0
- data/lib/peddler/api.rb +115 -0
- data/lib/peddler/error.rb +30 -0
- data/lib/peddler/region.rb +30 -0
- data/lib/peddler/version.rb +1 -1
- data/lib/peddler.rb +52 -1
- metadata +70 -80
- data/lib/mws/easy_ship/client.rb +0 -93
- data/lib/mws/easy_ship.rb +0 -3
- data/lib/mws/feeds/client.rb +0 -122
- data/lib/mws/feeds.rb +0 -3
- data/lib/mws/finances/client.rb +0 -82
- data/lib/mws/finances.rb +0 -3
- data/lib/mws/fulfillment_inbound_shipment/client.rb +0 -388
- data/lib/mws/fulfillment_inbound_shipment.rb +0 -3
- data/lib/mws/fulfillment_inventory/client.rb +0 -57
- data/lib/mws/fulfillment_inventory.rb +0 -3
- data/lib/mws/fulfillment_outbound_shipment/client.rb +0 -211
- data/lib/mws/fulfillment_outbound_shipment.rb +0 -3
- data/lib/mws/merchant_fulfillment/client.rb +0 -87
- data/lib/mws/merchant_fulfillment.rb +0 -3
- data/lib/mws/off_amazon_payments.rb +0 -3
- data/lib/mws/orders/client.rb +0 -120
- data/lib/mws/orders.rb +0 -3
- data/lib/mws/products/client.rb +0 -268
- data/lib/mws/products.rb +0 -3
- data/lib/mws/recommendations/client.rb +0 -72
- data/lib/mws/recommendations.rb +0 -3
- data/lib/mws/reports/client.rb +0 -236
- data/lib/mws/reports.rb +0 -3
- data/lib/mws/sellers/client.rb +0 -44
- data/lib/mws/sellers.rb +0 -3
- data/lib/mws/shipment_invoicing/client.rb +0 -74
- data/lib/mws/shipment_invoicing.rb +0 -3
- data/lib/mws/subscriptions/client.rb +0 -179
- data/lib/mws/subscriptions.rb +0 -3
- data/lib/mws.rb +0 -29
- data/lib/peddler/client.rb +0 -159
- data/lib/peddler/errors/builder.rb +0 -64
- data/lib/peddler/errors/class_generator.rb +0 -40
- data/lib/peddler/errors/error.rb +0 -45
- data/lib/peddler/errors/parser.rb +0 -28
- data/lib/peddler/flat_file_parser.rb +0 -56
- data/lib/peddler/headers.rb +0 -102
- data/lib/peddler/marketplace.rb +0 -78
- data/lib/peddler/operation.rb +0 -78
- data/lib/peddler/parser.rb +0 -33
- data/lib/peddler/structured_list.rb +0 -23
- data/lib/peddler/vcr_matcher.rb +0 -97
- data/lib/peddler/xml_parser.rb +0 -38
- data/lib/peddler/xml_response_parser.rb +0 -25
data/lib/peddler/vcr_matcher.rb
DELETED
@@ -1,97 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Peddler
|
4
|
-
# A custom matcher that can be used to record MWS interactions when
|
5
|
-
# writing integration tests
|
6
|
-
class VCRMatcher
|
7
|
-
# @!visibility private
|
8
|
-
TRANSIENT_PARAMS = %w[
|
9
|
-
Signature Timestamp StartDate CreatedAfter QueryStartDateTime
|
10
|
-
].freeze
|
11
|
-
|
12
|
-
# @!visibility private
|
13
|
-
SELLER_PARAMS = %w[
|
14
|
-
AWSAccessKeyId SellerId
|
15
|
-
].freeze
|
16
|
-
|
17
|
-
class << self
|
18
|
-
# @!visibility private
|
19
|
-
def call(*requests)
|
20
|
-
new(*requests).compare
|
21
|
-
end
|
22
|
-
|
23
|
-
# @!visibility private
|
24
|
-
def ignored_params
|
25
|
-
@ignored_params ||= TRANSIENT_PARAMS.dup
|
26
|
-
end
|
27
|
-
|
28
|
-
# Ignore seller specific attributes when recording
|
29
|
-
# @return [void]
|
30
|
-
def ignore_seller!
|
31
|
-
ignored_params.concat(SELLER_PARAMS)
|
32
|
-
ignored_params.uniq!
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
# @!visibility private
|
37
|
-
attr_reader :requests
|
38
|
-
|
39
|
-
# @!visibility private
|
40
|
-
def initialize(*requests)
|
41
|
-
@requests = requests
|
42
|
-
end
|
43
|
-
|
44
|
-
# @!visibility private
|
45
|
-
def compare
|
46
|
-
compare_uris && compare_bodies
|
47
|
-
end
|
48
|
-
|
49
|
-
private
|
50
|
-
|
51
|
-
def compare_uris
|
52
|
-
return false if hosts.reduce(:!=) || paths.reduce(:!=)
|
53
|
-
return true if queries.all?(&:empty?)
|
54
|
-
|
55
|
-
queries.reduce(:==)
|
56
|
-
end
|
57
|
-
|
58
|
-
def compare_bodies
|
59
|
-
bodies.reduce(:==)
|
60
|
-
end
|
61
|
-
|
62
|
-
def extract_params(string)
|
63
|
-
return {} unless string
|
64
|
-
|
65
|
-
params = ::CGI.parse(string)
|
66
|
-
self.class.ignored_params.each do |k|
|
67
|
-
params.delete(k)
|
68
|
-
end
|
69
|
-
|
70
|
-
params
|
71
|
-
end
|
72
|
-
|
73
|
-
def uris
|
74
|
-
requests.map { |r| URI.parse(r.uri) }
|
75
|
-
end
|
76
|
-
|
77
|
-
def hosts
|
78
|
-
uris.map(&:host)
|
79
|
-
end
|
80
|
-
|
81
|
-
def paths
|
82
|
-
uris.map(&:path)
|
83
|
-
end
|
84
|
-
|
85
|
-
def queries
|
86
|
-
uris.map { |uri| extract_params(uri.query) }
|
87
|
-
end
|
88
|
-
|
89
|
-
def bodies
|
90
|
-
if queries.all?(&:empty?)
|
91
|
-
requests.map { |request| extract_params(request.body) }
|
92
|
-
else
|
93
|
-
requests.map(&:body)
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
data/lib/peddler/xml_parser.rb
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'delegate'
|
4
|
-
require 'forwardable'
|
5
|
-
require 'peddler/headers'
|
6
|
-
require 'multi_xml'
|
7
|
-
|
8
|
-
module Peddler
|
9
|
-
# @!visibility private
|
10
|
-
class XMLParser < SimpleDelegator
|
11
|
-
extend Forwardable
|
12
|
-
include Headers
|
13
|
-
|
14
|
-
def_delegator :parse, :dig
|
15
|
-
|
16
|
-
def data
|
17
|
-
@data ||= find_data
|
18
|
-
end
|
19
|
-
|
20
|
-
alias parse data
|
21
|
-
|
22
|
-
def xml
|
23
|
-
MultiXml.parse(body)
|
24
|
-
end
|
25
|
-
|
26
|
-
def valid?
|
27
|
-
return unless headers['Content-Length']
|
28
|
-
|
29
|
-
headers['Content-Length'].to_i == body.size
|
30
|
-
end
|
31
|
-
|
32
|
-
private
|
33
|
-
|
34
|
-
def find_data
|
35
|
-
raise NotImplementedError
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'peddler/xml_parser'
|
4
|
-
|
5
|
-
module Peddler
|
6
|
-
# @!visibility private
|
7
|
-
class XMLResponseParser < XMLParser
|
8
|
-
MATCHER = /^Message$|^Node$|Report|Result/.freeze
|
9
|
-
private_constant :MATCHER
|
10
|
-
|
11
|
-
def next_token
|
12
|
-
parse.fetch('NextToken', false)
|
13
|
-
end
|
14
|
-
|
15
|
-
private
|
16
|
-
|
17
|
-
# FIXME: In next major version bump, stop assuming we know report internals.
|
18
|
-
def find_data
|
19
|
-
payload = xml.values.first
|
20
|
-
found = payload.find { |k, _| k.match(MATCHER) }
|
21
|
-
|
22
|
-
found&.last
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|