peddler 2.4.5 → 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 -79
- 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
@@ -0,0 +1,107 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "peddler/api"
|
4
|
+
|
5
|
+
module Peddler
|
6
|
+
class API
|
7
|
+
# Selling Partner API for Shipping
|
8
|
+
#
|
9
|
+
# Provides programmatic access to Amazon Shipping APIs. **Note:** If you are new to the Amazon Shipping API, refer
|
10
|
+
# to the latest version of <a
|
11
|
+
# href="https://developer-docs.amazon.com/amazon-shipping/docs/shipping-api-v2-reference">Amazon Shipping API
|
12
|
+
# (v2)</a> on the <a href="https://developer-docs.amazon.com/amazon-shipping/">Amazon Shipping Developer
|
13
|
+
# Documentation</a> site.
|
14
|
+
class ShippingV1 < API
|
15
|
+
# Create a new shipment.
|
16
|
+
#
|
17
|
+
# @param [Hash] body
|
18
|
+
# @return [Hash] The API response
|
19
|
+
def create_shipment(body)
|
20
|
+
path = "/shipping/v1/shipments"
|
21
|
+
|
22
|
+
rate_limit(5.0).post(path, body:)
|
23
|
+
end
|
24
|
+
|
25
|
+
# Return the entire shipment object for the shipmentId.
|
26
|
+
#
|
27
|
+
# @param [String] shipment_id
|
28
|
+
# @return [Hash] The API response
|
29
|
+
def get_shipment(shipment_id)
|
30
|
+
path = "/shipping/v1/shipments/#{shipment_id}"
|
31
|
+
|
32
|
+
rate_limit(5.0).get(path)
|
33
|
+
end
|
34
|
+
|
35
|
+
# Cancel a shipment by the given shipmentId.
|
36
|
+
#
|
37
|
+
# @param [String] shipment_id
|
38
|
+
# @return [Hash] The API response
|
39
|
+
def cancel_shipment(shipment_id)
|
40
|
+
path = "/shipping/v1/shipments/#{shipment_id}/cancel"
|
41
|
+
|
42
|
+
rate_limit(5.0).post(path)
|
43
|
+
end
|
44
|
+
|
45
|
+
# Purchase shipping labels based on a given rate.
|
46
|
+
#
|
47
|
+
# @param [String] shipment_id
|
48
|
+
# @param [Hash] body
|
49
|
+
# @return [Hash] The API response
|
50
|
+
def purchase_labels(shipment_id, body)
|
51
|
+
path = "/shipping/v1/shipments/#{shipment_id}/purchaseLabels"
|
52
|
+
|
53
|
+
rate_limit(5.0).post(path, body:)
|
54
|
+
end
|
55
|
+
|
56
|
+
# Retrieve shipping label based on the shipment id and tracking id.
|
57
|
+
#
|
58
|
+
# @param [String] shipment_id
|
59
|
+
# @param [String] tracking_id
|
60
|
+
# @param [Hash] body
|
61
|
+
# @return [Hash] The API response
|
62
|
+
def retrieve_shipping_label(shipment_id, tracking_id, body)
|
63
|
+
path = "/shipping/v1/shipments/#{shipment_id}/containers/#{tracking_id}/label"
|
64
|
+
|
65
|
+
rate_limit(5.0).post(path, body:)
|
66
|
+
end
|
67
|
+
|
68
|
+
# Purchase shipping labels.
|
69
|
+
#
|
70
|
+
# @param [Hash] body
|
71
|
+
# @return [Hash] The API response
|
72
|
+
def purchase_shipment(body)
|
73
|
+
path = "/shipping/v1/purchaseShipment"
|
74
|
+
|
75
|
+
rate_limit(5.0).post(path, body:)
|
76
|
+
end
|
77
|
+
|
78
|
+
# Get service rates.
|
79
|
+
#
|
80
|
+
# @param [Hash] body
|
81
|
+
# @return [Hash] The API response
|
82
|
+
def get_rates(body)
|
83
|
+
path = "/shipping/v1/rates"
|
84
|
+
|
85
|
+
rate_limit(5.0).post(path, body:)
|
86
|
+
end
|
87
|
+
|
88
|
+
# Verify if the current account is valid.
|
89
|
+
# @return [Hash] The API response
|
90
|
+
def get_account
|
91
|
+
path = "/shipping/v1/account"
|
92
|
+
|
93
|
+
rate_limit(5.0).get(path)
|
94
|
+
end
|
95
|
+
|
96
|
+
# Return the tracking information of a shipment.
|
97
|
+
#
|
98
|
+
# @param [String] tracking_id
|
99
|
+
# @return [Hash] The API response
|
100
|
+
def get_tracking_information(tracking_id)
|
101
|
+
path = "/shipping/v1/tracking/#{tracking_id}"
|
102
|
+
|
103
|
+
rate_limit(1.0).get(path)
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
@@ -0,0 +1,267 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "peddler/api"
|
4
|
+
|
5
|
+
module Peddler
|
6
|
+
class API
|
7
|
+
# Amazon Shipping API
|
8
|
+
#
|
9
|
+
# The Amazon Shipping API is designed to support outbound shipping use cases both for orders originating on
|
10
|
+
# Amazon-owned marketplaces as well as external channels/marketplaces. With these APIs, you can request shipping
|
11
|
+
# rates, create shipments, cancel shipments, and track shipments.
|
12
|
+
class ShippingV2 < API
|
13
|
+
# Returns the available shipping service offerings.
|
14
|
+
#
|
15
|
+
# @param [Hash] body
|
16
|
+
# @param [String] x_amzn_shipping_business_id Amazon shipping business to assume for this request. The default is
|
17
|
+
# AmazonShipping_UK.
|
18
|
+
# @return [Hash] The API response
|
19
|
+
def get_rates(body, x_amzn_shipping_business_id: nil)
|
20
|
+
path = "/shipping/v2/shipments/rates"
|
21
|
+
|
22
|
+
rate_limit(80.0).post(path, body:)
|
23
|
+
end
|
24
|
+
|
25
|
+
# Purchases the shipping service for a shipment using the best fit service offering. Returns purchase related
|
26
|
+
# details and documents.
|
27
|
+
#
|
28
|
+
# @param [Hash] body
|
29
|
+
# @param [String] x_amzn_idempotency_key A unique value which the server uses to recognize subsequent retries of
|
30
|
+
# the same request.
|
31
|
+
# @param [String] locale The IETF Language Tag. Note that this only supports the primary language subtag with one
|
32
|
+
# secondary language subtag (i.e. en-US, fr-CA). The secondary language subtag is almost always a regional
|
33
|
+
# designation. This does not support additional subtags beyond the primary and secondary language subtags.
|
34
|
+
# @param [String] x_amzn_shipping_business_id Amazon shipping business to assume for this request. The default is
|
35
|
+
# AmazonShipping_UK.
|
36
|
+
# @return [Hash] The API response
|
37
|
+
def direct_purchase_shipment(body, x_amzn_idempotency_key: nil, locale: nil, x_amzn_shipping_business_id: nil)
|
38
|
+
path = "/shipping/v2/shipments/directPurchase"
|
39
|
+
|
40
|
+
rate_limit(80.0).post(path, body:)
|
41
|
+
end
|
42
|
+
|
43
|
+
# Purchases a shipping service and returns purchase related details and documents. Note: You must complete the
|
44
|
+
# purchase within 10 minutes of rate creation by the shipping service provider. If you make the request after the
|
45
|
+
# 10 minutes have expired, you will receive an error response with the error code equal to "TOKEN_EXPIRED". If you
|
46
|
+
# receive this error response, you must get the rates for the shipment again.
|
47
|
+
#
|
48
|
+
# @param [Hash] body
|
49
|
+
# @param [String] x_amzn_idempotency_key A unique value which the server uses to recognize subsequent retries of
|
50
|
+
# the same request.
|
51
|
+
# @param [String] x_amzn_shipping_business_id Amazon shipping business to assume for this request. The default is
|
52
|
+
# AmazonShipping_UK.
|
53
|
+
# @return [Hash] The API response
|
54
|
+
def purchase_shipment(body, x_amzn_idempotency_key: nil, x_amzn_shipping_business_id: nil)
|
55
|
+
path = "/shipping/v2/shipments"
|
56
|
+
|
57
|
+
rate_limit(80.0).post(path, body:)
|
58
|
+
end
|
59
|
+
|
60
|
+
# Purchases a shipping service identifier and returns purchase-related details and documents.
|
61
|
+
#
|
62
|
+
# @param [Hash] body
|
63
|
+
# @param [String] x_amzn_shipping_business_id Amazon shipping business to assume for this request. The default is
|
64
|
+
# AmazonShipping_UK.
|
65
|
+
# @return [Hash] The API response
|
66
|
+
def one_click_shipment(body, x_amzn_shipping_business_id: nil)
|
67
|
+
path = "/shipping/v2/oneClickShipment"
|
68
|
+
|
69
|
+
rate_limit(80.0).post(path, body:)
|
70
|
+
end
|
71
|
+
|
72
|
+
# Returns tracking information for a purchased shipment.
|
73
|
+
#
|
74
|
+
# @param [String] tracking_id A carrier-generated tracking identifier originally returned by the purchaseShipment
|
75
|
+
# operation.
|
76
|
+
# @param [String] carrier_id A carrier identifier originally returned by the getRates operation for the selected
|
77
|
+
# rate.
|
78
|
+
# @param [String] x_amzn_shipping_business_id Amazon shipping business to assume for this request. The default is
|
79
|
+
# AmazonShipping_UK.
|
80
|
+
# @return [Hash] The API response
|
81
|
+
def get_tracking(tracking_id, carrier_id, x_amzn_shipping_business_id: nil)
|
82
|
+
path = "/shipping/v2/tracking"
|
83
|
+
params = {
|
84
|
+
"trackingId" => tracking_id,
|
85
|
+
"carrierId" => carrier_id,
|
86
|
+
}.compact
|
87
|
+
|
88
|
+
rate_limit(80.0).get(path, params:)
|
89
|
+
end
|
90
|
+
|
91
|
+
# Returns the shipping documents associated with a package in a shipment.
|
92
|
+
#
|
93
|
+
# @param [String] shipment_id The shipment identifier originally returned by the purchaseShipment operation.
|
94
|
+
# @param [String] package_client_reference_id The package client reference identifier originally provided in the
|
95
|
+
# request body parameter for the getRates operation.
|
96
|
+
# @param [String] format The file format of the document. Must be one of the supported formats returned by the
|
97
|
+
# getRates operation.
|
98
|
+
# @param [Number] dpi The resolution of the document (for example, 300 means 300 dots per inch). Must be one of
|
99
|
+
# the supported resolutions returned in the response to the getRates operation.
|
100
|
+
# @param [String] x_amzn_shipping_business_id Amazon shipping business to assume for this request. The default is
|
101
|
+
# AmazonShipping_UK.
|
102
|
+
# @return [Hash] The API response
|
103
|
+
def get_shipment_documents(shipment_id, package_client_reference_id, format: nil, dpi: nil,
|
104
|
+
x_amzn_shipping_business_id: nil)
|
105
|
+
path = "/shipping/v2/shipments/#{shipment_id}/documents"
|
106
|
+
params = {
|
107
|
+
"packageClientReferenceId" => package_client_reference_id,
|
108
|
+
"format" => format,
|
109
|
+
"dpi" => dpi,
|
110
|
+
}.compact
|
111
|
+
|
112
|
+
rate_limit(80.0).get(path, params:)
|
113
|
+
end
|
114
|
+
|
115
|
+
# Cancels a purchased shipment. Returns an empty object if the shipment is successfully cancelled.
|
116
|
+
#
|
117
|
+
# @param [String] shipment_id The shipment identifier originally returned by the purchaseShipment operation.
|
118
|
+
# @param [String] x_amzn_shipping_business_id Amazon shipping business to assume for this request. The default is
|
119
|
+
# AmazonShipping_UK.
|
120
|
+
# @return [Hash] The API response
|
121
|
+
def cancel_shipment(shipment_id, x_amzn_shipping_business_id: nil)
|
122
|
+
path = "/shipping/v2/shipments/#{shipment_id}/cancel"
|
123
|
+
|
124
|
+
rate_limit(80.0).put(path)
|
125
|
+
end
|
126
|
+
|
127
|
+
# Returns the JSON schema to use for providing additional inputs when needed to purchase a shipping offering. Call
|
128
|
+
# the getAdditionalInputs operation when the response to a previous call to the getRates operation indicates that
|
129
|
+
# additional inputs are required for the rate (shipping offering) that you want to purchase.
|
130
|
+
#
|
131
|
+
# @param [String] request_token The request token returned in the response to the getRates operation.
|
132
|
+
# @param [String] rate_id The rate identifier for the shipping offering (rate) returned in the response to the
|
133
|
+
# getRates operation.
|
134
|
+
# @param [String] x_amzn_shipping_business_id Amazon shipping business to assume for this request. The default is
|
135
|
+
# AmazonShipping_UK.
|
136
|
+
# @return [Hash] The API response
|
137
|
+
def get_additional_inputs(request_token, rate_id, x_amzn_shipping_business_id: nil)
|
138
|
+
path = "/shipping/v2/shipments/additionalInputs/schema"
|
139
|
+
params = {
|
140
|
+
"requestToken" => request_token,
|
141
|
+
"rateId" => rate_id,
|
142
|
+
}.compact
|
143
|
+
|
144
|
+
rate_limit(80.0).get(path, params:)
|
145
|
+
end
|
146
|
+
|
147
|
+
# This API will return a list of input schema required to register a shipper account with the carrier.
|
148
|
+
#
|
149
|
+
# @param [String] x_amzn_shipping_business_id Amazon shipping business to assume for this request. The default is
|
150
|
+
# AmazonShipping_UK.
|
151
|
+
# @return [Hash] The API response
|
152
|
+
def get_carrier_account_form_inputs(x_amzn_shipping_business_id: nil)
|
153
|
+
path = "/shipping/v2/carrierAccountFormInputs"
|
154
|
+
|
155
|
+
rate_limit(80.0).get(path)
|
156
|
+
end
|
157
|
+
|
158
|
+
# This API will return Get all carrier accounts for a merchant.
|
159
|
+
#
|
160
|
+
# @param [Hash] body
|
161
|
+
# @param [String] x_amzn_shipping_business_id Amazon shipping business to assume for this request. The default is
|
162
|
+
# AmazonShipping_UK.
|
163
|
+
# @return [Hash] The API response
|
164
|
+
def get_carrier_accounts(body, x_amzn_shipping_business_id: nil)
|
165
|
+
path = "/shipping/v2/carrierAccounts"
|
166
|
+
|
167
|
+
rate_limit(80.0).put(path, body:)
|
168
|
+
end
|
169
|
+
|
170
|
+
# This API associates/links the specified carrier account with the merchant.
|
171
|
+
#
|
172
|
+
# @param [String] carrier_id The unique identifier associated with the carrier account.
|
173
|
+
# @param [Hash] body
|
174
|
+
# @param [String] x_amzn_shipping_business_id Amazon shipping business to assume for this request. The default is
|
175
|
+
# AmazonShipping_UK.
|
176
|
+
# @return [Hash] The API response
|
177
|
+
def link_carrier_account(carrier_id, body, x_amzn_shipping_business_id: nil)
|
178
|
+
path = "/shipping/v2/carrierAccounts/#{carrier_id}"
|
179
|
+
|
180
|
+
rate_limit(80.0).put(path, body:)
|
181
|
+
end
|
182
|
+
|
183
|
+
# This API Unlink the specified carrier account with the merchant.
|
184
|
+
#
|
185
|
+
# @param [String] carrier_id carrier Id to unlink with merchant.
|
186
|
+
# @param [Hash] body
|
187
|
+
# @param [String] x_amzn_shipping_business_id Amazon shipping business to assume for this request. The default is
|
188
|
+
# AmazonShipping_UK.
|
189
|
+
# @return [Hash] The API response
|
190
|
+
def unlink_carrier_account(carrier_id, body, x_amzn_shipping_business_id: nil)
|
191
|
+
path = "/shipping/v2/carrierAccounts/#{carrier_id}/unlink"
|
192
|
+
|
193
|
+
rate_limit(80.0).put(path, body:)
|
194
|
+
end
|
195
|
+
|
196
|
+
# This API Call to generate the collection form.
|
197
|
+
#
|
198
|
+
# @param [Hash] body
|
199
|
+
# @param [String] x_amzn_idempotency_key A unique value which the server uses to recognize subsequent retries of
|
200
|
+
# the same request.
|
201
|
+
# @param [String] x_amzn_shipping_business_id Amazon shipping business to assume for this request. The default is
|
202
|
+
# AmazonShipping_UK.
|
203
|
+
# @return [Hash] The API response
|
204
|
+
def generate_collection_form(body, x_amzn_idempotency_key: nil, x_amzn_shipping_business_id: nil)
|
205
|
+
path = "/shipping/v2/collectionForms"
|
206
|
+
|
207
|
+
rate_limit(80.0).post(path, body:)
|
208
|
+
end
|
209
|
+
|
210
|
+
# This API Call to get the history of the previously generated collection forms.
|
211
|
+
#
|
212
|
+
# @param [Hash] body
|
213
|
+
# @param [String] x_amzn_shipping_business_id Amazon shipping business to assume for this request. The default is
|
214
|
+
# AmazonShipping_UK.
|
215
|
+
# @return [Hash] The API response
|
216
|
+
def get_collection_form_history(body, x_amzn_shipping_business_id: nil)
|
217
|
+
path = "/shipping/v2/collectionForms/history"
|
218
|
+
|
219
|
+
rate_limit(80.0).put(path, body:)
|
220
|
+
end
|
221
|
+
|
222
|
+
# This API Get all unmanifested carriers with shipment locations. Any locations which has unmanifested shipments
|
223
|
+
# with an eligible carrier for manifesting shall be returned.
|
224
|
+
#
|
225
|
+
# @param [Hash] body
|
226
|
+
# @param [String] x_amzn_shipping_business_id Amazon shipping business to assume for this request. The default is
|
227
|
+
# AmazonShipping_UK.
|
228
|
+
# @return [Hash] The API response
|
229
|
+
def get_unmanifested_shipments(body, x_amzn_shipping_business_id: nil)
|
230
|
+
path = "/shipping/v2/unmanifestedShipments"
|
231
|
+
|
232
|
+
rate_limit(80.0).put(path, body:)
|
233
|
+
end
|
234
|
+
|
235
|
+
# This API reprint a collection form.
|
236
|
+
#
|
237
|
+
# @param [String] collection_form_id collection form Id to reprint a collection.
|
238
|
+
# @param [String] x_amzn_shipping_business_id Amazon shipping business to assume for this request. The default is
|
239
|
+
# AmazonShipping_UK.
|
240
|
+
# @return [Hash] The API response
|
241
|
+
def get_collection_form(collection_form_id, x_amzn_shipping_business_id: nil)
|
242
|
+
path = "/shipping/v2/collectionForms/#{collection_form_id}"
|
243
|
+
|
244
|
+
rate_limit(80.0).get(path)
|
245
|
+
end
|
246
|
+
|
247
|
+
# Returns a list of access points in proximity of input postal code.
|
248
|
+
#
|
249
|
+
# @param [Array<String>] access_point_types
|
250
|
+
# @param [String] country_code
|
251
|
+
# @param [String] postal_code
|
252
|
+
# @param [String] x_amzn_shipping_business_id Amazon shipping business to assume for this request. The default is
|
253
|
+
# AmazonShipping_UK.
|
254
|
+
# @return [Hash] The API response
|
255
|
+
def get_access_points(access_point_types, country_code, postal_code, x_amzn_shipping_business_id: nil)
|
256
|
+
path = "/shipping/v2/accessPoints"
|
257
|
+
params = {
|
258
|
+
"accessPointTypes" => access_point_types,
|
259
|
+
"countryCode" => country_code,
|
260
|
+
"postalCode" => postal_code,
|
261
|
+
}.compact
|
262
|
+
|
263
|
+
rate_limit(80.0).get(path, params:)
|
264
|
+
end
|
265
|
+
end
|
266
|
+
end
|
267
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "peddler/api"
|
4
|
+
|
5
|
+
module Peddler
|
6
|
+
class API
|
7
|
+
# Selling Partner API for Solicitations
|
8
|
+
#
|
9
|
+
# With the Solicitations API you can build applications that send non-critical solicitations to buyers. You can get
|
10
|
+
# a list of solicitation types that are available for an order that you specify, then call an operation that sends a
|
11
|
+
# solicitation to the buyer for that order. Buyers cannot respond to solicitations sent by this API, and these
|
12
|
+
# solicitations do not appear in the Messaging section of Seller Central or in the recipient's Message Center. The
|
13
|
+
# Solicitations API returns responses that are formed according to the <a
|
14
|
+
# href=https://tools.ietf.org/html/draft-kelly-json-hal-08>JSON Hypertext Application Language</a> (HAL) standard.
|
15
|
+
class SolicitationsV1 < API
|
16
|
+
# Returns a list of solicitation types that are available for an order that you specify. A solicitation type is
|
17
|
+
# represented by an actions object, which contains a path and query parameter(s). You can use the path and
|
18
|
+
# parameter(s) to call an operation that sends a solicitation. Currently only the
|
19
|
+
# productReviewAndSellerFeedbackSolicitation solicitation type is available.
|
20
|
+
#
|
21
|
+
# @param [String] amazon_order_id An Amazon order identifier. This specifies the order for which you want a list
|
22
|
+
# of available solicitation types.
|
23
|
+
# @param [Array<String>] marketplace_ids A marketplace identifier. This specifies the marketplace in which the
|
24
|
+
# order was placed. Only one marketplace can be specified.
|
25
|
+
# @return [Hash] The API response
|
26
|
+
def get_solicitation_actions_for_order(amazon_order_id, marketplace_ids)
|
27
|
+
path = "/solicitations/v1/orders/#{amazon_order_id}"
|
28
|
+
params = {
|
29
|
+
"marketplaceIds" => marketplace_ids,
|
30
|
+
}.compact
|
31
|
+
|
32
|
+
rate_limit(1.0).get(path, params:)
|
33
|
+
end
|
34
|
+
|
35
|
+
# Sends a solicitation to a buyer asking for seller feedback and a product review for the specified order. Send
|
36
|
+
# only one productReviewAndSellerFeedback or free form proactive message per order.
|
37
|
+
#
|
38
|
+
# @param [String] amazon_order_id An Amazon order identifier. This specifies the order for which a solicitation is
|
39
|
+
# sent.
|
40
|
+
# @param [Array<String>] marketplace_ids A marketplace identifier. This specifies the marketplace in which the
|
41
|
+
# order was placed. Only one marketplace can be specified.
|
42
|
+
# @return [Hash] The API response
|
43
|
+
def create_product_review_and_seller_feedback_solicitation(amazon_order_id, marketplace_ids)
|
44
|
+
path = "/solicitations/v1/orders/#{amazon_order_id}/solicitations/productReviewAndSellerFeedback"
|
45
|
+
params = {
|
46
|
+
"marketplaceIds" => marketplace_ids,
|
47
|
+
}.compact
|
48
|
+
|
49
|
+
rate_limit(1.0).post(path, params:)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "peddler/api"
|
4
|
+
|
5
|
+
module Peddler
|
6
|
+
class API
|
7
|
+
# Selling Partner API for Supply Sources
|
8
|
+
#
|
9
|
+
# Manage configurations and capabilities of seller supply sources.
|
10
|
+
class SupplySources20200701 < API
|
11
|
+
# The path to retrieve paginated supply sources.
|
12
|
+
#
|
13
|
+
# @param [String] next_page_token The pagination token to retrieve a specific page of results.
|
14
|
+
# @param [Number] page_size The number of supply sources to return per paginated request.
|
15
|
+
# @return [Hash] The API response
|
16
|
+
def get_supply_sources(next_page_token: nil, page_size: nil)
|
17
|
+
path = "/supplySources/2020-07-01/supplySources"
|
18
|
+
params = {
|
19
|
+
"nextPageToken" => next_page_token,
|
20
|
+
"pageSize" => page_size,
|
21
|
+
}.compact
|
22
|
+
|
23
|
+
get(path, params:)
|
24
|
+
end
|
25
|
+
|
26
|
+
# Create a new supply source.
|
27
|
+
#
|
28
|
+
# @param [Hash] payload A request to create a supply source.
|
29
|
+
# @return [Hash] The API response
|
30
|
+
def create_supply_source(payload)
|
31
|
+
path = "/supplySources/2020-07-01/supplySources"
|
32
|
+
body = payload
|
33
|
+
|
34
|
+
post(path, body:)
|
35
|
+
end
|
36
|
+
|
37
|
+
# Retrieve a supply source.
|
38
|
+
#
|
39
|
+
# @param [String] supply_source_id The unique identifier of a supply source.
|
40
|
+
# @return [Hash] The API response
|
41
|
+
def get_supply_source(supply_source_id)
|
42
|
+
path = "/supplySources/2020-07-01/supplySources/#{supply_source_id}"
|
43
|
+
|
44
|
+
get(path)
|
45
|
+
end
|
46
|
+
|
47
|
+
# Update the configuration and capabilities of a supply source.
|
48
|
+
#
|
49
|
+
# @param [String] supply_source_id The unique identitier of a supply source.
|
50
|
+
# @param [Hash] payload
|
51
|
+
# @return [Hash] The API response
|
52
|
+
def update_supply_source(supply_source_id, payload: nil)
|
53
|
+
path = "/supplySources/2020-07-01/supplySources/#{supply_source_id}"
|
54
|
+
body = payload
|
55
|
+
|
56
|
+
put(path, body:)
|
57
|
+
end
|
58
|
+
|
59
|
+
# Archive a supply source, making it inactive. Cannot be undone.
|
60
|
+
#
|
61
|
+
# @param [String] supply_source_id The unique identifier of a supply source.
|
62
|
+
# @return [Hash] The API response
|
63
|
+
def archive_supply_source(supply_source_id)
|
64
|
+
path = "/supplySources/2020-07-01/supplySources/#{supply_source_id}"
|
65
|
+
|
66
|
+
delete(path)
|
67
|
+
end
|
68
|
+
|
69
|
+
# Update the status of a supply source.
|
70
|
+
#
|
71
|
+
# @param [String] supply_source_id The unique identifier of a supply source.
|
72
|
+
# @param [Hash] payload
|
73
|
+
# @return [Hash] The API response
|
74
|
+
def update_supply_source_status(supply_source_id, payload: nil)
|
75
|
+
path = "/supplySources/2020-07-01/supplySources/#{supply_source_id}/status"
|
76
|
+
body = payload
|
77
|
+
|
78
|
+
put(path, body:)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "peddler/api"
|
4
|
+
|
5
|
+
module Peddler
|
6
|
+
class API
|
7
|
+
# Selling Partner API for Tokens
|
8
|
+
#
|
9
|
+
# The Selling Partner API for Tokens provides a secure way to access a customer's PII (Personally Identifiable
|
10
|
+
# Information). You can call the Tokens API to get a Restricted Data Token (RDT) for one or more restricted
|
11
|
+
# resources that you specify. The RDT authorizes subsequent calls to restricted operations that correspond to the
|
12
|
+
# restricted resources that you specified. For more information, see the [Tokens API Use Case
|
13
|
+
# Guide](doc:tokens-api-use-case-guide).
|
14
|
+
class Tokens20210301 < API
|
15
|
+
# Returns a Restricted Data Token (RDT) for one or more restricted resources that you specify. A restricted
|
16
|
+
# resource is the HTTP method and path from a restricted operation that returns Personally Identifiable
|
17
|
+
# Information (PII), plus a dataElements value that indicates the type of PII requested. See the Tokens API Use
|
18
|
+
# Case Guide for a list of restricted operations. Use the RDT returned here as the access token in subsequent
|
19
|
+
# calls to the corresponding restricted operations.
|
20
|
+
#
|
21
|
+
# @param [Hash] body The restricted data token request details.
|
22
|
+
# @return [Hash] The API response
|
23
|
+
def create_restricted_data_token(body)
|
24
|
+
path = "/tokens/2021-03-01/restrictedDataToken"
|
25
|
+
|
26
|
+
rate_limit(1.0).post(path, body:)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "peddler/api"
|
4
|
+
|
5
|
+
module Peddler
|
6
|
+
class API
|
7
|
+
# Selling Partner API for Uploads
|
8
|
+
#
|
9
|
+
# The Uploads API lets you upload files that you can programmatically access using other Selling Partner APIs, such
|
10
|
+
# as the A+ Content API and the Messaging API.
|
11
|
+
class Uploads20201101 < API
|
12
|
+
# Creates an upload destination, returning the information required to upload a file to the destination and to
|
13
|
+
# programmatically access the file.
|
14
|
+
#
|
15
|
+
# @param [Array<String>] marketplace_ids A list of marketplace identifiers. This specifies the marketplaces where
|
16
|
+
# the upload will be available. Only one marketplace can be specified.
|
17
|
+
# @param [String] content_md5 An MD5 hash of the content to be submitted to the upload destination. This value is
|
18
|
+
# used to determine if the data has been corrupted or tampered with during transit.
|
19
|
+
# @param [String] resource The resource for the upload destination that you are creating. For example, if you are
|
20
|
+
# creating an upload destination for the createLegalDisclosure operation of the Messaging API, the `{resource}`
|
21
|
+
# would be `/messaging/v1/orders/{amazonOrderId}/messages/legalDisclosure`, and the entire path would be
|
22
|
+
# `/uploads/2020-11-01/uploadDestinations/messaging/v1/orders/{amazonOrderId}/messages/legalDisclosure`. If you
|
23
|
+
# are creating an upload destination for an Aplus content document, the `{resource}` would be
|
24
|
+
# `aplus/2020-11-01/contentDocuments` and the path would be
|
25
|
+
# `/uploads/v1/uploadDestinations/aplus/2020-11-01/contentDocuments`.
|
26
|
+
# @param [String] content_type The content type of the file to be uploaded.
|
27
|
+
# @return [Hash] The API response
|
28
|
+
def create_upload_destination_for_resource(marketplace_ids, content_md5, resource, content_type: nil)
|
29
|
+
path = "/uploads/2020-11-01/uploadDestinations/#{resource}"
|
30
|
+
params = {
|
31
|
+
"marketplaceIds" => marketplace_ids,
|
32
|
+
"contentMD5" => content_md5,
|
33
|
+
"contentType" => content_type,
|
34
|
+
}.compact
|
35
|
+
|
36
|
+
rate_limit(10.0).post(path, params:)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "peddler/api"
|
4
|
+
|
5
|
+
module Peddler
|
6
|
+
class API
|
7
|
+
# Selling Partner API for Direct Fulfillment Inventory Updates
|
8
|
+
#
|
9
|
+
# The Selling Partner API for Direct Fulfillment Inventory Updates provides programmatic access to a direct
|
10
|
+
# fulfillment vendor's inventory updates.
|
11
|
+
class VendorDirectFulfillmentInventoryV1 < API
|
12
|
+
# Submits inventory updates for the specified warehouse for either a partial or full feed of inventory items.
|
13
|
+
#
|
14
|
+
# @param [Hash] body The request body that contains the inventory update data to submit.
|
15
|
+
# @param [String] warehouse_id Identifier for the warehouse for which to update inventory.
|
16
|
+
# @return [Hash] The API response
|
17
|
+
def submit_inventory_update(body, warehouse_id)
|
18
|
+
path = "/vendor/directFulfillment/inventory/v1/warehouses/#{warehouse_id}/items"
|
19
|
+
|
20
|
+
rate_limit(10.0).post(path, body:)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "peddler/api"
|
4
|
+
|
5
|
+
module Peddler
|
6
|
+
class API
|
7
|
+
# Selling Partner API for Direct Fulfillment Orders
|
8
|
+
#
|
9
|
+
# The Selling Partner API for Direct Fulfillment Orders provides programmatic access to a direct fulfillment
|
10
|
+
# vendor's order data.
|
11
|
+
class VendorDirectFulfillmentOrders20211228 < API
|
12
|
+
# Returns a list of purchase orders created during the time frame that you specify. You define the time frame
|
13
|
+
# using the createdAfter and createdBefore parameters. You must use both parameters. You can choose to get only
|
14
|
+
# the purchase order numbers by setting the includeDetails parameter to false. In that case, the operation returns
|
15
|
+
# a list of purchase order numbers. You can then call the getOrder operation to return the details of a specific
|
16
|
+
# order.
|
17
|
+
#
|
18
|
+
# @param [String] ship_from_party_id The vendor warehouse identifier for the fulfillment warehouse. If not
|
19
|
+
# specified, the result will contain orders for all warehouses.
|
20
|
+
# @param [String] status Returns only the purchase orders that match the specified status. If not specified, the
|
21
|
+
# result will contain orders that match any status.
|
22
|
+
# @param [Integer] limit The limit to the number of purchase orders returned.
|
23
|
+
# @param [String] created_after Purchase orders that became available after this date and time will be included in
|
24
|
+
# the result. Must be in ISO-8601 date/time format.
|
25
|
+
# @param [String] created_before Purchase orders that became available before this date and time will be included
|
26
|
+
# in the result. Must be in ISO-8601 date/time format.
|
27
|
+
# @param [String] sort_order Sort the list in ascending or descending order by order creation date.
|
28
|
+
# @param [String] next_token Used for pagination when there are more orders than the specified result size limit.
|
29
|
+
# The token value is returned in the previous API call.
|
30
|
+
# @param [String] include_details When true, returns the complete purchase order details. Otherwise, only purchase
|
31
|
+
# order numbers are returned.
|
32
|
+
# @return [Hash] The API response
|
33
|
+
def get_orders(created_after, created_before, ship_from_party_id: nil, status: nil, limit: nil,
|
34
|
+
sort_order: nil, next_token: nil, include_details: nil)
|
35
|
+
path = "/vendor/directFulfillment/orders/2021-12-28/purchaseOrders"
|
36
|
+
params = {
|
37
|
+
"shipFromPartyId" => ship_from_party_id,
|
38
|
+
"status" => status,
|
39
|
+
"limit" => limit,
|
40
|
+
"createdAfter" => created_after,
|
41
|
+
"createdBefore" => created_before,
|
42
|
+
"sortOrder" => sort_order,
|
43
|
+
"nextToken" => next_token,
|
44
|
+
"includeDetails" => include_details,
|
45
|
+
}.compact
|
46
|
+
|
47
|
+
rate_limit(10.0).get(path, params:)
|
48
|
+
end
|
49
|
+
|
50
|
+
# Returns purchase order information for the purchaseOrderNumber that you specify.
|
51
|
+
#
|
52
|
+
# @param [String] purchase_order_number The order identifier for the purchase order that you want. Formatting
|
53
|
+
# Notes: alpha-numeric code.
|
54
|
+
# @return [Hash] The API response
|
55
|
+
def get_order(purchase_order_number)
|
56
|
+
path = "/vendor/directFulfillment/orders/2021-12-28/purchaseOrders/#{purchase_order_number}"
|
57
|
+
|
58
|
+
rate_limit(10.0).get(path)
|
59
|
+
end
|
60
|
+
|
61
|
+
# Submits acknowledgements for one or more purchase orders.
|
62
|
+
#
|
63
|
+
# @param [Hash] body The request body containing the acknowledgement to an order
|
64
|
+
# @return [Hash] The API response
|
65
|
+
def submit_acknowledgement(body)
|
66
|
+
path = "/vendor/directFulfillment/orders/2021-12-28/acknowledgements"
|
67
|
+
|
68
|
+
rate_limit(10.0).post(path, body:)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|