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,103 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "peddler/api"
4
+
5
+ module Peddler
6
+ class << self
7
+ def catalog_items_v0(...)
8
+ API::CatalogItemsV0.new(...)
9
+ end
10
+ end
11
+
12
+ class API
13
+ # Selling Partner API for Catalog Items
14
+ #
15
+ # The Selling Partner API for Catalog Items helps you programmatically retrieve item details for items in the
16
+ # catalog.
17
+ class CatalogItemsV0 < API
18
+ # Effective September 30, 2022, the `listCatalogItems` operation will no longer be available in the Selling
19
+ # Partner API for Catalog Items v0. As an alternative, `searchCatalogItems` is available in the latest version of
20
+ # the {https://developer-docs.amazon.com/sp-api/docs/catalog-items-api-v2022-04-01-reference Selling Partner API
21
+ # for Catalog Items v2022-04-01}. Integrations that rely on the `listCatalogItems` operation should migrate to the
22
+ # `searchCatalogItems`operation to avoid service disruption. _Note:_ The
23
+ # [`listCatalogCategories`](#get-catalogv0categories) operation is not being deprecated and you can continue to
24
+ # make calls to it.
25
+ #
26
+ # @note This operation can make a static sandbox call.
27
+ # @param marketplace_id [String] A marketplace identifier. Specifies the marketplace for which items are returned.
28
+ # @param query [String] Keyword(s) to use to search for items in the catalog. Example: 'harry potter books'.
29
+ # @param query_context_id [String] An identifier for the context within which the given search will be performed.
30
+ # A marketplace might provide mechanisms for constraining a search to a subset of potential items. For example,
31
+ # the retail marketplace allows queries to be constrained to a specific category. The QueryContextId parameter
32
+ # specifies such a subset. If it is omitted, the search will be performed using the default context for the
33
+ # marketplace, which will typically contain the largest set of items.
34
+ # @param seller_sku [String] Used to identify an item in the given marketplace. SellerSKU is qualified by the
35
+ # seller's SellerId, which is included with every operation that you submit.
36
+ # @param upc [String] A 12-digit bar code used for retail packaging.
37
+ # @param ean [String] A European article number that uniquely identifies the catalog item, manufacturer, and its
38
+ # attributes.
39
+ # @param isbn [String] The unique commercial book identifier used to identify books internationally.
40
+ # @param jan [String] A Japanese article number that uniquely identifies the product, manufacturer, and its
41
+ # attributes.
42
+ # @param rate_limit [Float] Requests per second
43
+ # @return [Hash] The API response
44
+ def list_catalog_items(marketplace_id, query: nil, query_context_id: nil, seller_sku: nil, upc: nil, ean: nil,
45
+ isbn: nil, jan: nil, rate_limit: nil)
46
+ path = "/catalog/v0/items"
47
+ params = {
48
+ "MarketplaceId" => marketplace_id,
49
+ "Query" => query,
50
+ "QueryContextId" => query_context_id,
51
+ "SellerSKU" => seller_sku,
52
+ "UPC" => upc,
53
+ "EAN" => ean,
54
+ "ISBN" => isbn,
55
+ "JAN" => jan,
56
+ }.compact
57
+
58
+ get(path, params:)
59
+ end
60
+
61
+ # Effective September 30, 2022, the `getCatalogItem` operation will no longer be available in the Selling Partner
62
+ # API for Catalog Items v0. This operation is available in the latest version of the
63
+ # {https://developer-docs.amazon.com/sp-api/docs/catalog-items-api-v2022-04-01-reference Selling Partner API for
64
+ # Catalog Items v2022-04-01}. Integrations that rely on this operation should migrate to the latest version to
65
+ # avoid service disruption. _Note:_ The [`listCatalogCategories`](#get-catalogv0categories) operation is not being
66
+ # deprecated and you can continue to make calls to it.
67
+ #
68
+ # @note This operation can make a static sandbox call.
69
+ # @param marketplace_id [String] A marketplace identifier. Specifies the marketplace for the item.
70
+ # @param asin [String] The Amazon Standard Identification Number (ASIN) of the item.
71
+ # @param rate_limit [Float] Requests per second
72
+ # @return [Hash] The API response
73
+ def get_catalog_item(marketplace_id, asin, rate_limit: nil)
74
+ path = "/catalog/v0/items/#{asin}"
75
+ params = {
76
+ "MarketplaceId" => marketplace_id,
77
+ }.compact
78
+
79
+ get(path, params:)
80
+ end
81
+
82
+ # Returns the parent categories to which an item belongs, based on the specified ASIN or SellerSKU.
83
+ #
84
+ # @note This operation can make a static sandbox call.
85
+ # @param marketplace_id [String] A marketplace identifier. Specifies the marketplace for the item.
86
+ # @param asin [String] The Amazon Standard Identification Number (ASIN) of the item.
87
+ # @param seller_sku [String] Used to identify items in the given marketplace. SellerSKU is qualified by the
88
+ # seller's SellerId, which is included with every operation that you submit.
89
+ # @param rate_limit [Float] Requests per second
90
+ # @return [Hash] The API response
91
+ def list_catalog_categories(marketplace_id, asin: nil, seller_sku: nil, rate_limit: 1.0)
92
+ path = "/catalog/v0/categories"
93
+ params = {
94
+ "MarketplaceId" => marketplace_id,
95
+ "ASIN" => asin,
96
+ "SellerSKU" => seller_sku,
97
+ }.compact
98
+
99
+ meter(rate_limit).get(path, params:)
100
+ end
101
+ end
102
+ end
103
+ end
@@ -0,0 +1,108 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "peddler/api"
4
+
5
+ module Peddler
6
+ class << self
7
+ def data_kiosk_2023_11_15(...)
8
+ API::DataKiosk20231115.new(...)
9
+ end
10
+ end
11
+
12
+ class API
13
+ # Selling Partner API for Data Kiosk
14
+ #
15
+ # The Selling Partner API for Data Kiosk lets you submit GraphQL queries from a variety of schemas to help selling
16
+ # partners manage their businesses.
17
+ class DataKiosk20231115 < API
18
+ # Returns details for the Data Kiosk queries that match the specified filters. See the `createQuery` operation for
19
+ # details about query retention.
20
+ #
21
+ # @note This operation can make a static sandbox call.
22
+ # @param processing_statuses [Array<String>] A list of processing statuses used to filter queries.
23
+ # @param page_size [Integer] The maximum number of queries to return in a single call.
24
+ # @param created_since [String] The earliest query creation date and time for queries to include in the response,
25
+ # in ISO 8601 date time format. The default is 90 days ago.
26
+ # @param created_until [String] The latest query creation date and time for queries to include in the response, in
27
+ # ISO 8601 date time format. The default is the time of the `getQueries` request.
28
+ # @param pagination_token [String] A token to fetch a certain page of results when there are multiple pages of
29
+ # results available. The value of this token is fetched from the `pagination.nextToken` field returned in the
30
+ # `GetQueriesResponse` object. All other parameters must be provided with the same values that were provided
31
+ # with the request that generated this token, with the exception of `pageSize` which can be modified between
32
+ # calls to `getQueries`. In the absence of this token value, `getQueries` returns the first page of results.
33
+ # @param rate_limit [Float] Requests per second
34
+ # @return [Hash] The API response
35
+ def get_queries(processing_statuses: nil, page_size: 10, created_since: nil, created_until: nil,
36
+ pagination_token: nil, rate_limit: 0.0222)
37
+ path = "/dataKiosk/2023-11-15/queries"
38
+ params = {
39
+ "processingStatuses" => processing_statuses,
40
+ "pageSize" => page_size,
41
+ "createdSince" => created_since,
42
+ "createdUntil" => created_until,
43
+ "paginationToken" => pagination_token,
44
+ }.compact
45
+
46
+ meter(rate_limit).get(path, params:)
47
+ end
48
+
49
+ # Creates a Data Kiosk query request. **Note:** The retention of a query varies based on the fields requested.
50
+ # Each field within a schema is annotated with a `@resultRetention` directive that defines how long a query
51
+ # containing that field will be retained. When a query contains multiple fields with different retentions, the
52
+ # shortest (minimum) retention is applied. The retention of a query's resulting documents always matches the
53
+ # retention of the query.
54
+ #
55
+ # @note This operation can make a static sandbox call.
56
+ # @param body [Hash] The body of the request.
57
+ # @param rate_limit [Float] Requests per second
58
+ # @return [Hash] The API response
59
+ def create_query(body, rate_limit: 0.0167)
60
+ path = "/dataKiosk/2023-11-15/queries"
61
+
62
+ meter(rate_limit).post(path, body:)
63
+ end
64
+
65
+ # Cancels the query specified by the `queryId` parameter. Only queries with a non-terminal `processingStatus`
66
+ # (`IN_QUEUE`, `IN_PROGRESS`) can be cancelled. Cancelling a query that already has a `processingStatus` of
67
+ # `CANCELLED` will no-op. Cancelled queries are returned in subsequent calls to the `getQuery` and `getQueries`
68
+ # operations.
69
+ #
70
+ # @note This operation can make a static sandbox call.
71
+ # @param query_id [String] The identifier for the query. This identifier is unique only in combination with a
72
+ # selling partner account ID.
73
+ # @param rate_limit [Float] Requests per second
74
+ # @return [Hash] The API response
75
+ def cancel_query(query_id, rate_limit: 0.0222)
76
+ path = "/dataKiosk/2023-11-15/queries/#{query_id}"
77
+
78
+ meter(rate_limit).delete(path)
79
+ end
80
+
81
+ # Returns query details for the query specified by the `queryId` parameter. See the `createQuery` operation for
82
+ # details about query retention.
83
+ #
84
+ # @note This operation can make a static sandbox call.
85
+ # @param query_id [String] The query identifier.
86
+ # @param rate_limit [Float] Requests per second
87
+ # @return [Hash] The API response
88
+ def get_query(query_id, rate_limit: 2.0)
89
+ path = "/dataKiosk/2023-11-15/queries/#{query_id}"
90
+
91
+ meter(rate_limit).get(path)
92
+ end
93
+
94
+ # Returns the information required for retrieving a Data Kiosk document's contents. See the `createQuery`
95
+ # operation for details about document retention.
96
+ #
97
+ # @note This operation can make a static sandbox call.
98
+ # @param document_id [String] The identifier for the Data Kiosk document.
99
+ # @param rate_limit [Float] Requests per second
100
+ # @return [Hash] The API response
101
+ def get_document(document_id, rate_limit: 0.0167)
102
+ path = "/dataKiosk/2023-11-15/documents/#{document_id}"
103
+
104
+ meter(rate_limit).get(path)
105
+ end
106
+ end
107
+ end
108
+ end
@@ -0,0 +1,127 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "peddler/api"
4
+
5
+ module Peddler
6
+ class << self
7
+ def easy_ship_2022_03_23(...)
8
+ API::EasyShip20220323.new(...)
9
+ end
10
+ end
11
+
12
+ class API
13
+ # Selling Partner API for Easy Ship
14
+ #
15
+ # The Selling Partner API for Easy Ship helps you build applications that help sellers manage and ship Amazon Easy
16
+ # Ship orders. Your Easy Ship applications can: * Get available time slots for packages to be scheduled for
17
+ # delivery. * Schedule, reschedule, and cancel Easy Ship orders. * Print labels, invoices, and warranties. See the
18
+ # {https://developer-docs.amazon.com/sp-api/docs/easyship-api-v2022-03-23-use-case-guide#marketplace-support-table
19
+ # Marketplace Support Table} for the differences in Easy Ship operations by marketplace.
20
+ class EasyShip20220323 < API
21
+ # Returns time slots available for Easy Ship orders to be scheduled based on the package weight and dimensions
22
+ # that the seller specifies. This operation is available for scheduled and unscheduled orders based on marketplace
23
+ # support. See **Get Time Slots** in the
24
+ # {https://developer-docs.amazon.com/sp-api/docs/easyship-api-v2022-03-23-use-case-guide#marketplace-support-table
25
+ # Marketplace Support Table}. This operation can return time slots that have either pickup or drop-off handover
26
+ # methods - see **Supported Handover Methods** in the
27
+ # {https://developer-docs.amazon.com/sp-api/docs/easyship-api-v2022-03-23-use-case-guide#marketplace-support-table
28
+ # Marketplace Support Table}.
29
+ #
30
+ # @note This operation can make a static sandbox call.
31
+ # @param list_handover_slots_request [Hash] The request schema for the `listHandoverSlots` operation.
32
+ # @param rate_limit [Float] Requests per second
33
+ # @return [Hash] The API response
34
+ def list_handover_slots(list_handover_slots_request: nil, rate_limit: 1.0)
35
+ path = "/easyShip/2022-03-23/timeSlot"
36
+ body = list_handover_slots_request
37
+
38
+ meter(rate_limit).post(path, body:)
39
+ end
40
+
41
+ # Returns information about a package, including dimensions, weight, time slot information for handover, invoice
42
+ # and item information, and status.
43
+ #
44
+ # @note This operation can make a static sandbox call.
45
+ # @param amazon_order_id [String] An Amazon-defined order identifier. Identifies the order that the seller wants
46
+ # to deliver using Amazon Easy Ship.
47
+ # @param marketplace_id [String] An identifier for the marketplace in which the seller is selling.
48
+ # @param rate_limit [Float] Requests per second
49
+ # @return [Hash] The API response
50
+ def get_scheduled_package(amazon_order_id, marketplace_id, rate_limit: 1.0)
51
+ path = "/easyShip/2022-03-23/package"
52
+ params = {
53
+ "amazonOrderId" => amazon_order_id,
54
+ "marketplaceId" => marketplace_id,
55
+ }.compact
56
+
57
+ meter(rate_limit).get(path, params:)
58
+ end
59
+
60
+ # Schedules an Easy Ship order and returns the scheduled package information. This operation does the following: *
61
+ # Specifies the time slot and handover method for the order to be scheduled for delivery. * Updates the Easy Ship
62
+ # order status. * Generates a shipping label and an invoice. Calling `createScheduledPackage` also generates a
63
+ # warranty document if you specify a `SerialNumber` value. To get these documents, see
64
+ # {https://developer-docs.amazon.com/sp-api/docs/easyship-api-v2022-03-23-use-case-guide How to get invoice,
65
+ # shipping label, and warranty documents}. * Shows the status of Easy Ship orders when you call the `getOrders`
66
+ # operation of the Selling Partner API for Orders and examine the `EasyShipShipmentStatus` property in the
67
+ # response body. See the **Shipping Label**, **Invoice**, and **Warranty** columns in the
68
+ # {https://developer-docs.amazon.com/sp-api/docs/easyship-api-v2022-03-23-use-case-guide#marketplace-support-table
69
+ # Marketplace Support Table} to see which documents are supported in each marketplace.
70
+ #
71
+ # @note This operation can make a static sandbox call.
72
+ # @param create_scheduled_package_request [Hash] The request schema for the `createScheduledPackage` operation.
73
+ # @param rate_limit [Float] Requests per second
74
+ # @return [Hash] The API response
75
+ def create_scheduled_package(create_scheduled_package_request, rate_limit: 1.0)
76
+ path = "/easyShip/2022-03-23/package"
77
+ body = create_scheduled_package_request
78
+
79
+ meter(rate_limit).post(path, body:)
80
+ end
81
+
82
+ # Updates the time slot for handing over the package indicated by the specified `scheduledPackageId`. You can get
83
+ # the new `slotId` value for the time slot by calling the `listHandoverSlots` operation before making another
84
+ # `patch` call. See the **Update Package** column in the
85
+ # {https://developer-docs.amazon.com/sp-api/docs/easyship-api-v2022-03-23-use-case-guide#marketplace-support-table
86
+ # Marketplace Support Table} to see which marketplaces this operation is supported in.
87
+ #
88
+ # @note This operation can make a static sandbox call.
89
+ # @param update_scheduled_packages_request [Hash] The request schema for the `updateScheduledPackages` operation.
90
+ # @param rate_limit [Float] Requests per second
91
+ # @return [Hash] The API response
92
+ def update_scheduled_packages(update_scheduled_packages_request: nil, rate_limit: 1.0)
93
+ path = "/easyShip/2022-03-23/package"
94
+ body = update_scheduled_packages_request
95
+
96
+ meter(rate_limit).patch(path, body:)
97
+ end
98
+
99
+ # This operation automatically schedules a time slot for all the `amazonOrderId`s given as input, generating the
100
+ # associated shipping labels, along with other compliance documents according to the marketplace (refer to the
101
+ # {https://developer-docs.amazon.com/sp-api/docs/easyship-api-v2022-03-23-use-case-guide#marketplace-support-table
102
+ # marketplace document support table}). Developers calling this operation may optionally assign a `packageDetails`
103
+ # object, allowing them to input a preferred time slot for each order in ther request. In this case, Amazon will
104
+ # try to schedule the respective packages using their optional settings. On the other hand, *i.e.*, if the time
105
+ # slot is not provided, Amazon will then pick the earliest time slot possible. Regarding the shipping label's file
106
+ # format, external developers are able to choose between PDF or ZPL, and Amazon will create the label accordingly.
107
+ # This operation returns an array composed of the scheduled packages, and a short-lived URL pointing to a zip file
108
+ # containing the generated shipping labels and the other documents enabled for your marketplace. If at least an
109
+ # order couldn't be scheduled, then Amazon adds the `rejectedOrders` list into the response, which contains an
110
+ # entry for each order we couldn't process. Each entry is composed of an error message describing the reason of
111
+ # the failure, so that sellers can take action. The table below displays the supported request and burst maximum
112
+ # rates:
113
+ #
114
+ # @note This operation can make a static sandbox call.
115
+ # @param create_scheduled_packages_request [Hash] The request schema for the `createScheduledPackageBulk`
116
+ # operation.
117
+ # @param rate_limit [Float] Requests per second
118
+ # @return [Hash] The API response
119
+ def create_scheduled_package_bulk(create_scheduled_packages_request, rate_limit: 1.0)
120
+ path = "/easyShip/2022-03-23/packages/bulk"
121
+ body = create_scheduled_packages_request
122
+
123
+ meter(rate_limit).post(path, body:)
124
+ end
125
+ end
126
+ end
127
+ end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "peddler/api"
4
+
5
+ module Peddler
6
+ class << self
7
+ def fba_inbound_eligibility_v1(...)
8
+ API::FBAInboundEligibilityV1.new(...)
9
+ end
10
+ end
11
+
12
+ class API
13
+ # Selling Partner API for FBA Inbound Eligibilty
14
+ #
15
+ # With the FBA Inbound Eligibility API, you can build applications that let sellers get eligibility previews for
16
+ # items before shipping them to Amazon's fulfillment centers. With this API you can find out if an item is eligible
17
+ # for inbound shipment to Amazon's fulfillment centers in a specific marketplace. You can also find out if an item
18
+ # is eligible for using the manufacturer barcode for FBA inventory tracking. Sellers can use this information to
19
+ # inform their decisions about which items to ship Amazon's fulfillment centers.
20
+ class FBAInboundEligibilityV1 < API
21
+ # This operation gets an eligibility preview for an item that you specify. You can specify the type of eligibility
22
+ # preview that you want (INBOUND or COMMINGLING). For INBOUND previews, you can specify the marketplace in which
23
+ # you want to determine the item's eligibility.
24
+ #
25
+ # @note This operation can make a static sandbox call.
26
+ # @param marketplace_ids [Array<String>] The identifier for the marketplace in which you want to determine
27
+ # eligibility. Required only when program=INBOUND.
28
+ # @param asin [String] The ASIN of the item for which you want an eligibility preview.
29
+ # @param program [String] The program that you want to check eligibility against.
30
+ # @param rate_limit [Float] Requests per second
31
+ # @return [Hash] The API response
32
+ def get_item_eligibility_preview(asin, program, marketplace_ids: nil, rate_limit: 1.0)
33
+ path = "/fba/inbound/v1/eligibility/itemPreview"
34
+ params = {
35
+ "marketplaceIds" => marketplace_ids,
36
+ "asin" => asin,
37
+ "program" => program,
38
+ }.compact
39
+
40
+ meter(rate_limit).get(path, params:)
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,122 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "peddler/api"
4
+
5
+ module Peddler
6
+ class << self
7
+ def fba_inventory_v1(...)
8
+ API::FBAInventoryV1.new(...)
9
+ end
10
+ end
11
+
12
+ class API
13
+ # Selling Partner API for FBA Inventory
14
+ #
15
+ # The Selling Partner API for FBA Inventory lets you programmatically retrieve information about inventory in
16
+ # Amazon's fulfillment network.
17
+ class FBAInventoryV1 < API
18
+ # Returns a list of inventory summaries. The summaries returned depend on the presence or absence of the
19
+ # startDateTime, sellerSkus and sellerSku parameters: - All inventory summaries with available details are
20
+ # returned when the startDateTime, sellerSkus and sellerSku parameters are omitted. - When startDateTime is
21
+ # provided, the operation returns inventory summaries that have had changes after the date and time specified. The
22
+ # sellerSkus and sellerSku parameters are ignored. Important: To avoid errors, use both startDateTime and
23
+ # nextToken to get the next page of inventory summaries that have changed after the date and time specified. -
24
+ # When the sellerSkus parameter is provided, the operation returns inventory summaries for only the specified
25
+ # sellerSkus. The sellerSku parameter is ignored. - When the sellerSku parameter is provided, the operation
26
+ # returns inventory summaries for only the specified sellerSku. Note: The parameters associated with this
27
+ # operation may contain special characters that must be encoded to successfully call the API. To avoid errors with
28
+ # SKUs when encoding URLs, refer to [URL Encoding](https://developer-docs.amazon.com/sp-api/docs/url-encoding).
29
+ #
30
+ # @note This operation can make a dynamic sandbox call.
31
+ # @param details [Boolean] true to return inventory summaries with additional summarized inventory details and
32
+ # quantities. Otherwise, returns inventory summaries only (default value).
33
+ # @param granularity_type [String] The granularity type for the inventory aggregation level.
34
+ # @param granularity_id [String] The granularity ID for the inventory aggregation level.
35
+ # @param start_date_time [String] A start date and time in ISO8601 format. If specified, all inventory summaries
36
+ # that have changed since then are returned. You must specify a date and time that is no earlier than 18 months
37
+ # prior to the date and time when you call the API. Note: Changes in inboundWorkingQuantity,
38
+ # inboundShippedQuantity and inboundReceivingQuantity are not detected.
39
+ # @param seller_skus [Array<String>] A list of seller SKUs for which to return inventory summaries. You may
40
+ # specify up to 50 SKUs.
41
+ # @param seller_sku [String] A single seller SKU used for querying the specified seller SKU inventory summaries.
42
+ # @param next_token [String] String token returned in the response of your previous request. The string token will
43
+ # expire 30 seconds after being created.
44
+ # @param marketplace_ids [Array<String>] The marketplace ID for the marketplace for which to return inventory
45
+ # summaries.
46
+ # @param rate_limit [Float] Requests per second
47
+ # @return [Hash] The API response
48
+ def get_inventory_summaries(granularity_type, granularity_id, marketplace_ids, details: nil, start_date_time: nil,
49
+ seller_skus: nil, seller_sku: nil, next_token: nil, rate_limit: 2.0)
50
+ path = "/fba/inventory/v1/summaries"
51
+ params = {
52
+ "details" => details,
53
+ "granularityType" => granularity_type,
54
+ "granularityId" => granularity_id,
55
+ "startDateTime" => start_date_time,
56
+ "sellerSkus" => seller_skus,
57
+ "sellerSku" => seller_sku,
58
+ "nextToken" => next_token,
59
+ "marketplaceIds" => marketplace_ids,
60
+ }.compact
61
+
62
+ meter(rate_limit).get(path, params:)
63
+ end
64
+
65
+ # Requests that Amazon create product-details in the Sandbox Inventory in the sandbox environment. This is a
66
+ # sandbox-only operation and must be directed to a sandbox endpoint. Refer to [Selling Partner API
67
+ # sandbox](https://developer-docs.amazon.com/sp-api/docs/the-selling-partner-api-sandbox) for more information.
68
+ #
69
+ # @note This operation can make a dynamic sandbox call.
70
+ # @param create_inventory_item_request_body [Hash] CreateInventoryItem Request Body Parameter.
71
+ # @param rate_limit [Float] Requests per second
72
+ # @return [Hash] The API response
73
+ def create_inventory_item(create_inventory_item_request_body, rate_limit: nil)
74
+ must_sandbox!
75
+
76
+ path = "/fba/inventory/v1/items"
77
+ body = create_inventory_item_request_body
78
+
79
+ post(path, body:)
80
+ end
81
+
82
+ # Requests that Amazon Deletes an item from the Sandbox Inventory in the sandbox environment. This is a
83
+ # sandbox-only operation and must be directed to a sandbox endpoint. Refer to [Selling Partner API
84
+ # sandbox](https://developer-docs.amazon.com/sp-api/docs/the-selling-partner-api-sandbox) for more information.
85
+ #
86
+ # @note This operation can make a dynamic sandbox call.
87
+ # @param seller_sku [String] A single seller SKU used for querying the specified seller SKU inventory summaries.
88
+ # @param marketplace_id [String] The marketplace ID for the marketplace for which the sellerSku is to be deleted.
89
+ # @param rate_limit [Float] Requests per second
90
+ # @return [Hash] The API response
91
+ def delete_inventory_item(seller_sku, marketplace_id, rate_limit: nil)
92
+ must_sandbox!
93
+
94
+ path = "/fba/inventory/v1/items/#{seller_sku}"
95
+ params = {
96
+ "marketplaceId" => marketplace_id,
97
+ }.compact
98
+
99
+ delete(path, params:)
100
+ end
101
+
102
+ # Requests that Amazon add items to the Sandbox Inventory with desired amount of quantity in the sandbox
103
+ # environment. This is a sandbox-only operation and must be directed to a sandbox endpoint. Refer to [Selling
104
+ # Partner API sandbox](https://developer-docs.amazon.com/sp-api/docs/the-selling-partner-api-sandbox) for more
105
+ # information.
106
+ #
107
+ # @note This operation can make a dynamic sandbox call.
108
+ # @param x_amzn_idempotency_token [String] A unique token/requestId provided with each call to ensure idempotency.
109
+ # @param add_inventory_request_body [Hash] List of items to add to Sandbox inventory.
110
+ # @param rate_limit [Float] Requests per second
111
+ # @return [Hash] The API response
112
+ def add_inventory(x_amzn_idempotency_token, add_inventory_request_body, rate_limit: nil)
113
+ must_sandbox!
114
+
115
+ path = "/fba/inventory/v1/items/inventory"
116
+ body = add_inventory_request_body
117
+
118
+ post(path, body:)
119
+ end
120
+ end
121
+ end
122
+ end
@@ -0,0 +1,122 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "peddler/api"
4
+
5
+ module Peddler
6
+ class << self
7
+ def feeds_2021_06_30(...)
8
+ API::Feeds20210630.new(...)
9
+ end
10
+ end
11
+
12
+ class API
13
+ # Selling Partner API for Feeds
14
+ #
15
+ # The Selling Partner API for Feeds lets you upload data to Amazon on behalf of a selling partner.
16
+ class Feeds20210630 < API
17
+ # Returns feed details for the feeds that match the filters that you specify.
18
+ #
19
+ # @note This operation can make a static sandbox call.
20
+ # @param feed_types [Array<String>] A list of feed types used to filter feeds. When feedTypes is provided, the
21
+ # other filter parameters (processingStatuses, marketplaceIds, createdSince, createdUntil) and pageSize may also
22
+ # be provided. Either feedTypes or nextToken is required.
23
+ # @param marketplace_ids [Array<String>] A list of marketplace identifiers used to filter feeds. The feeds
24
+ # returned will match at least one of the marketplaces that you specify.
25
+ # @param page_size [Integer] The maximum number of feeds to return in a single call.
26
+ # @param processing_statuses [Array<String>] A list of processing statuses used to filter feeds.
27
+ # @param created_since [String] The earliest feed creation date and time for feeds included in the response, in
28
+ # ISO 8601 format. The default is 90 days ago. Feeds are retained for a maximum of 90 days.
29
+ # @param created_until [String] The latest feed creation date and time for feeds included in the response, in ISO
30
+ # 8601 format. The default is now.
31
+ # @param next_token [String] A string token returned in the response to your previous request. nextToken is
32
+ # returned when the number of results exceeds the specified pageSize value. To get the next page of results,
33
+ # call the getFeeds operation and include this token as the only parameter. Specifying nextToken with any other
34
+ # parameters will cause the request to fail.
35
+ # @param rate_limit [Float] Requests per second
36
+ # @return [Hash] The API response
37
+ def get_feeds(feed_types: nil, marketplace_ids: nil, page_size: 10, processing_statuses: nil, created_since: nil,
38
+ created_until: nil, next_token: nil, rate_limit: 0.0222)
39
+ path = "/feeds/2021-06-30/feeds"
40
+ params = {
41
+ "feedTypes" => feed_types,
42
+ "marketplaceIds" => marketplace_ids,
43
+ "pageSize" => page_size,
44
+ "processingStatuses" => processing_statuses,
45
+ "createdSince" => created_since,
46
+ "createdUntil" => created_until,
47
+ "nextToken" => next_token,
48
+ }.compact
49
+
50
+ meter(rate_limit).get(path, params:)
51
+ end
52
+
53
+ # Creates a feed. Upload the contents of the feed document before calling this operation.
54
+ #
55
+ # @note This operation can make a static sandbox call.
56
+ # @param body [Hash] Information required to create the feed.
57
+ # @param rate_limit [Float] Requests per second
58
+ # @return [Hash] The API response
59
+ def create_feed(body, rate_limit: 0.0083)
60
+ path = "/feeds/2021-06-30/feeds"
61
+
62
+ meter(rate_limit).post(path, body:)
63
+ end
64
+
65
+ # Cancels the feed that you specify. Only feeds with `processingStatus=IN_QUEUE` can be cancelled. Cancelled feeds
66
+ # are returned in subsequent calls to the
67
+ # [`getFeed`](https://developer-docs.amazon.com/sp-api/docs/feeds-api-v2021-06-30-reference#getfeed) and
68
+ # [`getFeeds`](https://developer-docs.amazon.com/sp-api/docs/feeds-api-v2021-06-30-reference#getfeeds) operations.
69
+ #
70
+ # @note This operation can make a static sandbox call.
71
+ # @param feed_id [String] The identifier for the feed. This identifier is unique only in combination with a seller
72
+ # ID.
73
+ # @param rate_limit [Float] Requests per second
74
+ # @return [Hash] The API response
75
+ def cancel_feed(feed_id, rate_limit: 2.0)
76
+ path = "/feeds/2021-06-30/feeds/#{feed_id}"
77
+
78
+ meter(rate_limit).delete(path)
79
+ end
80
+
81
+ # Returns feed details (including the `resultDocumentId`, if available) for the feed that you specify.
82
+ #
83
+ # @note This operation can make a static sandbox call.
84
+ # @param feed_id [String] The identifier for the feed. This identifier is unique only in combination with a seller
85
+ # ID.
86
+ # @param rate_limit [Float] Requests per second
87
+ # @return [Hash] The API response
88
+ def get_feed(feed_id, rate_limit: 2.0)
89
+ path = "/feeds/2021-06-30/feeds/#{feed_id}"
90
+
91
+ meter(rate_limit).get(path)
92
+ end
93
+
94
+ # Creates a feed document for the feed type that you specify. This operation returns a presigned URL for uploading
95
+ # the feed document contents. It also returns a `feedDocumentId` value that you can pass in with a subsequent call
96
+ # to the [`createFeed`](https://developer-docs.amazon.com/sp-api/docs/feeds-api-v2021-06-30-reference#createfeed)
97
+ # operation.
98
+ #
99
+ # @note This operation can make a static sandbox call.
100
+ # @param body [Hash] Specifies the content type for the createFeedDocument operation.
101
+ # @param rate_limit [Float] Requests per second
102
+ # @return [Hash] The API response
103
+ def create_feed_document(body, rate_limit: 0.5)
104
+ path = "/feeds/2021-06-30/documents"
105
+
106
+ meter(rate_limit).post(path, body:)
107
+ end
108
+
109
+ # Returns the information required for retrieving a feed document's contents.
110
+ #
111
+ # @note This operation can make a static sandbox call.
112
+ # @param feed_document_id [String] The identifier of the feed document.
113
+ # @param rate_limit [Float] Requests per second
114
+ # @return [Hash] The API response
115
+ def get_feed_document(feed_document_id, rate_limit: 0.0222)
116
+ path = "/feeds/2021-06-30/documents/#{feed_document_id}"
117
+
118
+ meter(rate_limit).get(path)
119
+ end
120
+ end
121
+ end
122
+ end