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 notifications_v1(...)
8
+ APIs::NotificationsV1.new(...)
9
+ end
10
+ end
11
+
12
+ module APIs
7
13
  # Selling Partner API for Notifications
8
14
  #
9
15
  # The Selling Partner API for Notifications lets you subscribe to notifications that are relevant to a selling
@@ -16,15 +22,19 @@ module Peddler
16
22
  # subscription's information. You can use this API to get subscription information when you do not have a
17
23
  # subscription identifier.
18
24
  #
19
- # @param [String] payload_version The version of the payload object to be used in the notification.
20
- # @return [Hash] The API response
21
- def get_subscription(payload_version: nil)
25
+ # @note This operation can make a static sandbox call.
26
+ # @param payload_version [String] The version of the payload object to be used in the notification.
27
+ # @param rate_limit [Float] Requests per second
28
+ # @param notification_type [String] The type of notification. For more information about notification types, refer
29
+ # to [Notification Type Values](https://developer-docs.amazon.com/sp-api/docs/notification-type-values).
30
+ # @return [Peddler::Response] The API response
31
+ def get_subscription(notification_type, payload_version: nil, rate_limit: 1.0)
22
32
  path = "/notifications/v1/subscriptions/#{notification_type}"
23
33
  params = {
24
34
  "payloadVersion" => payload_version,
25
35
  }.compact
26
36
 
27
- rate_limit(1.0).get(path, params:)
37
+ meter(rate_limit).get(path, params:)
28
38
  end
29
39
 
30
40
  # Creates a subscription for the specified notification type to be delivered to the specified destination. Before
@@ -32,24 +42,32 @@ module Peddler
32
42
  # where the specified notification type supports multiple payload versions, you can utilize this API to subscribe
33
43
  # to a different payload version if you already have an existing subscription for a different payload version.
34
44
  #
35
- # @param [Hash] body
36
- # @return [Hash] The API response
37
- def create_subscription(body)
45
+ # @note This operation can make a static sandbox call.
46
+ # @param body [Hash]
47
+ # @param rate_limit [Float] Requests per second
48
+ # @param notification_type [String] The type of notification. For more information about notification types, refer
49
+ # to [Notification Type Values](https://developer-docs.amazon.com/sp-api/docs/notification-type-values).
50
+ # @return [Peddler::Response] The API response
51
+ def create_subscription(body, notification_type, rate_limit: 1.0)
38
52
  path = "/notifications/v1/subscriptions/#{notification_type}"
39
53
 
40
- rate_limit(1.0).post(path, body:)
54
+ meter(rate_limit).post(path, body:)
41
55
  end
42
56
 
43
57
  # Returns information about a subscription for the specified notification type. The `getSubscriptionById`
44
58
  # operation is grantless. For more information, refer to [Grantless
45
59
  # operations](https://developer-docs.amazon.com/sp-api/docs/grantless-operations).
46
60
  #
47
- # @param [String] subscription_id The identifier for the subscription that you want to get.
48
- # @return [Hash] The API response
49
- def get_subscription_by_id(subscription_id)
61
+ # @note This operation can make a static sandbox call.
62
+ # @param subscription_id [String] The identifier for the subscription that you want to get.
63
+ # @param rate_limit [Float] Requests per second
64
+ # @param notification_type [String] The type of notification. For more information about notification types, refer
65
+ # to [Notification Type Values](https://developer-docs.amazon.com/sp-api/docs/notification-type-values).
66
+ # @return [Peddler::Response] The API response
67
+ def get_subscription_by_id(subscription_id, notification_type, rate_limit: 1.0)
50
68
  path = "/notifications/v1/subscriptions/#{notification_type}/#{subscription_id}"
51
69
 
52
- rate_limit(1.0).get(path)
70
+ meter(rate_limit).get(path)
53
71
  end
54
72
 
55
73
  # Deletes the subscription indicated by the subscription identifier and notification type that you specify. The
@@ -58,56 +76,69 @@ module Peddler
58
76
  # `deleteSubscriptionById` operation is grantless. For more information, refer to [Grantless
59
77
  # operations](https://developer-docs.amazon.com/sp-api/docs/grantless-operations).
60
78
  #
61
- # @param [String] subscription_id The identifier for the subscription that you want to delete.
62
- # @return [Hash] The API response
63
- def delete_subscription_by_id(subscription_id)
79
+ # @note This operation can make a static sandbox call.
80
+ # @param subscription_id [String] The identifier for the subscription that you want to delete.
81
+ # @param rate_limit [Float] Requests per second
82
+ # @param notification_type [String] The type of notification. For more information about notification types, refer
83
+ # to [Notification Type Values](https://developer-docs.amazon.com/sp-api/docs/notification-type-values).
84
+ # @return [Peddler::Response] The API response
85
+ def delete_subscription_by_id(subscription_id, notification_type, rate_limit: 1.0)
64
86
  path = "/notifications/v1/subscriptions/#{notification_type}/#{subscription_id}"
65
87
 
66
- rate_limit(1.0).delete(path)
88
+ meter(rate_limit).delete(path)
67
89
  end
68
90
 
69
91
  # Returns information about all destinations. The `getDestinations` operation is grantless. For more information,
70
92
  # refer to [Grantless operations](https://developer-docs.amazon.com/sp-api/docs/grantless-operations).
71
- # @return [Hash] The API response
72
- def get_destinations
93
+ #
94
+ # @note This operation can make a static sandbox call.
95
+ # @param rate_limit [Float] Requests per second
96
+ # @return [Peddler::Response] The API response
97
+ def get_destinations(rate_limit: 1.0)
73
98
  path = "/notifications/v1/destinations"
74
99
 
75
- rate_limit(1.0).get(path)
100
+ meter(rate_limit).get(path)
76
101
  end
77
102
 
78
103
  # Creates a destination resource to receive notifications. The `createDestination` operation is grantless. For
79
104
  # more information, refer to [Grantless
80
105
  # operations](https://developer-docs.amazon.com/sp-api/docs/grantless-operations).
81
106
  #
82
- # @param [Hash] body
83
- # @return [Hash] The API response
84
- def create_destination(body)
107
+ # @note This operation can make a static sandbox call.
108
+ # @param body [Hash]
109
+ # @param rate_limit [Float] Requests per second
110
+ # @return [Peddler::Response] The API response
111
+ def create_destination(body, rate_limit: 1.0)
85
112
  path = "/notifications/v1/destinations"
86
113
 
87
- rate_limit(1.0).post(path, body:)
114
+ meter(rate_limit).post(path, body:)
88
115
  end
89
116
 
90
117
  # Returns information about the destination that you specify. The `getDestination` operation is grantless. For
91
118
  # more information, refer to [Grantless
92
119
  # operations](https://developer-docs.amazon.com/sp-api/docs/grantless-operations).
93
120
  #
94
- # @param [String] destination_id The identifier generated when you created the destination.
95
- # @return [Hash] The API response
96
- def get_destination(destination_id)
121
+ # @note This operation can make a static sandbox call.
122
+ # @param destination_id [String] The identifier generated when you created the destination.
123
+ # @param rate_limit [Float] Requests per second
124
+ # @return [Peddler::Response] The API response
125
+ def get_destination(destination_id, rate_limit: 1.0)
97
126
  path = "/notifications/v1/destinations/#{destination_id}"
98
127
 
99
- rate_limit(1.0).get(path)
128
+ meter(rate_limit).get(path)
100
129
  end
101
130
 
102
131
  # Deletes the destination that you specify. The `deleteDestination` operation is grantless. For more information,
103
132
  # refer to [Grantless operations](https://developer-docs.amazon.com/sp-api/docs/grantless-operations).
104
133
  #
105
- # @param [String] destination_id The identifier for the destination that you want to delete.
106
- # @return [Hash] The API response
107
- def delete_destination(destination_id)
134
+ # @note This operation can make a static sandbox call.
135
+ # @param destination_id [String] The identifier for the destination that you want to delete.
136
+ # @param rate_limit [Float] Requests per second
137
+ # @return [Peddler::Response] The API response
138
+ def delete_destination(destination_id, rate_limit: 1.0)
108
139
  path = "/notifications/v1/destinations/#{destination_id}"
109
140
 
110
- rate_limit(1.0).delete(path)
141
+ meter(rate_limit).delete(path)
111
142
  end
112
143
  end
113
144
  end
@@ -3,8 +3,14 @@
3
3
  require "peddler/api"
4
4
 
5
5
  module Peddler
6
- class API
7
- # Selling Partner API for Orders
6
+ class << self
7
+ def orders_v0(...)
8
+ APIs::OrdersV0.new(...)
9
+ end
10
+ end
11
+
12
+ module APIs
13
+ # Orders v0
8
14
  #
9
15
  # Use the Orders Selling Partner API to programmatically retrieve order information. With this API, you can develop
10
16
  # fast, flexible, and custom applications to manage order synchronization, perform order research, and create
@@ -16,29 +22,30 @@ module Peddler
16
22
  # types of orders, you can apply filters to your request. `NextToken` doesn't affect any filters that you include
17
23
  # in your request; it only impacts the pagination for the filtered orders response.
18
24
  #
19
- # @param [String] created_after Use this date to select orders created after (or at) a specified time. Only orders
25
+ # @note This operation can make a static sandbox call.
26
+ # @param created_after [String] Use this date to select orders created after (or at) a specified time. Only orders
20
27
  # placed after the specified time are returned. The date must be in [ISO
21
28
  # 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) format. **Note**: Either the `CreatedAfter`
22
29
  # parameter or the `LastUpdatedAfter` parameter is required. Both cannot be empty. `LastUpdatedAfter` and
23
30
  # `LastUpdatedBefore` cannot be set when `CreatedAfter` is set.
24
- # @param [String] created_before Use this date to select orders created before (or at) a specified time. Only
31
+ # @param created_before [String] Use this date to select orders created before (or at) a specified time. Only
25
32
  # orders placed before the specified time are returned. The date must be in [ISO
26
33
  # 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) format. **Note**: `CreatedBefore` is optional
27
34
  # when `CreatedAfter` is set. If specified, `CreatedBefore` must be equal to or after the `CreatedAfter` date
28
35
  # and at least two minutes before current time.
29
- # @param [String] last_updated_after Use this date to select orders that were last updated after (or at) a
36
+ # @param last_updated_after [String] Use this date to select orders that were last updated after (or at) a
30
37
  # specified time. An update is defined as any change in order status, including the creation of a new order.
31
38
  # Includes updates made by Amazon and by the seller. The date must be in [ISO
32
39
  # 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) format. **Note**: Either the `CreatedAfter`
33
40
  # parameter or the `LastUpdatedAfter` parameter is required. Both cannot be empty. `CreatedAfter` or
34
41
  # `CreatedBefore` cannot be set when `LastUpdatedAfter` is set.
35
- # @param [String] last_updated_before Use this date to select orders that were last updated before (or at) a
42
+ # @param last_updated_before [String] Use this date to select orders that were last updated before (or at) a
36
43
  # specified time. An update is defined as any change in order status, including the creation of a new order.
37
44
  # Includes updates made by Amazon and by the seller. The date must be in [ISO
38
45
  # 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) format. **Note**: `LastUpdatedBefore` is
39
46
  # optional when `LastUpdatedAfter` is set. But if specified, `LastUpdatedBefore` must be equal to or after the
40
47
  # `LastUpdatedAfter` date and at least two minutes before current time.
41
- # @param [Array<String>] order_statuses A list of `OrderStatus` values used to filter the results. **Possible
48
+ # @param order_statuses [Array<String>] A list of `OrderStatus` values used to filter the results. **Possible
42
49
  # values:** - `PendingAvailability` (This status is available for pre-orders only. The order has been placed,
43
50
  # payment has not been authorized, and the release date of the item is in the future.) - `Pending` (The order
44
51
  # has been placed but payment has not been authorized.) - `Unshipped` (Payment has been authorized and the order
@@ -47,23 +54,23 @@ module Peddler
47
54
  # `InvoiceUnconfirmed` (All items in the order have been shipped. The seller has not yet given confirmation to
48
55
  # Amazon that the invoice has been shipped to the buyer.) - `Canceled` (The order has been canceled.) -
49
56
  # `Unfulfillable` (The order cannot be fulfilled. This state applies only to Multi-Channel Fulfillment orders.)
50
- # @param [Array<String>] marketplace_ids A list of `MarketplaceId` values. Used to select orders that were placed
57
+ # @param marketplace_ids [Array<String>] A list of `MarketplaceId` values. Used to select orders that were placed
51
58
  # in the specified marketplaces. Refer to [Marketplace
52
59
  # IDs](https://developer-docs.amazon.com/sp-api/docs/marketplace-ids) for a complete list of `marketplaceId`
53
60
  # values.
54
- # @param [Array<String>] fulfillment_channels A list that indicates how an order was fulfilled. Filters the
61
+ # @param fulfillment_channels [Array<String>] A list that indicates how an order was fulfilled. Filters the
55
62
  # results by fulfillment channel. **Possible values**: `AFN` (fulfilled by Amazon), `MFN` (fulfilled by seller).
56
- # @param [Array<String>] payment_methods A list of payment method values. Use this field to select orders that
63
+ # @param payment_methods [Array<String>] A list of payment method values. Use this field to select orders that
57
64
  # were paid with the specified payment methods. **Possible values**: `COD` (cash on delivery), `CVS`
58
65
  # (convenience store), `Other` (Any payment method other than COD or CVS).
59
- # @param [String] buyer_email The email address of a buyer. Used to select orders that contain the specified email
66
+ # @param buyer_email [String] The email address of a buyer. Used to select orders that contain the specified email
60
67
  # address.
61
- # @param [String] seller_order_id An order identifier that is specified by the seller. Used to select only the
68
+ # @param seller_order_id [String] An order identifier that is specified by the seller. Used to select only the
62
69
  # orders that match the order identifier. If `SellerOrderId` is specified, then `FulfillmentChannels`,
63
70
  # `OrderStatuses`, `PaymentMethod`, `LastUpdatedAfter`, LastUpdatedBefore, and `BuyerEmail` cannot be specified.
64
- # @param [Integer] max_results_per_page A number that indicates the maximum number of orders that can be returned
71
+ # @param max_results_per_page [Integer] A number that indicates the maximum number of orders that can be returned
65
72
  # per page. Value must be 1 - 100. Default 100.
66
- # @param [Array<String>] easy_ship_shipment_statuses A list of `EasyShipShipmentStatus` values. Used to select
73
+ # @param easy_ship_shipment_statuses [Array<String>] A list of `EasyShipShipmentStatus` values. Used to select
67
74
  # Easy Ship orders with statuses that match the specified values. If `EasyShipShipmentStatus` is specified, only
68
75
  # Amazon Easy Ship orders are returned. **Possible values:** - `PendingSchedule` (The package is awaiting the
69
76
  # schedule for pick-up.) - `PendingPickUp` (Amazon has not yet picked up the package from the seller.) -
@@ -76,41 +83,41 @@ module Peddler
76
83
  # seller.) - `ReturnedToSeller` (The package was not delivered and was returned to the seller.) - `Lost` (The
77
84
  # package is lost.) - `OutForDelivery` (The package is out for delivery.) - `Damaged` (The package was damaged
78
85
  # by the carrier.)
79
- # @param [Array<String>] electronic_invoice_statuses A list of `ElectronicInvoiceStatus` values. Used to select
86
+ # @param electronic_invoice_statuses [Array<String>] A list of `ElectronicInvoiceStatus` values. Used to select
80
87
  # orders with electronic invoice statuses that match the specified values. **Possible values:** - `NotRequired`
81
88
  # (Electronic invoice submission is not required for this order.) - `NotFound` (The electronic invoice was not
82
89
  # submitted for this order.) - `Processing` (The electronic invoice is being processed for this order.) -
83
90
  # `Errored` (The last submitted electronic invoice was rejected for this order.) - `Accepted` (The last
84
91
  # submitted electronic invoice was submitted and accepted.)
85
- # @param [String] next_token A string token returned in the response of your previous request.
86
- # @param [Array<String>] amazon_order_ids A list of `AmazonOrderId` values. An `AmazonOrderId` is an
92
+ # @param next_token [String] A string token returned in the response of your previous request.
93
+ # @param amazon_order_ids [Array<String>] A list of `AmazonOrderId` values. An `AmazonOrderId` is an
87
94
  # Amazon-defined order identifier, in 3-7-7 format.
88
- # @param [String] actual_fulfillment_supply_source_id The `sourceId` of the location from where you want the order
95
+ # @param actual_fulfillment_supply_source_id [String] The `sourceId` of the location from where you want the order
89
96
  # fulfilled.
90
- # @param [Boolean] is_ispu When true, this order is marked to be picked up from a store rather than delivered.
91
- # @param [String] store_chain_store_id The store chain store identifier. Linked to a specific store in a store
97
+ # @param is_ispu [Boolean] When true, this order is marked to be picked up from a store rather than delivered.
98
+ # @param store_chain_store_id [String] The store chain store identifier. Linked to a specific store in a store
92
99
  # chain.
93
- # @param [String] earliest_delivery_date_before Use this date to select orders with a earliest delivery date
100
+ # @param earliest_delivery_date_before [String] Use this date to select orders with a earliest delivery date
94
101
  # before (or at) a specified time. The date must be in [ISO
95
102
  # 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) format.
96
- # @param [String] earliest_delivery_date_after Use this date to select orders with a earliest delivery date after
103
+ # @param earliest_delivery_date_after [String] Use this date to select orders with a earliest delivery date after
97
104
  # (or at) a specified time. The date must be in [ISO
98
105
  # 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) format.
99
- # @param [String] latest_delivery_date_before Use this date to select orders with a latest delivery date before
106
+ # @param latest_delivery_date_before [String] Use this date to select orders with a latest delivery date before
100
107
  # (or at) a specified time. The date must be in [ISO
101
108
  # 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) format.
102
- # @param [String] latest_delivery_date_after Use this date to select orders with a latest delivery date after (or
109
+ # @param latest_delivery_date_after [String] Use this date to select orders with a latest delivery date after (or
103
110
  # at) a specified time. The date must be in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601)
104
111
  # format.
105
- # @return [Hash] The API response
106
- def get_orders(
107
- marketplace_ids, created_after: nil, created_before: nil, last_updated_after: nil, last_updated_before: nil,
108
- order_statuses: nil, fulfillment_channels: nil, payment_methods: nil, buyer_email: nil, seller_order_id: nil,
109
- max_results_per_page: nil, easy_ship_shipment_statuses: nil, electronic_invoice_statuses: nil, next_token: nil,
110
- amazon_order_ids: nil, actual_fulfillment_supply_source_id: nil, is_ispu: nil, store_chain_store_id: nil,
112
+ # @param rate_limit [Float] Requests per second
113
+ # @return [Peddler::Response] The API response
114
+ def get_orders(marketplace_ids, created_after: nil, created_before: nil, last_updated_after: nil,
115
+ last_updated_before: nil, order_statuses: nil, fulfillment_channels: nil, payment_methods: nil,
116
+ buyer_email: nil, seller_order_id: nil, max_results_per_page: nil, easy_ship_shipment_statuses: nil,
117
+ electronic_invoice_statuses: nil, next_token: nil, amazon_order_ids: nil,
118
+ actual_fulfillment_supply_source_id: nil, is_ispu: nil, store_chain_store_id: nil,
111
119
  earliest_delivery_date_before: nil, earliest_delivery_date_after: nil, latest_delivery_date_before: nil,
112
- latest_delivery_date_after: nil
113
- )
120
+ latest_delivery_date_after: nil, rate_limit: 0.0167)
114
121
  path = "/orders/v0/orders"
115
122
  params = {
116
123
  "CreatedAfter" => created_after,
@@ -137,47 +144,43 @@ module Peddler
137
144
  "LatestDeliveryDateAfter" => latest_delivery_date_after,
138
145
  }.compact
139
146
 
140
- rate_limit(0.0167).get(path, params:)
147
+ meter(rate_limit).get(path, params:)
141
148
  end
142
149
 
143
150
  # Returns the order that you specify.
144
151
  #
145
- # @param [String] order_id An Amazon-defined order identifier, in 3-7-7 format.
146
- # @return [Hash] The API response
147
- def get_order(order_id)
152
+ # @note This operation can make a static sandbox call.
153
+ # @param order_id [String] An Amazon-defined order identifier, in 3-7-7 format.
154
+ # @param rate_limit [Float] Requests per second
155
+ # @return [Peddler::Response] The API response
156
+ def get_order(order_id, rate_limit: 0.5)
148
157
  path = "/orders/v0/orders/#{order_id}"
149
158
 
150
- rate_limit(0.5).get(path)
159
+ meter(rate_limit).get(path)
151
160
  end
152
161
 
153
162
  # Returns buyer information for the order that you specify.
154
163
  #
155
- # @param [String] order_id An `orderId` is an Amazon-defined order identifier, in 3-7-7 format.
156
- # @return [Hash] The API response
157
- def get_order_buyer_info(order_id)
164
+ # @note This operation can make a static sandbox call.
165
+ # @param order_id [String] An `orderId` is an Amazon-defined order identifier, in 3-7-7 format.
166
+ # @param rate_limit [Float] Requests per second
167
+ # @return [Peddler::Response] The API response
168
+ def get_order_buyer_info(order_id, rate_limit: 0.5)
158
169
  path = "/orders/v0/orders/#{order_id}/buyerInfo"
159
170
 
160
- rate_limit(0.5).get(path)
171
+ meter(rate_limit).get(path)
161
172
  end
162
173
 
163
174
  # Returns the shipping address for the order that you specify.
164
175
  #
165
- # @param [String] order_id An `orderId` is an Amazon-defined order identifier, in 3-7-7 format.
166
- # @return [Hash] The API response
167
- def get_order_address(order_id)
176
+ # @note This operation can make a static sandbox call.
177
+ # @param order_id [String] An `orderId` is an Amazon-defined order identifier, in 3-7-7 format.
178
+ # @param rate_limit [Float] Requests per second
179
+ # @return [Peddler::Response] The API response
180
+ def get_order_address(order_id, rate_limit: 0.5)
168
181
  path = "/orders/v0/orders/#{order_id}/address"
169
182
 
170
- rate_limit(0.5).get(path)
171
- end
172
-
173
- # Returns the fulfillment instructions for the order that you specify.
174
- #
175
- # @param [String] order_id An Amazon-defined order identifier, in 3-7-7 format.
176
- # @return [Hash] The API response
177
- def get_order_fulfillment_instructions(order_id)
178
- path = "/orders/v0/orders/#{order_id}/fulfillmentInstructions"
179
-
180
- rate_limit(0.5).get(path)
183
+ meter(rate_limit).get(path)
181
184
  end
182
185
 
183
186
  # Returns detailed order item information for the order that you specify. If `NextToken` is provided, it's used to
@@ -188,76 +191,88 @@ module Peddler
188
191
  # Shipped, or Shipped state, the getOrderItems operation returns information about pricing, taxes, shipping
189
192
  # charges, gift status and promotions for the order items in the order.
190
193
  #
191
- # @param [String] order_id An Amazon-defined order identifier, in 3-7-7 format.
192
- # @param [String] next_token A string token returned in the response of your previous request.
193
- # @return [Hash] The API response
194
- def get_order_items(order_id, next_token: nil)
194
+ # @note This operation can make a static sandbox call.
195
+ # @param order_id [String] An Amazon-defined order identifier, in 3-7-7 format.
196
+ # @param next_token [String] A string token returned in the response of your previous request.
197
+ # @param rate_limit [Float] Requests per second
198
+ # @return [Peddler::Response] The API response
199
+ def get_order_items(order_id, next_token: nil, rate_limit: 0.5)
195
200
  path = "/orders/v0/orders/#{order_id}/orderItems"
196
201
  params = {
197
202
  "NextToken" => next_token,
198
203
  }.compact
199
204
 
200
- rate_limit(0.5).get(path, params:)
205
+ meter(rate_limit).get(path, params:)
201
206
  end
202
207
 
203
208
  # Returns buyer information for the order items in the order that you specify.
204
209
  #
205
- # @param [String] order_id An Amazon-defined order identifier, in 3-7-7 format.
206
- # @param [String] next_token A string token returned in the response of your previous request.
207
- # @return [Hash] The API response
208
- def get_order_items_buyer_info(order_id, next_token: nil)
210
+ # @note This operation can make a static sandbox call.
211
+ # @param order_id [String] An Amazon-defined order identifier, in 3-7-7 format.
212
+ # @param next_token [String] A string token returned in the response of your previous request.
213
+ # @param rate_limit [Float] Requests per second
214
+ # @return [Peddler::Response] The API response
215
+ def get_order_items_buyer_info(order_id, next_token: nil, rate_limit: 0.5)
209
216
  path = "/orders/v0/orders/#{order_id}/orderItems/buyerInfo"
210
217
  params = {
211
218
  "NextToken" => next_token,
212
219
  }.compact
213
220
 
214
- rate_limit(0.5).get(path, params:)
221
+ meter(rate_limit).get(path, params:)
215
222
  end
216
223
 
217
224
  # Update the shipment status for an order that you specify.
218
225
  #
219
- # @param [String] order_id An Amazon-defined order identifier, in 3-7-7 format.
220
- # @param [Hash] payload The request body for the `updateShipmentStatus` operation.
221
- # @return [Hash] The API response
222
- def update_shipment_status(order_id, payload)
226
+ # @note This operation can make a static sandbox call.
227
+ # @param order_id [String] An Amazon-defined order identifier, in 3-7-7 format.
228
+ # @param payload [Hash] The request body for the `updateShipmentStatus` operation.
229
+ # @param rate_limit [Float] Requests per second
230
+ # @return [Peddler::Response] The API response
231
+ def update_shipment_status(order_id, payload, rate_limit: 5.0)
223
232
  path = "/orders/v0/orders/#{order_id}/shipment"
224
233
  body = payload
225
234
 
226
- rate_limit(5.0).post(path, body:)
235
+ meter(rate_limit).post(path, body:)
227
236
  end
228
237
 
229
238
  # Returns regulated information for the order that you specify.
230
239
  #
231
- # @param [String] order_id An Amazon-defined order identifier, in 3-7-7 format.
232
- # @return [Hash] The API response
233
- def get_order_regulated_info(order_id)
240
+ # @note This operation can make a static sandbox call.
241
+ # @param order_id [String] An Amazon-defined order identifier, in 3-7-7 format.
242
+ # @param rate_limit [Float] Requests per second
243
+ # @return [Peddler::Response] The API response
244
+ def get_order_regulated_info(order_id, rate_limit: 0.5)
234
245
  path = "/orders/v0/orders/#{order_id}/regulatedInfo"
235
246
 
236
- rate_limit(0.5).get(path)
247
+ meter(rate_limit).get(path)
237
248
  end
238
249
 
239
250
  # Updates (approves or rejects) the verification status of an order containing regulated products.
240
251
  #
241
- # @param [String] order_id An Amazon-defined order identifier, in 3-7-7 format.
242
- # @param [Hash] payload The request body for the `updateVerificationStatus` operation.
243
- # @return [Hash] The API response
244
- def update_verification_status(order_id, payload)
252
+ # @note This operation can make a static sandbox call.
253
+ # @param order_id [String] An Amazon-defined order identifier, in 3-7-7 format.
254
+ # @param payload [Hash] The request body for the `updateVerificationStatus` operation.
255
+ # @param rate_limit [Float] Requests per second
256
+ # @return [Peddler::Response] The API response
257
+ def update_verification_status(order_id, payload, rate_limit: 0.5)
245
258
  path = "/orders/v0/orders/#{order_id}/regulatedInfo"
246
259
  body = payload
247
260
 
248
- rate_limit(0.5).patch(path, body:)
261
+ meter(rate_limit).patch(path, body:)
249
262
  end
250
263
 
251
264
  # Updates the shipment confirmation status for a specified order.
252
265
  #
253
- # @param [String] order_id An Amazon-defined order identifier, in 3-7-7 format.
254
- # @param [Hash] payload Request body of `confirmShipment`.
255
- # @return [Hash] The API response
256
- def confirm_shipment(order_id, payload)
266
+ # @note This operation can make a static sandbox call.
267
+ # @param order_id [String] An Amazon-defined order identifier, in 3-7-7 format.
268
+ # @param payload [Hash] Request body of `confirmShipment`.
269
+ # @param rate_limit [Float] Requests per second
270
+ # @return [Peddler::Response] The API response
271
+ def confirm_shipment(order_id, payload, rate_limit: 2.0)
257
272
  path = "/orders/v0/orders/#{order_id}/shipmentConfirmation"
258
273
  body = payload
259
274
 
260
- rate_limit(2.0).post(path, body:)
275
+ meter(rate_limit).post(path, body:)
261
276
  end
262
277
  end
263
278
  end
@@ -0,0 +1,77 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "peddler/api"
4
+
5
+ module Peddler
6
+ class << self
7
+ def product_fees_v0(...)
8
+ APIs::ProductFeesV0.new(...)
9
+ end
10
+ end
11
+
12
+ module APIs
13
+ # Selling Partner API for Product Fees
14
+ #
15
+ # The Selling Partner API for Product Fees lets you programmatically retrieve estimated fees for a product. You can
16
+ # then account for those fees in your pricing.
17
+ class ProductFeesV0 < API
18
+ # Returns the estimated fees for the item indicated by the specified seller SKU in the marketplace specified in
19
+ # the request body. **Note:** The parameters associated with this operation may contain special characters that
20
+ # require URL encoding to call the API. To avoid errors with SKUs when encoding URLs, refer to [URL
21
+ # Encoding](https://developer-docs.amazon.com/sp-api/docs/url-encoding). You can call `getMyFeesEstimateForSKU`
22
+ # for an item on behalf of a selling partner before the selling partner sets the item's price. The selling partner
23
+ # can then take any estimated fees into account. Each fees estimate request must include an original identifier.
24
+ # This identifier is included in the fees estimate so that you can correlate a fees estimate with the original
25
+ # request. **Note:** This identifier value is used to identify an estimate. Actual costs may vary. Search "fees"
26
+ # in [Seller Central](https://sellercentral.amazon.com/) and consult the store-specific fee schedule for the most
27
+ # up-to-date information. **Note:** When sellers use the `getMyFeesEstimateForSKU` operation with their
28
+ # `SellerSKU`, they get accurate fees based on real item measurements, but only after they've sent their items to
29
+ # Amazon.
30
+ #
31
+ # @note This operation can make a static sandbox call.
32
+ # @param body [Hash]
33
+ # @param seller_sku [String] Used to identify an item in the given marketplace. SellerSKU is qualified by the
34
+ # seller's SellerId, which is included with every operation that you submit.
35
+ # @param rate_limit [Float] Requests per second
36
+ # @return [Peddler::Response] The API response
37
+ def get_my_fees_estimate_for_sku(body, seller_sku, rate_limit: 1.0)
38
+ path = "/products/fees/v0/listings/#{seller_sku}/feesEstimate"
39
+
40
+ meter(rate_limit).post(path, body:)
41
+ end
42
+
43
+ # Returns the estimated fees for the item indicated by the specified ASIN in the marketplace specified in the
44
+ # request body. You can call `getMyFeesEstimateForASIN` for an item on behalf of a selling partner before the
45
+ # selling partner sets the item's price. The selling partner can then take estimated fees into account. Each fees
46
+ # request must include an original identifier. This identifier is included in the fees estimate so you can
47
+ # correlate a fees estimate with the original request. **Note:** This identifier value is used to identify an
48
+ # estimate. Actual costs may vary. Search "fees" in [Seller Central](https://sellercentral.amazon.com/) and
49
+ # consult the store-specific fee schedule for the most up-to-date information. **Note:** When using the
50
+ # `getMyFeesEstimateForASIN` operation with an ASIN, the fee estimates might be different. This is because these
51
+ # estimates use the item's catalog size, which might not always match the actual size of the item sent to Amazon.
52
+ #
53
+ # @note This operation can make a static sandbox call.
54
+ # @param body [Hash]
55
+ # @param asin [String] The Amazon Standard Identification Number (ASIN) of the item.
56
+ # @param rate_limit [Float] Requests per second
57
+ # @return [Peddler::Response] The API response
58
+ def get_my_fees_estimate_for_asin(body, asin, rate_limit: 1.0)
59
+ path = "/products/fees/v0/items/#{asin}/feesEstimate"
60
+
61
+ meter(rate_limit).post(path, body:)
62
+ end
63
+
64
+ # Returns the estimated fees for a list of products.
65
+ #
66
+ # @note This operation can make a static sandbox call.
67
+ # @param body [Hash]
68
+ # @param rate_limit [Float] Requests per second
69
+ # @return [Peddler::Response] The API response
70
+ def get_my_fees_estimates(body, rate_limit: 0.5)
71
+ path = "/products/fees/v0/feesEstimate"
72
+
73
+ meter(rate_limit).post(path, body:)
74
+ end
75
+ end
76
+ end
77
+ end