Class: Peddler::APIs::NotificationsV1
- Inherits:
-
Peddler::API
- Object
- Peddler::API
- Peddler::APIs::NotificationsV1
- Defined in:
- lib/peddler/apis/notifications_v1.rb,
lib/peddler/apis/notifications_v1/error.rb,
lib/peddler/apis/notifications_v1/error_list.rb,
lib/peddler/apis/notifications_v1/destination.rb,
lib/peddler/apis/notifications_v1/event_filter.rb,
lib/peddler/apis/notifications_v1/sqs_resource.rb,
lib/peddler/apis/notifications_v1/subscription.rb,
lib/peddler/apis/notifications_v1/marketplace_ids.rb,
lib/peddler/apis/notifications_v1/destination_list.rb,
lib/peddler/apis/notifications_v1/test_notification.rb,
lib/peddler/apis/notifications_v1/aggregation_filter.rb,
lib/peddler/apis/notifications_v1/marketplace_filter.rb,
lib/peddler/apis/notifications_v1/order_change_types.rb,
lib/peddler/apis/notifications_v1/aggregation_settings.rb,
lib/peddler/apis/notifications_v1/destination_resource.rb,
lib/peddler/apis/notifications_v1/processing_directive.rb,
lib/peddler/apis/notifications_v1/event_bridge_resource.rb,
lib/peddler/apis/notifications_v1/get_destination_response.rb,
lib/peddler/apis/notifications_v1/order_change_type_filter.rb,
lib/peddler/apis/notifications_v1/get_destinations_response.rb,
lib/peddler/apis/notifications_v1/get_subscription_response.rb,
lib/peddler/apis/notifications_v1/create_destination_request.rb,
lib/peddler/apis/notifications_v1/create_destination_response.rb,
lib/peddler/apis/notifications_v1/create_subscription_request.rb,
lib/peddler/apis/notifications_v1/delete_destination_response.rb,
lib/peddler/apis/notifications_v1/create_subscription_response.rb,
lib/peddler/apis/notifications_v1/send_test_notification_request.rb,
lib/peddler/apis/notifications_v1/get_subscription_by_id_response.rb,
lib/peddler/apis/notifications_v1/send_test_notification_response.rb,
lib/peddler/apis/notifications_v1/delete_subscription_by_id_response.rb,
lib/peddler/apis/notifications_v1/destination_resource_specification.rb,
lib/peddler/apis/notifications_v1/event_bridge_resource_specification.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).
Defined Under Namespace
Classes: DestinationList, ErrorList, MarketplaceIds, OrderChangeTypes
Constant Summary collapse
- Error =
An error response returned when the request is unsuccessful.
Structure.new do # @return [String] An error code that identifies the type of error that occurred. attribute(:code, String, null: false) # @return [String] A message that describes the error condition. attribute(:message, String, null: false) # @return [String] Additional details that can help the caller understand or fix the issue. attribute?(:details, String) end
- Destination =
Information about the destination you create when you call the ‘createDestination` operation.
Structure.new do # @return [String] The destination identifier generated when you created the destination. attribute(:destination_id, String, null: false, from: "destinationId") # @return [String] The developer-defined name for this destination. attribute(:name, String, null: false) # @return [DestinationResource] The resource that will receive notifications associated with this destination. attribute(:resource, DestinationResource, null: false) end
- EventFilter =
A ‘notificationType` filter. This object contains all of the available filters and properties that you can use to define a `notificationType` specific filter.
Structure.new do # @return [String] An `eventFilterType` value that the `notificationType` supports. The subscription service # uses the `eventFilterType` to determine the type of event filter. To determine if a specific # `notificationType` supports an `eventFilterType`, refer to [Notification Type Values]( # https://developer-docs.amazon.com/sp-api/docs/notification-type-values). attribute(:event_filter_type, String, null: false, from: "eventFilterType") # @return [AggregationSettings] attribute?(:aggregation_settings, AggregationSettings, from: "aggregationSettings") # @return [Array<String>] attribute?(:marketplace_ids, [String], from: "marketplaceIds") # @return [Array<OrderChangeTypeEnum>] attribute?(:order_change_types, Array, from: "orderChangeTypes") end
- SqsResource =
The information required to create an Amazon Simple Queue Service (Amazon SQS) queue destination.
Structure.new do # @return [String] The Amazon Resource Name (ARN) associated with the SQS queue. attribute(:arn, String, null: false) end
- Subscription =
Information about the subscription.
Structure.new do # @return [String] The identifier for the destination where notifications will be delivered. attribute(:destination_id, String, null: false, from: "destinationId") # @return [String] The version of the payload object to be used in the notification. attribute(:payload_version, String, null: false, from: "payloadVersion") # @return [String] The subscription identifier generated when the subscription is created. attribute(:subscription_id, String, null: false, from: "subscriptionId") # @return [ProcessingDirective] attribute?(:processing_directive, ProcessingDirective, from: "processingDirective") end
- TestNotification =
The describer for the test notification that will be delivered.
Structure.new do # @return [String] The version of the payload object to be used in the notification. attribute(:payload_version, String, null: false, from: "payloadVersion") # @return [String] The scenario of the specified notification to be used in the notification payload. If # testScenario is empty, a 400 response will be returned back to the developer. The scenarios supported for # each notification type can be found in the Selling Partner API Developer Guide. attribute?(:test_scenario, String, from: "testScenario") end
- AggregationFilter =
A filter you can use to select the aggregation time period at which to send notifications (for example, limit to one notification every five minutes for high frequency notifications).
Structure.new do # @return [AggregationSettings] attribute?(:aggregation_settings, AggregationSettings, from: "aggregationSettings") end
- MarketplaceFilter =
An event filter you can use to customize your subscription to send notifications for specific ‘marketplaceId`s.
Structure.new do # @return [Array<String>] attribute?(:marketplace_ids, [String], from: "marketplaceIds") end
- AggregationSettings =
A container that holds all of the necessary properties to configure the aggregation of notifications.
Structure.new do # @return [String] The supported time period to use to perform marketplace-ASIN level aggregation. attribute(:aggregation_time_period, String, null: false, from: "aggregationTimePeriod") end
- DestinationResource =
The destination resource types.
Structure.new do # @return [EventBridgeResource] An Amazon EventBridge destination. attribute?(:event_bridge, EventBridgeResource, from: "eventBridge") # @return [SqsResource] An Amazon Simple Queue Service (SQS) queue destination. attribute?(:sqs, SqsResource) end
- ProcessingDirective =
Additional information passed to the subscription to control the processing of notifications. For example, you can use an ‘eventFilter` to customize your subscription to send notifications for only the `marketplaceId`s that you specify, or select the aggregation time period at which to send notifications (for example, you can set a limit of one notification every five minutes for high frequency notifications). You can also use `filterExpression` to filter events based on notification payload. The specific features available can vary by the `notificationType`.
Structure.new do # @return [EventFilter] A `notificationType` filter. Note: eventFilter and filterExpression are mutually # exclusive, meaning if eventFilter is provided, filterExpression field cannot be used. attribute?(:event_filter, EventFilter, from: "eventFilter") # @return [String] An expression for filtering events before delivery to destination based on the notification # payload (example: FulfillmentOrderStatusNotification.FulfillmentOrderStatus == `SHIPPED` ). The # `filterExpression` is a string that follows the CEL expression syntax (https://github.com/google/cel-spec) # excluding arithmetic operators (+, -, *, /, %) and list/map indexing ([]). Refer to Notification Type Values # to determine if filter Expression is supported for a Notification Type. Refer to CEL Operators # (https://developer-docs.amazon.com/sp-api/docs/filter-notification-subscriptions) to see if a CEL operator # is supported. # Note: eventFilter and filterExpression are mutually exclusive. You can use filterExpression to replace # existing eventFilter configurations. attribute?(:filter_expression, String, from: "filterExpression") end
- EventBridgeResource =
The Amazon EventBridge destination.
Structure.new do # @return [String] The identifier for the AWS account that is responsible for charges related to receiving # notifications. attribute(:account_id, String, null: false, from: "accountId") # @return [String] The name of the partner event source associated with the destination. attribute(:name, String, null: false) # @return [String] The AWS region in which you receive the notifications. For AWS regions that Amazon # EventBridge supports, refer to [Amazon EventBridge endpoints and # quotas](https://docs.aws.amazon.com/general/latest/gr/ev.html). attribute(:region, String, null: false) end
- GetDestinationResponse =
The response schema for the ‘getDestination` operation.
Structure.new do # @return [Array<Error>] One or more unexpected errors occurred during the `getDestination` operation. attribute?(:errors, [Error]) # @return [Destination] The payload for the `getDestination` operation. attribute?(:payload, Destination) end
- OrderChangeTypeFilter =
An event filter you can use to customize your subscription to send notifications for a specific ‘orderChangeType`.
Structure.new do # @return [Array<OrderChangeTypeEnum>] attribute?(:order_change_types, Array, from: "orderChangeTypes") end
- GetDestinationsResponse =
The response schema for the ‘getDestinations` operation.
Structure.new do # @return [Array<Error>] One or more unexpected errors occurred during the `getDestinations` operation. attribute?(:errors, [Error]) # @return [Array<Destination>] The payload for the `getDestinations` operation. attribute?(:payload, [Destination]) end
- GetSubscriptionResponse =
The response schema for the ‘getSubscription` operation.
Structure.new do # @return [Array<Error>] One or more unexpected errors occurred during the `getSubscription` operation. attribute?(:errors, [Error]) # @return [Subscription] The payload for the `getSubscription` operation. attribute?(:payload, Subscription) end
- CreateDestinationRequest =
The request schema for the ‘createDestination` operation.
Structure.new do # @return [String] A developer-defined name to help identify this destination. attribute(:name, String, null: false) # @return [DestinationResourceSpecification] The information required to create a destination resource. # Applications should use one resource type (sqs or eventBridge) per destination. attribute(:resource_specification, DestinationResourceSpecification, null: false, from: "resourceSpecification") end
- CreateDestinationResponse =
The response schema for the createDestination operation.
Structure.new do # @return [Array<Error>] One or more unexpected errors occurred during the `createDestination` operation. attribute?(:errors, [Error]) # @return [Destination] The payload for the `createDestination` operation. attribute?(:payload, Destination) end
- CreateSubscriptionRequest =
The request schema for the ‘createSubscription` operation.
Structure.new do # @return [String] The identifier for the destination where notifications will be delivered. attribute(:destination_id, String, null: false, from: "destinationId") # @return [String] The version of the payload object to be used in the notification. attribute(:payload_version, String, null: false, from: "payloadVersion") # @return [ProcessingDirective] attribute?(:processing_directive, ProcessingDirective, from: "processingDirective") end
- DeleteDestinationResponse =
The response schema for the ‘deleteDestination` operation.
Structure.new do # @return [Array<Error>] One or more unexpected errors occurred during the `deleteDestination` operation. attribute?(:errors, [Error]) end
- CreateSubscriptionResponse =
The response schema for the ‘createSubscription` operation.
Structure.new do # @return [Array<Error>] One or more unexpected errors occurred during the `createSubscription` operation. attribute?(:errors, [Error]) # @return [Subscription] The payload for the `createSubscription` operation. attribute?(:payload, Subscription) end
- SendTestNotificationRequest =
The request schema for the ‘sendTestNotification` operation.
Structure.new do # @return [String] The identifier for the destination where notifications will be delivered. attribute?(:destination_id, String, from: "destinationId") # @return [TestNotification] attribute?(:test_notification, TestNotification, from: "testNotification") end
- GetSubscriptionByIdResponse =
The response schema for the ‘getSubscriptionById` operation.
Structure.new do # @return [Array<Error>] An unexpected condition occurred during the `getSubscriptionById` operation. attribute?(:errors, [Error]) # @return [Subscription] The payload for the `getSubscriptionById` operation. attribute?(:payload, Subscription) end
- SendTestNotificationResponse =
The response schema for the ‘sendTestNotification` operation.
Structure.new do # @return [Array<Error>] One or more unexpected errors occurred during the `sendTestNotification` operation. attribute?(:errors, [Error]) # @return [String] The payload for the `sendTestNotification` operation. attribute?(:payload, String) end
- DeleteSubscriptionByIdResponse =
The response schema for the ‘deleteSubscriptionById` operation.
Structure.new do # @return [Array<Error>] An unexpected condition occurred during the `deleteSubscriptionById` operation. attribute?(:errors, [Error]) end
- DestinationResourceSpecification =
The information required to create a destination resource. Applications should use one resource type (sqs or eventBridge) per destination.
Structure.new do # @return [EventBridgeResourceSpecification] The information required to create an Amazon EventBridge # destination. attribute?(:event_bridge, EventBridgeResourceSpecification, from: "eventBridge") # @return [SqsResource] The information required to create an Amazon Simple Queue Service (SQS) queue # destination. attribute?(:sqs, SqsResource) end
- EventBridgeResourceSpecification =
The information required to create an Amazon EventBridge destination.
Structure.new do # @return [String] The identifier for the AWS account that is responsible for charges related to receiving # notifications. attribute(:account_id, String, null: false, from: "accountId") # @return [String] The AWS region in which you will be receiving the notifications. attribute(:region, String, null: false) end
Constants inherited from Peddler::API
Peddler::API::TRANSIENT_STATUSES
Instance Attribute Summary
Attributes inherited from Peddler::API
#access_token, #endpoint, #retries
Instance Method Summary collapse
-
#create_destination(body, rate_limit: 1.0) ⇒ Peddler::Response
Creates a destination resource to receive notifications.
-
#create_subscription(body, notification_type, rate_limit: 1.0) ⇒ Peddler::Response
Creates a subscription for the specified notification type to be delivered to the specified destination.
-
#delete_destination(destination_id, rate_limit: 1.0) ⇒ Peddler::Response
Deletes the destination that you specify.
-
#delete_subscription_by_id(subscription_id, notification_type, rate_limit: 1.0) ⇒ Peddler::Response
Deletes the subscription indicated by the subscription identifier and notification type that you specify.
-
#get_destination(destination_id, rate_limit: 1.0) ⇒ Peddler::Response
Returns information about the destination that you specify.
-
#get_destinations(rate_limit: 1.0) ⇒ Peddler::Response
Returns information about all destinations.
-
#get_subscription(notification_type, payload_version: nil, rate_limit: 1.0) ⇒ Peddler::Response
Returns information about subscription of the specified notification type and payload version.
-
#get_subscription_by_id(subscription_id, notification_type, rate_limit: 1.0) ⇒ Peddler::Response
Returns information about a subscription for the specified notification type.
-
#send_test_notification(body, notification_type, rate_limit: 1.0) ⇒ Peddler::Response
Sends a mock notification of the specified type to your SQS.
Methods inherited from Peddler::API
#endpoint_uri, #http, #initialize, #sandbox, #sandbox?
Constructor Details
This class inherits a constructor from Peddler::API
Instance Method Details
#create_destination(body, rate_limit: 1.0) ⇒ Peddler::Response
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) in the Selling Partner API Developer Guide.
135 136 137 138 139 |
# File 'lib/peddler/apis/notifications_v1.rb', line 135 def create_destination(body, rate_limit: 1.0) path = "/notifications/v1/destinations" parser = -> { CreateDestinationResponse } post(path, body:, rate_limit:, parser:) end |
#create_subscription(body, notification_type, rate_limit: 1.0) ⇒ Peddler::Response
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. If the notification type that you specify supports multiple payload versions, you can use this operation 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/apis/notifications_v1.rb', line 51 def create_subscription(body, notification_type, rate_limit: 1.0) path = "/notifications/v1/subscriptions/#{percent_encode(notification_type)}" parser = -> { CreateSubscriptionResponse } post(path, body:, rate_limit:, parser:) end |
#delete_destination(destination_id, rate_limit: 1.0) ⇒ Peddler::Response
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) in the Selling Partner API Developer Guide.
164 165 166 167 168 |
# File 'lib/peddler/apis/notifications_v1.rb', line 164 def delete_destination(destination_id, rate_limit: 1.0) path = "/notifications/v1/destinations/#{percent_encode(destination_id)}" parser = -> { DeleteDestinationResponse } delete(path, rate_limit:, parser:) end |
#delete_subscription_by_id(subscription_id, notification_type, rate_limit: 1.0) ⇒ Peddler::Response
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) in the Selling Partner API Developer Guide.
89 90 91 92 93 |
# File 'lib/peddler/apis/notifications_v1.rb', line 89 def delete_subscription_by_id(subscription_id, notification_type, rate_limit: 1.0) path = "/notifications/v1/subscriptions/#{percent_encode(notification_type)}/#{percent_encode(subscription_id)}" parser = -> { DeleteSubscriptionByIdResponse } delete(path, rate_limit:, parser:) end |
#get_destination(destination_id, rate_limit: 1.0) ⇒ Peddler::Response
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) in the Selling Partner API Developer Guide.
150 151 152 153 154 |
# File 'lib/peddler/apis/notifications_v1.rb', line 150 def get_destination(destination_id, rate_limit: 1.0) path = "/notifications/v1/destinations/#{percent_encode(destination_id)}" parser = -> { GetDestinationResponse } get(path, rate_limit:, parser:) end |
#get_destinations(rate_limit: 1.0) ⇒ Peddler::Response
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) in the Selling Partner API Developer Guide.
120 121 122 123 124 |
# File 'lib/peddler/apis/notifications_v1.rb', line 120 def get_destinations(rate_limit: 1.0) path = "/notifications/v1/destinations" parser = -> { GetDestinationsResponse } get(path, rate_limit:, parser:) end |
#get_subscription(notification_type, payload_version: nil, rate_limit: 1.0) ⇒ Peddler::Response
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 you do not provide `payloadVersion`, the operation returns the latest payload version subscription’s information. You can use this API to get subscription information when you do not have a subscription identifier.
30 31 32 33 34 35 36 37 |
# File 'lib/peddler/apis/notifications_v1.rb', line 30 def get_subscription(notification_type, payload_version: nil, rate_limit: 1.0) path = "/notifications/v1/subscriptions/#{percent_encode(notification_type)}" params = { "payloadVersion" => payload_version, }.compact parser = -> { GetSubscriptionResponse } get(path, params:, rate_limit:, parser:) end |
#get_subscription_by_id(subscription_id, notification_type, rate_limit: 1.0) ⇒ Peddler::Response
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) in the Selling Partner API Developer Guide.
69 70 71 72 73 |
# File 'lib/peddler/apis/notifications_v1.rb', line 69 def get_subscription_by_id(subscription_id, notification_type, rate_limit: 1.0) path = "/notifications/v1/subscriptions/#{percent_encode(notification_type)}/#{percent_encode(subscription_id)}" parser = -> { GetSubscriptionByIdResponse } get(path, rate_limit:, parser:) end |
#send_test_notification(body, notification_type, rate_limit: 1.0) ⇒ Peddler::Response
This operation can make a dynamic sandbox call.
Sends a mock notification of the specified type to your SQS. The ‘sendTestNotification` API is grantless. For more information, see “Grantless operations” in the Selling Partner API Developer Guide.
105 106 107 108 109 110 111 |
# File 'lib/peddler/apis/notifications_v1.rb', line 105 def send_test_notification(body, notification_type, rate_limit: 1.0) must_sandbox! path = "/notifications/v1/subscriptions/#{percent_encode(notification_type)}/testNotification" parser = -> { SendTestNotificationResponse } post(path, body:, rate_limit:, parser:) end |