diff --git a/bin/templates/api.rb.erb b/bin/templates/api.rb.erb index 8e805334..b2e9363b 100644 --- a/bin/templates/api.rb.erb +++ b/bin/templates/api.rb.erb @@ -28,7 +28,7 @@ module Peddler <% method_args << "params:" if operation["query_params"]&.any? %> <% if operation["rate_limit"] %> - retriable(delay: <%= 1 / operation["rate_limit"] %>, retry_statuses: [429]).<%= http_method %>(<%= method_args.join(", ") %>) + retriable(delay: <%= (1 / operation["rate_limit"]).round(1) %>, retry_statuses: [429]).<%= http_method %>(<%= method_args.join(", ") %>) <% else %> <%= http_method %>(<%= method_args.join(", ") %>) <% end %> diff --git a/lib/peddler/api/application_management_2023_11_30.rb b/lib/peddler/api/application_management_2023_11_30.rb index 1f9ff112..80ffa147 100644 --- a/lib/peddler/api/application_management_2023_11_30.rb +++ b/lib/peddler/api/application_management_2023_11_30.rb @@ -18,7 +18,7 @@ class ApplicationManagement20231130 < API def rotate_application_client_secret path = "/applications/2023-11-30/clientSecret" - retriable(delay: 59.880239520958085, retry_statuses: [429]).post(path) + retriable(delay: 59.9, retry_statuses: [429]).post(path) end end end diff --git a/lib/peddler/api/data_kiosk_2023_11_15.rb b/lib/peddler/api/data_kiosk_2023_11_15.rb index 353ed470..5c0b3bc4 100644 --- a/lib/peddler/api/data_kiosk_2023_11_15.rb +++ b/lib/peddler/api/data_kiosk_2023_11_15.rb @@ -35,7 +35,7 @@ def get_queries(processing_statuses: nil, page_size: nil, created_since: nil, cr "paginationToken" => pagination_token, }.compact - retriable(delay: 45.04504504504504, retry_statuses: [429]).get(path, params:) + retriable(delay: 45.0, retry_statuses: [429]).get(path, params:) end # Creates a Data Kiosk query request. @@ -50,7 +50,7 @@ def create_query(body) path = "/dataKiosk/2023-11-15/queries" body = body - retriable(delay: 59.880239520958085, retry_statuses: [429]).post(path, body:) + retriable(delay: 59.9, retry_statuses: [429]).post(path, body:) end # Cancels the query specified by the `queryId` parameter. Only queries with a non-terminal `processingStatus` @@ -64,7 +64,7 @@ def create_query(body) def cancel_query(query_id) path = "/dataKiosk/2023-11-15/queries/#{query_id}" - retriable(delay: 45.04504504504504, retry_statuses: [429]).delete(path) + retriable(delay: 45.0, retry_statuses: [429]).delete(path) end # Returns query details for the query specified by the `queryId` parameter. See the `createQuery` operation for @@ -86,7 +86,7 @@ def get_query(query_id) def get_document(document_id) path = "/dataKiosk/2023-11-15/documents/#{document_id}" - retriable(delay: 59.880239520958085, retry_statuses: [429]).get(path) + retriable(delay: 59.9, retry_statuses: [429]).get(path) end end end diff --git a/lib/peddler/api/feeds_2021_06_30.rb b/lib/peddler/api/feeds_2021_06_30.rb index 27af2f9a..b4ca781a 100644 --- a/lib/peddler/api/feeds_2021_06_30.rb +++ b/lib/peddler/api/feeds_2021_06_30.rb @@ -39,7 +39,7 @@ def get_feeds(feed_types: nil, marketplace_ids: nil, page_size: nil, processing_ "nextToken" => next_token, }.compact - retriable(delay: 45.04504504504504, retry_statuses: [429]).get(path, params:) + retriable(delay: 45.0, retry_statuses: [429]).get(path, params:) end # Creates a feed. Upload the contents of the feed document before calling this operation. @@ -50,7 +50,7 @@ def create_feed(body) path = "/feeds/2021-06-30/feeds" body = body - retriable(delay: 120.48192771084337, retry_statuses: [429]).post(path, body:) + retriable(delay: 120.5, retry_statuses: [429]).post(path, body:) end # Cancels the feed that you specify. Only feeds with `processingStatus=IN_QUEUE` can be cancelled. Cancelled feeds @@ -99,7 +99,7 @@ def create_feed_document(body) def get_feed_document(feed_document_id) path = "/feeds/2021-06-30/documents/#{feed_document_id}" - retriable(delay: 45.04504504504504, retry_statuses: [429]).get(path) + retriable(delay: 45.0, retry_statuses: [429]).get(path) end end end diff --git a/lib/peddler/api/orders_v0.rb b/lib/peddler/api/orders_v0.rb index 70bcdddf..1bc48248 100644 --- a/lib/peddler/api/orders_v0.rb +++ b/lib/peddler/api/orders_v0.rb @@ -138,7 +138,7 @@ def get_orders( "LatestDeliveryDateAfter" => latest_delivery_date_after, }.compact - retriable(delay: 59.880239520958085, retry_statuses: [429]).get(path, params:) + retriable(delay: 59.9, retry_statuses: [429]).get(path, params:) end # Returns the order that you specify. diff --git a/lib/peddler/api/product_pricing_2022_05_01.rb b/lib/peddler/api/product_pricing_2022_05_01.rb index 9769279e..d6b6df97 100644 --- a/lib/peddler/api/product_pricing_2022_05_01.rb +++ b/lib/peddler/api/product_pricing_2022_05_01.rb @@ -24,7 +24,7 @@ def get_featured_offer_expected_price_batch(get_featured_offer_expected_price_ba path = "/batches/products/pricing/2022-05-01/offer/featuredOfferExpectedPrice" body = get_featured_offer_expected_price_batch_request_body - retriable(delay: 30.3030303030303, retry_statuses: [429]).post(path, body:) + retriable(delay: 30.3, retry_statuses: [429]).post(path, body:) end # Returns the competitive summary response including featured buying options for the ASIN and `marketplaceId` @@ -36,7 +36,7 @@ def get_competitive_summary(requests) path = "/batches/products/pricing/2022-05-01/items/competitiveSummary" body = requests - retriable(delay: 30.3030303030303, retry_statuses: [429]).post(path, body:) + retriable(delay: 30.3, retry_statuses: [429]).post(path, body:) end end end diff --git a/lib/peddler/api/reports_2021_06_30.rb b/lib/peddler/api/reports_2021_06_30.rb index 664c6242..e2531578 100644 --- a/lib/peddler/api/reports_2021_06_30.rb +++ b/lib/peddler/api/reports_2021_06_30.rb @@ -42,7 +42,7 @@ def get_reports(report_types: nil, processing_statuses: nil, marketplace_ids: ni "nextToken" => next_token, }.compact - retriable(delay: 45.04504504504504, retry_statuses: [429]).get(path, params:) + retriable(delay: 45.0, retry_statuses: [429]).get(path, params:) end # Creates a report. @@ -53,7 +53,7 @@ def create_report(body) path = "/reports/2021-06-30/reports" body = body - retriable(delay: 59.880239520958085, retry_statuses: [429]).post(path, body:) + retriable(delay: 59.9, retry_statuses: [429]).post(path, body:) end # Cancels the report that you specify. Only reports with `processingStatus=IN_QUEUE` can be cancelled. Cancelled @@ -65,7 +65,7 @@ def create_report(body) def cancel_report(report_id) path = "/reports/2021-06-30/reports/#{report_id}" - retriable(delay: 45.04504504504504, retry_statuses: [429]).delete(path) + retriable(delay: 45.0, retry_statuses: [429]).delete(path) end # Returns report details (including the `reportDocumentId`, if available) for the report that you specify. @@ -90,7 +90,7 @@ def get_report_schedules(report_types) "reportTypes" => report_types, }.compact - retriable(delay: 45.04504504504504, retry_statuses: [429]).get(path, params:) + retriable(delay: 45.0, retry_statuses: [429]).get(path, params:) end # Creates a report schedule. If a report schedule with the same report type and marketplace IDs already exists, it @@ -102,7 +102,7 @@ def create_report_schedule(body) path = "/reports/2021-06-30/schedules" body = body - retriable(delay: 45.04504504504504, retry_statuses: [429]).post(path, body:) + retriable(delay: 45.0, retry_statuses: [429]).post(path, body:) end # Cancels the report schedule that you specify. @@ -113,7 +113,7 @@ def create_report_schedule(body) def cancel_report_schedule(report_schedule_id) path = "/reports/2021-06-30/schedules/#{report_schedule_id}" - retriable(delay: 45.04504504504504, retry_statuses: [429]).delete(path) + retriable(delay: 45.0, retry_statuses: [429]).delete(path) end # Returns report schedule details for the report schedule that you specify. @@ -124,7 +124,7 @@ def cancel_report_schedule(report_schedule_id) def get_report_schedule(report_schedule_id) path = "/reports/2021-06-30/schedules/##{report_schedule_id}" - retriable(delay: 45.04504504504504, retry_statuses: [429]).get(path) + retriable(delay: 45.0, retry_statuses: [429]).get(path) end # Returns the information required for retrieving a report document's contents. @@ -134,7 +134,7 @@ def get_report_schedule(report_schedule_id) def get_report_document(report_document_id) path = "/reports/2021-06-30/documents/#{report_document_id}" - retriable(delay: 59.880239520958085, retry_statuses: [429]).get(path) + retriable(delay: 59.9, retry_statuses: [429]).get(path) end end end diff --git a/lib/peddler/api/services_v1.rb b/lib/peddler/api/services_v1.rb index c4d60bdd..9f94b270 100644 --- a/lib/peddler/api/services_v1.rb +++ b/lib/peddler/api/services_v1.rb @@ -16,7 +16,7 @@ class ServicesV1 < API def get_service_job_by_service_job_id(service_job_id) path = "/service/v1/serviceJobs/#{service_job_id}" - retriable(delay: 0.05, retry_statuses: [429]).get(path) + retriable(delay: 0.1, retry_statuses: [429]).get(path) end # Cancels the service job indicated by the service job identifier specified. @@ -300,7 +300,7 @@ def get_appointment_slots(asin, store_id, marketplace_ids, start_time: nil, end_ "endTime" => end_time, }.compact - retriable(delay: 0.05, retry_statuses: [429]).get(path, params:) + retriable(delay: 0.1, retry_statuses: [429]).get(path, params:) end # Creates an upload destination. diff --git a/lib/peddler/api/shipment_invoicing_v0.rb b/lib/peddler/api/shipment_invoicing_v0.rb index 5033d8a0..e7576d75 100644 --- a/lib/peddler/api/shipment_invoicing_v0.rb +++ b/lib/peddler/api/shipment_invoicing_v0.rb @@ -18,7 +18,7 @@ class ShipmentInvoicingV0 < API def get_shipment_details(shipment_id) path = "/fba/outbound/brazil/v0/shipments/#{shipment_id}" - retriable(delay: 0.8826125330979699, retry_statuses: [429]).get(path) + retriable(delay: 0.9, retry_statuses: [429]).get(path) end # Submits a shipment invoice document for a given shipment. @@ -30,7 +30,7 @@ def submit_invoice(shipment_id, body) path = "/fba/outbound/brazil/v0/shipments/#{shipment_id}/invoice" body = body - retriable(delay: 0.8826125330979699, retry_statuses: [429]).post(path, body:) + retriable(delay: 0.9, retry_statuses: [429]).post(path, body:) end # Returns the invoice status for the shipment you specify. @@ -40,7 +40,7 @@ def submit_invoice(shipment_id, body) def get_invoice_status(shipment_id) path = "/fba/outbound/brazil/v0/shipments/#{shipment_id}/invoice/status" - retriable(delay: 0.8826125330979699, retry_statuses: [429]).get(path) + retriable(delay: 0.9, retry_statuses: [429]).get(path) end end end diff --git a/lib/peddler/api/shipping_v2.rb b/lib/peddler/api/shipping_v2.rb index e3332e8f..21aa46e7 100644 --- a/lib/peddler/api/shipping_v2.rb +++ b/lib/peddler/api/shipping_v2.rb @@ -20,7 +20,7 @@ def get_rates(body, x_amzn_shipping_business_id: nil) path = "/shipping/v2/shipments/rates" body = body - retriable(delay: 0.0125, retry_statuses: [429]).post(path, body:) + retriable(delay: 0.0, retry_statuses: [429]).post(path, body:) end # Purchases the shipping service for a shipment using the best fit service offering. Returns purchase related @@ -39,7 +39,7 @@ def direct_purchase_shipment(body, x_amzn_idempotency_key: nil, locale: nil, x_a path = "/shipping/v2/shipments/directPurchase" body = body - retriable(delay: 0.0125, retry_statuses: [429]).post(path, body:) + retriable(delay: 0.0, retry_statuses: [429]).post(path, body:) end # Purchases a shipping service and returns purchase related details and documents. Note: You must complete the @@ -57,7 +57,7 @@ def purchase_shipment(body, x_amzn_idempotency_key: nil, x_amzn_shipping_busines path = "/shipping/v2/shipments" body = body - retriable(delay: 0.0125, retry_statuses: [429]).post(path, body:) + retriable(delay: 0.0, retry_statuses: [429]).post(path, body:) end # Purchases a shipping service identifier and returns purchase-related details and documents. @@ -70,7 +70,7 @@ def one_click_shipment(body, x_amzn_shipping_business_id: nil) path = "/shipping/v2/oneClickShipment" body = body - retriable(delay: 0.0125, retry_statuses: [429]).post(path, body:) + retriable(delay: 0.0, retry_statuses: [429]).post(path, body:) end # Returns tracking information for a purchased shipment. @@ -89,7 +89,7 @@ def get_tracking(tracking_id, carrier_id, x_amzn_shipping_business_id: nil) "carrierId" => carrier_id, }.compact - retriable(delay: 0.0125, retry_statuses: [429]).get(path, params:) + retriable(delay: 0.0, retry_statuses: [429]).get(path, params:) end # Returns the shipping documents associated with a package in a shipment. @@ -113,7 +113,7 @@ def get_shipment_documents(shipment_id, package_client_reference_id, format: nil "dpi" => dpi, }.compact - retriable(delay: 0.0125, retry_statuses: [429]).get(path, params:) + retriable(delay: 0.0, retry_statuses: [429]).get(path, params:) end # Cancels a purchased shipment. Returns an empty object if the shipment is successfully cancelled. @@ -125,7 +125,7 @@ def get_shipment_documents(shipment_id, package_client_reference_id, format: nil def cancel_shipment(shipment_id, x_amzn_shipping_business_id: nil) path = "/shipping/v2/shipments/#{shipment_id}/cancel" - retriable(delay: 0.0125, retry_statuses: [429]).put(path) + retriable(delay: 0.0, retry_statuses: [429]).put(path) end # Returns the JSON schema to use for providing additional inputs when needed to purchase a shipping offering. Call @@ -145,7 +145,7 @@ def get_additional_inputs(request_token, rate_id, x_amzn_shipping_business_id: n "rateId" => rate_id, }.compact - retriable(delay: 0.0125, retry_statuses: [429]).get(path, params:) + retriable(delay: 0.0, retry_statuses: [429]).get(path, params:) end # This API will return a list of input schema required to register a shipper account with the carrier. @@ -156,7 +156,7 @@ def get_additional_inputs(request_token, rate_id, x_amzn_shipping_business_id: n def get_carrier_account_form_inputs(x_amzn_shipping_business_id: nil) path = "/shipping/v2/carrierAccountFormInputs" - retriable(delay: 0.0125, retry_statuses: [429]).get(path) + retriable(delay: 0.0, retry_statuses: [429]).get(path) end # This API will return Get all carrier accounts for a merchant. @@ -169,7 +169,7 @@ def get_carrier_accounts(body, x_amzn_shipping_business_id: nil) path = "/shipping/v2/carrierAccounts" body = body - retriable(delay: 0.0125, retry_statuses: [429]).put(path, body:) + retriable(delay: 0.0, retry_statuses: [429]).put(path, body:) end # This API associates/links the specified carrier account with the merchant. @@ -183,7 +183,7 @@ def link_carrier_account(carrier_id, body, x_amzn_shipping_business_id: nil) path = "/shipping/v2/carrierAccounts/#{carrier_id}" body = body - retriable(delay: 0.0125, retry_statuses: [429]).put(path, body:) + retriable(delay: 0.0, retry_statuses: [429]).put(path, body:) end # This API Unlink the specified carrier account with the merchant. @@ -197,7 +197,7 @@ def unlink_carrier_account(carrier_id, body, x_amzn_shipping_business_id: nil) path = "/shipping/v2/carrierAccounts/#{carrier_id}/unlink" body = body - retriable(delay: 0.0125, retry_statuses: [429]).put(path, body:) + retriable(delay: 0.0, retry_statuses: [429]).put(path, body:) end # This API Call to generate the collection form. @@ -212,7 +212,7 @@ def generate_collection_form(body, x_amzn_idempotency_key: nil, x_amzn_shipping_ path = "/shipping/v2/collectionForms" body = body - retriable(delay: 0.0125, retry_statuses: [429]).post(path, body:) + retriable(delay: 0.0, retry_statuses: [429]).post(path, body:) end # This API Call to get the history of the previously generated collection forms. @@ -225,7 +225,7 @@ def get_collection_form_history(body, x_amzn_shipping_business_id: nil) path = "/shipping/v2/collectionForms/history" body = body - retriable(delay: 0.0125, retry_statuses: [429]).put(path, body:) + retriable(delay: 0.0, retry_statuses: [429]).put(path, body:) end # This API Get all unmanifested carriers with shipment locations. Any locations which has unmanifested shipments @@ -239,7 +239,7 @@ def get_unmanifested_shipments(body, x_amzn_shipping_business_id: nil) path = "/shipping/v2/unmanifestedShipments" body = body - retriable(delay: 0.0125, retry_statuses: [429]).put(path, body:) + retriable(delay: 0.0, retry_statuses: [429]).put(path, body:) end # This API reprint a collection form. @@ -251,7 +251,7 @@ def get_unmanifested_shipments(body, x_amzn_shipping_business_id: nil) def get_collection_form(collection_form_id, x_amzn_shipping_business_id: nil) path = "/shipping/v2/collectionForms/#{collection_form_id}" - retriable(delay: 0.0125, retry_statuses: [429]).get(path) + retriable(delay: 0.0, retry_statuses: [429]).get(path) end # Returns a list of access points in proximity of input postal code. @@ -270,7 +270,7 @@ def get_access_points(access_point_types, country_code, postal_code, x_amzn_ship "postalCode" => postal_code, }.compact - retriable(delay: 0.0125, retry_statuses: [429]).get(path, params:) + retriable(delay: 0.0, retry_statuses: [429]).get(path, params:) end end end