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
@@ -0,0 +1,76 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "http"
|
4
|
+
|
5
|
+
module Peddler
|
6
|
+
# Requests a Login with Amazon (LWA) access token that authorizes your application to take actions on behalf of a
|
7
|
+
# selling partner. An LWA access token expires one hour after it is issued.
|
8
|
+
#
|
9
|
+
# @see https://developer-docs.amazon.com/sp-api/docs/connecting-to-the-selling-partner-api
|
10
|
+
class AccessToken
|
11
|
+
URL = "https://api.amazon.com/auth/o2/token"
|
12
|
+
|
13
|
+
attr_reader :client_id, :client_secret, :refresh_token, :scope
|
14
|
+
|
15
|
+
class << self
|
16
|
+
# Requests an access token
|
17
|
+
#
|
18
|
+
# @param client_id [String]
|
19
|
+
# @param client_secret [String]
|
20
|
+
# @param refresh_token [String]
|
21
|
+
# @param scope [String]
|
22
|
+
def request(client_id: ENV["LWA_CLIENT_ID"], client_secret: ENV["LWA_CLIENT_SECRET"], refresh_token: nil,
|
23
|
+
scope: nil)
|
24
|
+
new(client_id: client_id, client_secret: client_secret, refresh_token: refresh_token, scope: scope).request
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
# @param client_id [String]
|
29
|
+
# @param client_secret [String]
|
30
|
+
# @param refresh_token [String]
|
31
|
+
# @param scope [String]
|
32
|
+
def initialize(client_id: ENV["LWA_CLIENT_ID"], client_secret: ENV["LWA_CLIENT_SECRET"], refresh_token: nil,
|
33
|
+
scope: nil)
|
34
|
+
@client_id = client_id
|
35
|
+
@client_secret = client_secret
|
36
|
+
@refresh_token = refresh_token
|
37
|
+
@scope = scope
|
38
|
+
|
39
|
+
validate_lwa_credentials!
|
40
|
+
validate_exclusive_token_or_scope!
|
41
|
+
end
|
42
|
+
|
43
|
+
def request
|
44
|
+
response = HTTP.post(URL, form: params)
|
45
|
+
response.parse.fetch("access_token")
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
def validate_lwa_credentials!
|
51
|
+
if client_id.nil? || client_secret.nil?
|
52
|
+
raise ArgumentError, "Provide client_id and client_secret."
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def validate_exclusive_token_or_scope!
|
57
|
+
if @refresh_token.nil? == @scope.nil?
|
58
|
+
raise ArgumentError, "Provide either refresh_token or scope, not both."
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def params
|
63
|
+
{
|
64
|
+
grant_type: grant_type,
|
65
|
+
refresh_token: refresh_token,
|
66
|
+
scope: scope,
|
67
|
+
client_id: client_id,
|
68
|
+
client_secret: client_secret,
|
69
|
+
}.compact
|
70
|
+
end
|
71
|
+
|
72
|
+
def grant_type
|
73
|
+
scope ? "client_credentials" : "refresh_token"
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "peddler/api"
|
4
|
+
|
5
|
+
module Peddler
|
6
|
+
class API
|
7
|
+
# The Selling Partner API for Amazon Warehousing and Distribution
|
8
|
+
#
|
9
|
+
# The Selling Partner API for Amazon Warehousing and Distribution (AWD) provides programmatic access to information
|
10
|
+
# about AWD shipments and inventory.
|
11
|
+
class AmazonWarehousingAndDistribution20240509 < API
|
12
|
+
# Retrieves an AWD inbound shipment.
|
13
|
+
#
|
14
|
+
# @param [String] shipment_id ID for the shipment. A shipment contains the cases being inbounded.
|
15
|
+
# @param [String] sku_quantities If equal to `SHOW`, the response includes the shipment SKU quantity details.
|
16
|
+
# Defaults to `HIDE`, in which case the response does not contain SKU quantities
|
17
|
+
# @return [Hash] The API response
|
18
|
+
def get_inbound_shipment(shipment_id, sku_quantities: nil)
|
19
|
+
path = "/awd/2024-05-09/inboundShipments/#{shipment_id}"
|
20
|
+
params = {
|
21
|
+
"skuQuantities" => sku_quantities,
|
22
|
+
}.compact
|
23
|
+
|
24
|
+
rate_limit(2.0).get(path, params:)
|
25
|
+
end
|
26
|
+
|
27
|
+
# Retrieves a summary of all the inbound AWD shipments associated with a merchant, with the ability to apply
|
28
|
+
# optional filters.
|
29
|
+
#
|
30
|
+
# @param [String] sort_by Field to sort results by. By default, the response will be sorted by UPDATED_AT.
|
31
|
+
# @param [String] sort_order Sort the response in ASCENDING or DESCENDING order. By default, the response will be
|
32
|
+
# sorted in DESCENDING order.
|
33
|
+
# @param [String] shipment_status Filter by inbound shipment status.
|
34
|
+
# @param [String] updated_after List the inbound shipments that were updated after a certain time (inclusive). The
|
35
|
+
# date must be in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) format.
|
36
|
+
# @param [String] updated_before List the inbound shipments that were updated before a certain time (inclusive).
|
37
|
+
# The date must be in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) format.
|
38
|
+
# @param [Integer] max_results Maximum number of results to return.
|
39
|
+
# @param [String] next_token Token to retrieve the next set of paginated results.
|
40
|
+
# @return [Hash] The API response
|
41
|
+
def list_inbound_shipments(sort_by: nil, sort_order: nil, shipment_status: nil, updated_after: nil,
|
42
|
+
updated_before: nil, max_results: nil, next_token: nil)
|
43
|
+
path = "/awd/2024-05-09/inboundShipments"
|
44
|
+
params = {
|
45
|
+
"sortBy" => sort_by,
|
46
|
+
"sortOrder" => sort_order,
|
47
|
+
"shipmentStatus" => shipment_status,
|
48
|
+
"updatedAfter" => updated_after,
|
49
|
+
"updatedBefore" => updated_before,
|
50
|
+
"maxResults" => max_results,
|
51
|
+
"nextToken" => next_token,
|
52
|
+
}.compact
|
53
|
+
|
54
|
+
rate_limit(1.0).get(path, params:)
|
55
|
+
end
|
56
|
+
|
57
|
+
# Lists AWD inventory associated with a merchant with the ability to apply optional filters.
|
58
|
+
#
|
59
|
+
# @param [String] sku Filter by seller or merchant SKU for the item.
|
60
|
+
# @param [String] sort_order Sort the response in `ASCENDING` or `DESCENDING` order.
|
61
|
+
# @param [String] details Set to `SHOW` to return summaries with additional inventory details. Defaults to `HIDE,`
|
62
|
+
# which returns only inventory summary totals.
|
63
|
+
# @param [String] next_token Token to retrieve the next set of paginated results.
|
64
|
+
# @param [Integer] max_results Maximum number of results to return.
|
65
|
+
# @return [Hash] The API response
|
66
|
+
def list_inventory(sku: nil, sort_order: nil, details: nil, next_token: nil, max_results: nil)
|
67
|
+
path = "/awd/2024-05-09/inventory"
|
68
|
+
params = {
|
69
|
+
"sku" => sku,
|
70
|
+
"sortOrder" => sort_order,
|
71
|
+
"details" => details,
|
72
|
+
"nextToken" => next_token,
|
73
|
+
"maxResults" => max_results,
|
74
|
+
}.compact
|
75
|
+
|
76
|
+
rate_limit(2.0).get(path, params:)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,208 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "peddler/api"
|
4
|
+
|
5
|
+
module Peddler
|
6
|
+
class API
|
7
|
+
# Selling Partner API for A+ Content Management
|
8
|
+
#
|
9
|
+
# With the A+ Content API, you can build applications that help selling partners add rich marketing content to their
|
10
|
+
# Amazon product detail pages. A+ content helps selling partners share their brand and product story, which helps
|
11
|
+
# buyers make informed purchasing decisions. Selling partners assemble content by choosing from content modules and
|
12
|
+
# adding images and text.
|
13
|
+
class AplusContent20201101 < API
|
14
|
+
# Returns a list of all A+ Content documents assigned to a selling partner. This operation returns only the
|
15
|
+
# metadata of the A+ Content documents. Call the getContentDocument operation to get the actual contents of the A+
|
16
|
+
# Content documents.
|
17
|
+
#
|
18
|
+
# @param [String] marketplace_id The identifier for the marketplace where the A+ Content is published.
|
19
|
+
# @param [String] page_token A page token from the nextPageToken response element returned by your previous call
|
20
|
+
# to this operation. nextPageToken is returned when the results of a call exceed the page size. To get the next
|
21
|
+
# page of results, call the operation and include pageToken as the only parameter. Specifying pageToken with any
|
22
|
+
# other parameter will cause the request to fail. When no nextPageToken value is returned there are no more
|
23
|
+
# pages to return. A pageToken value is not usable across different operations.
|
24
|
+
# @return [Hash] The API response
|
25
|
+
def search_content_documents(marketplace_id, page_token: nil)
|
26
|
+
path = "/aplus/2020-11-01/contentDocuments"
|
27
|
+
params = {
|
28
|
+
"marketplaceId" => marketplace_id,
|
29
|
+
"pageToken" => page_token,
|
30
|
+
}.compact
|
31
|
+
|
32
|
+
rate_limit(10.0).get(path, params:)
|
33
|
+
end
|
34
|
+
|
35
|
+
# Creates a new A+ Content document.
|
36
|
+
#
|
37
|
+
# @param [String] marketplace_id The identifier for the marketplace where the A+ Content is published.
|
38
|
+
# @param [Hash] post_content_document_request The content document request details.
|
39
|
+
# @return [Hash] The API response
|
40
|
+
def create_content_document(marketplace_id, post_content_document_request)
|
41
|
+
path = "/aplus/2020-11-01/contentDocuments"
|
42
|
+
body = post_content_document_request
|
43
|
+
params = {
|
44
|
+
"marketplaceId" => marketplace_id,
|
45
|
+
}.compact
|
46
|
+
|
47
|
+
rate_limit(10.0).post(path, body:, params:)
|
48
|
+
end
|
49
|
+
|
50
|
+
# Returns an A+ Content document, if available.
|
51
|
+
#
|
52
|
+
# @param [String] content_reference_key The unique reference key for the A+ Content document. A content reference
|
53
|
+
# key cannot form a permalink and may change in the future. A content reference key is not guaranteed to match
|
54
|
+
# any A+ Content identifier.
|
55
|
+
# @param [String] marketplace_id The identifier for the marketplace where the A+ Content is published.
|
56
|
+
# @param [Array<String>] included_data_set The set of A+ Content data types to include in the response.
|
57
|
+
# @return [Hash] The API response
|
58
|
+
def get_content_document(content_reference_key, marketplace_id, included_data_set)
|
59
|
+
path = "/aplus/2020-11-01/contentDocuments/#{content_reference_key}"
|
60
|
+
params = {
|
61
|
+
"marketplaceId" => marketplace_id,
|
62
|
+
"includedDataSet" => included_data_set,
|
63
|
+
}.compact
|
64
|
+
|
65
|
+
rate_limit(10.0).get(path, params:)
|
66
|
+
end
|
67
|
+
|
68
|
+
# Updates an existing A+ Content document.
|
69
|
+
#
|
70
|
+
# @param [String] content_reference_key The unique reference key for the A+ Content document. A content reference
|
71
|
+
# key cannot form a permalink and may change in the future. A content reference key is not guaranteed to match
|
72
|
+
# any A+ Content identifier.
|
73
|
+
# @param [String] marketplace_id The identifier for the marketplace where the A+ Content is published.
|
74
|
+
# @param [Hash] post_content_document_request The content document request details.
|
75
|
+
# @return [Hash] The API response
|
76
|
+
def update_content_document(content_reference_key, marketplace_id, post_content_document_request)
|
77
|
+
path = "/aplus/2020-11-01/contentDocuments/#{content_reference_key}"
|
78
|
+
body = post_content_document_request
|
79
|
+
params = {
|
80
|
+
"marketplaceId" => marketplace_id,
|
81
|
+
}.compact
|
82
|
+
|
83
|
+
rate_limit(10.0).post(path, body:, params:)
|
84
|
+
end
|
85
|
+
|
86
|
+
# Returns a list of ASINs related to the specified A+ Content document, if available. If you do not include the
|
87
|
+
# asinSet parameter, the operation returns all ASINs related to the content document.
|
88
|
+
#
|
89
|
+
# @param [String] content_reference_key The unique reference key for the A+ Content document. A content reference
|
90
|
+
# key cannot form a permalink and may change in the future. A content reference key is not guaranteed to match
|
91
|
+
# any A+ Content identifier.
|
92
|
+
# @param [String] marketplace_id The identifier for the marketplace where the A+ Content is published.
|
93
|
+
# @param [Array<String>] included_data_set The set of A+ Content data types to include in the response. If you do
|
94
|
+
# not include this parameter, the operation returns the related ASINs without metadata.
|
95
|
+
# @param [Array<String>] asin_set The set of ASINs.
|
96
|
+
# @param [String] page_token A page token from the nextPageToken response element returned by your previous call
|
97
|
+
# to this operation. nextPageToken is returned when the results of a call exceed the page size. To get the next
|
98
|
+
# page of results, call the operation and include pageToken as the only parameter. Specifying pageToken with any
|
99
|
+
# other parameter will cause the request to fail. When no nextPageToken value is returned there are no more
|
100
|
+
# pages to return. A pageToken value is not usable across different operations.
|
101
|
+
# @return [Hash] The API response
|
102
|
+
def list_content_document_asin_relations(content_reference_key, marketplace_id, included_data_set: nil,
|
103
|
+
asin_set: nil, page_token: nil)
|
104
|
+
path = "/aplus/2020-11-01/contentDocuments/#{content_reference_key}/asins"
|
105
|
+
params = {
|
106
|
+
"marketplaceId" => marketplace_id,
|
107
|
+
"includedDataSet" => included_data_set,
|
108
|
+
"asinSet" => asin_set,
|
109
|
+
"pageToken" => page_token,
|
110
|
+
}.compact
|
111
|
+
|
112
|
+
rate_limit(10.0).get(path, params:)
|
113
|
+
end
|
114
|
+
|
115
|
+
# Replaces all ASINs related to the specified A+ Content document, if available. This may add or remove ASINs,
|
116
|
+
# depending on the current set of related ASINs. Removing an ASIN has the side effect of suspending the content
|
117
|
+
# document from that ASIN.
|
118
|
+
#
|
119
|
+
# @param [String] content_reference_key The unique reference key for the A+ Content document. A content reference
|
120
|
+
# key cannot form a permalink and may change in the future. A content reference key is not guaranteed to match
|
121
|
+
# any A+ content identifier.
|
122
|
+
# @param [String] marketplace_id The identifier for the marketplace where the A+ Content is published.
|
123
|
+
# @param [Hash] post_content_document_asin_relations_request The content document ASIN relations request details.
|
124
|
+
# @return [Hash] The API response
|
125
|
+
def post_content_document_asin_relations(content_reference_key, marketplace_id,
|
126
|
+
post_content_document_asin_relations_request)
|
127
|
+
path = "/aplus/2020-11-01/contentDocuments/#{content_reference_key}/asins"
|
128
|
+
body = post_content_document_asin_relations_request
|
129
|
+
params = {
|
130
|
+
"marketplaceId" => marketplace_id,
|
131
|
+
}.compact
|
132
|
+
|
133
|
+
rate_limit(10.0).post(path, body:, params:)
|
134
|
+
end
|
135
|
+
|
136
|
+
# Checks if the A+ Content document is valid for use on a set of ASINs.
|
137
|
+
#
|
138
|
+
# @param [String] marketplace_id The identifier for the marketplace where the A+ Content is published.
|
139
|
+
# @param [Array<String>] asin_set The set of ASINs.
|
140
|
+
# @param [Hash] post_content_document_request The content document request details.
|
141
|
+
# @return [Hash] The API response
|
142
|
+
def validate_content_document_asin_relations(marketplace_id, post_content_document_request, asin_set: nil)
|
143
|
+
path = "/aplus/2020-11-01/contentAsinValidations"
|
144
|
+
body = post_content_document_request
|
145
|
+
params = {
|
146
|
+
"marketplaceId" => marketplace_id,
|
147
|
+
"asinSet" => asin_set,
|
148
|
+
}.compact
|
149
|
+
|
150
|
+
rate_limit(10.0).post(path, body:, params:)
|
151
|
+
end
|
152
|
+
|
153
|
+
# Searches for A+ Content publishing records, if available.
|
154
|
+
#
|
155
|
+
# @param [String] marketplace_id The identifier for the marketplace where the A+ Content is published.
|
156
|
+
# @param [String] asin The Amazon Standard Identification Number (ASIN).
|
157
|
+
# @param [String] page_token A page token from the nextPageToken response element returned by your previous call
|
158
|
+
# to this operation. nextPageToken is returned when the results of a call exceed the page size. To get the next
|
159
|
+
# page of results, call the operation and include pageToken as the only parameter. Specifying pageToken with any
|
160
|
+
# other parameter will cause the request to fail. When no nextPageToken value is returned there are no more
|
161
|
+
# pages to return. A pageToken value is not usable across different operations.
|
162
|
+
# @return [Hash] The API response
|
163
|
+
def search_content_publish_records(marketplace_id, asin, page_token: nil)
|
164
|
+
path = "/aplus/2020-11-01/contentPublishRecords"
|
165
|
+
params = {
|
166
|
+
"marketplaceId" => marketplace_id,
|
167
|
+
"asin" => asin,
|
168
|
+
"pageToken" => page_token,
|
169
|
+
}.compact
|
170
|
+
|
171
|
+
rate_limit(10.0).get(path, params:)
|
172
|
+
end
|
173
|
+
|
174
|
+
# Submits an A+ Content document for review, approval, and publishing.
|
175
|
+
#
|
176
|
+
# @param [String] content_reference_key The unique reference key for the A+ Content document. A content reference
|
177
|
+
# key cannot form a permalink and may change in the future. A content reference key is not guaranteed to match
|
178
|
+
# any A+ content identifier.
|
179
|
+
# @param [String] marketplace_id The identifier for the marketplace where the A+ Content is published.
|
180
|
+
# @return [Hash] The API response
|
181
|
+
def post_content_document_approval_submission(content_reference_key, marketplace_id)
|
182
|
+
path = "/aplus/2020-11-01/contentDocuments/#{content_reference_key}/approvalSubmissions"
|
183
|
+
params = {
|
184
|
+
"marketplaceId" => marketplace_id,
|
185
|
+
}.compact
|
186
|
+
|
187
|
+
rate_limit(10.0).post(path, params:)
|
188
|
+
end
|
189
|
+
|
190
|
+
# Submits a request to suspend visible A+ Content. This neither deletes the content document nor the ASIN
|
191
|
+
# relations.
|
192
|
+
#
|
193
|
+
# @param [String] content_reference_key The unique reference key for the A+ Content document. A content reference
|
194
|
+
# key cannot form a permalink and may change in the future. A content reference key is not guaranteed to match
|
195
|
+
# any A+ content identifier.
|
196
|
+
# @param [String] marketplace_id The identifier for the marketplace where the A+ Content is published.
|
197
|
+
# @return [Hash] The API response
|
198
|
+
def post_content_document_suspend_submission(content_reference_key, marketplace_id)
|
199
|
+
path = "/aplus/2020-11-01/contentDocuments/#{content_reference_key}/suspendSubmissions"
|
200
|
+
params = {
|
201
|
+
"marketplaceId" => marketplace_id,
|
202
|
+
}.compact
|
203
|
+
|
204
|
+
rate_limit(10.0).post(path, params:)
|
205
|
+
end
|
206
|
+
end
|
207
|
+
end
|
208
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "peddler/api"
|
4
|
+
|
5
|
+
module Peddler
|
6
|
+
class API
|
7
|
+
# Selling Partner API for Application Management
|
8
|
+
#
|
9
|
+
# The Selling Partner API for Application Management lets you programmatically update the client secret on
|
10
|
+
# registered applications.
|
11
|
+
class ApplicationManagement20231130 < API
|
12
|
+
# Rotates application client secrets for a developer application. Developers must register a destination queue in
|
13
|
+
# the developer console before calling this operation. When this operation is called a new client secret is
|
14
|
+
# generated and sent to the developer-registered queue. For more information, refer to [Rotate your application
|
15
|
+
# client
|
16
|
+
# secret](https://developer-docs.amazon.com/sp-api/v0/docs/application-management-api-v2023-11-30-use-case-guide#tutorial-rotate-your-applications-client-secret).
|
17
|
+
# @return [Hash] The API response
|
18
|
+
def rotate_application_client_secret
|
19
|
+
path = "/applications/2023-11-30/clientSecret"
|
20
|
+
|
21
|
+
rate_limit(0.0167).post(path)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "peddler/api"
|
4
|
+
|
5
|
+
module Peddler
|
6
|
+
class API
|
7
|
+
# Selling Partner API for Catalog Items
|
8
|
+
#
|
9
|
+
# The Selling Partner API for Catalog Items provides programmatic access to information about items in the Amazon
|
10
|
+
# catalog. For more information, see the [Catalog Items API Use Case
|
11
|
+
# Guide](doc:catalog-items-api-v2020-12-01-use-case-guide).
|
12
|
+
class CatalogItems20201201 < API
|
13
|
+
# Search for and return a list of Amazon catalog items and associated information.
|
14
|
+
#
|
15
|
+
# @param [Array<String>] keywords A comma-delimited list of words or item identifiers to search the Amazon catalog
|
16
|
+
# for.
|
17
|
+
# @param [Array<String>] marketplace_ids A comma-delimited list of Amazon marketplace identifiers for the request.
|
18
|
+
# @param [Array<String>] included_data A comma-delimited list of data sets to include in the response. Default:
|
19
|
+
# summaries.
|
20
|
+
# @param [Array<String>] brand_names A comma-delimited list of brand names to limit the search to.
|
21
|
+
# @param [Array<String>] classification_ids A comma-delimited list of classification identifiers to limit the
|
22
|
+
# search to.
|
23
|
+
# @param [Integer] page_size Number of results to be returned per page.
|
24
|
+
# @param [String] page_token A token to fetch a certain page when there are multiple pages worth of results.
|
25
|
+
# @param [String] keywords_locale The language the keywords are provided in. Defaults to the primary locale of the
|
26
|
+
# marketplace.
|
27
|
+
# @param [String] locale Locale for retrieving localized summaries. Defaults to the primary locale of the
|
28
|
+
# marketplace.
|
29
|
+
# @return [Hash] The API response
|
30
|
+
def search_catalog_items(keywords, marketplace_ids, included_data: nil, brand_names: nil,
|
31
|
+
classification_ids: nil, page_size: nil, page_token: nil, keywords_locale: nil, locale: nil)
|
32
|
+
path = "/catalog/2020-12-01/items"
|
33
|
+
params = {
|
34
|
+
"keywords" => keywords,
|
35
|
+
"marketplaceIds" => marketplace_ids,
|
36
|
+
"includedData" => included_data,
|
37
|
+
"brandNames" => brand_names,
|
38
|
+
"classificationIds" => classification_ids,
|
39
|
+
"pageSize" => page_size,
|
40
|
+
"pageToken" => page_token,
|
41
|
+
"keywordsLocale" => keywords_locale,
|
42
|
+
"locale" => locale,
|
43
|
+
}.compact
|
44
|
+
|
45
|
+
rate_limit(2.0).get(path, params:)
|
46
|
+
end
|
47
|
+
|
48
|
+
# Retrieves details for an item in the Amazon catalog.
|
49
|
+
#
|
50
|
+
# @param [String] asin The Amazon Standard Identification Number (ASIN) of the item.
|
51
|
+
# @param [Array<String>] marketplace_ids A comma-delimited list of Amazon marketplace identifiers. Data sets in
|
52
|
+
# the response contain data only for the specified marketplaces.
|
53
|
+
# @param [Array<String>] included_data A comma-delimited list of data sets to include in the response. Default:
|
54
|
+
# summaries.
|
55
|
+
# @param [String] locale Locale for retrieving localized summaries. Defaults to the primary locale of the
|
56
|
+
# marketplace.
|
57
|
+
# @return [Hash] The API response
|
58
|
+
def get_catalog_item(asin, marketplace_ids, included_data: nil, locale: nil)
|
59
|
+
path = "/catalog/2020-12-01/items/#{asin}"
|
60
|
+
params = {
|
61
|
+
"marketplaceIds" => marketplace_ids,
|
62
|
+
"includedData" => included_data,
|
63
|
+
"locale" => locale,
|
64
|
+
}.compact
|
65
|
+
|
66
|
+
rate_limit(2.0).get(path, params:)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "peddler/api"
|
4
|
+
|
5
|
+
module Peddler
|
6
|
+
class API
|
7
|
+
# Selling Partner API for Catalog Items
|
8
|
+
#
|
9
|
+
# The Selling Partner API for Catalog Items provides programmatic access to information about items in the Amazon
|
10
|
+
# catalog. For more information, refer to the [Catalog Items API Use Case
|
11
|
+
# Guide](doc:catalog-items-api-v2022-04-01-use-case-guide).
|
12
|
+
class CatalogItems20220401 < API
|
13
|
+
# Search for and return a list of Amazon catalog items and associated information either by identifier or by
|
14
|
+
# keywords.
|
15
|
+
#
|
16
|
+
# @param [Array<String>] identifiers A comma-delimited list of product identifiers to search the Amazon catalog
|
17
|
+
# for. **Note:** Cannot be used with `keywords`.
|
18
|
+
# @param [String] identifiers_type Type of product identifiers to search the Amazon catalog for. **Note:**
|
19
|
+
# Required when `identifiers` are provided.
|
20
|
+
# @param [Array<String>] marketplace_ids A comma-delimited list of Amazon marketplace identifiers for the request.
|
21
|
+
# @param [Array<String>] included_data A comma-delimited list of data sets to include in the response. Default:
|
22
|
+
# `summaries`.
|
23
|
+
# @param [String] locale Locale for retrieving localized summaries. Defaults to the primary locale of the
|
24
|
+
# marketplace.
|
25
|
+
# @param [String] seller_id A selling partner identifier, such as a seller account or vendor code. **Note:**
|
26
|
+
# Required when `identifiersType` is `SKU`.
|
27
|
+
# @param [Array<String>] keywords A comma-delimited list of words to search the Amazon catalog for. **Note:**
|
28
|
+
# Cannot be used with `identifiers`.
|
29
|
+
# @param [Array<String>] brand_names A comma-delimited list of brand names to limit the search for
|
30
|
+
# `keywords`-based queries. **Note:** Cannot be used with `identifiers`.
|
31
|
+
# @param [Array<String>] classification_ids A comma-delimited list of classification identifiers to limit the
|
32
|
+
# search for `keywords`-based queries. **Note:** Cannot be used with `identifiers`.
|
33
|
+
# @param [Integer] page_size Number of results to be returned per page.
|
34
|
+
# @param [String] page_token A token to fetch a certain page when there are multiple pages worth of results.
|
35
|
+
# @param [String] keywords_locale The language of the keywords provided for `keywords`-based queries. Defaults to
|
36
|
+
# the primary locale of the marketplace. **Note:** Cannot be used with `identifiers`.
|
37
|
+
# @return [Hash] The API response
|
38
|
+
def search_catalog_items(
|
39
|
+
marketplace_ids, identifiers: nil, identifiers_type: nil, included_data: nil, locale: nil, seller_id: nil,
|
40
|
+
keywords: nil, brand_names: nil, classification_ids: nil, page_size: nil, page_token: nil, keywords_locale: nil
|
41
|
+
)
|
42
|
+
path = "/catalog/2022-04-01/items"
|
43
|
+
params = {
|
44
|
+
"identifiers" => identifiers,
|
45
|
+
"identifiersType" => identifiers_type,
|
46
|
+
"marketplaceIds" => marketplace_ids,
|
47
|
+
"includedData" => included_data,
|
48
|
+
"locale" => locale,
|
49
|
+
"sellerId" => seller_id,
|
50
|
+
"keywords" => keywords,
|
51
|
+
"brandNames" => brand_names,
|
52
|
+
"classificationIds" => classification_ids,
|
53
|
+
"pageSize" => page_size,
|
54
|
+
"pageToken" => page_token,
|
55
|
+
"keywordsLocale" => keywords_locale,
|
56
|
+
}.compact
|
57
|
+
|
58
|
+
rate_limit(2.0).get(path, params:)
|
59
|
+
end
|
60
|
+
|
61
|
+
# Retrieves details for an item in the Amazon catalog.
|
62
|
+
#
|
63
|
+
# @param [String] asin The Amazon Standard Identification Number (ASIN) of the item.
|
64
|
+
# @param [Array<String>] marketplace_ids A comma-delimited list of Amazon marketplace identifiers. Data sets in
|
65
|
+
# the response contain data only for the specified marketplaces.
|
66
|
+
# @param [Array<String>] included_data A comma-delimited list of data sets to include in the response. Default:
|
67
|
+
# `summaries`.
|
68
|
+
# @param [String] locale Locale for retrieving localized summaries. Defaults to the primary locale of the
|
69
|
+
# marketplace.
|
70
|
+
# @return [Hash] The API response
|
71
|
+
def get_catalog_item(asin, marketplace_ids, included_data: nil, locale: nil)
|
72
|
+
path = "/catalog/2022-04-01/items/#{asin}"
|
73
|
+
params = {
|
74
|
+
"marketplaceIds" => marketplace_ids,
|
75
|
+
"includedData" => included_data,
|
76
|
+
"locale" => locale,
|
77
|
+
}.compact
|
78
|
+
|
79
|
+
rate_limit(2.0).get(path, params:)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "peddler/api"
|
4
|
+
|
5
|
+
module Peddler
|
6
|
+
class API
|
7
|
+
# Selling Partner API for Catalog Items
|
8
|
+
#
|
9
|
+
# The Selling Partner API for Catalog Items helps you programmatically retrieve item details for items in the
|
10
|
+
# catalog.
|
11
|
+
class CatalogItemsV0 < API
|
12
|
+
# Effective September 30, 2022, the `listCatalogItems` operation will no longer be available in the Selling
|
13
|
+
# Partner API for Catalog Items v0. As an alternative, `searchCatalogItems` is available in the latest version of
|
14
|
+
# the [Selling Partner API for Catalog Items v2022-04-01](doc:catalog-items-api-v2022-04-01-reference).
|
15
|
+
# Integrations that rely on the `listCatalogItems` operation should migrate to the `searchCatalogItems`operation
|
16
|
+
# to avoid service disruption. _Note:_ The [`listCatalogCategories`](#get-catalogv0categories) operation is not
|
17
|
+
# being deprecated and you can continue to make calls to it.
|
18
|
+
#
|
19
|
+
# @param [String] marketplace_id A marketplace identifier. Specifies the marketplace for which items are returned.
|
20
|
+
# @param [String] query Keyword(s) to use to search for items in the catalog. Example: 'harry potter books'.
|
21
|
+
# @param [String] query_context_id An identifier for the context within which the given search will be performed.
|
22
|
+
# A marketplace might provide mechanisms for constraining a search to a subset of potential items. For example,
|
23
|
+
# the retail marketplace allows queries to be constrained to a specific category. The QueryContextId parameter
|
24
|
+
# specifies such a subset. If it is omitted, the search will be performed using the default context for the
|
25
|
+
# marketplace, which will typically contain the largest set of items.
|
26
|
+
# @param [String] seller_sku Used to identify an item in the given marketplace. SellerSKU is qualified by the
|
27
|
+
# seller's SellerId, which is included with every operation that you submit.
|
28
|
+
# @param [String] upc A 12-digit bar code used for retail packaging.
|
29
|
+
# @param [String] ean A European article number that uniquely identifies the catalog item, manufacturer, and its
|
30
|
+
# attributes.
|
31
|
+
# @param [String] isbn The unique commercial book identifier used to identify books internationally.
|
32
|
+
# @param [String] jan A Japanese article number that uniquely identifies the product, manufacturer, and its
|
33
|
+
# attributes.
|
34
|
+
# @return [Hash] The API response
|
35
|
+
def list_catalog_items(marketplace_id, query: nil, query_context_id: nil, seller_sku: nil, upc: nil, ean: nil,
|
36
|
+
isbn: nil, jan: nil)
|
37
|
+
path = "/catalog/v0/items"
|
38
|
+
params = {
|
39
|
+
"MarketplaceId" => marketplace_id,
|
40
|
+
"Query" => query,
|
41
|
+
"QueryContextId" => query_context_id,
|
42
|
+
"SellerSKU" => seller_sku,
|
43
|
+
"UPC" => upc,
|
44
|
+
"EAN" => ean,
|
45
|
+
"ISBN" => isbn,
|
46
|
+
"JAN" => jan,
|
47
|
+
}.compact
|
48
|
+
|
49
|
+
get(path, params:)
|
50
|
+
end
|
51
|
+
|
52
|
+
# Effective September 30, 2022, the `getCatalogItem` operation will no longer be available in the Selling Partner
|
53
|
+
# API for Catalog Items v0. This operation is available in the latest version of the [Selling Partner API for
|
54
|
+
# Catalog Items v2022-04-01](doc:catalog-items-api-v2022-04-01-reference). Integrations that rely on this
|
55
|
+
# operation should migrate to the latest version to avoid service disruption. _Note:_ The
|
56
|
+
# [`listCatalogCategories`](#get-catalogv0categories) operation is not being deprecated and you can continue to
|
57
|
+
# make calls to it.
|
58
|
+
#
|
59
|
+
# @param [String] marketplace_id A marketplace identifier. Specifies the marketplace for the item.
|
60
|
+
# @param [String] asin The Amazon Standard Identification Number (ASIN) of the item.
|
61
|
+
# @return [Hash] The API response
|
62
|
+
def get_catalog_item(marketplace_id, asin)
|
63
|
+
path = "/catalog/v0/items/#{asin}"
|
64
|
+
params = {
|
65
|
+
"MarketplaceId" => marketplace_id,
|
66
|
+
}.compact
|
67
|
+
|
68
|
+
get(path, params:)
|
69
|
+
end
|
70
|
+
|
71
|
+
# Returns the parent categories to which an item belongs, based on the specified ASIN or SellerSKU.
|
72
|
+
#
|
73
|
+
# @param [String] marketplace_id A marketplace identifier. Specifies the marketplace for the item.
|
74
|
+
# @param [String] asin The Amazon Standard Identification Number (ASIN) of the item.
|
75
|
+
# @param [String] seller_sku Used to identify items in the given marketplace. SellerSKU is qualified by the
|
76
|
+
# seller's SellerId, which is included with every operation that you submit.
|
77
|
+
# @return [Hash] The API response
|
78
|
+
def list_catalog_categories(marketplace_id, asin: nil, seller_sku: nil)
|
79
|
+
path = "/catalog/v0/categories"
|
80
|
+
params = {
|
81
|
+
"MarketplaceId" => marketplace_id,
|
82
|
+
"ASIN" => asin,
|
83
|
+
"SellerSKU" => seller_sku,
|
84
|
+
}.compact
|
85
|
+
|
86
|
+
rate_limit(1.0).get(path, params:)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|