lib/peddler/apis/orders_v0.rb in peddler-4.0.1 vs lib/peddler/apis/orders_v0.rb in peddler-4.1.0

- old
+ new

@@ -108,18 +108,19 @@ # 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) format. # @param latest_delivery_date_after [String] Use this date to select orders with a latest delivery date after (or # at) a specified time. The date must be in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) # format. # @param rate_limit [Float] Requests per second + # @param tries [Integer] Total request attempts, including retries # @return [Peddler::Response] The API response def get_orders(marketplace_ids, created_after: nil, created_before: nil, last_updated_after: nil, last_updated_before: nil, order_statuses: nil, fulfillment_channels: nil, payment_methods: nil, buyer_email: nil, seller_order_id: nil, max_results_per_page: nil, easy_ship_shipment_statuses: nil, electronic_invoice_statuses: nil, next_token: nil, amazon_order_ids: nil, actual_fulfillment_supply_source_id: nil, is_ispu: nil, store_chain_store_id: nil, earliest_delivery_date_before: nil, earliest_delivery_date_after: nil, latest_delivery_date_before: nil, - latest_delivery_date_after: nil, rate_limit: 0.0167) + latest_delivery_date_after: nil, rate_limit: 0.0167, tries: 2) path = "/orders/v0/orders" params = { "CreatedAfter" => created_after, "CreatedBefore" => created_before, "LastUpdatedAfter" => last_updated_after, @@ -142,47 +143,50 @@ "EarliestDeliveryDateAfter" => earliest_delivery_date_after, "LatestDeliveryDateBefore" => latest_delivery_date_before, "LatestDeliveryDateAfter" => latest_delivery_date_after, }.compact - meter(rate_limit).get(path, params:) + meter(rate_limit, tries:).get(path, params:) end # Returns the order that you specify. # # @note This operation can make a static sandbox call. # @param order_id [String] An Amazon-defined order identifier, in 3-7-7 format. # @param rate_limit [Float] Requests per second + # @param tries [Integer] Total request attempts, including retries # @return [Peddler::Response] The API response - def get_order(order_id, rate_limit: 0.5) + def get_order(order_id, rate_limit: 0.5, tries: 2) path = "/orders/v0/orders/#{order_id}" - meter(rate_limit).get(path) + meter(rate_limit, tries:).get(path) end # Returns buyer information for the order that you specify. # # @note This operation can make a static sandbox call. # @param order_id [String] An `orderId` is an Amazon-defined order identifier, in 3-7-7 format. # @param rate_limit [Float] Requests per second + # @param tries [Integer] Total request attempts, including retries # @return [Peddler::Response] The API response - def get_order_buyer_info(order_id, rate_limit: 0.5) + def get_order_buyer_info(order_id, rate_limit: 0.5, tries: 2) path = "/orders/v0/orders/#{order_id}/buyerInfo" - meter(rate_limit).get(path) + meter(rate_limit, tries:).get(path) end # Returns the shipping address for the order that you specify. # # @note This operation can make a static sandbox call. # @param order_id [String] An `orderId` is an Amazon-defined order identifier, in 3-7-7 format. # @param rate_limit [Float] Requests per second + # @param tries [Integer] Total request attempts, including retries # @return [Peddler::Response] The API response - def get_order_address(order_id, rate_limit: 0.5) + def get_order_address(order_id, rate_limit: 0.5, tries: 2) path = "/orders/v0/orders/#{order_id}/address" - meter(rate_limit).get(path) + meter(rate_limit, tries:).get(path) end # Returns detailed order item information for the order that you specify. If `NextToken` is provided, it's used to # retrieve the next page of order items. __Note__: When an order is in the Pending state (the order has been # placed but payment has not been authorized), the getOrderItems operation does not return information about @@ -193,87 +197,93 @@ # # @note This operation can make a static sandbox call. # @param order_id [String] An Amazon-defined order identifier, in 3-7-7 format. # @param next_token [String] A string token returned in the response of your previous request. # @param rate_limit [Float] Requests per second + # @param tries [Integer] Total request attempts, including retries # @return [Peddler::Response] The API response - def get_order_items(order_id, next_token: nil, rate_limit: 0.5) + def get_order_items(order_id, next_token: nil, rate_limit: 0.5, tries: 2) path = "/orders/v0/orders/#{order_id}/orderItems" params = { "NextToken" => next_token, }.compact - meter(rate_limit).get(path, params:) + meter(rate_limit, tries:).get(path, params:) end # Returns buyer information for the order items in the order that you specify. # # @note This operation can make a static sandbox call. # @param order_id [String] An Amazon-defined order identifier, in 3-7-7 format. # @param next_token [String] A string token returned in the response of your previous request. # @param rate_limit [Float] Requests per second + # @param tries [Integer] Total request attempts, including retries # @return [Peddler::Response] The API response - def get_order_items_buyer_info(order_id, next_token: nil, rate_limit: 0.5) + def get_order_items_buyer_info(order_id, next_token: nil, rate_limit: 0.5, tries: 2) path = "/orders/v0/orders/#{order_id}/orderItems/buyerInfo" params = { "NextToken" => next_token, }.compact - meter(rate_limit).get(path, params:) + meter(rate_limit, tries:).get(path, params:) end # Update the shipment status for an order that you specify. # # @note This operation can make a static sandbox call. # @param order_id [String] An Amazon-defined order identifier, in 3-7-7 format. # @param payload [Hash] The request body for the `updateShipmentStatus` operation. # @param rate_limit [Float] Requests per second + # @param tries [Integer] Total request attempts, including retries # @return [Peddler::Response] The API response - def update_shipment_status(order_id, payload, rate_limit: 5.0) + def update_shipment_status(order_id, payload, rate_limit: 5.0, tries: 2) path = "/orders/v0/orders/#{order_id}/shipment" body = payload - meter(rate_limit).post(path, body:) + meter(rate_limit, tries:).post(path, body:) end # Returns regulated information for the order that you specify. # # @note This operation can make a static sandbox call. # @param order_id [String] An Amazon-defined order identifier, in 3-7-7 format. # @param rate_limit [Float] Requests per second + # @param tries [Integer] Total request attempts, including retries # @return [Peddler::Response] The API response - def get_order_regulated_info(order_id, rate_limit: 0.5) + def get_order_regulated_info(order_id, rate_limit: 0.5, tries: 2) path = "/orders/v0/orders/#{order_id}/regulatedInfo" - meter(rate_limit).get(path) + meter(rate_limit, tries:).get(path) end # Updates (approves or rejects) the verification status of an order containing regulated products. # # @note This operation can make a static sandbox call. # @param order_id [String] An Amazon-defined order identifier, in 3-7-7 format. # @param payload [Hash] The request body for the `updateVerificationStatus` operation. # @param rate_limit [Float] Requests per second + # @param tries [Integer] Total request attempts, including retries # @return [Peddler::Response] The API response - def update_verification_status(order_id, payload, rate_limit: 0.5) + def update_verification_status(order_id, payload, rate_limit: 0.5, tries: 2) path = "/orders/v0/orders/#{order_id}/regulatedInfo" body = payload - meter(rate_limit).patch(path, body:) + meter(rate_limit, tries:).patch(path, body:) end # Updates the shipment confirmation status for a specified order. # # @note This operation can make a static sandbox call. # @param order_id [String] An Amazon-defined order identifier, in 3-7-7 format. # @param payload [Hash] Request body of `confirmShipment`. # @param rate_limit [Float] Requests per second + # @param tries [Integer] Total request attempts, including retries # @return [Peddler::Response] The API response - def confirm_shipment(order_id, payload, rate_limit: 2.0) + def confirm_shipment(order_id, payload, rate_limit: 2.0, tries: 2) path = "/orders/v0/orders/#{order_id}/shipmentConfirmation" body = payload - meter(rate_limit).post(path, body:) + meter(rate_limit, tries:).post(path, body:) end end end end