peddler 3.0.0.beta1 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +108 -110
  3. data/lib/peddler/api.rb +56 -18
  4. data/lib/peddler/{api → apis}/amazon_warehousing_and_distribution_2024_05_09.rb +38 -26
  5. data/lib/peddler/{api → apis}/aplus_content_2020_11_01.rb +97 -59
  6. data/lib/peddler/apis/application_integrations_2024_04_01.rb +56 -0
  7. data/lib/peddler/{api → apis}/application_management_2023_11_30.rb +14 -4
  8. data/lib/peddler/{api → apis}/catalog_items_2020_12_01.rb +34 -23
  9. data/lib/peddler/{api → apis}/catalog_items_2022_04_01.rb +39 -29
  10. data/lib/peddler/{api → apis}/catalog_items_v0.rb +43 -30
  11. data/lib/peddler/{api → apis}/data_kiosk_2023_11_15.rb +47 -31
  12. data/lib/peddler/apis/easy_ship_2022_03_23.rb +126 -0
  13. data/lib/peddler/{api → apis}/fba_inbound_eligibility_v1.rb +15 -7
  14. data/lib/peddler/{api → apis}/fba_inventory_v1.rb +45 -29
  15. data/lib/peddler/{api → apis}/feeds_2021_06_30.rb +54 -33
  16. data/lib/peddler/apis/finances_2024_06_19.rb +50 -0
  17. data/lib/peddler/{api → apis}/finances_v0.rb +50 -36
  18. data/lib/peddler/{api → apis}/fulfillment_inbound_2024_03_20.rb +384 -255
  19. data/lib/peddler/{api → apis}/fulfillment_inbound_v0.rb +138 -93
  20. data/lib/peddler/{api → apis}/fulfillment_outbound_2020_07_01.rb +105 -68
  21. data/lib/peddler/apis/invoices_2024_06_19.rb +180 -0
  22. data/lib/peddler/apis/listings_items_2020_09_01.rb +95 -0
  23. data/lib/peddler/apis/listings_items_2021_08_01.rb +136 -0
  24. data/lib/peddler/{api → apis}/listings_restrictions_2021_08_01.rb +21 -11
  25. data/lib/peddler/apis/merchant_fulfillment_v0.rb +80 -0
  26. data/lib/peddler/{api → apis}/messaging_v1.rb +107 -75
  27. data/lib/peddler/{api → apis}/notifications_v1.rb +63 -32
  28. data/lib/peddler/{api → apis}/orders_v0.rb +99 -84
  29. data/lib/peddler/apis/product_fees_v0.rb +77 -0
  30. data/lib/peddler/{api → apis}/product_pricing_2022_05_01.rb +24 -13
  31. data/lib/peddler/{api → apis}/product_pricing_v0.rb +70 -52
  32. data/lib/peddler/{api → apis}/product_type_definitions_2020_09_01.rb +32 -21
  33. data/lib/peddler/{api → apis}/replenishment_2022_11_07.rb +25 -13
  34. data/lib/peddler/{api → apis}/reports_2021_06_30.rb +71 -47
  35. data/lib/peddler/{api → apis}/sales_v1.rb +22 -14
  36. data/lib/peddler/{api → apis}/sellers_v1.rb +19 -7
  37. data/lib/peddler/{api → apis}/services_v1.rb +156 -116
  38. data/lib/peddler/apis/shipment_invoicing_v0.rb +59 -0
  39. data/lib/peddler/apis/shipping_v1.rb +132 -0
  40. data/lib/peddler/{api → apis}/shipping_v2.rb +150 -98
  41. data/lib/peddler/{api → apis}/solicitations_v1.rb +21 -11
  42. data/lib/peddler/apis/supply_sources_2020_07_01.rb +100 -0
  43. data/lib/peddler/{api → apis}/tokens_2021_03_01.rb +15 -7
  44. data/lib/peddler/{api → apis}/uploads_2020_11_01.rb +18 -8
  45. data/lib/peddler/{api → apis}/vendor_direct_fulfillment_inventory_v1.rb +14 -6
  46. data/lib/peddler/{api → apis}/vendor_direct_fulfillment_orders_2021_12_28.rb +33 -21
  47. data/lib/peddler/{api → apis}/vendor_direct_fulfillment_orders_v1.rb +33 -21
  48. data/lib/peddler/{api → apis}/vendor_direct_fulfillment_payments_v1.rb +13 -5
  49. data/lib/peddler/apis/vendor_direct_fulfillment_sandbox_test_data_2021_10_28.rb +45 -0
  50. data/lib/peddler/{api → apis}/vendor_direct_fulfillment_shipping_2021_12_28.rb +86 -60
  51. data/lib/peddler/apis/vendor_direct_fulfillment_shipping_v1.rb +189 -0
  52. data/lib/peddler/{api → apis}/vendor_direct_fulfillment_transactions_2021_12_28.rb +14 -6
  53. data/lib/peddler/{api → apis}/vendor_direct_fulfillment_transactions_v1.rb +14 -6
  54. data/lib/peddler/apis/vendor_invoices_v1.rb +30 -0
  55. data/lib/peddler/{api → apis}/vendor_orders_v1.rb +59 -48
  56. data/lib/peddler/apis/vendor_shipments_v1.rb +132 -0
  57. data/lib/peddler/{api → apis}/vendor_transaction_status_v1.rb +14 -5
  58. data/lib/peddler/endpoint.rb +51 -0
  59. data/lib/peddler/error.rb +21 -11
  60. data/lib/peddler/helpers/feeds_2021_06_30.rb +26 -0
  61. data/lib/peddler/json_feed_document.rb +31 -0
  62. data/lib/peddler/marketplace.rb +93 -0
  63. data/lib/peddler/response.rb +46 -0
  64. data/lib/peddler/token.rb +70 -0
  65. data/lib/peddler/version.rb +1 -1
  66. data/lib/peddler.rb +55 -52
  67. metadata +64 -57
  68. data/lib/peddler/access_token.rb +0 -76
  69. data/lib/peddler/api/easy_ship_2022_03_23.rb +0 -108
  70. data/lib/peddler/api/listings_items_2020_09_01.rb +0 -84
  71. data/lib/peddler/api/listings_items_2021_08_01.rb +0 -154
  72. data/lib/peddler/api/merchant_fulfillment_v0.rb +0 -64
  73. data/lib/peddler/api/product_fees_v0.rb +0 -69
  74. data/lib/peddler/api/shipment_invoicing_v0.rb +0 -46
  75. data/lib/peddler/api/shipping_v1.rb +0 -107
  76. data/lib/peddler/api/supply_sources_2020_07_01.rb +0 -82
  77. data/lib/peddler/api/vendor_direct_fulfillment_sandbox_test_data_2021_10_28.rb +0 -35
  78. data/lib/peddler/api/vendor_direct_fulfillment_shipping_v1.rb +0 -165
  79. data/lib/peddler/api/vendor_invoices_v1.rb +0 -22
  80. data/lib/peddler/api/vendor_shipments_v1.rb +0 -120
  81. data/lib/peddler/region.rb +0 -30
@@ -3,7 +3,13 @@
3
3
  require "peddler/api"
4
4
 
5
5
  module Peddler
6
- class API
6
+ class << self
7
+ def fba_inventory_v1(...)
8
+ APIs::FBAInventoryV1.new(...)
9
+ end
10
+ end
11
+
12
+ module APIs
7
13
  # Selling Partner API for FBA Inventory
8
14
  #
9
15
  # The Selling Partner API for FBA Inventory lets you programmatically retrieve information about inventory in
@@ -19,30 +25,28 @@ module Peddler
19
25
  # sellerSkus. The sellerSku parameter is ignored. - When the sellerSku parameter is provided, the operation
20
26
  # returns inventory summaries for only the specified sellerSku. Note: The parameters associated with this
21
27
  # 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.
28
+ # SKUs when encoding URLs, refer to [URL Encoding](https://developer-docs.amazon.com/sp-api/docs/url-encoding).
27
29
  #
28
- # @param [Boolean] details true to return inventory summaries with additional summarized inventory details and
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
29
32
  # 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
+ # @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
33
36
  # that have changed since then are returned. You must specify a date and time that is no earlier than 18 months
34
37
  # prior to the date and time when you call the API. Note: Changes in inboundWorkingQuantity,
35
38
  # 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
39
+ # @param seller_skus [Array<String>] A list of seller SKUs for which to return inventory summaries. You may
37
40
  # 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
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
40
43
  # expire 30 seconds after being created.
41
- # @param [Array<String>] marketplace_ids The marketplace ID for the marketplace for which to return inventory
44
+ # @param marketplace_ids [Array<String>] The marketplace ID for the marketplace for which to return inventory
42
45
  # 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
+ # @param rate_limit [Float] Requests per second
47
+ # @return [Peddler::Response] 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)
46
50
  path = "/fba/inventory/v1/summaries"
47
51
  params = {
48
52
  "details" => details,
@@ -55,16 +59,20 @@ module Peddler
55
59
  "marketplaceIds" => marketplace_ids,
56
60
  }.compact
57
61
 
58
- rate_limit(2.0).get(path, params:)
62
+ meter(rate_limit).get(path, params:)
59
63
  end
60
64
 
61
65
  # Requests that Amazon create product-details in the Sandbox Inventory in the sandbox environment. This is a
62
66
  # sandbox-only operation and must be directed to a sandbox endpoint. Refer to [Selling Partner API
63
67
  # sandbox](https://developer-docs.amazon.com/sp-api/docs/the-selling-partner-api-sandbox) for more information.
64
68
  #
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)
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 [Peddler::Response] The API response
73
+ def create_inventory_item(create_inventory_item_request_body, rate_limit: nil)
74
+ must_sandbox!
75
+
68
76
  path = "/fba/inventory/v1/items"
69
77
  body = create_inventory_item_request_body
70
78
 
@@ -75,10 +83,14 @@ module Peddler
75
83
  # sandbox-only operation and must be directed to a sandbox endpoint. Refer to [Selling Partner API
76
84
  # sandbox](https://developer-docs.amazon.com/sp-api/docs/the-selling-partner-api-sandbox) for more information.
77
85
  #
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)
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 [Peddler::Response] The API response
91
+ def delete_inventory_item(seller_sku, marketplace_id, rate_limit: nil)
92
+ must_sandbox!
93
+
82
94
  path = "/fba/inventory/v1/items/#{seller_sku}"
83
95
  params = {
84
96
  "marketplaceId" => marketplace_id,
@@ -92,10 +104,14 @@ module Peddler
92
104
  # Partner API sandbox](https://developer-docs.amazon.com/sp-api/docs/the-selling-partner-api-sandbox) for more
93
105
  # information.
94
106
  #
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)
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 [Peddler::Response] The API response
112
+ def add_inventory(x_amzn_idempotency_token, add_inventory_request_body, rate_limit: nil)
113
+ must_sandbox!
114
+
99
115
  path = "/fba/inventory/v1/items/inventory"
100
116
  body = add_inventory_request_body
101
117
 
@@ -1,33 +1,44 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "peddler/api"
4
+ require "peddler/helpers/feeds_2021_06_30"
4
5
 
5
6
  module Peddler
6
- class API
7
- # Selling Partner API for Feeds
7
+ class << self
8
+ def feeds_2021_06_30(...)
9
+ APIs::Feeds20210630.new(...)
10
+ end
11
+ end
12
+
13
+ module APIs
14
+ # Feeds v2021-06-30
8
15
  #
9
16
  # The Selling Partner API for Feeds lets you upload data to Amazon on behalf of a selling partner.
10
17
  class Feeds20210630 < API
18
+ include Peddler::Helpers::Feeds20210630
19
+
11
20
  # Returns feed details for the feeds that match the filters that you specify.
12
21
  #
13
- # @param [Array<String>] feed_types A list of feed types used to filter feeds. When feedTypes is provided, the
22
+ # @note This operation can make a static sandbox call.
23
+ # @param feed_types [Array<String>] A list of feed types used to filter feeds. When feedTypes is provided, the
14
24
  # other filter parameters (processingStatuses, marketplaceIds, createdSince, createdUntil) and pageSize may also
15
25
  # 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
26
+ # @param marketplace_ids [Array<String>] A list of marketplace identifiers used to filter feeds. The feeds
17
27
  # 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
28
+ # @param page_size [Integer] The maximum number of feeds to return in a single call.
29
+ # @param processing_statuses [Array<String>] A list of processing statuses used to filter feeds.
30
+ # @param created_since [String] The earliest feed creation date and time for feeds included in the response, in
21
31
  # 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
32
+ # @param created_until [String] The latest feed creation date and time for feeds included in the response, in ISO
23
33
  # 8601 format. The default is now.
24
- # @param [String] next_token A string token returned in the response to your previous request. nextToken is
34
+ # @param next_token [String] A string token returned in the response to your previous request. nextToken is
25
35
  # returned when the number of results exceeds the specified pageSize value. To get the next page of results,
26
36
  # call the getFeeds operation and include this token as the only parameter. Specifying nextToken with any other
27
37
  # 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)
38
+ # @param rate_limit [Float] Requests per second
39
+ # @return [Peddler::Response] The API response
40
+ def get_feeds(feed_types: nil, marketplace_ids: nil, page_size: 10, processing_statuses: nil, created_since: nil,
41
+ created_until: nil, next_token: nil, rate_limit: 0.0222)
31
42
  path = "/feeds/2021-06-30/feeds"
32
43
  params = {
33
44
  "feedTypes" => feed_types,
@@ -39,17 +50,19 @@ module Peddler
39
50
  "nextToken" => next_token,
40
51
  }.compact
41
52
 
42
- rate_limit(0.0222).get(path, params:)
53
+ meter(rate_limit).get(path, params:)
43
54
  end
44
55
 
45
56
  # Creates a feed. Upload the contents of the feed document before calling this operation.
46
57
  #
47
- # @param [Hash] body Information required to create the feed.
48
- # @return [Hash] The API response
49
- def create_feed(body)
58
+ # @note This operation can make a static sandbox call.
59
+ # @param body [Hash] Information required to create the feed.
60
+ # @param rate_limit [Float] Requests per second
61
+ # @return [Peddler::Response] The API response
62
+ def create_feed(body, rate_limit: 0.0083)
50
63
  path = "/feeds/2021-06-30/feeds"
51
64
 
52
- rate_limit(0.0083).post(path, body:)
65
+ meter(rate_limit).post(path, body:)
53
66
  end
54
67
 
55
68
  # Cancels the feed that you specify. Only feeds with `processingStatus=IN_QUEUE` can be cancelled. Cancelled feeds
@@ -57,24 +70,28 @@ module Peddler
57
70
  # [`getFeed`](https://developer-docs.amazon.com/sp-api/docs/feeds-api-v2021-06-30-reference#getfeed) and
58
71
  # [`getFeeds`](https://developer-docs.amazon.com/sp-api/docs/feeds-api-v2021-06-30-reference#getfeeds) operations.
59
72
  #
60
- # @param [String] feed_id The identifier for the feed. This identifier is unique only in combination with a seller
73
+ # @note This operation can make a static sandbox call.
74
+ # @param feed_id [String] The identifier for the feed. This identifier is unique only in combination with a seller
61
75
  # ID.
62
- # @return [Hash] The API response
63
- def cancel_feed(feed_id)
76
+ # @param rate_limit [Float] Requests per second
77
+ # @return [Peddler::Response] The API response
78
+ def cancel_feed(feed_id, rate_limit: 2.0)
64
79
  path = "/feeds/2021-06-30/feeds/#{feed_id}"
65
80
 
66
- rate_limit(2.0).delete(path)
81
+ meter(rate_limit).delete(path)
67
82
  end
68
83
 
69
84
  # Returns feed details (including the `resultDocumentId`, if available) for the feed that you specify.
70
85
  #
71
- # @param [String] feed_id The identifier for the feed. This identifier is unique only in combination with a seller
86
+ # @note This operation can make a static sandbox call.
87
+ # @param feed_id [String] The identifier for the feed. This identifier is unique only in combination with a seller
72
88
  # ID.
73
- # @return [Hash] The API response
74
- def get_feed(feed_id)
89
+ # @param rate_limit [Float] Requests per second
90
+ # @return [Peddler::Response] The API response
91
+ def get_feed(feed_id, rate_limit: 2.0)
75
92
  path = "/feeds/2021-06-30/feeds/#{feed_id}"
76
93
 
77
- rate_limit(2.0).get(path)
94
+ meter(rate_limit).get(path)
78
95
  end
79
96
 
80
97
  # Creates a feed document for the feed type that you specify. This operation returns a presigned URL for uploading
@@ -82,22 +99,26 @@ module Peddler
82
99
  # to the [`createFeed`](https://developer-docs.amazon.com/sp-api/docs/feeds-api-v2021-06-30-reference#createfeed)
83
100
  # operation.
84
101
  #
85
- # @param [Hash] body Specifies the content type for the createFeedDocument operation.
86
- # @return [Hash] The API response
87
- def create_feed_document(body)
102
+ # @note This operation can make a static sandbox call.
103
+ # @param body [Hash] Specifies the content type for the createFeedDocument operation.
104
+ # @param rate_limit [Float] Requests per second
105
+ # @return [Peddler::Response] The API response
106
+ def create_feed_document(body, rate_limit: 0.5)
88
107
  path = "/feeds/2021-06-30/documents"
89
108
 
90
- rate_limit(0.5).post(path, body:)
109
+ meter(rate_limit).post(path, body:)
91
110
  end
92
111
 
93
112
  # Returns the information required for retrieving a feed document's contents.
94
113
  #
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)
114
+ # @note This operation can make a static sandbox call.
115
+ # @param feed_document_id [String] The identifier of the feed document.
116
+ # @param rate_limit [Float] Requests per second
117
+ # @return [Peddler::Response] The API response
118
+ def get_feed_document(feed_document_id, rate_limit: 0.0222)
98
119
  path = "/feeds/2021-06-30/documents/#{feed_document_id}"
99
120
 
100
- rate_limit(0.0222).get(path)
121
+ meter(rate_limit).get(path)
101
122
  end
102
123
  end
103
124
  end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "peddler/api"
4
+
5
+ module Peddler
6
+ class << self
7
+ def finances_2024_06_19(...)
8
+ APIs::Finances20240619.new(...)
9
+ end
10
+ end
11
+
12
+ module APIs
13
+ # The Selling Partner API for Finances
14
+ #
15
+ # The Selling Partner API for Finances provides financial information relevant to a seller's business. You can
16
+ # obtain financial events for a given order or date range without having to wait until a statement period closes.
17
+ class Finances20240619 < API
18
+ # Returns transactions for the given parameters. Orders from the last 48 hours might not be included in financial
19
+ # events.
20
+ #
21
+ # @note This operation can make a static sandbox call.
22
+ # @param posted_after [String] The response includes financial events posted after (or on) this date. This date
23
+ # must be in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date-time format. The date-time
24
+ # must be more than two minutes before the time of the request.
25
+ # @param posted_before [String] The response includes financial events posted before (but not on) this date. This
26
+ # date must be in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date-time format. The
27
+ # date-time must be later than `PostedAfter` and more than two minutes before the request was submitted. If
28
+ # `PostedAfter` and `PostedBefore` are more than 180 days apart, the response is empty. **Default:** Two minutes
29
+ # before the time of the request.
30
+ # @param marketplace_id [String] The ID of the marketplace from which you want to retrieve transactions.
31
+ # @param next_token [String] The response includes `nextToken` when the number of results exceeds the specified
32
+ # `pageSize` value. To get the next page of results, call the operation with this token and include the same
33
+ # arguments as the call that produced the token. To get a complete list, call this operation until `nextToken`
34
+ # is null. Note that this operation can return empty pages.
35
+ # @param rate_limit [Float] Requests per second
36
+ # @return [Peddler::Response] The API response
37
+ def list_transactions(posted_after, posted_before: nil, marketplace_id: nil, next_token: nil, rate_limit: 0.5)
38
+ path = "/finances/2024-06-19/transactions"
39
+ params = {
40
+ "postedAfter" => posted_after,
41
+ "postedBefore" => posted_before,
42
+ "marketplaceId" => marketplace_id,
43
+ "nextToken" => next_token,
44
+ }.compact
45
+
46
+ meter(rate_limit).get(path, params:)
47
+ end
48
+ end
49
+ end
50
+ end
@@ -3,7 +3,13 @@
3
3
  require "peddler/api"
4
4
 
5
5
  module Peddler
6
- class API
6
+ class << self
7
+ def finances_v0(...)
8
+ APIs::FinancesV0.new(...)
9
+ end
10
+ end
11
+
12
+ module APIs
7
13
  # Selling Partner API for Finances
8
14
  #
9
15
  # The Selling Partner API for Finances helps you obtain financial information relevant to a seller's business. You
@@ -13,21 +19,23 @@ module Peddler
13
19
  # Returns financial event groups for a given date range. It may take up to 48 hours for orders to appear in your
14
20
  # financial events.
15
21
  #
16
- # @param [Integer] max_results_per_page The maximum number of results to return per page. If the response exceeds
22
+ # @note This operation can make a static sandbox call.
23
+ # @param max_results_per_page [Integer] The maximum number of results to return per page. If the response exceeds
17
24
  # 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
25
+ # @param financial_event_group_started_before [String] A date used for selecting financial event groups that
19
26
  # opened before (but not at) a specified date and time, in [ISO
20
27
  # 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) format. The date-time must be later than
21
28
  # FinancialEventGroupStartedAfter and no later than two minutes before the request was submitted. If
22
29
  # FinancialEventGroupStartedAfter and FinancialEventGroupStartedBefore are more than 180 days apart, no
23
30
  # financial event groups are returned.
24
- # @param [String] financial_event_group_started_after A date used for selecting financial event groups that opened
31
+ # @param financial_event_group_started_after [String] A date used for selecting financial event groups that opened
25
32
  # after (or at) a specified date and time, in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601)
26
33
  # 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)
34
+ # @param next_token [String] A string token returned in the response of your previous request.
35
+ # @param rate_limit [Float] Requests per second
36
+ # @return [Peddler::Response] The API response
37
+ def list_financial_event_groups(max_results_per_page: 10, financial_event_group_started_before: nil,
38
+ financial_event_group_started_after: nil, next_token: nil, rate_limit: 0.5)
31
39
  path = "/finances/v0/financialEventGroups"
32
40
  params = {
33
41
  "MaxResultsPerPage" => max_results_per_page,
@@ -36,30 +44,31 @@ module Peddler
36
44
  "NextToken" => next_token,
37
45
  }.compact
38
46
 
39
- rate_limit(0.5).get(path, params:)
47
+ meter(rate_limit).get(path, params:)
40
48
  end
41
49
 
42
50
  # 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.
51
+ # appear in your financial events. **Note:** This operation will only retrieve group's data for the past two
52
+ # years. If a request is submitted for data spanning more than two years, an empty response is returned.
46
53
  #
47
- # @param [Integer] max_results_per_page The maximum number of results to return per page. If the response exceeds
54
+ # @note This operation can make a static sandbox call.
55
+ # @param max_results_per_page [Integer] The maximum number of results to return per page. If the response exceeds
48
56
  # 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.
57
+ # @param posted_after [String] A date used for selecting financial events posted after (or at) a specified time.
50
58
  # The date-time **must** be more than two minutes before the time of the request, in [ISO
51
59
  # 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
60
+ # @param posted_before [String] A date used for selecting financial events posted before (but not at) a specified
53
61
  # time. The date-time must be later than `PostedAfter` and no later than two minutes before the request was
54
62
  # submitted, in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date time format. If
55
63
  # `PostedAfter` and `PostedBefore` are more than 180 days apart, no financial events are returned. You must
56
64
  # specify the `PostedAfter` parameter if you specify the `PostedBefore` parameter. Default: Now minus two
57
65
  # 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)
66
+ # @param event_group_id [String] The identifier of the financial event group to which the events belong.
67
+ # @param next_token [String] A string token returned in the response of your previous request.
68
+ # @param rate_limit [Float] Requests per second
69
+ # @return [Peddler::Response] The API response
70
+ def list_financial_events_by_group_id(event_group_id, max_results_per_page: 100, posted_after: nil,
71
+ posted_before: nil, next_token: nil, rate_limit: 0.5)
63
72
  path = "/finances/v0/financialEventGroups/#{event_group_id}/financialEvents"
64
73
  params = {
65
74
  "MaxResultsPerPage" => max_results_per_page,
@@ -68,44 +77,49 @@ module Peddler
68
77
  "NextToken" => next_token,
69
78
  }.compact
70
79
 
71
- rate_limit(0.5).get(path, params:)
80
+ meter(rate_limit).get(path, params:)
72
81
  end
73
82
 
74
83
  # Returns all financial events for the specified order. It may take up to 48 hours for orders to appear in your
75
84
  # financial events.
76
85
  #
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
86
+ # @note This operation can make a static sandbox call.
87
+ # @param order_id [String] An Amazon-defined order identifier, in 3-7-7 format.
88
+ # @param max_results_per_page [Integer] The maximum number of results to return per page. If the response exceeds
79
89
  # 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)
90
+ # @param next_token [String] A string token returned in the response of your previous request.
91
+ # @param rate_limit [Float] Requests per second
92
+ # @return [Peddler::Response] The API response
93
+ def list_financial_events_by_order_id(order_id, max_results_per_page: 100, next_token: nil, rate_limit: 0.5)
83
94
  path = "/finances/v0/orders/#{order_id}/financialEvents"
84
95
  params = {
85
96
  "MaxResultsPerPage" => max_results_per_page,
86
97
  "NextToken" => next_token,
87
98
  }.compact
88
99
 
89
- rate_limit(0.5).get(path, params:)
100
+ meter(rate_limit).get(path, params:)
90
101
  end
91
102
 
92
103
  # 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.
104
+ # financial events. **Note:** in `ListFinancialEvents`, deferred events don't show up in responses until in they
105
+ # are released.
95
106
  #
96
- # @param [Integer] max_results_per_page The maximum number of results to return per page. If the response exceeds
107
+ # @note This operation can make a static sandbox call.
108
+ # @param max_results_per_page [Integer] The maximum number of results to return per page. If the response exceeds
97
109
  # 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.
110
+ # @param posted_after [String] A date used for selecting financial events posted after (or at) a specified time.
99
111
  # The date-time must be no later than two minutes before the request was submitted, in [ISO
100
112
  # 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
113
+ # @param posted_before [String] A date used for selecting financial events posted before (but not at) a specified
102
114
  # time. The date-time must be later than PostedAfter and no later than two minutes before the request was
103
115
  # submitted, in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date time format. If
104
116
  # PostedAfter and PostedBefore are more than 180 days apart, no financial events are returned. You must specify
105
117
  # 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)
118
+ # @param next_token [String] A string token returned in the response of your previous request.
119
+ # @param rate_limit [Float] Requests per second
120
+ # @return [Peddler::Response] The API response
121
+ def list_financial_events(max_results_per_page: 100, posted_after: nil, posted_before: nil, next_token: nil,
122
+ rate_limit: 0.5)
109
123
  path = "/finances/v0/financialEvents"
110
124
  params = {
111
125
  "MaxResultsPerPage" => max_results_per_page,
@@ -114,7 +128,7 @@ module Peddler
114
128
  "NextToken" => next_token,
115
129
  }.compact
116
130
 
117
- rate_limit(0.5).get(path, params:)
131
+ meter(rate_limit).get(path, params:)
118
132
  end
119
133
  end
120
134
  end