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

- old
+ new

@@ -23,53 +23,56 @@ # subscription identifier. # # @note This operation can make a static sandbox call. # @param payload_version [String] The version of the payload object to be used in the notification. # @param rate_limit [Float] Requests per second + # @param tries [Integer] Total request attempts, including retries # @param notification_type [String] The type of notification. For more information about notification types, refer # to [Notification Type Values](https://developer-docs.amazon.com/sp-api/docs/notification-type-values). # @return [Peddler::Response] The API response - def get_subscription(notification_type, payload_version: nil, rate_limit: 1.0) + def get_subscription(notification_type, payload_version: nil, rate_limit: 1.0, tries: 2) path = "/notifications/v1/subscriptions/#{notification_type}" params = { "payloadVersion" => payload_version, }.compact - meter(rate_limit).get(path, params:) + meter(rate_limit, tries:).get(path, params:) end # Creates a subscription for the specified notification type to be delivered to the specified destination. Before # you can subscribe, you must first create the destination by calling the `createDestination` operation. In cases # where the specified notification type supports multiple payload versions, you can utilize this API to subscribe # to a different payload version if you already have an existing subscription for a different payload version. # # @note This operation can make a static sandbox call. # @param body [Hash] # @param rate_limit [Float] Requests per second + # @param tries [Integer] Total request attempts, including retries # @param notification_type [String] The type of notification. For more information about notification types, refer # to [Notification Type Values](https://developer-docs.amazon.com/sp-api/docs/notification-type-values). # @return [Peddler::Response] The API response - def create_subscription(body, notification_type, rate_limit: 1.0) + def create_subscription(body, notification_type, rate_limit: 1.0, tries: 2) path = "/notifications/v1/subscriptions/#{notification_type}" - meter(rate_limit).post(path, body:) + meter(rate_limit, tries:).post(path, body:) end # Returns information about a subscription for the specified notification type. The `getSubscriptionById` # operation is grantless. For more information, refer to [Grantless # operations](https://developer-docs.amazon.com/sp-api/docs/grantless-operations). # # @note This operation can make a static sandbox call. # @param subscription_id [String] The identifier for the subscription that you want to get. # @param rate_limit [Float] Requests per second + # @param tries [Integer] Total request attempts, including retries # @param notification_type [String] The type of notification. For more information about notification types, refer # to [Notification Type Values](https://developer-docs.amazon.com/sp-api/docs/notification-type-values). # @return [Peddler::Response] The API response - def get_subscription_by_id(subscription_id, notification_type, rate_limit: 1.0) + def get_subscription_by_id(subscription_id, notification_type, rate_limit: 1.0, tries: 2) path = "/notifications/v1/subscriptions/#{notification_type}/#{subscription_id}" - meter(rate_limit).get(path) + meter(rate_limit, tries:).get(path) end # Deletes the subscription indicated by the subscription identifier and notification type that you specify. The # subscription identifier can be for any subscription associated with your application. After you successfully # call this operation, notifications will stop being sent for the associated subscription. The @@ -77,69 +80,74 @@ # operations](https://developer-docs.amazon.com/sp-api/docs/grantless-operations). # # @note This operation can make a static sandbox call. # @param subscription_id [String] The identifier for the subscription that you want to delete. # @param rate_limit [Float] Requests per second + # @param tries [Integer] Total request attempts, including retries # @param notification_type [String] The type of notification. For more information about notification types, refer # to [Notification Type Values](https://developer-docs.amazon.com/sp-api/docs/notification-type-values). # @return [Peddler::Response] The API response - def delete_subscription_by_id(subscription_id, notification_type, rate_limit: 1.0) + def delete_subscription_by_id(subscription_id, notification_type, rate_limit: 1.0, tries: 2) path = "/notifications/v1/subscriptions/#{notification_type}/#{subscription_id}" - meter(rate_limit).delete(path) + meter(rate_limit, tries:).delete(path) end # Returns information about all destinations. The `getDestinations` operation is grantless. For more information, # refer to [Grantless operations](https://developer-docs.amazon.com/sp-api/docs/grantless-operations). # # @note This operation can make a static sandbox call. # @param rate_limit [Float] Requests per second + # @param tries [Integer] Total request attempts, including retries # @return [Peddler::Response] The API response - def get_destinations(rate_limit: 1.0) + def get_destinations(rate_limit: 1.0, tries: 2) path = "/notifications/v1/destinations" - meter(rate_limit).get(path) + meter(rate_limit, tries:).get(path) end # Creates a destination resource to receive notifications. The `createDestination` operation is grantless. For # more information, refer to [Grantless # operations](https://developer-docs.amazon.com/sp-api/docs/grantless-operations). # # @note This operation can make a static sandbox call. # @param body [Hash] # @param rate_limit [Float] Requests per second + # @param tries [Integer] Total request attempts, including retries # @return [Peddler::Response] The API response - def create_destination(body, rate_limit: 1.0) + def create_destination(body, rate_limit: 1.0, tries: 2) path = "/notifications/v1/destinations" - meter(rate_limit).post(path, body:) + meter(rate_limit, tries:).post(path, body:) end # Returns information about the destination that you specify. The `getDestination` operation is grantless. For # more information, refer to [Grantless # operations](https://developer-docs.amazon.com/sp-api/docs/grantless-operations). # # @note This operation can make a static sandbox call. # @param destination_id [String] The identifier generated when you created the destination. # @param rate_limit [Float] Requests per second + # @param tries [Integer] Total request attempts, including retries # @return [Peddler::Response] The API response - def get_destination(destination_id, rate_limit: 1.0) + def get_destination(destination_id, rate_limit: 1.0, tries: 2) path = "/notifications/v1/destinations/#{destination_id}" - meter(rate_limit).get(path) + meter(rate_limit, tries:).get(path) end # Deletes the destination that you specify. The `deleteDestination` operation is grantless. For more information, # refer to [Grantless operations](https://developer-docs.amazon.com/sp-api/docs/grantless-operations). # # @note This operation can make a static sandbox call. # @param destination_id [String] The identifier for the destination that you want to delete. # @param rate_limit [Float] Requests per second + # @param tries [Integer] Total request attempts, including retries # @return [Peddler::Response] The API response - def delete_destination(destination_id, rate_limit: 1.0) + def delete_destination(destination_id, rate_limit: 1.0, tries: 2) path = "/notifications/v1/destinations/#{destination_id}" - meter(rate_limit).delete(path) + meter(rate_limit, tries:).delete(path) end end end end