peddler 3.0.0 → 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 (67) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +14 -6
  3. data/lib/peddler/api.rb +28 -13
  4. data/lib/peddler/{api → apis}/amazon_warehousing_and_distribution_2024_05_09.rb +5 -5
  5. data/lib/peddler/{api → apis}/aplus_content_2020_11_01.rb +12 -12
  6. data/lib/peddler/{api → apis}/application_integrations_2024_04_01.rb +5 -5
  7. data/lib/peddler/{api → apis}/application_management_2023_11_30.rb +3 -3
  8. data/lib/peddler/{api → apis}/catalog_items_2020_12_01.rb +4 -4
  9. data/lib/peddler/{api → apis}/catalog_items_2022_04_01.rb +5 -5
  10. data/lib/peddler/{api → apis}/catalog_items_v0.rb +5 -5
  11. data/lib/peddler/{api → apis}/data_kiosk_2023_11_15.rb +7 -7
  12. data/lib/peddler/{api → apis}/easy_ship_2022_03_23.rb +20 -21
  13. data/lib/peddler/{api → apis}/fba_inbound_eligibility_v1.rb +3 -3
  14. data/lib/peddler/{api → apis}/fba_inventory_v1.rb +6 -6
  15. data/lib/peddler/{api → apis}/feeds_2021_06_30.rb +12 -9
  16. data/lib/peddler/{api → apis}/finances_2024_06_19.rb +3 -3
  17. data/lib/peddler/apis/finances_v0.rb +135 -0
  18. data/lib/peddler/{api → apis}/fulfillment_inbound_2024_03_20.rb +84 -54
  19. data/lib/peddler/{api → apis}/fulfillment_inbound_v0.rb +27 -20
  20. data/lib/peddler/{api → apis}/fulfillment_outbound_2020_07_01.rb +16 -16
  21. data/lib/peddler/{api → apis}/invoices_2024_06_19.rb +9 -9
  22. data/lib/peddler/{api → apis}/listings_items_2020_09_01.rb +5 -5
  23. data/lib/peddler/{api → apis}/listings_items_2021_08_01.rb +7 -41
  24. data/lib/peddler/{api → apis}/listings_restrictions_2021_08_01.rb +3 -3
  25. data/lib/peddler/{api → apis}/merchant_fulfillment_v0.rb +14 -14
  26. data/lib/peddler/{api → apis}/messaging_v1.rb +15 -15
  27. data/lib/peddler/{api → apis}/notifications_v1.rb +10 -10
  28. data/lib/peddler/{api → apis}/orders_v0.rb +13 -13
  29. data/lib/peddler/{api → apis}/product_fees_v0.rb +5 -5
  30. data/lib/peddler/{api → apis}/product_pricing_2022_05_01.rb +8 -8
  31. data/lib/peddler/{api → apis}/product_pricing_v0.rb +8 -8
  32. data/lib/peddler/{api → apis}/product_type_definitions_2020_09_01.rb +4 -4
  33. data/lib/peddler/{api → apis}/replenishment_2022_11_07.rb +5 -5
  34. data/lib/peddler/{api → apis}/reports_2021_06_30.rb +12 -12
  35. data/lib/peddler/{api → apis}/sales_v1.rb +3 -3
  36. data/lib/peddler/{api → apis}/sellers_v1.rb +4 -4
  37. data/lib/peddler/{api → apis}/services_v1.rb +19 -19
  38. data/lib/peddler/{api → apis}/shipment_invoicing_v0.rb +5 -5
  39. data/lib/peddler/{api → apis}/shipping_v1.rb +11 -11
  40. data/lib/peddler/{api → apis}/shipping_v2.rb +19 -19
  41. data/lib/peddler/{api → apis}/solicitations_v1.rb +4 -4
  42. data/lib/peddler/{api → apis}/supply_sources_2020_07_01.rb +8 -8
  43. data/lib/peddler/{api → apis}/tokens_2021_03_01.rb +3 -3
  44. data/lib/peddler/{api → apis}/uploads_2020_11_01.rb +3 -3
  45. data/lib/peddler/{api → apis}/vendor_direct_fulfillment_inventory_v1.rb +4 -4
  46. data/lib/peddler/{api → apis}/vendor_direct_fulfillment_orders_2021_12_28.rb +5 -5
  47. data/lib/peddler/{api → apis}/vendor_direct_fulfillment_orders_v1.rb +6 -6
  48. data/lib/peddler/{api → apis}/vendor_direct_fulfillment_payments_v1.rb +4 -4
  49. data/lib/peddler/{api → apis}/vendor_direct_fulfillment_sandbox_test_data_2021_10_28.rb +9 -9
  50. data/lib/peddler/{api → apis}/vendor_direct_fulfillment_shipping_2021_12_28.rb +17 -17
  51. data/lib/peddler/{api → apis}/vendor_direct_fulfillment_shipping_v1.rb +30 -30
  52. data/lib/peddler/{api → apis}/vendor_direct_fulfillment_transactions_2021_12_28.rb +4 -4
  53. data/lib/peddler/{api → apis}/vendor_direct_fulfillment_transactions_v1.rb +4 -4
  54. data/lib/peddler/{api → apis}/vendor_invoices_v1.rb +4 -4
  55. data/lib/peddler/{api → apis}/vendor_orders_v1.rb +7 -7
  56. data/lib/peddler/{api → apis}/vendor_shipments_v1.rb +6 -6
  57. data/lib/peddler/{api → apis}/vendor_transaction_status_v1.rb +3 -3
  58. data/lib/peddler/endpoint.rb +2 -2
  59. data/lib/peddler/error.rb +21 -12
  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 +46 -2
  63. data/lib/peddler/response.rb +46 -0
  64. data/lib/peddler/version.rb +1 -1
  65. data/lib/peddler.rb +54 -55
  66. metadata +59 -56
  67. data/lib/peddler/api/finances_v0.rb +0 -148
@@ -5,11 +5,11 @@ require "peddler/api"
5
5
  module Peddler
6
6
  class << self
7
7
  def fba_inbound_eligibility_v1(...)
8
- API::FBAInboundEligibilityV1.new(...)
8
+ APIs::FBAInboundEligibilityV1.new(...)
9
9
  end
10
10
  end
11
11
 
12
- class API
12
+ module APIs
13
13
  # Selling Partner API for FBA Inbound Eligibilty
14
14
  #
15
15
  # With the FBA Inbound Eligibility API, you can build applications that let sellers get eligibility previews for
@@ -28,7 +28,7 @@ module Peddler
28
28
  # @param asin [String] The ASIN of the item for which you want an eligibility preview.
29
29
  # @param program [String] The program that you want to check eligibility against.
30
30
  # @param rate_limit [Float] Requests per second
31
- # @return [Hash] The API response
31
+ # @return [Peddler::Response] The API response
32
32
  def get_item_eligibility_preview(asin, program, marketplace_ids: nil, rate_limit: 1.0)
33
33
  path = "/fba/inbound/v1/eligibility/itemPreview"
34
34
  params = {
@@ -5,11 +5,11 @@ require "peddler/api"
5
5
  module Peddler
6
6
  class << self
7
7
  def fba_inventory_v1(...)
8
- API::FBAInventoryV1.new(...)
8
+ APIs::FBAInventoryV1.new(...)
9
9
  end
10
10
  end
11
11
 
12
- class API
12
+ module APIs
13
13
  # Selling Partner API for FBA Inventory
14
14
  #
15
15
  # The Selling Partner API for FBA Inventory lets you programmatically retrieve information about inventory in
@@ -44,7 +44,7 @@ module Peddler
44
44
  # @param marketplace_ids [Array<String>] The marketplace ID for the marketplace for which to return inventory
45
45
  # summaries.
46
46
  # @param rate_limit [Float] Requests per second
47
- # @return [Hash] The API response
47
+ # @return [Peddler::Response] The API response
48
48
  def get_inventory_summaries(granularity_type, granularity_id, marketplace_ids, details: nil, start_date_time: nil,
49
49
  seller_skus: nil, seller_sku: nil, next_token: nil, rate_limit: 2.0)
50
50
  path = "/fba/inventory/v1/summaries"
@@ -69,7 +69,7 @@ module Peddler
69
69
  # @note This operation can make a dynamic sandbox call.
70
70
  # @param create_inventory_item_request_body [Hash] CreateInventoryItem Request Body Parameter.
71
71
  # @param rate_limit [Float] Requests per second
72
- # @return [Hash] The API response
72
+ # @return [Peddler::Response] The API response
73
73
  def create_inventory_item(create_inventory_item_request_body, rate_limit: nil)
74
74
  must_sandbox!
75
75
 
@@ -87,7 +87,7 @@ module Peddler
87
87
  # @param seller_sku [String] A single seller SKU used for querying the specified seller SKU inventory summaries.
88
88
  # @param marketplace_id [String] The marketplace ID for the marketplace for which the sellerSku is to be deleted.
89
89
  # @param rate_limit [Float] Requests per second
90
- # @return [Hash] The API response
90
+ # @return [Peddler::Response] The API response
91
91
  def delete_inventory_item(seller_sku, marketplace_id, rate_limit: nil)
92
92
  must_sandbox!
93
93
 
@@ -108,7 +108,7 @@ module Peddler
108
108
  # @param x_amzn_idempotency_token [String] A unique token/requestId provided with each call to ensure idempotency.
109
109
  # @param add_inventory_request_body [Hash] List of items to add to Sandbox inventory.
110
110
  # @param rate_limit [Float] Requests per second
111
- # @return [Hash] The API response
111
+ # @return [Peddler::Response] The API response
112
112
  def add_inventory(x_amzn_idempotency_token, add_inventory_request_body, rate_limit: nil)
113
113
  must_sandbox!
114
114
 
@@ -1,19 +1,22 @@
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
7
  class << self
7
8
  def feeds_2021_06_30(...)
8
- API::Feeds20210630.new(...)
9
+ APIs::Feeds20210630.new(...)
9
10
  end
10
11
  end
11
12
 
12
- class API
13
- # Selling Partner API for Feeds
13
+ module APIs
14
+ # Feeds v2021-06-30
14
15
  #
15
16
  # The Selling Partner API for Feeds lets you upload data to Amazon on behalf of a selling partner.
16
17
  class Feeds20210630 < API
18
+ include Peddler::Helpers::Feeds20210630
19
+
17
20
  # Returns feed details for the feeds that match the filters that you specify.
18
21
  #
19
22
  # @note This operation can make a static sandbox call.
@@ -33,7 +36,7 @@ module Peddler
33
36
  # call the getFeeds operation and include this token as the only parameter. Specifying nextToken with any other
34
37
  # parameters will cause the request to fail.
35
38
  # @param rate_limit [Float] Requests per second
36
- # @return [Hash] The API response
39
+ # @return [Peddler::Response] The API response
37
40
  def get_feeds(feed_types: nil, marketplace_ids: nil, page_size: 10, processing_statuses: nil, created_since: nil,
38
41
  created_until: nil, next_token: nil, rate_limit: 0.0222)
39
42
  path = "/feeds/2021-06-30/feeds"
@@ -55,7 +58,7 @@ module Peddler
55
58
  # @note This operation can make a static sandbox call.
56
59
  # @param body [Hash] Information required to create the feed.
57
60
  # @param rate_limit [Float] Requests per second
58
- # @return [Hash] The API response
61
+ # @return [Peddler::Response] The API response
59
62
  def create_feed(body, rate_limit: 0.0083)
60
63
  path = "/feeds/2021-06-30/feeds"
61
64
 
@@ -71,7 +74,7 @@ module Peddler
71
74
  # @param feed_id [String] The identifier for the feed. This identifier is unique only in combination with a seller
72
75
  # ID.
73
76
  # @param rate_limit [Float] Requests per second
74
- # @return [Hash] The API response
77
+ # @return [Peddler::Response] The API response
75
78
  def cancel_feed(feed_id, rate_limit: 2.0)
76
79
  path = "/feeds/2021-06-30/feeds/#{feed_id}"
77
80
 
@@ -84,7 +87,7 @@ module Peddler
84
87
  # @param feed_id [String] The identifier for the feed. This identifier is unique only in combination with a seller
85
88
  # ID.
86
89
  # @param rate_limit [Float] Requests per second
87
- # @return [Hash] The API response
90
+ # @return [Peddler::Response] The API response
88
91
  def get_feed(feed_id, rate_limit: 2.0)
89
92
  path = "/feeds/2021-06-30/feeds/#{feed_id}"
90
93
 
@@ -99,7 +102,7 @@ module Peddler
99
102
  # @note This operation can make a static sandbox call.
100
103
  # @param body [Hash] Specifies the content type for the createFeedDocument operation.
101
104
  # @param rate_limit [Float] Requests per second
102
- # @return [Hash] The API response
105
+ # @return [Peddler::Response] The API response
103
106
  def create_feed_document(body, rate_limit: 0.5)
104
107
  path = "/feeds/2021-06-30/documents"
105
108
 
@@ -111,7 +114,7 @@ module Peddler
111
114
  # @note This operation can make a static sandbox call.
112
115
  # @param feed_document_id [String] The identifier of the feed document.
113
116
  # @param rate_limit [Float] Requests per second
114
- # @return [Hash] The API response
117
+ # @return [Peddler::Response] The API response
115
118
  def get_feed_document(feed_document_id, rate_limit: 0.0222)
116
119
  path = "/feeds/2021-06-30/documents/#{feed_document_id}"
117
120
 
@@ -5,11 +5,11 @@ require "peddler/api"
5
5
  module Peddler
6
6
  class << self
7
7
  def finances_2024_06_19(...)
8
- API::Finances20240619.new(...)
8
+ APIs::Finances20240619.new(...)
9
9
  end
10
10
  end
11
11
 
12
- class API
12
+ module APIs
13
13
  # The Selling Partner API for Finances
14
14
  #
15
15
  # The Selling Partner API for Finances provides financial information relevant to a seller's business. You can
@@ -33,7 +33,7 @@ module Peddler
33
33
  # arguments as the call that produced the token. To get a complete list, call this operation until `nextToken`
34
34
  # is null. Note that this operation can return empty pages.
35
35
  # @param rate_limit [Float] Requests per second
36
- # @return [Hash] The API response
36
+ # @return [Peddler::Response] The API response
37
37
  def list_transactions(posted_after, posted_before: nil, marketplace_id: nil, next_token: nil, rate_limit: 0.5)
38
38
  path = "/finances/2024-06-19/transactions"
39
39
  params = {
@@ -0,0 +1,135 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "peddler/api"
4
+
5
+ module Peddler
6
+ class << self
7
+ def finances_v0(...)
8
+ APIs::FinancesV0.new(...)
9
+ end
10
+ end
11
+
12
+ module APIs
13
+ # Selling Partner API for Finances
14
+ #
15
+ # The Selling Partner API for Finances helps you obtain financial information relevant to a seller's business. You
16
+ # can obtain financial events for a given order, financial event group, or date range without having to wait until a
17
+ # statement period closes. You can also obtain financial event groups for a given date range.
18
+ class FinancesV0 < API
19
+ # Returns financial event groups for a given date range. It may take up to 48 hours for orders to appear in your
20
+ # financial events.
21
+ #
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
24
+ # the maximum number of transactions or 10 MB, the API responds with 'InvalidInput'.
25
+ # @param financial_event_group_started_before [String] A date used for selecting financial event groups that
26
+ # opened before (but not at) a specified date and time, in [ISO
27
+ # 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) format. The date-time must be later than
28
+ # FinancialEventGroupStartedAfter and no later than two minutes before the request was submitted. If
29
+ # FinancialEventGroupStartedAfter and FinancialEventGroupStartedBefore are more than 180 days apart, no
30
+ # financial event groups are returned.
31
+ # @param financial_event_group_started_after [String] A date used for selecting financial event groups that opened
32
+ # after (or at) a specified date and time, in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601)
33
+ # format. The date-time must be no later than two minutes before the request was submitted.
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)
39
+ path = "/finances/v0/financialEventGroups"
40
+ params = {
41
+ "MaxResultsPerPage" => max_results_per_page,
42
+ "FinancialEventGroupStartedBefore" => financial_event_group_started_before,
43
+ "FinancialEventGroupStartedAfter" => financial_event_group_started_after,
44
+ "NextToken" => next_token,
45
+ }.compact
46
+
47
+ meter(rate_limit).get(path, params:)
48
+ end
49
+
50
+ # Returns all financial events for the specified financial event group. It may take up to 48 hours for orders to
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.
53
+ #
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
56
+ # the maximum number of transactions or 10 MB, the API responds with 'InvalidInput'.
57
+ # @param posted_after [String] A date used for selecting financial events posted after (or at) a specified time.
58
+ # The date-time **must** be more than two minutes before the time of the request, in [ISO
59
+ # 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date time format.
60
+ # @param posted_before [String] A date used for selecting financial events posted before (but not at) a specified
61
+ # time. The date-time must be later than `PostedAfter` and no later than two minutes before the request was
62
+ # submitted, in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date time format. If
63
+ # `PostedAfter` and `PostedBefore` are more than 180 days apart, no financial events are returned. You must
64
+ # specify the `PostedAfter` parameter if you specify the `PostedBefore` parameter. Default: Now minus two
65
+ # minutes.
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)
72
+ path = "/finances/v0/financialEventGroups/#{event_group_id}/financialEvents"
73
+ params = {
74
+ "MaxResultsPerPage" => max_results_per_page,
75
+ "PostedAfter" => posted_after,
76
+ "PostedBefore" => posted_before,
77
+ "NextToken" => next_token,
78
+ }.compact
79
+
80
+ meter(rate_limit).get(path, params:)
81
+ end
82
+
83
+ # Returns all financial events for the specified order. It may take up to 48 hours for orders to appear in your
84
+ # financial events.
85
+ #
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
89
+ # the maximum number of transactions or 10 MB, the API responds with 'InvalidInput'.
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)
94
+ path = "/finances/v0/orders/#{order_id}/financialEvents"
95
+ params = {
96
+ "MaxResultsPerPage" => max_results_per_page,
97
+ "NextToken" => next_token,
98
+ }.compact
99
+
100
+ meter(rate_limit).get(path, params:)
101
+ end
102
+
103
+ # Returns financial events for the specified data range. It may take up to 48 hours for orders to appear in your
104
+ # financial events. **Note:** in `ListFinancialEvents`, deferred events don't show up in responses until in they
105
+ # are released.
106
+ #
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
109
+ # the maximum number of transactions or 10 MB, the API responds with 'InvalidInput'.
110
+ # @param posted_after [String] A date used for selecting financial events posted after (or at) a specified time.
111
+ # The date-time must be no later than two minutes before the request was submitted, in [ISO
112
+ # 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date time format.
113
+ # @param posted_before [String] A date used for selecting financial events posted before (but not at) a specified
114
+ # time. The date-time must be later than PostedAfter and no later than two minutes before the request was
115
+ # submitted, in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date time format. If
116
+ # PostedAfter and PostedBefore are more than 180 days apart, no financial events are returned. You must specify
117
+ # the PostedAfter parameter if you specify the PostedBefore parameter. Default: Now minus two minutes.
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)
123
+ path = "/finances/v0/financialEvents"
124
+ params = {
125
+ "MaxResultsPerPage" => max_results_per_page,
126
+ "PostedAfter" => posted_after,
127
+ "PostedBefore" => posted_before,
128
+ "NextToken" => next_token,
129
+ }.compact
130
+
131
+ meter(rate_limit).get(path, params:)
132
+ end
133
+ end
134
+ end
135
+ end