peddler 3.0.0.beta1 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +96 -106
- data/lib/peddler/api/amazon_warehousing_and_distribution_2024_05_09.rb +34 -22
- data/lib/peddler/api/aplus_content_2020_11_01.rb +86 -48
- data/lib/peddler/api/application_integrations_2024_04_01.rb +56 -0
- data/lib/peddler/api/application_management_2023_11_30.rb +12 -2
- data/lib/peddler/api/catalog_items_2020_12_01.rb +31 -20
- data/lib/peddler/api/catalog_items_2022_04_01.rb +35 -25
- data/lib/peddler/api/catalog_items_v0.rb +39 -26
- data/lib/peddler/api/data_kiosk_2023_11_15.rb +41 -25
- data/lib/peddler/api/easy_ship_2022_03_23.rb +62 -43
- data/lib/peddler/api/fba_inbound_eligibility_v1.rb +13 -5
- data/lib/peddler/api/fba_inventory_v1.rb +40 -24
- data/lib/peddler/api/feeds_2021_06_30.rb +43 -25
- data/lib/peddler/api/finances_2024_06_19.rb +50 -0
- data/lib/peddler/api/finances_v0.rb +86 -59
- data/lib/peddler/api/fulfillment_inbound_2024_03_20.rb +304 -205
- data/lib/peddler/api/fulfillment_inbound_v0.rb +112 -74
- data/lib/peddler/api/fulfillment_outbound_2020_07_01.rb +90 -53
- data/lib/peddler/api/invoices_2024_06_19.rb +180 -0
- data/lib/peddler/api/listings_items_2020_09_01.rb +44 -33
- data/lib/peddler/api/listings_items_2021_08_01.rb +76 -60
- data/lib/peddler/api/listings_restrictions_2021_08_01.rb +19 -9
- data/lib/peddler/api/merchant_fulfillment_v0.rb +31 -15
- data/lib/peddler/api/messaging_v1.rb +93 -61
- data/lib/peddler/api/notifications_v1.rb +54 -23
- data/lib/peddler/api/orders_v0.rb +87 -72
- data/lib/peddler/api/product_fees_v0.rb +39 -31
- data/lib/peddler/api/product_pricing_2022_05_01.rb +17 -6
- data/lib/peddler/api/product_pricing_v0.rb +63 -45
- data/lib/peddler/api/product_type_definitions_2020_09_01.rb +29 -18
- data/lib/peddler/api/replenishment_2022_11_07.rb +21 -9
- data/lib/peddler/api/reports_2021_06_30.rb +60 -36
- data/lib/peddler/api/sales_v1.rb +20 -12
- data/lib/peddler/api/sellers_v1.rb +16 -4
- data/lib/peddler/api/services_v1.rb +138 -98
- data/lib/peddler/api/shipment_invoicing_v0.rb +25 -12
- data/lib/peddler/api/shipping_v1.rb +54 -29
- data/lib/peddler/api/shipping_v2.rb +132 -80
- data/lib/peddler/api/solicitations_v1.rb +18 -8
- data/lib/peddler/api/supply_sources_2020_07_01.rb +33 -15
- data/lib/peddler/api/tokens_2021_03_01.rb +13 -5
- data/lib/peddler/api/uploads_2020_11_01.rb +16 -6
- data/lib/peddler/api/vendor_direct_fulfillment_inventory_v1.rb +12 -4
- data/lib/peddler/api/vendor_direct_fulfillment_orders_2021_12_28.rb +29 -17
- data/lib/peddler/api/vendor_direct_fulfillment_orders_v1.rb +29 -17
- data/lib/peddler/api/vendor_direct_fulfillment_payments_v1.rb +11 -3
- data/lib/peddler/api/vendor_direct_fulfillment_sandbox_test_data_2021_10_28.rb +14 -4
- data/lib/peddler/api/vendor_direct_fulfillment_shipping_2021_12_28.rb +74 -48
- data/lib/peddler/api/vendor_direct_fulfillment_shipping_v1.rb +74 -50
- data/lib/peddler/api/vendor_direct_fulfillment_transactions_2021_12_28.rb +11 -3
- data/lib/peddler/api/vendor_direct_fulfillment_transactions_v1.rb +11 -3
- data/lib/peddler/api/vendor_invoices_v1.rb +11 -3
- data/lib/peddler/api/vendor_orders_v1.rb +54 -43
- data/lib/peddler/api/vendor_shipments_v1.rb +63 -51
- data/lib/peddler/api/vendor_transaction_status_v1.rb +12 -3
- data/lib/peddler/api.rb +41 -18
- data/lib/peddler/endpoint.rb +51 -0
- data/lib/peddler/error.rb +1 -0
- data/lib/peddler/marketplace.rb +49 -0
- data/lib/peddler/token.rb +70 -0
- data/lib/peddler/version.rb +1 -1
- data/lib/peddler.rb +56 -52
- metadata +10 -6
- data/lib/peddler/access_token.rb +0 -76
- data/lib/peddler/region.rb +0 -30
@@ -3,33 +3,42 @@
|
|
3
3
|
require "peddler/api"
|
4
4
|
|
5
5
|
module Peddler
|
6
|
+
class << self
|
7
|
+
def product_pricing_v0(...)
|
8
|
+
API::ProductPricingV0.new(...)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
6
12
|
class API
|
7
13
|
# Selling Partner API for Pricing
|
8
14
|
#
|
9
15
|
# The Selling Partner API for Pricing helps you programmatically retrieve product pricing and offer information for
|
10
16
|
# Amazon Marketplace products.
|
11
17
|
class ProductPricingV0 < API
|
12
|
-
# Returns pricing information for a seller's offer listings based on seller SKU or ASIN.
|
13
|
-
#
|
14
|
-
#
|
15
|
-
#
|
18
|
+
# Returns pricing information for a seller's offer listings based on seller SKU or ASIN. **Note:** The parameters
|
19
|
+
# associated with this operation may contain special characters that require URL encoding to call the API. To
|
20
|
+
# avoid errors with SKUs when encoding URLs, refer to [URL
|
21
|
+
# Encoding](https://developer-docs.amazon.com/sp-api/docs/url-encoding).
|
16
22
|
#
|
17
|
-
# @
|
23
|
+
# @note This operation can make a static sandbox call.
|
24
|
+
# @param marketplace_id [String] A marketplace identifier. Specifies the marketplace for which prices are
|
18
25
|
# returned.
|
19
|
-
# @param [Array<String>]
|
26
|
+
# @param asins [Array<String>] A list of up to twenty Amazon Standard Identification Number (ASIN) values used to
|
20
27
|
# identify items in the given marketplace.
|
21
|
-
# @param [Array<String>]
|
28
|
+
# @param skus [Array<String>] A list of up to twenty seller SKU values used to identify items in the given
|
22
29
|
# marketplace.
|
23
|
-
# @param [String]
|
30
|
+
# @param item_type [String] Indicates whether ASIN values or seller SKU values are used to identify items. If you
|
24
31
|
# specify Asin, the information in the response will be dependent on the list of Asins you provide in the Asins
|
25
32
|
# parameter. If you specify Sku, the information in the response will be dependent on the list of Skus you
|
26
33
|
# provide in the Skus parameter.
|
27
|
-
# @param [String]
|
34
|
+
# @param item_condition [String] Filters the offer listings based on item condition. Possible values: New, Used,
|
28
35
|
# Collectible, Refurbished, Club.
|
29
|
-
# @param [String]
|
36
|
+
# @param offer_type [String] Indicates whether to request pricing information for the seller's B2C or B2B offers.
|
30
37
|
# Default is B2C.
|
38
|
+
# @param rate_limit [Float] Requests per second
|
31
39
|
# @return [Hash] The API response
|
32
|
-
def get_pricing(marketplace_id, item_type, asins: nil, skus: nil, item_condition: nil, offer_type: nil
|
40
|
+
def get_pricing(marketplace_id, item_type, asins: nil, skus: nil, item_condition: nil, offer_type: nil,
|
41
|
+
rate_limit: 0.5)
|
33
42
|
path = "/products/pricing/v0/price"
|
34
43
|
params = {
|
35
44
|
"MarketplaceId" => marketplace_id,
|
@@ -40,28 +49,30 @@ module Peddler
|
|
40
49
|
"OfferType" => offer_type,
|
41
50
|
}.compact
|
42
51
|
|
43
|
-
rate_limit
|
52
|
+
meter(rate_limit).get(path, params:)
|
44
53
|
end
|
45
54
|
|
46
|
-
# Returns competitive pricing information for a seller's offer listings based on seller SKU or ASIN.
|
47
|
-
#
|
48
|
-
#
|
49
|
-
#
|
55
|
+
# Returns competitive pricing information for a seller's offer listings based on seller SKU or ASIN. **Note:** The
|
56
|
+
# parameters associated with this operation may contain special characters that require URL encoding to call the
|
57
|
+
# API. To avoid errors with SKUs when encoding URLs, refer to [URL
|
58
|
+
# Encoding](https://developer-docs.amazon.com/sp-api/docs/url-encoding).
|
50
59
|
#
|
51
|
-
# @
|
60
|
+
# @note This operation can make a static sandbox call.
|
61
|
+
# @param marketplace_id [String] A marketplace identifier. Specifies the marketplace for which prices are
|
52
62
|
# returned.
|
53
|
-
# @param [Array<String>]
|
63
|
+
# @param asins [Array<String>] A list of up to twenty Amazon Standard Identification Number (ASIN) values used to
|
54
64
|
# identify items in the given marketplace.
|
55
|
-
# @param [Array<String>]
|
65
|
+
# @param skus [Array<String>] A list of up to twenty seller SKU values used to identify items in the given
|
56
66
|
# marketplace.
|
57
|
-
# @param [String]
|
67
|
+
# @param item_type [String] Indicates whether ASIN values or seller SKU values are used to identify items. If you
|
58
68
|
# specify Asin, the information in the response will be dependent on the list of Asins you provide in the Asins
|
59
69
|
# parameter. If you specify Sku, the information in the response will be dependent on the list of Skus you
|
60
70
|
# provide in the Skus parameter. Possible values: Asin, Sku.
|
61
|
-
# @param [String]
|
71
|
+
# @param customer_type [String] Indicates whether to request pricing information from the point of view of
|
62
72
|
# Consumer or Business buyers. Default is Consumer.
|
73
|
+
# @param rate_limit [Float] Requests per second
|
63
74
|
# @return [Hash] The API response
|
64
|
-
def get_competitive_pricing(marketplace_id, item_type, asins: nil, skus: nil, customer_type: nil)
|
75
|
+
def get_competitive_pricing(marketplace_id, item_type, asins: nil, skus: nil, customer_type: nil, rate_limit: 0.5)
|
65
76
|
path = "/products/pricing/v0/competitivePrice"
|
66
77
|
params = {
|
67
78
|
"MarketplaceId" => marketplace_id,
|
@@ -71,23 +82,24 @@ module Peddler
|
|
71
82
|
"CustomerType" => customer_type,
|
72
83
|
}.compact
|
73
84
|
|
74
|
-
rate_limit
|
85
|
+
meter(rate_limit).get(path, params:)
|
75
86
|
end
|
76
87
|
|
77
|
-
# Returns the lowest priced offers for a single SKU listing.
|
78
|
-
#
|
79
|
-
#
|
80
|
-
# Encoding](https://developer-docs.amazon.com/sp-api/docs/url-encoding).
|
88
|
+
# Returns the lowest priced offers for a single SKU listing. **Note:** The parameters associated with this
|
89
|
+
# operation may contain special characters that require URL encoding to call the API. To avoid errors with SKUs
|
90
|
+
# when encoding URLs, refer to [URL Encoding](https://developer-docs.amazon.com/sp-api/docs/url-encoding).
|
81
91
|
#
|
82
|
-
# @
|
92
|
+
# @note This operation can make a static sandbox call.
|
93
|
+
# @param marketplace_id [String] A marketplace identifier. Specifies the marketplace for which prices are
|
83
94
|
# returned.
|
84
|
-
# @param [String]
|
95
|
+
# @param item_condition [String] Filters the offer listings based on item condition. Possible values: New, Used,
|
85
96
|
# Collectible, Refurbished, Club.
|
86
|
-
# @param [String]
|
97
|
+
# @param seller_sku [String] Identifies an item in the given marketplace. SellerSKU is qualified by the seller's
|
87
98
|
# SellerId, which is included with every operation that you submit.
|
88
|
-
# @param [String]
|
99
|
+
# @param customer_type [String] Indicates whether to request Consumer or Business offers. Default is Consumer.
|
100
|
+
# @param rate_limit [Float] Requests per second
|
89
101
|
# @return [Hash] The API response
|
90
|
-
def get_listing_offers(marketplace_id, item_condition, seller_sku, customer_type: nil)
|
102
|
+
def get_listing_offers(marketplace_id, item_condition, seller_sku, customer_type: nil, rate_limit: 1.0)
|
91
103
|
path = "/products/pricing/v0/listings/#{seller_sku}/offers"
|
92
104
|
params = {
|
93
105
|
"MarketplaceId" => marketplace_id,
|
@@ -95,19 +107,21 @@ module Peddler
|
|
95
107
|
"CustomerType" => customer_type,
|
96
108
|
}.compact
|
97
109
|
|
98
|
-
rate_limit
|
110
|
+
meter(rate_limit).get(path, params:)
|
99
111
|
end
|
100
112
|
|
101
113
|
# Returns the lowest priced offers for a single item based on ASIN.
|
102
114
|
#
|
103
|
-
# @
|
115
|
+
# @note This operation can make a static sandbox call.
|
116
|
+
# @param marketplace_id [String] A marketplace identifier. Specifies the marketplace for which prices are
|
104
117
|
# returned.
|
105
|
-
# @param [String]
|
118
|
+
# @param item_condition [String] Filters the offer listings to be considered based on item condition. Possible
|
106
119
|
# values: New, Used, Collectible, Refurbished, Club.
|
107
|
-
# @param [String]
|
108
|
-
# @param [String]
|
120
|
+
# @param asin [String] The Amazon Standard Identification Number (ASIN) of the item.
|
121
|
+
# @param customer_type [String] Indicates whether to request Consumer or Business offers. Default is Consumer.
|
122
|
+
# @param rate_limit [Float] Requests per second
|
109
123
|
# @return [Hash] The API response
|
110
|
-
def get_item_offers(marketplace_id, item_condition, asin, customer_type: nil)
|
124
|
+
def get_item_offers(marketplace_id, item_condition, asin, customer_type: nil, rate_limit: 0.5)
|
111
125
|
path = "/products/pricing/v0/items/#{asin}/offers"
|
112
126
|
params = {
|
113
127
|
"MarketplaceId" => marketplace_id,
|
@@ -115,29 +129,33 @@ module Peddler
|
|
115
129
|
"CustomerType" => customer_type,
|
116
130
|
}.compact
|
117
131
|
|
118
|
-
rate_limit
|
132
|
+
meter(rate_limit).get(path, params:)
|
119
133
|
end
|
120
134
|
|
121
135
|
# Returns the lowest priced offers for a batch of items based on ASIN.
|
122
136
|
#
|
123
|
-
# @
|
137
|
+
# @note This operation can make a static sandbox call.
|
138
|
+
# @param get_item_offers_batch_request_body [Hash]
|
139
|
+
# @param rate_limit [Float] Requests per second
|
124
140
|
# @return [Hash] The API response
|
125
|
-
def get_item_offers_batch(get_item_offers_batch_request_body)
|
141
|
+
def get_item_offers_batch(get_item_offers_batch_request_body, rate_limit: 0.1)
|
126
142
|
path = "/batches/products/pricing/v0/itemOffers"
|
127
143
|
body = get_item_offers_batch_request_body
|
128
144
|
|
129
|
-
rate_limit
|
145
|
+
meter(rate_limit).post(path, body:)
|
130
146
|
end
|
131
147
|
|
132
148
|
# Returns the lowest priced offers for a batch of listings by SKU.
|
133
149
|
#
|
134
|
-
# @
|
150
|
+
# @note This operation can make a static sandbox call.
|
151
|
+
# @param get_listing_offers_batch_request_body [Hash]
|
152
|
+
# @param rate_limit [Float] Requests per second
|
135
153
|
# @return [Hash] The API response
|
136
|
-
def get_listing_offers_batch(get_listing_offers_batch_request_body)
|
154
|
+
def get_listing_offers_batch(get_listing_offers_batch_request_body, rate_limit: 0.5)
|
137
155
|
path = "/batches/products/pricing/v0/listingOffers"
|
138
156
|
body = get_listing_offers_batch_request_body
|
139
157
|
|
140
|
-
rate_limit
|
158
|
+
meter(rate_limit).post(path, body:)
|
141
159
|
end
|
142
160
|
end
|
143
161
|
end
|
@@ -3,6 +3,12 @@
|
|
3
3
|
require "peddler/api"
|
4
4
|
|
5
5
|
module Peddler
|
6
|
+
class << self
|
7
|
+
def product_type_definitions_2020_09_01(...)
|
8
|
+
API::ProductTypeDefinitions20200901.new(...)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
6
12
|
class API
|
7
13
|
# Selling Partner API for Product Type Definitions
|
8
14
|
#
|
@@ -10,22 +16,25 @@ module Peddler
|
|
10
16
|
# requirements for product types in the Amazon catalog. Use this API to return the JSON Schema for a product type
|
11
17
|
# that you can then use with other Selling Partner APIs, such as the Selling Partner API for Listings Items, the
|
12
18
|
# Selling Partner API for Catalog Items, and the Selling Partner API for Feeds (for JSON-based listing feeds). For
|
13
|
-
# more information, see the
|
19
|
+
# more information, see the {https://developer-docs.amazon.com/sp-api/docs/product-type-api-use-case-guide Product
|
20
|
+
# Type Definitions API Use Case Guide}.
|
14
21
|
class ProductTypeDefinitions20200901 < API
|
15
22
|
# Search for and return a list of Amazon product types that have definitions available.
|
16
23
|
#
|
17
|
-
# @
|
24
|
+
# @note This operation can make a static sandbox call.
|
25
|
+
# @param keywords [Array<String>] A comma-delimited list of keywords to search product types. **Note:** Cannot be
|
18
26
|
# used with `itemName`.
|
19
|
-
# @param [Array<String>]
|
20
|
-
# @param [String]
|
27
|
+
# @param marketplace_ids [Array<String>] A comma-delimited list of Amazon marketplace identifiers for the request.
|
28
|
+
# @param item_name [String] The title of the ASIN to get the product type recommendation. **Note:** Cannot be used
|
21
29
|
# with `keywords`.
|
22
|
-
# @param [String]
|
30
|
+
# @param locale [String] The locale for the display names in the response. Defaults to the primary locale of the
|
23
31
|
# marketplace.
|
24
|
-
# @param [String]
|
32
|
+
# @param search_locale [String] The locale used for the `keywords` and `itemName` parameters. Defaults to the
|
25
33
|
# primary locale of the marketplace.
|
34
|
+
# @param rate_limit [Float] Requests per second
|
26
35
|
# @return [Hash] The API response
|
27
36
|
def search_definitions_product_types(marketplace_ids, keywords: nil, item_name: nil, locale: nil,
|
28
|
-
search_locale: nil)
|
37
|
+
search_locale: nil, rate_limit: 5.0)
|
29
38
|
path = "/definitions/2020-09-01/productTypes"
|
30
39
|
params = {
|
31
40
|
"keywords" => keywords,
|
@@ -35,29 +44,31 @@ module Peddler
|
|
35
44
|
"searchLocale" => search_locale,
|
36
45
|
}.compact
|
37
46
|
|
38
|
-
rate_limit
|
47
|
+
meter(rate_limit).get(path, params:)
|
39
48
|
end
|
40
49
|
|
41
50
|
# Retrieve an Amazon product type definition.
|
42
51
|
#
|
43
|
-
# @
|
44
|
-
# @param [String]
|
52
|
+
# @note This operation can make a static sandbox call.
|
53
|
+
# @param product_type [String] The Amazon product type name.
|
54
|
+
# @param seller_id [String] A selling partner identifier. When provided, seller-specific requirements and values
|
45
55
|
# are populated within the product type definition schema, such as brand names associated with the selling
|
46
56
|
# partner.
|
47
|
-
# @param [Array<String>]
|
57
|
+
# @param marketplace_ids [Array<String>] A comma-delimited list of Amazon marketplace identifiers for the request.
|
48
58
|
# Note: This parameter is limited to one marketplaceId at this time.
|
49
|
-
# @param [String]
|
59
|
+
# @param product_type_version [String] The version of the Amazon product type to retrieve. Defaults to "LATEST",.
|
50
60
|
# Prerelease versions of product type definitions may be retrieved with "RELEASE_CANDIDATE". If no prerelease
|
51
61
|
# version is currently available, the "LATEST" live version will be provided.
|
52
|
-
# @param [String]
|
53
|
-
# @param [String]
|
62
|
+
# @param requirements [String] The name of the requirements set to retrieve requirements for.
|
63
|
+
# @param requirements_enforced [String] Identifies if the required attributes for a requirements set are enforced
|
54
64
|
# by the product type definition schema. Non-enforced requirements enable structural validation of individual
|
55
65
|
# attributes without all the required attributes being present (such as for partial updates).
|
56
|
-
# @param [String]
|
66
|
+
# @param locale [String] Locale for retrieving display labels and other presentation details. Defaults to the
|
57
67
|
# default language of the first marketplace in the request.
|
68
|
+
# @param rate_limit [Float] Requests per second
|
58
69
|
# @return [Hash] The API response
|
59
|
-
def get_definitions_product_type(product_type, marketplace_ids, seller_id: nil, product_type_version:
|
60
|
-
requirements:
|
70
|
+
def get_definitions_product_type(product_type, marketplace_ids, seller_id: nil, product_type_version: "LATEST",
|
71
|
+
requirements: "LISTING", requirements_enforced: "ENFORCED", locale: "DEFAULT", rate_limit: 5.0)
|
61
72
|
path = "/definitions/2020-09-01/productTypes/#{product_type}"
|
62
73
|
params = {
|
63
74
|
"sellerId" => seller_id,
|
@@ -68,7 +79,7 @@ module Peddler
|
|
68
79
|
"locale" => locale,
|
69
80
|
}.compact
|
70
81
|
|
71
|
-
rate_limit
|
82
|
+
meter(rate_limit).get(path, params:)
|
72
83
|
end
|
73
84
|
end
|
74
85
|
end
|
@@ -3,6 +3,12 @@
|
|
3
3
|
require "peddler/api"
|
4
4
|
|
5
5
|
module Peddler
|
6
|
+
class << self
|
7
|
+
def replenishment_2022_11_07(...)
|
8
|
+
API::Replenishment20221107.new(...)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
6
12
|
class API
|
7
13
|
# Selling Partner API for Replenishment
|
8
14
|
#
|
@@ -13,32 +19,38 @@ module Peddler
|
|
13
19
|
class Replenishment20221107 < API
|
14
20
|
# Returns aggregated replenishment program metrics for a selling partner.
|
15
21
|
#
|
16
|
-
# @
|
22
|
+
# @note This operation can make a static sandbox call.
|
23
|
+
# @param body [Hash] The request body for the `getSellingPartnerMetrics` operation.
|
24
|
+
# @param rate_limit [Float] Requests per second
|
17
25
|
# @return [Hash] The API response
|
18
|
-
def get_selling_partner_metrics(body: nil)
|
26
|
+
def get_selling_partner_metrics(body: nil, rate_limit: 1.0)
|
19
27
|
path = "/replenishment/2022-11-07/sellingPartners/metrics/search"
|
20
28
|
|
21
|
-
rate_limit
|
29
|
+
meter(rate_limit).post(path, body:)
|
22
30
|
end
|
23
31
|
|
24
32
|
# Returns aggregated replenishment program metrics for a selling partner's offers.
|
25
33
|
#
|
26
|
-
# @
|
34
|
+
# @note This operation can make a static sandbox call.
|
35
|
+
# @param body [Hash] The request body for the `listOfferMetrics` operation.
|
36
|
+
# @param rate_limit [Float] Requests per second
|
27
37
|
# @return [Hash] The API response
|
28
|
-
def list_offer_metrics(body: nil)
|
38
|
+
def list_offer_metrics(body: nil, rate_limit: 1.0)
|
29
39
|
path = "/replenishment/2022-11-07/offers/metrics/search"
|
30
40
|
|
31
|
-
rate_limit
|
41
|
+
meter(rate_limit).post(path, body:)
|
32
42
|
end
|
33
43
|
|
34
44
|
# Returns the details of a selling partner's replenishment program offers.
|
35
45
|
#
|
36
|
-
# @
|
46
|
+
# @note This operation can make a static sandbox call.
|
47
|
+
# @param body [Hash] The request body for the `listOffers` operation.
|
48
|
+
# @param rate_limit [Float] Requests per second
|
37
49
|
# @return [Hash] The API response
|
38
|
-
def list_offers(body: nil)
|
50
|
+
def list_offers(body: nil, rate_limit: 1.0)
|
39
51
|
path = "/replenishment/2022-11-07/offers/search"
|
40
52
|
|
41
|
-
rate_limit
|
53
|
+
meter(rate_limit).post(path, body:)
|
42
54
|
end
|
43
55
|
end
|
44
56
|
end
|
@@ -3,6 +3,12 @@
|
|
3
3
|
require "peddler/api"
|
4
4
|
|
5
5
|
module Peddler
|
6
|
+
class << self
|
7
|
+
def reports_2021_06_30(...)
|
8
|
+
API::Reports20210630.new(...)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
6
12
|
class API
|
7
13
|
# Selling Partner API for Reports
|
8
14
|
#
|
@@ -11,26 +17,28 @@ module Peddler
|
|
11
17
|
class Reports20210630 < API
|
12
18
|
# Returns report details for the reports that match the filters that you specify.
|
13
19
|
#
|
14
|
-
# @
|
20
|
+
# @note This operation can make a static sandbox call.
|
21
|
+
# @param report_types [Array<String>] A list of report types used to filter reports. Refer to [Report Type
|
15
22
|
# Values](https://developer-docs.amazon.com/sp-api/docs/report-type-values) for more information. When
|
16
23
|
# reportTypes is provided, the other filter parameters (processingStatuses, marketplaceIds, createdSince,
|
17
24
|
# createdUntil) and pageSize may also be provided. Either reportTypes or nextToken is required.
|
18
|
-
# @param [Array<String>]
|
19
|
-
# @param [Array<String>]
|
25
|
+
# @param processing_statuses [Array<String>] A list of processing statuses used to filter reports.
|
26
|
+
# @param marketplace_ids [Array<String>] A list of marketplace identifiers used to filter reports. The reports
|
20
27
|
# returned will match at least one of the marketplaces that you specify.
|
21
|
-
# @param [Integer]
|
22
|
-
# @param [String]
|
23
|
-
# in
|
28
|
+
# @param page_size [Integer] The maximum number of reports to return in a single call.
|
29
|
+
# @param created_since [String] The earliest report creation date and time for reports to include in the response,
|
30
|
+
# in {https://developer-docs.amazon.com/sp-api/docs/iso-8601 ISO 8601} date time format. The default is 90 days
|
24
31
|
# ago. Reports are retained for a maximum of 90 days.
|
25
|
-
# @param [String]
|
26
|
-
# in
|
27
|
-
# @param [String]
|
32
|
+
# @param created_until [String] The latest report creation date and time for reports to include in the response,
|
33
|
+
# in {https://developer-docs.amazon.com/sp-api/docs/iso-8601 ISO 8601} date time format. The default is now.
|
34
|
+
# @param next_token [String] A string token returned in the response to your previous request. `nextToken` is
|
28
35
|
# returned when the number of results exceeds the specified `pageSize` value. To get the next page of results,
|
29
36
|
# call the `getReports` operation and include this token as the only parameter. Specifying `nextToken` with any
|
30
37
|
# other parameters will cause the request to fail.
|
38
|
+
# @param rate_limit [Float] Requests per second
|
31
39
|
# @return [Hash] The API response
|
32
|
-
def get_reports(report_types: nil, processing_statuses: nil, marketplace_ids: nil, page_size:
|
33
|
-
created_since: nil, created_until: nil, next_token: nil)
|
40
|
+
def get_reports(report_types: nil, processing_statuses: nil, marketplace_ids: nil, page_size: 10,
|
41
|
+
created_since: nil, created_until: nil, next_token: nil, rate_limit: 0.0222)
|
34
42
|
path = "/reports/2021-06-30/reports"
|
35
43
|
params = {
|
36
44
|
"reportTypes" => report_types,
|
@@ -42,97 +50,113 @@ module Peddler
|
|
42
50
|
"nextToken" => next_token,
|
43
51
|
}.compact
|
44
52
|
|
45
|
-
rate_limit
|
53
|
+
meter(rate_limit).get(path, params:)
|
46
54
|
end
|
47
55
|
|
48
56
|
# Creates a report.
|
49
57
|
#
|
50
|
-
# @
|
58
|
+
# @note This operation can make a static sandbox call.
|
59
|
+
# @param body [Hash] Information required to create the report.
|
60
|
+
# @param rate_limit [Float] Requests per second
|
51
61
|
# @return [Hash] The API response
|
52
|
-
def create_report(body)
|
62
|
+
def create_report(body, rate_limit: 0.0167)
|
53
63
|
path = "/reports/2021-06-30/reports"
|
54
64
|
|
55
|
-
rate_limit
|
65
|
+
meter(rate_limit).post(path, body:)
|
56
66
|
end
|
57
67
|
|
58
68
|
# Cancels the report that you specify. Only reports with `processingStatus=IN_QUEUE` can be cancelled. Cancelled
|
59
69
|
# reports are returned in subsequent calls to the `getReport` and `getReports` operations.
|
60
70
|
#
|
61
|
-
# @
|
71
|
+
# @note This operation can make a static sandbox call.
|
72
|
+
# @param report_id [String] The identifier for the report. This identifier is unique only in combination with a
|
62
73
|
# seller ID.
|
74
|
+
# @param rate_limit [Float] Requests per second
|
63
75
|
# @return [Hash] The API response
|
64
|
-
def cancel_report(report_id)
|
76
|
+
def cancel_report(report_id, rate_limit: 0.0222)
|
65
77
|
path = "/reports/2021-06-30/reports/#{report_id}"
|
66
78
|
|
67
|
-
rate_limit
|
79
|
+
meter(rate_limit).delete(path)
|
68
80
|
end
|
69
81
|
|
70
82
|
# Returns report details (including the `reportDocumentId`, if available) for the report that you specify.
|
71
83
|
#
|
72
|
-
# @
|
84
|
+
# @note This operation can make a static sandbox call.
|
85
|
+
# @param report_id [String] The identifier for the report. This identifier is unique only in combination with a
|
73
86
|
# seller ID.
|
87
|
+
# @param rate_limit [Float] Requests per second
|
74
88
|
# @return [Hash] The API response
|
75
|
-
def get_report(report_id)
|
89
|
+
def get_report(report_id, rate_limit: 2.0)
|
76
90
|
path = "/reports/2021-06-30/reports/#{report_id}"
|
77
91
|
|
78
|
-
rate_limit
|
92
|
+
meter(rate_limit).get(path)
|
79
93
|
end
|
80
94
|
|
81
95
|
# Returns report schedule details that match the filters that you specify.
|
82
96
|
#
|
83
|
-
# @
|
97
|
+
# @note This operation can make a static sandbox call.
|
98
|
+
# @param report_types [Array<String>] A list of report types used to filter report schedules. Refer to [Report
|
84
99
|
# Type Values](https://developer-docs.amazon.com/sp-api/docs/report-type-values) for more information.
|
100
|
+
# @param rate_limit [Float] Requests per second
|
85
101
|
# @return [Hash] The API response
|
86
|
-
def get_report_schedules(report_types)
|
102
|
+
def get_report_schedules(report_types, rate_limit: 0.0222)
|
87
103
|
path = "/reports/2021-06-30/schedules"
|
88
104
|
params = {
|
89
105
|
"reportTypes" => report_types,
|
90
106
|
}.compact
|
91
107
|
|
92
|
-
rate_limit
|
108
|
+
meter(rate_limit).get(path, params:)
|
93
109
|
end
|
94
110
|
|
95
111
|
# Creates a report schedule. If a report schedule with the same report type and marketplace IDs already exists, it
|
96
112
|
# will be cancelled and replaced with this one.
|
97
113
|
#
|
98
|
-
# @
|
114
|
+
# @note This operation can make a static sandbox call.
|
115
|
+
# @param body [Hash] Information required to create the report schedule.
|
116
|
+
# @param rate_limit [Float] Requests per second
|
99
117
|
# @return [Hash] The API response
|
100
|
-
def create_report_schedule(body)
|
118
|
+
def create_report_schedule(body, rate_limit: 0.0222)
|
101
119
|
path = "/reports/2021-06-30/schedules"
|
102
120
|
|
103
|
-
rate_limit
|
121
|
+
meter(rate_limit).post(path, body:)
|
104
122
|
end
|
105
123
|
|
106
124
|
# Cancels the report schedule that you specify.
|
107
125
|
#
|
108
|
-
# @
|
126
|
+
# @note This operation can make a static sandbox call.
|
127
|
+
# @param report_schedule_id [String] The identifier for the report schedule. This identifier is unique only in
|
109
128
|
# combination with a seller ID.
|
129
|
+
# @param rate_limit [Float] Requests per second
|
110
130
|
# @return [Hash] The API response
|
111
|
-
def cancel_report_schedule(report_schedule_id)
|
131
|
+
def cancel_report_schedule(report_schedule_id, rate_limit: 0.0222)
|
112
132
|
path = "/reports/2021-06-30/schedules/#{report_schedule_id}"
|
113
133
|
|
114
|
-
rate_limit
|
134
|
+
meter(rate_limit).delete(path)
|
115
135
|
end
|
116
136
|
|
117
137
|
# Returns report schedule details for the report schedule that you specify.
|
118
138
|
#
|
119
|
-
# @
|
139
|
+
# @note This operation can make a static sandbox call.
|
140
|
+
# @param report_schedule_id [String] The identifier for the report schedule. This identifier is unique only in
|
120
141
|
# combination with a seller ID.
|
142
|
+
# @param rate_limit [Float] Requests per second
|
121
143
|
# @return [Hash] The API response
|
122
|
-
def get_report_schedule(report_schedule_id)
|
144
|
+
def get_report_schedule(report_schedule_id, rate_limit: 0.0222)
|
123
145
|
path = "/reports/2021-06-30/schedules/#{report_schedule_id}"
|
124
146
|
|
125
|
-
rate_limit
|
147
|
+
meter(rate_limit).get(path)
|
126
148
|
end
|
127
149
|
|
128
150
|
# Returns the information required for retrieving a report document's contents.
|
129
151
|
#
|
130
|
-
# @
|
152
|
+
# @note This operation can make a static sandbox call.
|
153
|
+
# @param report_document_id [String] The identifier for the report document.
|
154
|
+
# @param rate_limit [Float] Requests per second
|
131
155
|
# @return [Hash] The API response
|
132
|
-
def get_report_document(report_document_id)
|
156
|
+
def get_report_document(report_document_id, rate_limit: 0.0167)
|
133
157
|
path = "/reports/2021-06-30/documents/#{report_document_id}"
|
134
158
|
|
135
|
-
rate_limit
|
159
|
+
meter(rate_limit).get(path)
|
136
160
|
end
|
137
161
|
end
|
138
162
|
end
|
data/lib/peddler/api/sales_v1.rb
CHANGED
@@ -3,6 +3,12 @@
|
|
3
3
|
require "peddler/api"
|
4
4
|
|
5
5
|
module Peddler
|
6
|
+
class << self
|
7
|
+
def sales_v1(...)
|
8
|
+
API::SalesV1.new(...)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
6
12
|
class API
|
7
13
|
# Selling Partner API for Sales
|
8
14
|
#
|
@@ -10,45 +16,47 @@ module Peddler
|
|
10
16
|
class SalesV1 < API
|
11
17
|
# Returns aggregated order metrics for given interval, broken down by granularity, for given buyer type.
|
12
18
|
#
|
13
|
-
# @
|
19
|
+
# @note This operation can make a static sandbox call.
|
20
|
+
# @param marketplace_ids [Array<String>] A marketplace identifier. This specifies the marketplace in which the
|
14
21
|
# order was placed. Only one marketplace can be specified. For example, ATVPDKIKX0DER indicates the US
|
15
22
|
# marketplace.
|
16
|
-
# @param [String]
|
23
|
+
# @param interval [String] A time interval used for selecting order metrics. This takes the form of two dates
|
17
24
|
# separated by two hyphens (first date is inclusive; second date is exclusive). Dates are in ISO8601 format and
|
18
25
|
# must represent absolute time (either Z notation or offset notation). Example:
|
19
26
|
# 2018-09-01T00:00:00-07:00--2018-09-04T00:00:00-07:00 requests order metrics for Sept 1st, 2nd and 3rd in the
|
20
27
|
# -07:00 zone.
|
21
|
-
# @param [String]
|
28
|
+
# @param granularity_time_zone [String] An IANA-compatible time zone for determining the day boundary. Required
|
22
29
|
# when specifying a granularity value greater than Hour. The granularityTimeZone value must align with the
|
23
30
|
# offset of the specified interval value. For example, if the interval value uses Z notation, then
|
24
31
|
# granularityTimeZone must be UTC. If the interval value uses an offset, then granularityTimeZone must be an
|
25
32
|
# IANA-compatible time zone that matches the offset. Example: US/Pacific to compute day boundaries, accounting
|
26
33
|
# for daylight time savings, for US/Pacific zone.
|
27
|
-
# @param [String]
|
34
|
+
# @param granularity [String] The granularity of the grouping of order metrics, based on a unit of time.
|
28
35
|
# Specifying granularity=Hour results in a successful request only if the interval specified is less than or
|
29
36
|
# equal to 30 days from now. For all other granularities, the interval specified must be less or equal to 2
|
30
37
|
# years from now. Specifying granularity=Total results in order metrics that are aggregated over the entire
|
31
38
|
# interval that you specify. If the interval start and end date don’t align with the specified granularity, the
|
32
39
|
# head and tail end of the response interval will contain partial data. Example: Day to get a daily breakdown of
|
33
40
|
# the request interval, where the day boundary is defined by the granularityTimeZone.
|
34
|
-
# @param [String]
|
41
|
+
# @param buyer_type [String] Filters the results by the buyer type that you specify, B2B (business to business) or
|
35
42
|
# B2C (business to customer). Example: B2B, if you want the response to include order metrics for only B2B
|
36
43
|
# buyers.
|
37
|
-
# @param [String]
|
44
|
+
# @param fulfillment_network [String] Filters the results by the fulfillment network that you specify, MFN
|
38
45
|
# (merchant fulfillment network) or AFN (Amazon fulfillment network). Do not include this filter if you want the
|
39
46
|
# response to include order metrics for all fulfillment networks. Example: AFN, if you want the response to
|
40
47
|
# include order metrics for only Amazon fulfillment network.
|
41
|
-
# @param [String]
|
48
|
+
# @param first_day_of_week [String] Specifies the day that the week starts on when granularity=Week, either Monday
|
42
49
|
# or Sunday. Default: Monday. Example: Sunday, if you want the week to start on a Sunday.
|
43
|
-
# @param [String]
|
50
|
+
# @param asin [String] Filters the results by the ASIN that you specify. Specifying both ASIN and SKU returns an
|
44
51
|
# error. Do not include this filter if you want the response to include order metrics for all ASINs. Example:
|
45
52
|
# B0792R1RSN, if you want the response to include order metrics for only ASIN B0792R1RSN.
|
46
|
-
# @param [String]
|
53
|
+
# @param sku [String] Filters the results by the SKU that you specify. Specifying both ASIN and SKU returns an
|
47
54
|
# error. Do not include this filter if you want the response to include order metrics for all SKUs. Example:
|
48
55
|
# TestSKU, if you want the response to include order metrics for only SKU TestSKU.
|
56
|
+
# @param rate_limit [Float] Requests per second
|
49
57
|
# @return [Hash] The API response
|
50
|
-
def get_order_metrics(marketplace_ids, interval, granularity, granularity_time_zone: nil, buyer_type:
|
51
|
-
fulfillment_network: nil, first_day_of_week:
|
58
|
+
def get_order_metrics(marketplace_ids, interval, granularity, granularity_time_zone: nil, buyer_type: "All",
|
59
|
+
fulfillment_network: nil, first_day_of_week: "Monday", asin: nil, sku: nil, rate_limit: 0.5)
|
52
60
|
path = "/sales/v1/orderMetrics"
|
53
61
|
params = {
|
54
62
|
"marketplaceIds" => marketplace_ids,
|
@@ -62,7 +70,7 @@ module Peddler
|
|
62
70
|
"sku" => sku,
|
63
71
|
}.compact
|
64
72
|
|
65
|
-
rate_limit
|
73
|
+
meter(rate_limit).get(path, params:)
|
66
74
|
end
|
67
75
|
end
|
68
76
|
end
|