Class: Peddler::API::NotificationsV1
- Inherits:
-
Peddler::API
- Object
- Peddler::API
- Peddler::API::NotificationsV1
- Defined in:
- lib/peddler/api/notifications_v1.rb
Overview
Selling Partner API for Notifications
The Selling Partner API for Notifications lets you subscribe to notifications that are relevant to a selling partner’s business. Using this API you can create a destination to receive notifications, subscribe to notifications, delete notification subscriptions, and more. For more information, refer to the [Notifications Use Case Guide](developer-docs.amazon.com/sp-api/docs/notifications-api-v1-use-case-guide).
Instance Attribute Summary
Attributes inherited from Peddler::API
Instance Method Summary collapse
-
#create_destination(body, rate_limit: 1.0) ⇒ Hash
Creates a destination resource to receive notifications.
-
#create_subscription(body, notification_type, rate_limit: 1.0) ⇒ Hash
Creates a subscription for the specified notification type to be delivered to the specified destination.
-
#delete_destination(destination_id, rate_limit: 1.0) ⇒ Hash
Deletes the destination that you specify.
-
#delete_subscription_by_id(subscription_id, notification_type, rate_limit: 1.0) ⇒ Hash
Deletes the subscription indicated by the subscription identifier and notification type that you specify.
-
#get_destination(destination_id, rate_limit: 1.0) ⇒ Hash
Returns information about the destination that you specify.
-
#get_destinations(rate_limit: 1.0) ⇒ Hash
Returns information about all destinations.
-
#get_subscription(notification_type, payload_version: nil, rate_limit: 1.0) ⇒ Hash
Returns information about subscription of the specified notification type and payload version.
-
#get_subscription_by_id(subscription_id, notification_type, rate_limit: 1.0) ⇒ Hash
Returns information about a subscription for the specified notification type.
Methods inherited from Peddler::API
#cannot_sandbox!, #endpoint_uri, #http, #initialize, #meter, #must_sandbox!, #retriable, #sandbox, #sandbox?, #use, #via
Constructor Details
This class inherits a constructor from Peddler::API
Instance Method Details
#create_destination(body, rate_limit: 1.0) ⇒ Hash
This operation can make a static sandbox call.
Creates a destination resource to receive notifications. The ‘createDestination` operation is grantless. For more information, refer to [Grantless operations](developer-docs.amazon.com/sp-api/docs/grantless-operations).
111 112 113 114 115 |
# File 'lib/peddler/api/notifications_v1.rb', line 111 def create_destination(body, rate_limit: 1.0) path = "/notifications/v1/destinations" meter(rate_limit).post(path, body:) end |
#create_subscription(body, notification_type, rate_limit: 1.0) ⇒ Hash
This operation can make a static sandbox call.
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.
51 52 53 54 55 |
# File 'lib/peddler/api/notifications_v1.rb', line 51 def create_subscription(body, notification_type, rate_limit: 1.0) path = "/notifications/v1/subscriptions/#{notification_type}" meter(rate_limit).post(path, body:) end |
#delete_destination(destination_id, rate_limit: 1.0) ⇒ Hash
This operation can make a static sandbox call.
Deletes the destination that you specify. The ‘deleteDestination` operation is grantless. For more information, refer to [Grantless operations](developer-docs.amazon.com/sp-api/docs/grantless-operations).
138 139 140 141 142 |
# File 'lib/peddler/api/notifications_v1.rb', line 138 def delete_destination(destination_id, rate_limit: 1.0) path = "/notifications/v1/destinations/#{destination_id}" meter(rate_limit).delete(path) end |
#delete_subscription_by_id(subscription_id, notification_type, rate_limit: 1.0) ⇒ Hash
This operation can make a static sandbox call.
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 ‘deleteSubscriptionById` operation is grantless. For more information, refer to [Grantless operations](developer-docs.amazon.com/sp-api/docs/grantless-operations).
85 86 87 88 89 |
# File 'lib/peddler/api/notifications_v1.rb', line 85 def delete_subscription_by_id(subscription_id, notification_type, rate_limit: 1.0) path = "/notifications/v1/subscriptions/#{notification_type}/#{subscription_id}" meter(rate_limit).delete(path) end |
#get_destination(destination_id, rate_limit: 1.0) ⇒ Hash
This operation can make a static sandbox call.
Returns information about the destination that you specify. The ‘getDestination` operation is grantless. For more information, refer to [Grantless operations](developer-docs.amazon.com/sp-api/docs/grantless-operations).
125 126 127 128 129 |
# File 'lib/peddler/api/notifications_v1.rb', line 125 def get_destination(destination_id, rate_limit: 1.0) path = "/notifications/v1/destinations/#{destination_id}" meter(rate_limit).get(path) end |
#get_destinations(rate_limit: 1.0) ⇒ Hash
This operation can make a static sandbox call.
Returns information about all destinations. The ‘getDestinations` operation is grantless. For more information, refer to [Grantless operations](developer-docs.amazon.com/sp-api/docs/grantless-operations).
97 98 99 100 101 |
# File 'lib/peddler/api/notifications_v1.rb', line 97 def get_destinations(rate_limit: 1.0) path = "/notifications/v1/destinations" meter(rate_limit).get(path) end |
#get_subscription(notification_type, payload_version: nil, rate_limit: 1.0) ⇒ Hash
This operation can make a static sandbox call.
Returns information about subscription of the specified notification type and payload version. ‘payloadVersion` is an optional parameter. When `payloadVersion` is not provided, it will return latest payload version subscription’s information. You can use this API to get subscription information when you do not have a subscription identifier.
31 32 33 34 35 36 37 38 |
# File 'lib/peddler/api/notifications_v1.rb', line 31 def get_subscription(notification_type, payload_version: nil, rate_limit: 1.0) path = "/notifications/v1/subscriptions/#{notification_type}" params = { "payloadVersion" => payload_version, }.compact meter(rate_limit).get(path, params:) end |
#get_subscription_by_id(subscription_id, notification_type, rate_limit: 1.0) ⇒ Hash
This operation can make a static sandbox call.
Returns information about a subscription for the specified notification type. The ‘getSubscriptionById` operation is grantless. For more information, refer to [Grantless operations](developer-docs.amazon.com/sp-api/docs/grantless-operations).
67 68 69 70 71 |
# File 'lib/peddler/api/notifications_v1.rb', line 67 def get_subscription_by_id(subscription_id, notification_type, rate_limit: 1.0) path = "/notifications/v1/subscriptions/#{notification_type}/#{subscription_id}" meter(rate_limit).get(path) end |