peddler 2.4.5 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +402 -140
  3. data/lib/peddler/api/amazon_warehousing_and_distribution_2024_05_09.rb +92 -0
  4. data/lib/peddler/api/aplus_content_2020_11_01.rb +246 -0
  5. data/lib/peddler/api/application_integrations_2024_04_01.rb +56 -0
  6. data/lib/peddler/api/application_management_2023_11_30.rb +35 -0
  7. data/lib/peddler/api/catalog_items_2020_12_01.rb +81 -0
  8. data/lib/peddler/api/catalog_items_2022_04_01.rb +93 -0
  9. data/lib/peddler/api/catalog_items_v0.rb +103 -0
  10. data/lib/peddler/api/data_kiosk_2023_11_15.rb +108 -0
  11. data/lib/peddler/api/easy_ship_2022_03_23.rb +127 -0
  12. data/lib/peddler/api/fba_inbound_eligibility_v1.rb +44 -0
  13. data/lib/peddler/api/fba_inventory_v1.rb +122 -0
  14. data/lib/peddler/api/feeds_2021_06_30.rb +122 -0
  15. data/lib/peddler/api/finances_2024_06_19.rb +50 -0
  16. data/lib/peddler/api/finances_v0.rb +148 -0
  17. data/lib/peddler/api/fulfillment_inbound_2024_03_20.rb +759 -0
  18. data/lib/peddler/api/fulfillment_inbound_v0.rb +352 -0
  19. data/lib/peddler/api/fulfillment_outbound_2020_07_01.rb +259 -0
  20. data/lib/peddler/api/invoices_2024_06_19.rb +180 -0
  21. data/lib/peddler/api/listings_items_2020_09_01.rb +95 -0
  22. data/lib/peddler/api/listings_items_2021_08_01.rb +170 -0
  23. data/lib/peddler/api/listings_restrictions_2021_08_01.rb +47 -0
  24. data/lib/peddler/api/merchant_fulfillment_v0.rb +80 -0
  25. data/lib/peddler/api/messaging_v1.rb +273 -0
  26. data/lib/peddler/api/notifications_v1.rb +145 -0
  27. data/lib/peddler/api/orders_v0.rb +279 -0
  28. data/lib/peddler/api/product_fees_v0.rb +77 -0
  29. data/lib/peddler/api/product_pricing_2022_05_01.rb +54 -0
  30. data/lib/peddler/api/product_pricing_v0.rb +162 -0
  31. data/lib/peddler/api/product_type_definitions_2020_09_01.rb +86 -0
  32. data/lib/peddler/api/replenishment_2022_11_07.rb +57 -0
  33. data/lib/peddler/api/reports_2021_06_30.rb +163 -0
  34. data/lib/peddler/api/sales_v1.rb +77 -0
  35. data/lib/peddler/api/sellers_v1.rb +45 -0
  36. data/lib/peddler/api/services_v1.rb +348 -0
  37. data/lib/peddler/api/shipment_invoicing_v0.rb +59 -0
  38. data/lib/peddler/api/shipping_v1.rb +132 -0
  39. data/lib/peddler/api/shipping_v2.rb +319 -0
  40. data/lib/peddler/api/solicitations_v1.rb +63 -0
  41. data/lib/peddler/api/supply_sources_2020_07_01.rb +100 -0
  42. data/lib/peddler/api/tokens_2021_03_01.rb +38 -0
  43. data/lib/peddler/api/uploads_2020_11_01.rb +50 -0
  44. data/lib/peddler/api/vendor_direct_fulfillment_inventory_v1.rb +32 -0
  45. data/lib/peddler/api/vendor_direct_fulfillment_orders_2021_12_28.rb +84 -0
  46. data/lib/peddler/api/vendor_direct_fulfillment_orders_v1.rb +84 -0
  47. data/lib/peddler/api/vendor_direct_fulfillment_payments_v1.rb +31 -0
  48. data/lib/peddler/api/vendor_direct_fulfillment_sandbox_test_data_2021_10_28.rb +45 -0
  49. data/lib/peddler/api/vendor_direct_fulfillment_shipping_2021_12_28.rb +203 -0
  50. data/lib/peddler/api/vendor_direct_fulfillment_shipping_v1.rb +189 -0
  51. data/lib/peddler/api/vendor_direct_fulfillment_transactions_2021_12_28.rb +32 -0
  52. data/lib/peddler/api/vendor_direct_fulfillment_transactions_v1.rb +32 -0
  53. data/lib/peddler/api/vendor_invoices_v1.rb +30 -0
  54. data/lib/peddler/api/vendor_orders_v1.rb +159 -0
  55. data/lib/peddler/api/vendor_shipments_v1.rb +132 -0
  56. data/lib/peddler/api/vendor_transaction_status_v1.rb +33 -0
  57. data/lib/peddler/api.rb +138 -0
  58. data/lib/peddler/endpoint.rb +51 -0
  59. data/lib/peddler/error.rb +31 -0
  60. data/lib/peddler/marketplace.rb +38 -68
  61. data/lib/peddler/token.rb +70 -0
  62. data/lib/peddler/version.rb +1 -1
  63. data/lib/peddler.rb +56 -1
  64. metadata +74 -80
  65. data/lib/mws/easy_ship/client.rb +0 -93
  66. data/lib/mws/easy_ship.rb +0 -3
  67. data/lib/mws/feeds/client.rb +0 -122
  68. data/lib/mws/feeds.rb +0 -3
  69. data/lib/mws/finances/client.rb +0 -82
  70. data/lib/mws/finances.rb +0 -3
  71. data/lib/mws/fulfillment_inbound_shipment/client.rb +0 -388
  72. data/lib/mws/fulfillment_inbound_shipment.rb +0 -3
  73. data/lib/mws/fulfillment_inventory/client.rb +0 -57
  74. data/lib/mws/fulfillment_inventory.rb +0 -3
  75. data/lib/mws/fulfillment_outbound_shipment/client.rb +0 -211
  76. data/lib/mws/fulfillment_outbound_shipment.rb +0 -3
  77. data/lib/mws/merchant_fulfillment/client.rb +0 -87
  78. data/lib/mws/merchant_fulfillment.rb +0 -3
  79. data/lib/mws/off_amazon_payments.rb +0 -3
  80. data/lib/mws/orders/client.rb +0 -120
  81. data/lib/mws/orders.rb +0 -3
  82. data/lib/mws/products/client.rb +0 -268
  83. data/lib/mws/products.rb +0 -3
  84. data/lib/mws/recommendations/client.rb +0 -72
  85. data/lib/mws/recommendations.rb +0 -3
  86. data/lib/mws/reports/client.rb +0 -236
  87. data/lib/mws/reports.rb +0 -3
  88. data/lib/mws/sellers/client.rb +0 -44
  89. data/lib/mws/sellers.rb +0 -3
  90. data/lib/mws/shipment_invoicing/client.rb +0 -74
  91. data/lib/mws/shipment_invoicing.rb +0 -3
  92. data/lib/mws/subscriptions/client.rb +0 -179
  93. data/lib/mws/subscriptions.rb +0 -3
  94. data/lib/mws.rb +0 -29
  95. data/lib/peddler/client.rb +0 -159
  96. data/lib/peddler/errors/builder.rb +0 -64
  97. data/lib/peddler/errors/class_generator.rb +0 -40
  98. data/lib/peddler/errors/error.rb +0 -45
  99. data/lib/peddler/errors/parser.rb +0 -28
  100. data/lib/peddler/flat_file_parser.rb +0 -56
  101. data/lib/peddler/headers.rb +0 -102
  102. data/lib/peddler/operation.rb +0 -78
  103. data/lib/peddler/parser.rb +0 -33
  104. data/lib/peddler/structured_list.rb +0 -23
  105. data/lib/peddler/vcr_matcher.rb +0 -97
  106. data/lib/peddler/xml_parser.rb +0 -38
  107. data/lib/peddler/xml_response_parser.rb +0 -25
@@ -0,0 +1,180 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "peddler/api"
4
+
5
+ module Peddler
6
+ class << self
7
+ def invoices_2024_06_19(...)
8
+ API::Invoices20240619.new(...)
9
+ end
10
+ end
11
+
12
+ class API
13
+ # The Selling Partner API for Invoices.
14
+ #
15
+ # Use the Selling Partner API for Invoices to retrieve and manage invoice-related operations, which can help selling
16
+ # partners manage their bookkeeping processes.
17
+ class Invoices20240619 < API
18
+ # Returns marketplace-dependent schemas and their respective set of possible values.
19
+ #
20
+ # @note This operation can make a static sandbox call.
21
+ # @param marketplace_id [String] The marketplace identifier.
22
+ # @param rate_limit [Float] Requests per second
23
+ # @return [Hash] The API response
24
+ def get_invoices_attributes(marketplace_id, rate_limit: 1.0)
25
+ path = "/tax/invoices/2024-06-19/attributes"
26
+ params = {
27
+ "marketplaceId" => marketplace_id,
28
+ }.compact
29
+
30
+ meter(rate_limit).get(path, params:)
31
+ end
32
+
33
+ # Returns the invoice document's ID and URL. Use the URL to download the ZIP file, which contains the invoices
34
+ # from the corresponding `createInvoicesExport` request.
35
+ #
36
+ # @note This operation can make a static sandbox call.
37
+ # @param invoices_document_id [String] The export document identifier.
38
+ # @param rate_limit [Float] Requests per second
39
+ # @return [Hash] The API response
40
+ def get_invoices_document(invoices_document_id, rate_limit: 0.0167)
41
+ path = "/tax/invoices/2024-06-19/documents/#{invoices_document_id}"
42
+
43
+ meter(rate_limit).get(path)
44
+ end
45
+
46
+ # Creates an invoice export request.
47
+ #
48
+ # @note This operation can make a static sandbox call.
49
+ # @param body [Hash] Information required to create the export request.
50
+ # @param rate_limit [Float] Requests per second
51
+ # @return [Hash] The API response
52
+ def create_invoices_export(body, rate_limit: 0.167)
53
+ path = "/tax/invoices/2024-06-19/exports"
54
+
55
+ meter(rate_limit).post(path, body:)
56
+ end
57
+
58
+ # Returns invoice exports details for exports that match the filters that you specify.
59
+ #
60
+ # @note This operation can make a static sandbox call.
61
+ # @param marketplace_id [String] The returned exports match the specified marketplace.
62
+ # @param date_start [String] The earliest export creation date and time for exports that you want to include in
63
+ # the response. Values are in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date-time
64
+ # format. The default is 30 days ago.
65
+ # @param next_token [String] The response includes `nextToken` when the number of results exceeds the specified
66
+ # `pageSize` value. To get the next page of results, call the operation with this token and include the same
67
+ # arguments as the call that produced the token. To get a complete list, call this operation until `nextToken`
68
+ # is null. Note that this operation can return empty pages.
69
+ # @param page_size [Integer] The maximum number of invoices to return in a single call. Minimum: 1 Maximum: 100
70
+ # @param date_end [String] The latest export creation date and time for exports that you want to include in the
71
+ # response. Values are in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date-time format.
72
+ # The default value is the time of the request.
73
+ # @param status [String] Return exports matching the status specified.
74
+ # @param rate_limit [Float] Requests per second
75
+ # @return [Hash] The API response
76
+ def get_invoices_exports(marketplace_id, date_start: nil, next_token: nil, page_size: nil, date_end: nil,
77
+ status: nil, rate_limit: 0.1)
78
+ path = "/tax/invoices/2024-06-19/exports"
79
+ params = {
80
+ "marketplaceId" => marketplace_id,
81
+ "dateStart" => date_start,
82
+ "nextToken" => next_token,
83
+ "pageSize" => page_size,
84
+ "dateEnd" => date_end,
85
+ "status" => status,
86
+ }.compact
87
+
88
+ meter(rate_limit).get(path, params:)
89
+ end
90
+
91
+ # Returns invoice export details (including the `exportDocumentId`, if available) for the export that you specify.
92
+ #
93
+ # @note This operation can make a static sandbox call.
94
+ # @param export_id [String] The unique identifier for the export.
95
+ # @param rate_limit [Float] Requests per second
96
+ # @return [Hash] The API response
97
+ def get_invoices_export(export_id, rate_limit: 2.0)
98
+ path = "/tax/invoices/2024-06-19/exports/#{export_id}"
99
+
100
+ meter(rate_limit).get(path)
101
+ end
102
+
103
+ # Returns invoice details for the invoices that match the filters that you specify.
104
+ #
105
+ # @note This operation can make a static sandbox call.
106
+ # @param transaction_identifier_name [String] The name of the transaction identifier filter. If you provide a
107
+ # value for this field, you must also provide a value for the `transactionIdentifierId` field.Use the
108
+ # `getInvoicesAttributes` operation to check `transactionIdentifierName` options.
109
+ # @param page_size [Integer] The maximum number of invoices you want to return in a single call. Minimum: 1
110
+ # Maximum: 200
111
+ # @param date_end [String] The latest invoice creation date for invoices that you want to include in the response.
112
+ # Dates are in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date-time format. The default
113
+ # is the current date-time.
114
+ # @param marketplace_id [String] The response includes only the invoices that match the specified marketplace.
115
+ # @param transaction_type [String] The marketplace-specific classification of the transaction type for which the
116
+ # invoice was created. Use the `getInvoicesAttributes` operation to check `transactionType` options.
117
+ # @param transaction_identifier_id [String] The ID of the transaction identifier filter. If you provide a value
118
+ # for this field, you must also provide a value for the `transactionIdentifierName` field.
119
+ # @param date_start [String] The earliest invoice creation date for invoices that you want to include in the
120
+ # response. Dates are in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date-time format.
121
+ # The default is 24 hours prior to the time of the request.
122
+ # @param series [String] Return invoices with the specified series number.
123
+ # @param next_token [String] The response includes `nextToken` when the number of results exceeds the specified
124
+ # `pageSize` value. To get the next page of results, call the operation with this token and include the same
125
+ # arguments as the call that produced the token. To get a complete list, call this operation until `nextToken`
126
+ # is null. Note that this operation can return empty pages.
127
+ # @param sort_order [String] Sort the invoices in the response in ascending or descending order.
128
+ # @param invoice_type [String] The marketplace-specific classification of the invoice type. Use the
129
+ # `getInvoicesAttributes` operation to check `invoiceType` options.
130
+ # @param statuses [Array<String>] A list of statuses that you can use to filter invoices. Use the
131
+ # `getInvoicesAttributes` operation to check invoice status options. Min count: 1
132
+ # @param external_invoice_id [String] Return invoices that match this external ID. This is typically the
133
+ # Government Invoice ID.
134
+ # @param sort_by [String] The attribute by which you want to sort the invoices in the response.
135
+ # @param rate_limit [Float] Requests per second
136
+ # @return [Hash] The API response
137
+ def get_invoices(marketplace_id, transaction_identifier_name: nil, page_size: nil, date_end: nil,
138
+ transaction_type: nil, transaction_identifier_id: nil, date_start: nil, series: nil, next_token: nil,
139
+ sort_order: nil, invoice_type: nil, statuses: nil, external_invoice_id: nil, sort_by: nil, rate_limit: 0.1)
140
+ path = "/tax/invoices/2024-06-19/invoices"
141
+ params = {
142
+ "transactionIdentifierName" => transaction_identifier_name,
143
+ "pageSize" => page_size,
144
+ "dateEnd" => date_end,
145
+ "marketplaceId" => marketplace_id,
146
+ "transactionType" => transaction_type,
147
+ "transactionIdentifierId" => transaction_identifier_id,
148
+ "dateStart" => date_start,
149
+ "series" => series,
150
+ "nextToken" => next_token,
151
+ "sortOrder" => sort_order,
152
+ "invoiceType" => invoice_type,
153
+ "statuses" => statuses,
154
+ "externalInvoiceId" => external_invoice_id,
155
+ "sortBy" => sort_by,
156
+ }.compact
157
+
158
+ meter(rate_limit).get(path, params:)
159
+ end
160
+
161
+ # Returns invoice data for the specified invoice. This operation returns only a subset of the invoices data; refer
162
+ # to the response definition to get all the possible attributes. To get the full invoice, use the
163
+ # `createInvoicesExport` operation to start an export request.
164
+ #
165
+ # @note This operation can make a static sandbox call.
166
+ # @param marketplace_id [String] The marketplace from which you want the invoice.
167
+ # @param invoice_id [String] The invoice identifier.
168
+ # @param rate_limit [Float] Requests per second
169
+ # @return [Hash] The API response
170
+ def get_invoice(marketplace_id, invoice_id, rate_limit: 2.0)
171
+ path = "/tax/invoices/2024-06-19/invoices/#{invoice_id}"
172
+ params = {
173
+ "marketplaceId" => marketplace_id,
174
+ }.compact
175
+
176
+ meter(rate_limit).get(path, params:)
177
+ end
178
+ end
179
+ end
180
+ end
@@ -0,0 +1,95 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "peddler/api"
4
+
5
+ module Peddler
6
+ class << self
7
+ def listings_items_2020_09_01(...)
8
+ API::ListingsItems20200901.new(...)
9
+ end
10
+ end
11
+
12
+ class API
13
+ # Selling Partner API for Listings Items
14
+ #
15
+ # The Selling Partner API for Listings Items (Listings Items API) provides programmatic access to selling partner
16
+ # listings on Amazon. Use this API in collaboration with the Selling Partner API for Product Type Definitions, which
17
+ # you use to retrieve the information about Amazon product types needed to use the Listings Items API. For more
18
+ # information, see the {https://developer-docs.amazon.com/sp-api/docs/listings-items-api-v2020-09-01-use-case-guide
19
+ # Listing Items API Use Case Guide}.
20
+ class ListingsItems20200901 < API
21
+ # Delete a listings item for a selling partner. **Note:** The parameters associated with this operation may
22
+ # contain special characters that must be encoded to successfully call the API. To avoid errors with SKUs when
23
+ # encoding URLs, refer to [URL Encoding](https://developer-docs.amazon.com/sp-api/docs/url-encoding).
24
+ #
25
+ # @note This operation can make a static sandbox call.
26
+ # @param seller_id [String] A selling partner identifier, such as a merchant account or vendor code.
27
+ # @param sku [String] A selling partner provided identifier for an Amazon listing.
28
+ # @param marketplace_ids [Array<String>] A comma-delimited list of Amazon marketplace identifiers for the request.
29
+ # @param issue_locale [String] A locale for localization of issues. When not provided, the default language code
30
+ # of the first marketplace is used. Examples: "en_US", "fr_CA", "fr_FR". Localized messages default to "en_US"
31
+ # when a localization is not available in the specified locale.
32
+ # @param rate_limit [Float] Requests per second
33
+ # @return [Hash] The API response
34
+ def delete_listings_item(seller_id, sku, marketplace_ids, issue_locale: nil, rate_limit: 5.0)
35
+ path = "/listings/2020-09-01/items/#{seller_id}/#{sku}"
36
+ params = {
37
+ "marketplaceIds" => marketplace_ids,
38
+ "issueLocale" => issue_locale,
39
+ }.compact
40
+
41
+ meter(rate_limit).delete(path, params:)
42
+ end
43
+
44
+ # Partially update (patch) a listings item for a selling partner. Only top-level listings item attributes can be
45
+ # patched. Patching nested attributes is not supported. **Note:** The parameters associated with this operation
46
+ # may contain special characters that must be encoded to successfully call the API. To avoid errors with SKUs when
47
+ # encoding URLs, refer to [URL Encoding](https://developer-docs.amazon.com/sp-api/docs/url-encoding).
48
+ #
49
+ # @note This operation can make a static sandbox call.
50
+ # @param seller_id [String] A selling partner identifier, such as a merchant account or vendor code.
51
+ # @param sku [String] A selling partner provided identifier for an Amazon listing.
52
+ # @param marketplace_ids [Array<String>] A comma-delimited list of Amazon marketplace identifiers for the request.
53
+ # @param issue_locale [String] A locale for localization of issues. When not provided, the default language code
54
+ # of the first marketplace is used. Examples: "en_US", "fr_CA", "fr_FR". Localized messages default to "en_US"
55
+ # when a localization is not available in the specified locale.
56
+ # @param body [Hash] The request body schema for the patchListingsItem operation.
57
+ # @param rate_limit [Float] Requests per second
58
+ # @return [Hash] The API response
59
+ def patch_listings_item(seller_id, sku, marketplace_ids, body, issue_locale: nil, rate_limit: 5.0)
60
+ path = "/listings/2020-09-01/items/#{seller_id}/#{sku}"
61
+ params = {
62
+ "marketplaceIds" => marketplace_ids,
63
+ "issueLocale" => issue_locale,
64
+ }.compact
65
+
66
+ meter(rate_limit).patch(path, body:, params:)
67
+ end
68
+
69
+ # Creates a new or fully-updates an existing listings item for a selling partner. **Note:** The parameters
70
+ # associated with this operation may contain special characters that must be encoded to successfully call the API.
71
+ # To avoid errors with SKUs when encoding URLs, refer to [URL
72
+ # Encoding](https://developer-docs.amazon.com/sp-api/docs/url-encoding).
73
+ #
74
+ # @note This operation can make a static sandbox call.
75
+ # @param seller_id [String] A selling partner identifier, such as a merchant account or vendor code.
76
+ # @param sku [String] A selling partner provided identifier for an Amazon listing.
77
+ # @param marketplace_ids [Array<String>] A comma-delimited list of Amazon marketplace identifiers for the request.
78
+ # @param issue_locale [String] A locale for localization of issues. When not provided, the default language code
79
+ # of the first marketplace is used. Examples: "en_US", "fr_CA", "fr_FR". Localized messages default to "en_US"
80
+ # when a localization is not available in the specified locale.
81
+ # @param body [Hash] The request body schema for the putListingsItem operation.
82
+ # @param rate_limit [Float] Requests per second
83
+ # @return [Hash] The API response
84
+ def put_listings_item(seller_id, sku, marketplace_ids, body, issue_locale: nil, rate_limit: 5.0)
85
+ path = "/listings/2020-09-01/items/#{seller_id}/#{sku}"
86
+ params = {
87
+ "marketplaceIds" => marketplace_ids,
88
+ "issueLocale" => issue_locale,
89
+ }.compact
90
+
91
+ meter(rate_limit).put(path, body:, params:)
92
+ end
93
+ end
94
+ end
95
+ end
@@ -0,0 +1,170 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "peddler/api"
4
+
5
+ module Peddler
6
+ class << self
7
+ def listings_items_2021_08_01(...)
8
+ API::ListingsItems20210801.new(...)
9
+ end
10
+ end
11
+
12
+ class API
13
+ # Selling Partner API for Listings Items
14
+ #
15
+ # The Selling Partner API for Listings Items (Listings Items API) provides programmatic access to selling partner
16
+ # listings on Amazon. Use this API in collaboration with the Selling Partner API for Product Type Definitions, which
17
+ # you use to retrieve the information about Amazon product types needed to use the Listings Items API. For more
18
+ # information, see the [Listings Items API Use Case
19
+ # Guide](https://developer-docs.amazon.com/sp-api/docs/listings-items-api-v2021-08-01-use-case-guide).
20
+ class ListingsItems20210801 < API
21
+ # Delete a listings item for a selling partner. **Note:** The parameters associated with this operation may
22
+ # contain special characters that must be encoded to successfully call the API. To avoid errors with SKUs when
23
+ # encoding URLs, refer to [URL Encoding](https://developer-docs.amazon.com/sp-api/docs/url-encoding).
24
+ #
25
+ # @note This operation can make a static sandbox call.
26
+ # @param seller_id [String] A selling partner identifier, such as a merchant account or vendor code.
27
+ # @param sku [String] A selling partner provided identifier for an Amazon listing.
28
+ # @param marketplace_ids [Array<String>] A comma-delimited list of Amazon marketplace identifiers for the request.
29
+ # @param issue_locale [String] A locale for localization of issues. When not provided, the default language code
30
+ # of the first marketplace is used. Examples: `en_US`, `fr_CA`, `fr_FR`. Localized messages default to `en_US`
31
+ # when a localization is not available in the specified locale.
32
+ # @param rate_limit [Float] Requests per second
33
+ # @return [Hash] The API response
34
+ def delete_listings_item(seller_id, sku, marketplace_ids, issue_locale: nil, rate_limit: 5.0)
35
+ path = "/listings/2021-08-01/items/#{seller_id}/#{sku}"
36
+ params = {
37
+ "marketplaceIds" => marketplace_ids,
38
+ "issueLocale" => issue_locale,
39
+ }.compact
40
+
41
+ meter(rate_limit).delete(path, params:)
42
+ end
43
+
44
+ # Returns details about a listings item for a selling partner. **Note:** The parameters associated with this
45
+ # operation may contain special characters that must be encoded to successfully call the API. To avoid errors with
46
+ # SKUs when encoding URLs, refer to [URL Encoding](https://developer-docs.amazon.com/sp-api/docs/url-encoding).
47
+ #
48
+ # @note This operation can make a static sandbox call.
49
+ # @param seller_id [String] A selling partner identifier, such as a merchant account or vendor code.
50
+ # @param sku [String] A selling partner provided identifier for an Amazon listing.
51
+ # @param marketplace_ids [Array<String>] A comma-delimited list of Amazon marketplace identifiers for the request.
52
+ # @param issue_locale [String] A locale for localization of issues. When not provided, the default language code
53
+ # of the first marketplace is used. Examples: `en_US`, `fr_CA`, `fr_FR`. Localized messages default to `en_US`
54
+ # when a localization is not available in the specified locale.
55
+ # @param included_data [Array<String>] A comma-delimited list of data sets to include in the response. Default:
56
+ # `summaries`.
57
+ # @param rate_limit [Float] Requests per second
58
+ # @return [Hash] The API response
59
+ def get_listings_item(seller_id, sku, marketplace_ids, issue_locale: nil, included_data: ["summaries"],
60
+ rate_limit: 5.0)
61
+ path = "/listings/2021-08-01/items/#{seller_id}/#{sku}"
62
+ params = {
63
+ "marketplaceIds" => marketplace_ids,
64
+ "issueLocale" => issue_locale,
65
+ "includedData" => included_data,
66
+ }.compact
67
+
68
+ meter(rate_limit).get(path, params:)
69
+ end
70
+
71
+ # Partially update (patch) a listings item for a selling partner. Only top-level listings item attributes can be
72
+ # patched. Patching nested attributes is not supported. **Note:** This operation has a throttling rate of one
73
+ # request per second when `mode` is `VALIDATION_PREVIEW`. **Note:** The parameters associated with this operation
74
+ # may contain special characters that must be encoded to successfully call the API. To avoid errors with SKUs when
75
+ # encoding URLs, refer to [URL Encoding](https://developer-docs.amazon.com/sp-api/docs/url-encoding).
76
+ #
77
+ # @note This operation can make a static sandbox call.
78
+ # @param seller_id [String] A selling partner identifier, such as a merchant account or vendor code.
79
+ # @param sku [String] A selling partner provided identifier for an Amazon listing.
80
+ # @param marketplace_ids [Array<String>] A comma-delimited list of Amazon marketplace identifiers for the request.
81
+ # @param included_data [Array<String>] A comma-delimited list of data sets to include in the response. Default:
82
+ # `issues`.
83
+ # @param mode [String] The mode of operation for the request.
84
+ # @param issue_locale [String] A locale for localization of issues. When not provided, the default language code
85
+ # of the first marketplace is used. Examples: `en_US`, `fr_CA`, `fr_FR`. Localized messages default to `en_US`
86
+ # when a localization is not available in the specified locale.
87
+ # @param body [Hash] The request body schema for the `patchListingsItem` operation.
88
+ # @param rate_limit [Float] Requests per second
89
+ # @return [Hash] The API response
90
+ def patch_listings_item(seller_id, sku, marketplace_ids, body, included_data: ["issues"], mode: nil,
91
+ issue_locale: nil, rate_limit: 5.0)
92
+ path = "/listings/2021-08-01/items/#{seller_id}/#{sku}"
93
+ params = {
94
+ "marketplaceIds" => marketplace_ids,
95
+ "includedData" => included_data,
96
+ "mode" => mode,
97
+ "issueLocale" => issue_locale,
98
+ }.compact
99
+
100
+ meter(rate_limit).patch(path, body:, params:)
101
+ end
102
+
103
+ # Creates or fully updates an existing listings item for a selling partner. **Note:** This operation has a
104
+ # throttling rate of one request per second when `mode` is `VALIDATION_PREVIEW`. **Note:** The parameters
105
+ # associated with this operation may contain special characters that must be encoded to successfully call the API.
106
+ # To avoid errors with SKUs when encoding URLs, refer to [URL
107
+ # Encoding](https://developer-docs.amazon.com/sp-api/docs/url-encoding).
108
+ #
109
+ # @note This operation can make a static sandbox call.
110
+ # @param seller_id [String] A selling partner identifier, such as a merchant account or vendor code.
111
+ # @param sku [String] A selling partner provided identifier for an Amazon listing.
112
+ # @param marketplace_ids [Array<String>] A comma-delimited list of Amazon marketplace identifiers for the request.
113
+ # @param included_data [Array<String>] A comma-delimited list of data sets to include in the response. Default:
114
+ # `issues`.
115
+ # @param mode [String] The mode of operation for the request.
116
+ # @param issue_locale [String] A locale for localization of issues. When not provided, the default language code
117
+ # of the first marketplace is used. Examples: `en_US`, `fr_CA`, `fr_FR`. Localized messages default to `en_US`
118
+ # when a localization is not available in the specified locale.
119
+ # @param body [Hash] The request body schema for the `putListingsItem` operation.
120
+ # @param rate_limit [Float] Requests per second
121
+ # @return [Hash] The API response
122
+ def put_listings_item(seller_id, sku, marketplace_ids, body, included_data: ["issues"], mode: nil,
123
+ issue_locale: nil, rate_limit: 5.0)
124
+ path = "/listings/2021-08-01/items/#{seller_id}/#{sku}"
125
+ params = {
126
+ "marketplaceIds" => marketplace_ids,
127
+ "includedData" => included_data,
128
+ "mode" => mode,
129
+ "issueLocale" => issue_locale,
130
+ }.compact
131
+
132
+ meter(rate_limit).put(path, body:, params:)
133
+ end
134
+
135
+ # Search for and return list of listings items and respective details for a selling partner.
136
+ #
137
+ # @note This operation can make a static sandbox call.
138
+ # @param seller_id [String] A selling partner identifier, such as a merchant account or vendor code.
139
+ # @param marketplace_ids [Array<String>] A comma-delimited list of Amazon marketplace identifiers for the request.
140
+ # @param identifiers [Array<String>] A comma-delimited list of product identifiers to search for listings items
141
+ # by. **Note**: 1. Required when `identifiersType` is provided.
142
+ # @param identifiers_type [String] Type of product identifiers to search for listings items by. **Note**: 1.
143
+ # Required when `identifiers` is provided.
144
+ # @param page_size [Integer] Number of results to be returned per page.
145
+ # @param page_token [String] A token to fetch a certain page when there are multiple pages worth of results.
146
+ # @param included_data [Array<String>] A comma-delimited list of data sets to include in the response. Default:
147
+ # summaries.
148
+ # @param issue_locale [String] A locale for localization of issues. When not provided, the default language code
149
+ # of the first marketplace is used. Examples: "en_US", "fr_CA", "fr_FR". Localized messages default to "en_US"
150
+ # when a localization is not available in the specified locale.
151
+ # @param rate_limit [Float] Requests per second
152
+ # @return [Hash] The API response
153
+ def search_listings_items(seller_id, marketplace_ids, identifiers: nil, identifiers_type: nil, page_size: 10,
154
+ page_token: nil, included_data: ["summaries"], issue_locale: nil, rate_limit: 5.0)
155
+ path = "/listings/2021-08-01/items/#{seller_id}"
156
+ params = {
157
+ "marketplaceIds" => marketplace_ids,
158
+ "identifiers" => identifiers,
159
+ "identifiersType" => identifiers_type,
160
+ "pageSize" => page_size,
161
+ "pageToken" => page_token,
162
+ "includedData" => included_data,
163
+ "issueLocale" => issue_locale,
164
+ }.compact
165
+
166
+ meter(rate_limit).get(path, params:)
167
+ end
168
+ end
169
+ end
170
+ end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "peddler/api"
4
+
5
+ module Peddler
6
+ class << self
7
+ def listings_restrictions_2021_08_01(...)
8
+ API::ListingsRestrictions20210801.new(...)
9
+ end
10
+ end
11
+
12
+ class API
13
+ # Selling Partner API for Listings Restrictions
14
+ #
15
+ # The Selling Partner API for Listings Restrictions provides programmatic access to restrictions on Amazon catalog
16
+ # listings. For more information, see the
17
+ # {https://developer-docs.amazon.com/sp-api/docs/listings-restrictions-api-v2021-08-01-use-case-guide Listings
18
+ # Restrictions API Use Case Guide}.
19
+ class ListingsRestrictions20210801 < API
20
+ # Returns listing restrictions for an item in the Amazon Catalog.
21
+ #
22
+ # @note This operation can make a static sandbox call.
23
+ # @param asin [String] The Amazon Standard Identification Number (ASIN) of the item.
24
+ # @param condition_type [String] The condition used to filter restrictions.
25
+ # @param seller_id [String] A selling partner identifier, such as a merchant account.
26
+ # @param marketplace_ids [Array<String>] A comma-delimited list of Amazon marketplace identifiers for the request.
27
+ # @param reason_locale [String] A locale for reason text localization. When not provided, the default language
28
+ # code of the first marketplace is used. Examples: "en_US", "fr_CA", "fr_FR". Localized messages default to
29
+ # "en_US" when a localization is not available in the specified locale.
30
+ # @param rate_limit [Float] Requests per second
31
+ # @return [Hash] The API response
32
+ def get_listings_restrictions(asin, seller_id, marketplace_ids, condition_type: nil, reason_locale: nil,
33
+ rate_limit: 5.0)
34
+ path = "/listings/2021-08-01/restrictions"
35
+ params = {
36
+ "asin" => asin,
37
+ "conditionType" => condition_type,
38
+ "sellerId" => seller_id,
39
+ "marketplaceIds" => marketplace_ids,
40
+ "reasonLocale" => reason_locale,
41
+ }.compact
42
+
43
+ meter(rate_limit).get(path, params:)
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,80 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "peddler/api"
4
+
5
+ module Peddler
6
+ class << self
7
+ def merchant_fulfillment_v0(...)
8
+ API::MerchantFulfillmentV0.new(...)
9
+ end
10
+ end
11
+
12
+ class API
13
+ # Selling Partner API for Merchant Fulfillment
14
+ #
15
+ # The Selling Partner API for Merchant Fulfillment helps you build applications that let sellers purchase shipping
16
+ # for non-Prime and Prime orders using Amazon’s Buy Shipping Services.
17
+ class MerchantFulfillmentV0 < API
18
+ # Returns a list of shipping service offers that satisfy the specified shipment request details.
19
+ #
20
+ # @note This operation can make a static sandbox call.
21
+ # @param body [Hash] Request schema for GetEligibleShipmentServices operation.
22
+ # @param rate_limit [Float] Requests per second
23
+ # @return [Hash] The API response
24
+ def get_eligible_shipment_services(body, rate_limit: 5.0)
25
+ path = "/mfn/v0/eligibleShippingServices"
26
+
27
+ meter(rate_limit).post(path, body:)
28
+ end
29
+
30
+ # Returns the shipment information for an existing shipment.
31
+ #
32
+ # @note This operation can make a static sandbox call.
33
+ # @param shipment_id [String] The Amazon-defined shipment identifier for the shipment.
34
+ # @param rate_limit [Float] Requests per second
35
+ # @return [Hash] The API response
36
+ def get_shipment(shipment_id, rate_limit: 1.0)
37
+ path = "/mfn/v0/shipments/#{shipment_id}"
38
+
39
+ meter(rate_limit).get(path)
40
+ end
41
+
42
+ # Cancel the shipment indicated by the specified shipment identifier.
43
+ #
44
+ # @note This operation can make a static sandbox call.
45
+ # @param shipment_id [String] The Amazon-defined shipment identifier for the shipment to cancel.
46
+ # @param rate_limit [Float] Requests per second
47
+ # @return [Hash] The API response
48
+ def cancel_shipment(shipment_id, rate_limit: 1.0)
49
+ path = "/mfn/v0/shipments/#{shipment_id}"
50
+
51
+ meter(rate_limit).delete(path)
52
+ end
53
+
54
+ # Create a shipment with the information provided.
55
+ #
56
+ # @note This operation can make a static sandbox call.
57
+ # @param body [Hash] Request schema for CreateShipment operation.
58
+ # @param rate_limit [Float] Requests per second
59
+ # @return [Hash] The API response
60
+ def create_shipment(body, rate_limit: 1.0)
61
+ path = "/mfn/v0/shipments"
62
+
63
+ meter(rate_limit).post(path, body:)
64
+ end
65
+
66
+ # Gets a list of additional seller inputs required for a ship method. This is generally used for international
67
+ # shipping.
68
+ #
69
+ # @note This operation can make a static sandbox call.
70
+ # @param body [Hash] Request schema for GetAdditionalSellerInputs operation.
71
+ # @param rate_limit [Float] Requests per second
72
+ # @return [Hash] The API response
73
+ def get_additional_seller_inputs(body, rate_limit: 1.0)
74
+ path = "/mfn/v0/additionalSellerInputs"
75
+
76
+ meter(rate_limit).post(path, body:)
77
+ end
78
+ end
79
+ end
80
+ end