peddler 2.4.5 → 3.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +406 -134
  3. data/lib/peddler/access_token.rb +76 -0
  4. data/lib/peddler/api/amazon_warehousing_and_distribution_2024_05_09.rb +80 -0
  5. data/lib/peddler/api/aplus_content_2020_11_01.rb +208 -0
  6. data/lib/peddler/api/application_management_2023_11_30.rb +25 -0
  7. data/lib/peddler/api/catalog_items_2020_12_01.rb +70 -0
  8. data/lib/peddler/api/catalog_items_2022_04_01.rb +83 -0
  9. data/lib/peddler/api/catalog_items_v0.rb +90 -0
  10. data/lib/peddler/api/data_kiosk_2023_11_15.rb +92 -0
  11. data/lib/peddler/api/easy_ship_2022_03_23.rb +108 -0
  12. data/lib/peddler/api/fba_inbound_eligibility_v1.rb +36 -0
  13. data/lib/peddler/api/fba_inventory_v1.rb +106 -0
  14. data/lib/peddler/api/feeds_2021_06_30.rb +104 -0
  15. data/lib/peddler/api/finances_v0.rb +121 -0
  16. data/lib/peddler/api/fulfillment_inbound_2024_03_20.rb +660 -0
  17. data/lib/peddler/api/fulfillment_inbound_v0.rb +314 -0
  18. data/lib/peddler/api/fulfillment_outbound_2020_07_01.rb +222 -0
  19. data/lib/peddler/api/listings_items_2020_09_01.rb +84 -0
  20. data/lib/peddler/api/listings_items_2021_08_01.rb +154 -0
  21. data/lib/peddler/api/listings_restrictions_2021_08_01.rb +37 -0
  22. data/lib/peddler/api/merchant_fulfillment_v0.rb +64 -0
  23. data/lib/peddler/api/messaging_v1.rb +241 -0
  24. data/lib/peddler/api/notifications_v1.rb +114 -0
  25. data/lib/peddler/api/orders_v0.rb +264 -0
  26. data/lib/peddler/api/product_fees_v0.rb +69 -0
  27. data/lib/peddler/api/product_pricing_2022_05_01.rb +43 -0
  28. data/lib/peddler/api/product_pricing_v0.rb +144 -0
  29. data/lib/peddler/api/product_type_definitions_2020_09_01.rb +75 -0
  30. data/lib/peddler/api/replenishment_2022_11_07.rb +45 -0
  31. data/lib/peddler/api/reports_2021_06_30.rb +139 -0
  32. data/lib/peddler/api/sales_v1.rb +69 -0
  33. data/lib/peddler/api/sellers_v1.rb +33 -0
  34. data/lib/peddler/api/services_v1.rb +308 -0
  35. data/lib/peddler/api/shipment_invoicing_v0.rb +46 -0
  36. data/lib/peddler/api/shipping_v1.rb +107 -0
  37. data/lib/peddler/api/shipping_v2.rb +267 -0
  38. data/lib/peddler/api/solicitations_v1.rb +53 -0
  39. data/lib/peddler/api/supply_sources_2020_07_01.rb +82 -0
  40. data/lib/peddler/api/tokens_2021_03_01.rb +30 -0
  41. data/lib/peddler/api/uploads_2020_11_01.rb +40 -0
  42. data/lib/peddler/api/vendor_direct_fulfillment_inventory_v1.rb +24 -0
  43. data/lib/peddler/api/vendor_direct_fulfillment_orders_2021_12_28.rb +72 -0
  44. data/lib/peddler/api/vendor_direct_fulfillment_orders_v1.rb +72 -0
  45. data/lib/peddler/api/vendor_direct_fulfillment_payments_v1.rb +23 -0
  46. data/lib/peddler/api/vendor_direct_fulfillment_sandbox_test_data_2021_10_28.rb +35 -0
  47. data/lib/peddler/api/vendor_direct_fulfillment_shipping_2021_12_28.rb +177 -0
  48. data/lib/peddler/api/vendor_direct_fulfillment_shipping_v1.rb +165 -0
  49. data/lib/peddler/api/vendor_direct_fulfillment_transactions_2021_12_28.rb +24 -0
  50. data/lib/peddler/api/vendor_direct_fulfillment_transactions_v1.rb +24 -0
  51. data/lib/peddler/api/vendor_invoices_v1.rb +22 -0
  52. data/lib/peddler/api/vendor_orders_v1.rb +148 -0
  53. data/lib/peddler/api/vendor_shipments_v1.rb +120 -0
  54. data/lib/peddler/api/vendor_transaction_status_v1.rb +24 -0
  55. data/lib/peddler/api.rb +115 -0
  56. data/lib/peddler/error.rb +30 -0
  57. data/lib/peddler/region.rb +30 -0
  58. data/lib/peddler/version.rb +1 -1
  59. data/lib/peddler.rb +52 -1
  60. metadata +70 -80
  61. data/lib/mws/easy_ship/client.rb +0 -93
  62. data/lib/mws/easy_ship.rb +0 -3
  63. data/lib/mws/feeds/client.rb +0 -122
  64. data/lib/mws/feeds.rb +0 -3
  65. data/lib/mws/finances/client.rb +0 -82
  66. data/lib/mws/finances.rb +0 -3
  67. data/lib/mws/fulfillment_inbound_shipment/client.rb +0 -388
  68. data/lib/mws/fulfillment_inbound_shipment.rb +0 -3
  69. data/lib/mws/fulfillment_inventory/client.rb +0 -57
  70. data/lib/mws/fulfillment_inventory.rb +0 -3
  71. data/lib/mws/fulfillment_outbound_shipment/client.rb +0 -211
  72. data/lib/mws/fulfillment_outbound_shipment.rb +0 -3
  73. data/lib/mws/merchant_fulfillment/client.rb +0 -87
  74. data/lib/mws/merchant_fulfillment.rb +0 -3
  75. data/lib/mws/off_amazon_payments.rb +0 -3
  76. data/lib/mws/orders/client.rb +0 -120
  77. data/lib/mws/orders.rb +0 -3
  78. data/lib/mws/products/client.rb +0 -268
  79. data/lib/mws/products.rb +0 -3
  80. data/lib/mws/recommendations/client.rb +0 -72
  81. data/lib/mws/recommendations.rb +0 -3
  82. data/lib/mws/reports/client.rb +0 -236
  83. data/lib/mws/reports.rb +0 -3
  84. data/lib/mws/sellers/client.rb +0 -44
  85. data/lib/mws/sellers.rb +0 -3
  86. data/lib/mws/shipment_invoicing/client.rb +0 -74
  87. data/lib/mws/shipment_invoicing.rb +0 -3
  88. data/lib/mws/subscriptions/client.rb +0 -179
  89. data/lib/mws/subscriptions.rb +0 -3
  90. data/lib/mws.rb +0 -29
  91. data/lib/peddler/client.rb +0 -159
  92. data/lib/peddler/errors/builder.rb +0 -64
  93. data/lib/peddler/errors/class_generator.rb +0 -40
  94. data/lib/peddler/errors/error.rb +0 -45
  95. data/lib/peddler/errors/parser.rb +0 -28
  96. data/lib/peddler/flat_file_parser.rb +0 -56
  97. data/lib/peddler/headers.rb +0 -102
  98. data/lib/peddler/marketplace.rb +0 -79
  99. data/lib/peddler/operation.rb +0 -78
  100. data/lib/peddler/parser.rb +0 -33
  101. data/lib/peddler/structured_list.rb +0 -23
  102. data/lib/peddler/vcr_matcher.rb +0 -97
  103. data/lib/peddler/xml_parser.rb +0 -38
  104. data/lib/peddler/xml_response_parser.rb +0 -25
@@ -0,0 +1,92 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "peddler/api"
4
+
5
+ module Peddler
6
+ class API
7
+ # Selling Partner API for Data Kiosk
8
+ #
9
+ # The Selling Partner API for Data Kiosk lets you submit GraphQL queries from a variety of schemas to help selling
10
+ # partners manage their businesses.
11
+ class DataKiosk20231115 < API
12
+ # Returns details for the Data Kiosk queries that match the specified filters. See the `createQuery` operation for
13
+ # details about query retention.
14
+ #
15
+ # @param [Array<String>] processing_statuses A list of processing statuses used to filter queries.
16
+ # @param [Integer] page_size The maximum number of queries to return in a single call.
17
+ # @param [String] created_since The earliest query creation date and time for queries to include in the response,
18
+ # in ISO 8601 date time format. The default is 90 days ago.
19
+ # @param [String] created_until The latest query creation date and time for queries to include in the response, in
20
+ # ISO 8601 date time format. The default is the time of the `getQueries` request.
21
+ # @param [String] pagination_token A token to fetch a certain page of results when there are multiple pages of
22
+ # results available. The value of this token is fetched from the `pagination.nextToken` field returned in the
23
+ # `GetQueriesResponse` object. All other parameters must be provided with the same values that were provided
24
+ # with the request that generated this token, with the exception of `pageSize` which can be modified between
25
+ # calls to `getQueries`. In the absence of this token value, `getQueries` returns the first page of results.
26
+ # @return [Hash] The API response
27
+ def get_queries(processing_statuses: nil, page_size: nil, created_since: nil, created_until: nil,
28
+ pagination_token: nil)
29
+ path = "/dataKiosk/2023-11-15/queries"
30
+ params = {
31
+ "processingStatuses" => processing_statuses,
32
+ "pageSize" => page_size,
33
+ "createdSince" => created_since,
34
+ "createdUntil" => created_until,
35
+ "paginationToken" => pagination_token,
36
+ }.compact
37
+
38
+ rate_limit(0.0222).get(path, params:)
39
+ end
40
+
41
+ # Creates a Data Kiosk query request.
42
+ # @note The retention of a query varies based on the fields requested. Each field within a schema is annotated
43
+ # with a `@resultRetention` directive that defines how long a query containing that field will be retained. When
44
+ # a query contains multiple fields with different retentions, the shortest (minimum) retention is applied. The
45
+ # retention of a query's resulting documents always matches the retention of the query.
46
+ #
47
+ # @param [Hash] body The body of the request.
48
+ # @return [Hash] The API response
49
+ def create_query(body)
50
+ path = "/dataKiosk/2023-11-15/queries"
51
+
52
+ rate_limit(0.0167).post(path, body:)
53
+ end
54
+
55
+ # Cancels the query specified by the `queryId` parameter. Only queries with a non-terminal `processingStatus`
56
+ # (`IN_QUEUE`, `IN_PROGRESS`) can be cancelled. Cancelling a query that already has a `processingStatus` of
57
+ # `CANCELLED` will no-op. Cancelled queries are returned in subsequent calls to the `getQuery` and `getQueries`
58
+ # operations.
59
+ #
60
+ # @param [String] query_id The identifier for the query. This identifier is unique only in combination with a
61
+ # selling partner account ID.
62
+ # @return [Hash] The API response
63
+ def cancel_query(query_id)
64
+ path = "/dataKiosk/2023-11-15/queries/#{query_id}"
65
+
66
+ rate_limit(0.0222).delete(path)
67
+ end
68
+
69
+ # Returns query details for the query specified by the `queryId` parameter. See the `createQuery` operation for
70
+ # details about query retention.
71
+ #
72
+ # @param [String] query_id The query identifier.
73
+ # @return [Hash] The API response
74
+ def get_query(query_id)
75
+ path = "/dataKiosk/2023-11-15/queries/#{query_id}"
76
+
77
+ rate_limit(2.0).get(path)
78
+ end
79
+
80
+ # Returns the information required for retrieving a Data Kiosk document's contents. See the `createQuery`
81
+ # operation for details about document retention.
82
+ #
83
+ # @param [String] document_id The identifier for the Data Kiosk document.
84
+ # @return [Hash] The API response
85
+ def get_document(document_id)
86
+ path = "/dataKiosk/2023-11-15/documents/#{document_id}"
87
+
88
+ rate_limit(0.0167).get(path)
89
+ end
90
+ end
91
+ end
92
+ end
@@ -0,0 +1,108 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "peddler/api"
4
+
5
+ module Peddler
6
+ class API
7
+ # Selling Partner API for Easy Ship
8
+ #
9
+ # The Selling Partner API for Easy Ship helps you build applications that help sellers manage and ship Amazon Easy
10
+ # Ship orders. Your Easy Ship applications can: * Get available time slots for packages to be scheduled for
11
+ # delivery. * Schedule, reschedule, and cancel Easy Ship orders. * Print labels, invoices, and warranties. See the
12
+ # [Marketplace Support Table](doc:easyship-api-v2022-03-23-use-case-guide#marketplace-support-table) for the
13
+ # differences in Easy Ship operations by marketplace.
14
+ class EasyShip20220323 < API
15
+ # Returns time slots available for Easy Ship orders to be scheduled based on the package weight and dimensions
16
+ # that the seller specifies. This operation is available for scheduled and unscheduled orders based on marketplace
17
+ # support. See **Get Time Slots** in the [Marketplace Support
18
+ # Table](doc:easyship-api-v2022-03-23-use-case-guide#marketplace-support-table). This operation can return time
19
+ # slots that have either pickup or drop-off handover methods - see **Supported Handover Methods** in the
20
+ # [Marketplace Support Table](doc:easyship-api-v2022-03-23-use-case-guide#marketplace-support-table).
21
+ #
22
+ # @param [Hash] list_handover_slots_request The request schema for the `listHandoverSlots` operation.
23
+ # @return [Hash] The API response
24
+ def list_handover_slots(list_handover_slots_request: nil)
25
+ path = "/easyShip/2022-03-23/timeSlot"
26
+ body = list_handover_slots_request
27
+
28
+ rate_limit(1.0).post(path, body:)
29
+ end
30
+
31
+ # Returns information about a package, including dimensions, weight, time slot information for handover, invoice
32
+ # and item information, and status.
33
+ #
34
+ # @param [String] amazon_order_id An Amazon-defined order identifier. Identifies the order that the seller wants
35
+ # to deliver using Amazon Easy Ship.
36
+ # @param [String] marketplace_id An identifier for the marketplace in which the seller is selling.
37
+ # @return [Hash] The API response
38
+ def get_scheduled_package(amazon_order_id, marketplace_id)
39
+ path = "/easyShip/2022-03-23/package"
40
+ params = {
41
+ "amazonOrderId" => amazon_order_id,
42
+ "marketplaceId" => marketplace_id,
43
+ }.compact
44
+
45
+ rate_limit(1.0).get(path, params:)
46
+ end
47
+
48
+ # Schedules an Easy Ship order and returns the scheduled package information. This operation does the following: *
49
+ # Specifies the time slot and handover method for the order to be scheduled for delivery. * Updates the Easy Ship
50
+ # order status. * Generates a shipping label and an invoice. Calling `createScheduledPackage` also generates a
51
+ # warranty document if you specify a `SerialNumber` value. To get these documents, see [How to get invoice,
52
+ # shipping label, and warranty documents](doc:easyship-api-v2022-03-23-use-case-guide). * Shows the status of Easy
53
+ # Ship orders when you call the `getOrders` operation of the Selling Partner API for Orders and examine the
54
+ # `EasyShipShipmentStatus` property in the response body. See the **Shipping Label**, **Invoice**, and
55
+ # **Warranty** columns in the [Marketplace Support
56
+ # Table](doc:easyship-api-v2022-03-23-use-case-guide#marketplace-support-table) to see which documents are
57
+ # supported in each marketplace.
58
+ #
59
+ # @param [Hash] create_scheduled_package_request The request schema for the `createScheduledPackage` operation.
60
+ # @return [Hash] The API response
61
+ def create_scheduled_package(create_scheduled_package_request)
62
+ path = "/easyShip/2022-03-23/package"
63
+ body = create_scheduled_package_request
64
+
65
+ rate_limit(1.0).post(path, body:)
66
+ end
67
+
68
+ # Updates the time slot for handing over the package indicated by the specified `scheduledPackageId`. You can get
69
+ # the new `slotId` value for the time slot by calling the `listHandoverSlots` operation before making another
70
+ # `patch` call. See the **Update Package** column in the [Marketplace Support
71
+ # Table](doc:easyship-api-v2022-03-23-use-case-guide#marketplace-support-table) to see which marketplaces this
72
+ # operation is supported in.
73
+ #
74
+ # @param [Hash] update_scheduled_packages_request The request schema for the `updateScheduledPackages` operation.
75
+ # @return [Hash] The API response
76
+ def update_scheduled_packages(update_scheduled_packages_request: nil)
77
+ path = "/easyShip/2022-03-23/package"
78
+ body = update_scheduled_packages_request
79
+
80
+ rate_limit(1.0).patch(path, body:)
81
+ end
82
+
83
+ # This operation automatically schedules a time slot for all the `amazonOrderId`s given as input, generating the
84
+ # associated shipping labels, along with other compliance documents according to the marketplace (refer to the
85
+ # [marketplace document support table](doc:easyship-api-v2022-03-23-use-case-guide#marketplace-support-table)).
86
+ # Developers calling this operation may optionally assign a `packageDetails` object, allowing them to input a
87
+ # preferred time slot for each order in ther request. In this case, Amazon will try to schedule the respective
88
+ # packages using their optional settings. On the other hand, *i.e.*, if the time slot is not provided, Amazon will
89
+ # then pick the earliest time slot possible. Regarding the shipping label's file format, external developers are
90
+ # able to choose between PDF or ZPL, and Amazon will create the label accordingly. This operation returns an array
91
+ # composed of the scheduled packages, and a short-lived URL pointing to a zip file containing the generated
92
+ # shipping labels and the other documents enabled for your marketplace. If at least an order couldn't be
93
+ # scheduled, then Amazon adds the `rejectedOrders` list into the response, which contains an entry for each order
94
+ # we couldn't process. Each entry is composed of an error message describing the reason of the failure, so that
95
+ # sellers can take action. The table below displays the supported request and burst maximum rates:
96
+ #
97
+ # @param [Hash] create_scheduled_packages_request The request schema for the `createScheduledPackageBulk`
98
+ # operation.
99
+ # @return [Hash] The API response
100
+ def create_scheduled_package_bulk(create_scheduled_packages_request)
101
+ path = "/easyShip/2022-03-23/packages/bulk"
102
+ body = create_scheduled_packages_request
103
+
104
+ rate_limit(1.0).post(path, body:)
105
+ end
106
+ end
107
+ end
108
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "peddler/api"
4
+
5
+ module Peddler
6
+ class API
7
+ # Selling Partner API for FBA Inbound Eligibilty
8
+ #
9
+ # With the FBA Inbound Eligibility API, you can build applications that let sellers get eligibility previews for
10
+ # items before shipping them to Amazon's fulfillment centers. With this API you can find out if an item is eligible
11
+ # for inbound shipment to Amazon's fulfillment centers in a specific marketplace. You can also find out if an item
12
+ # is eligible for using the manufacturer barcode for FBA inventory tracking. Sellers can use this information to
13
+ # inform their decisions about which items to ship Amazon's fulfillment centers.
14
+ class FBAInboundEligibilityV1 < API
15
+ # This operation gets an eligibility preview for an item that you specify. You can specify the type of eligibility
16
+ # preview that you want (INBOUND or COMMINGLING). For INBOUND previews, you can specify the marketplace in which
17
+ # you want to determine the item's eligibility.
18
+ #
19
+ # @param [Array<String>] marketplace_ids The identifier for the marketplace in which you want to determine
20
+ # eligibility. Required only when program=INBOUND.
21
+ # @param [String] asin The ASIN of the item for which you want an eligibility preview.
22
+ # @param [String] program The program that you want to check eligibility against.
23
+ # @return [Hash] The API response
24
+ def get_item_eligibility_preview(asin, program, marketplace_ids: nil)
25
+ path = "/fba/inbound/v1/eligibility/itemPreview"
26
+ params = {
27
+ "marketplaceIds" => marketplace_ids,
28
+ "asin" => asin,
29
+ "program" => program,
30
+ }.compact
31
+
32
+ rate_limit(1.0).get(path, params:)
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,106 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "peddler/api"
4
+
5
+ module Peddler
6
+ class API
7
+ # Selling Partner API for FBA Inventory
8
+ #
9
+ # The Selling Partner API for FBA Inventory lets you programmatically retrieve information about inventory in
10
+ # Amazon's fulfillment network.
11
+ class FBAInventoryV1 < API
12
+ # Returns a list of inventory summaries. The summaries returned depend on the presence or absence of the
13
+ # startDateTime, sellerSkus and sellerSku parameters: - All inventory summaries with available details are
14
+ # returned when the startDateTime, sellerSkus and sellerSku parameters are omitted. - When startDateTime is
15
+ # provided, the operation returns inventory summaries that have had changes after the date and time specified. The
16
+ # sellerSkus and sellerSku parameters are ignored. Important: To avoid errors, use both startDateTime and
17
+ # nextToken to get the next page of inventory summaries that have changed after the date and time specified. -
18
+ # When the sellerSkus parameter is provided, the operation returns inventory summaries for only the specified
19
+ # sellerSkus. The sellerSku parameter is ignored. - When the sellerSku parameter is provided, the operation
20
+ # returns inventory summaries for only the specified sellerSku. Note: The parameters associated with this
21
+ # operation may contain special characters that must be encoded to successfully call the API. To avoid errors with
22
+ # SKUs when encoding URLs, refer to URL Encoding. Usage Plan: | Rate (requests per second) | Burst | | ---- | ----
23
+ # | | 2 | 2 | The x-amzn-RateLimit-Limit response header returns the usage plan rate limits that were applied to
24
+ # the requested operation, when available. The table above indicates the default rate and burst values for this
25
+ # operation. Selling partners whose business demands require higher throughput may see higher rate and burst
26
+ # values than those shown here. For more information, see Usage Plans and Rate Limits in the Selling Partner API.
27
+ #
28
+ # @param [Boolean] details true to return inventory summaries with additional summarized inventory details and
29
+ # quantities. Otherwise, returns inventory summaries only (default value).
30
+ # @param [String] granularity_type The granularity type for the inventory aggregation level.
31
+ # @param [String] granularity_id The granularity ID for the inventory aggregation level.
32
+ # @param [String] start_date_time A start date and time in ISO8601 format. If specified, all inventory summaries
33
+ # that have changed since then are returned. You must specify a date and time that is no earlier than 18 months
34
+ # prior to the date and time when you call the API. Note: Changes in inboundWorkingQuantity,
35
+ # inboundShippedQuantity and inboundReceivingQuantity are not detected.
36
+ # @param [Array<String>] seller_skus A list of seller SKUs for which to return inventory summaries. You may
37
+ # specify up to 50 SKUs.
38
+ # @param [String] seller_sku A single seller SKU used for querying the specified seller SKU inventory summaries.
39
+ # @param [String] next_token String token returned in the response of your previous request. The string token will
40
+ # expire 30 seconds after being created.
41
+ # @param [Array<String>] marketplace_ids The marketplace ID for the marketplace for which to return inventory
42
+ # summaries.
43
+ # @return [Hash] The API response
44
+ def get_inventory_summaries(granularity_type, granularity_id, marketplace_ids, details: nil,
45
+ start_date_time: nil, seller_skus: nil, seller_sku: nil, next_token: nil)
46
+ path = "/fba/inventory/v1/summaries"
47
+ params = {
48
+ "details" => details,
49
+ "granularityType" => granularity_type,
50
+ "granularityId" => granularity_id,
51
+ "startDateTime" => start_date_time,
52
+ "sellerSkus" => seller_skus,
53
+ "sellerSku" => seller_sku,
54
+ "nextToken" => next_token,
55
+ "marketplaceIds" => marketplace_ids,
56
+ }.compact
57
+
58
+ rate_limit(2.0).get(path, params:)
59
+ end
60
+
61
+ # Requests that Amazon create product-details in the Sandbox Inventory in the sandbox environment. This is a
62
+ # sandbox-only operation and must be directed to a sandbox endpoint. Refer to [Selling Partner API
63
+ # sandbox](https://developer-docs.amazon.com/sp-api/docs/the-selling-partner-api-sandbox) for more information.
64
+ #
65
+ # @param [Hash] create_inventory_item_request_body CreateInventoryItem Request Body Parameter.
66
+ # @return [Hash] The API response
67
+ def create_inventory_item(create_inventory_item_request_body)
68
+ path = "/fba/inventory/v1/items"
69
+ body = create_inventory_item_request_body
70
+
71
+ post(path, body:)
72
+ end
73
+
74
+ # Requests that Amazon Deletes an item from the Sandbox Inventory in the sandbox environment. This is a
75
+ # sandbox-only operation and must be directed to a sandbox endpoint. Refer to [Selling Partner API
76
+ # sandbox](https://developer-docs.amazon.com/sp-api/docs/the-selling-partner-api-sandbox) for more information.
77
+ #
78
+ # @param [String] seller_sku A single seller SKU used for querying the specified seller SKU inventory summaries.
79
+ # @param [String] marketplace_id The marketplace ID for the marketplace for which the sellerSku is to be deleted.
80
+ # @return [Hash] The API response
81
+ def delete_inventory_item(seller_sku, marketplace_id)
82
+ path = "/fba/inventory/v1/items/#{seller_sku}"
83
+ params = {
84
+ "marketplaceId" => marketplace_id,
85
+ }.compact
86
+
87
+ delete(path, params:)
88
+ end
89
+
90
+ # Requests that Amazon add items to the Sandbox Inventory with desired amount of quantity in the sandbox
91
+ # environment. This is a sandbox-only operation and must be directed to a sandbox endpoint. Refer to [Selling
92
+ # Partner API sandbox](https://developer-docs.amazon.com/sp-api/docs/the-selling-partner-api-sandbox) for more
93
+ # information.
94
+ #
95
+ # @param [String] x_amzn_idempotency_token A unique token/requestId provided with each call to ensure idempotency.
96
+ # @param [Hash] add_inventory_request_body List of items to add to Sandbox inventory.
97
+ # @return [Hash] The API response
98
+ def add_inventory(x_amzn_idempotency_token, add_inventory_request_body)
99
+ path = "/fba/inventory/v1/items/inventory"
100
+ body = add_inventory_request_body
101
+
102
+ post(path, body:)
103
+ end
104
+ end
105
+ end
106
+ end
@@ -0,0 +1,104 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "peddler/api"
4
+
5
+ module Peddler
6
+ class API
7
+ # Selling Partner API for Feeds
8
+ #
9
+ # The Selling Partner API for Feeds lets you upload data to Amazon on behalf of a selling partner.
10
+ class Feeds20210630 < API
11
+ # Returns feed details for the feeds that match the filters that you specify.
12
+ #
13
+ # @param [Array<String>] feed_types A list of feed types used to filter feeds. When feedTypes is provided, the
14
+ # other filter parameters (processingStatuses, marketplaceIds, createdSince, createdUntil) and pageSize may also
15
+ # be provided. Either feedTypes or nextToken is required.
16
+ # @param [Array<String>] marketplace_ids A list of marketplace identifiers used to filter feeds. The feeds
17
+ # returned will match at least one of the marketplaces that you specify.
18
+ # @param [Integer] page_size The maximum number of feeds to return in a single call.
19
+ # @param [Array<String>] processing_statuses A list of processing statuses used to filter feeds.
20
+ # @param [String] created_since The earliest feed creation date and time for feeds included in the response, in
21
+ # ISO 8601 format. The default is 90 days ago. Feeds are retained for a maximum of 90 days.
22
+ # @param [String] created_until The latest feed creation date and time for feeds included in the response, in ISO
23
+ # 8601 format. The default is now.
24
+ # @param [String] next_token A string token returned in the response to your previous request. nextToken is
25
+ # returned when the number of results exceeds the specified pageSize value. To get the next page of results,
26
+ # call the getFeeds operation and include this token as the only parameter. Specifying nextToken with any other
27
+ # parameters will cause the request to fail.
28
+ # @return [Hash] The API response
29
+ def get_feeds(feed_types: nil, marketplace_ids: nil, page_size: nil, processing_statuses: nil,
30
+ created_since: nil, created_until: nil, next_token: nil)
31
+ path = "/feeds/2021-06-30/feeds"
32
+ params = {
33
+ "feedTypes" => feed_types,
34
+ "marketplaceIds" => marketplace_ids,
35
+ "pageSize" => page_size,
36
+ "processingStatuses" => processing_statuses,
37
+ "createdSince" => created_since,
38
+ "createdUntil" => created_until,
39
+ "nextToken" => next_token,
40
+ }.compact
41
+
42
+ rate_limit(0.0222).get(path, params:)
43
+ end
44
+
45
+ # Creates a feed. Upload the contents of the feed document before calling this operation.
46
+ #
47
+ # @param [Hash] body Information required to create the feed.
48
+ # @return [Hash] The API response
49
+ def create_feed(body)
50
+ path = "/feeds/2021-06-30/feeds"
51
+
52
+ rate_limit(0.0083).post(path, body:)
53
+ end
54
+
55
+ # Cancels the feed that you specify. Only feeds with `processingStatus=IN_QUEUE` can be cancelled. Cancelled feeds
56
+ # are returned in subsequent calls to the
57
+ # [`getFeed`](https://developer-docs.amazon.com/sp-api/docs/feeds-api-v2021-06-30-reference#getfeed) and
58
+ # [`getFeeds`](https://developer-docs.amazon.com/sp-api/docs/feeds-api-v2021-06-30-reference#getfeeds) operations.
59
+ #
60
+ # @param [String] feed_id The identifier for the feed. This identifier is unique only in combination with a seller
61
+ # ID.
62
+ # @return [Hash] The API response
63
+ def cancel_feed(feed_id)
64
+ path = "/feeds/2021-06-30/feeds/#{feed_id}"
65
+
66
+ rate_limit(2.0).delete(path)
67
+ end
68
+
69
+ # Returns feed details (including the `resultDocumentId`, if available) for the feed that you specify.
70
+ #
71
+ # @param [String] feed_id The identifier for the feed. This identifier is unique only in combination with a seller
72
+ # ID.
73
+ # @return [Hash] The API response
74
+ def get_feed(feed_id)
75
+ path = "/feeds/2021-06-30/feeds/#{feed_id}"
76
+
77
+ rate_limit(2.0).get(path)
78
+ end
79
+
80
+ # Creates a feed document for the feed type that you specify. This operation returns a presigned URL for uploading
81
+ # the feed document contents. It also returns a `feedDocumentId` value that you can pass in with a subsequent call
82
+ # to the [`createFeed`](https://developer-docs.amazon.com/sp-api/docs/feeds-api-v2021-06-30-reference#createfeed)
83
+ # operation.
84
+ #
85
+ # @param [Hash] body Specifies the content type for the createFeedDocument operation.
86
+ # @return [Hash] The API response
87
+ def create_feed_document(body)
88
+ path = "/feeds/2021-06-30/documents"
89
+
90
+ rate_limit(0.5).post(path, body:)
91
+ end
92
+
93
+ # Returns the information required for retrieving a feed document's contents.
94
+ #
95
+ # @param [String] feed_document_id The identifier of the feed document.
96
+ # @return [Hash] The API response
97
+ def get_feed_document(feed_document_id)
98
+ path = "/feeds/2021-06-30/documents/#{feed_document_id}"
99
+
100
+ rate_limit(0.0222).get(path)
101
+ end
102
+ end
103
+ end
104
+ end
@@ -0,0 +1,121 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "peddler/api"
4
+
5
+ module Peddler
6
+ class API
7
+ # Selling Partner API for Finances
8
+ #
9
+ # The Selling Partner API for Finances helps you obtain financial information relevant to a seller's business. You
10
+ # can obtain financial events for a given order, financial event group, or date range without having to wait until a
11
+ # statement period closes. You can also obtain financial event groups for a given date range.
12
+ class FinancesV0 < API
13
+ # Returns financial event groups for a given date range. It may take up to 48 hours for orders to appear in your
14
+ # financial events.
15
+ #
16
+ # @param [Integer] max_results_per_page The maximum number of results to return per page. If the response exceeds
17
+ # the maximum number of transactions or 10 MB, the API responds with 'InvalidInput'.
18
+ # @param [String] financial_event_group_started_before A date used for selecting financial event groups that
19
+ # opened before (but not at) a specified date and time, in [ISO
20
+ # 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) format. The date-time must be later than
21
+ # FinancialEventGroupStartedAfter and no later than two minutes before the request was submitted. If
22
+ # FinancialEventGroupStartedAfter and FinancialEventGroupStartedBefore are more than 180 days apart, no
23
+ # financial event groups are returned.
24
+ # @param [String] financial_event_group_started_after A date used for selecting financial event groups that opened
25
+ # after (or at) a specified date and time, in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601)
26
+ # format. The date-time must be no later than two minutes before the request was submitted.
27
+ # @param [String] next_token A string token returned in the response of your previous request.
28
+ # @return [Hash] The API response
29
+ def list_financial_event_groups(max_results_per_page: nil, financial_event_group_started_before: nil,
30
+ financial_event_group_started_after: nil, next_token: nil)
31
+ path = "/finances/v0/financialEventGroups"
32
+ params = {
33
+ "MaxResultsPerPage" => max_results_per_page,
34
+ "FinancialEventGroupStartedBefore" => financial_event_group_started_before,
35
+ "FinancialEventGroupStartedAfter" => financial_event_group_started_after,
36
+ "NextToken" => next_token,
37
+ }.compact
38
+
39
+ rate_limit(0.5).get(path, params:)
40
+ end
41
+
42
+ # Returns all financial events for the specified financial event group. It may take up to 48 hours for orders to
43
+ # appear in your financial events.
44
+ # @note This operation will only retrieve group's data for the past two years. If a request is submitted for data
45
+ # spanning more than two years, an empty response is returned.
46
+ #
47
+ # @param [Integer] max_results_per_page The maximum number of results to return per page. If the response exceeds
48
+ # the maximum number of transactions or 10 MB, the API responds with 'InvalidInput'.
49
+ # @param [String] posted_after A date used for selecting financial events posted after (or at) a specified time.
50
+ # The date-time **must** be more than two minutes before the time of the request, in [ISO
51
+ # 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date time format.
52
+ # @param [String] posted_before A date used for selecting financial events posted before (but not at) a specified
53
+ # time. The date-time must be later than `PostedAfter` and no later than two minutes before the request was
54
+ # submitted, in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date time format. If
55
+ # `PostedAfter` and `PostedBefore` are more than 180 days apart, no financial events are returned. You must
56
+ # specify the `PostedAfter` parameter if you specify the `PostedBefore` parameter. Default: Now minus two
57
+ # minutes.
58
+ # @param [String] event_group_id The identifier of the financial event group to which the events belong.
59
+ # @param [String] next_token A string token returned in the response of your previous request.
60
+ # @return [Hash] The API response
61
+ def list_financial_events_by_group_id(event_group_id, max_results_per_page: nil, posted_after: nil,
62
+ posted_before: nil, next_token: nil)
63
+ path = "/finances/v0/financialEventGroups/#{event_group_id}/financialEvents"
64
+ params = {
65
+ "MaxResultsPerPage" => max_results_per_page,
66
+ "PostedAfter" => posted_after,
67
+ "PostedBefore" => posted_before,
68
+ "NextToken" => next_token,
69
+ }.compact
70
+
71
+ rate_limit(0.5).get(path, params:)
72
+ end
73
+
74
+ # Returns all financial events for the specified order. It may take up to 48 hours for orders to appear in your
75
+ # financial events.
76
+ #
77
+ # @param [String] order_id An Amazon-defined order identifier, in 3-7-7 format.
78
+ # @param [Integer] max_results_per_page The maximum number of results to return per page. If the response exceeds
79
+ # the maximum number of transactions or 10 MB, the API responds with 'InvalidInput'.
80
+ # @param [String] next_token A string token returned in the response of your previous request.
81
+ # @return [Hash] The API response
82
+ def list_financial_events_by_order_id(order_id, max_results_per_page: nil, next_token: nil)
83
+ path = "/finances/v0/orders/#{order_id}/financialEvents"
84
+ params = {
85
+ "MaxResultsPerPage" => max_results_per_page,
86
+ "NextToken" => next_token,
87
+ }.compact
88
+
89
+ rate_limit(0.5).get(path, params:)
90
+ end
91
+
92
+ # Returns financial events for the specified data range. It may take up to 48 hours for orders to appear in your
93
+ # financial events.
94
+ # @note in `ListFinancialEvents`, deferred events don't show up in responses until in they are released.
95
+ #
96
+ # @param [Integer] max_results_per_page The maximum number of results to return per page. If the response exceeds
97
+ # the maximum number of transactions or 10 MB, the API responds with 'InvalidInput'.
98
+ # @param [String] posted_after A date used for selecting financial events posted after (or at) a specified time.
99
+ # The date-time must be no later than two minutes before the request was submitted, in [ISO
100
+ # 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date time format.
101
+ # @param [String] posted_before A date used for selecting financial events posted before (but not at) a specified
102
+ # time. The date-time must be later than PostedAfter and no later than two minutes before the request was
103
+ # submitted, in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date time format. If
104
+ # PostedAfter and PostedBefore are more than 180 days apart, no financial events are returned. You must specify
105
+ # the PostedAfter parameter if you specify the PostedBefore parameter. Default: Now minus two minutes.
106
+ # @param [String] next_token A string token returned in the response of your previous request.
107
+ # @return [Hash] The API response
108
+ def list_financial_events(max_results_per_page: nil, posted_after: nil, posted_before: nil, next_token: nil)
109
+ path = "/finances/v0/financialEvents"
110
+ params = {
111
+ "MaxResultsPerPage" => max_results_per_page,
112
+ "PostedAfter" => posted_after,
113
+ "PostedBefore" => posted_before,
114
+ "NextToken" => next_token,
115
+ }.compact
116
+
117
+ rate_limit(0.5).get(path, params:)
118
+ end
119
+ end
120
+ end
121
+ end