Class: Peddler::APIs::NotificationsV1

Inherits:
Peddler::API show all
Defined in:
lib/peddler/apis/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

#access_token, #endpoint, #retries

Instance Method Summary collapse

Methods inherited from Peddler::API

#endpoint_uri, #http, #initialize, #meter, #retriable, #sandbox, #sandbox?, #typed, #typed?, #use, #via

Constructor Details

This class inherits a constructor from Peddler::API

Instance Method Details

#create_destination(body, rate_limit: 1.0) ⇒ Peddler::Response

Note:

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).

Parameters:

  • body (Hash)
  • rate_limit (Float) (defaults to: 1.0)

    Requests per second

Returns:



115
116
117
118
119
# File 'lib/peddler/apis/notifications_v1.rb', line 115

def create_destination(body, rate_limit: 1.0)
  path = "/notifications/v1/destinations"
  parser = Peddler::Types::NotificationsV1::CreateDestinationResponse if typed?
  meter(rate_limit).post(path, body:, parser:)
end

#create_subscription(body, notification_type, rate_limit: 1.0) ⇒ Peddler::Response

Note:

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.

Parameters:

Returns:



55
56
57
58
59
# File 'lib/peddler/apis/notifications_v1.rb', line 55

def create_subscription(body, notification_type, rate_limit: 1.0)
  path = "/notifications/v1/subscriptions/#{percent_encode(notification_type)}"
  parser = Peddler::Types::NotificationsV1::CreateSubscriptionResponse if typed?
  meter(rate_limit).post(path, body:, parser:)
end

#delete_destination(destination_id, rate_limit: 1.0) ⇒ Peddler::Response

Note:

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).

Parameters:

  • destination_id (String)

    The identifier for the destination that you want to delete.

  • rate_limit (Float) (defaults to: 1.0)

    Requests per second

Returns:



142
143
144
145
146
# File 'lib/peddler/apis/notifications_v1.rb', line 142

def delete_destination(destination_id, rate_limit: 1.0)
  path = "/notifications/v1/destinations/#{percent_encode(destination_id)}"
  parser = Peddler::Types::NotificationsV1::DeleteDestinationResponse if typed?
  meter(rate_limit).delete(path, parser:)
end

#delete_subscription_by_id(subscription_id, notification_type, rate_limit: 1.0) ⇒ Peddler::Response

Note:

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).

Parameters:

  • subscription_id (String)

    The identifier for the subscription that you want to delete.

  • notification_type (String)

    The type of notification. For more information about notification types, refer to [Notification Type Values](developer-docs.amazon.com/sp-api/docs/notification-type-values).

  • rate_limit (Float) (defaults to: 1.0)

    Requests per second

Returns:



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 = Peddler::Types::NotificationsV1::DeleteSubscriptionByIdResponse if typed?
  meter(rate_limit).delete(path, parser:)
end

#get_destination(destination_id, rate_limit: 1.0) ⇒ Peddler::Response

Note:

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).

Parameters:

  • destination_id (String)

    The identifier generated when you created the destination.

  • rate_limit (Float) (defaults to: 1.0)

    Requests per second

Returns:



129
130
131
132
133
# File 'lib/peddler/apis/notifications_v1.rb', line 129

def get_destination(destination_id, rate_limit: 1.0)
  path = "/notifications/v1/destinations/#{percent_encode(destination_id)}"
  parser = Peddler::Types::NotificationsV1::GetDestinationResponse if typed?
  meter(rate_limit).get(path, parser:)
end

#get_destinations(rate_limit: 1.0) ⇒ Peddler::Response

Note:

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).

Parameters:

  • rate_limit (Float) (defaults to: 1.0)

    Requests per second

Returns:



101
102
103
104
105
# File 'lib/peddler/apis/notifications_v1.rb', line 101

def get_destinations(rate_limit: 1.0)
  path = "/notifications/v1/destinations"
  parser = Peddler::Types::NotificationsV1::GetDestinationsResponse if typed?
  meter(rate_limit).get(path, parser:)
end

#get_subscription(notification_type, payload_version: nil, rate_limit: 1.0) ⇒ Peddler::Response

Note:

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.

Parameters:

  • payload_version (String) (defaults to: nil)

    The version of the payload object to be used in the notification.

  • notification_type (String)

    The type of notification. For more information about notification types, refer to [Notification Type Values](developer-docs.amazon.com/sp-api/docs/notification-type-values).

  • rate_limit (Float) (defaults to: 1.0)

    Requests per second

Returns:



35
36
37
38
39
40
41
42
# File 'lib/peddler/apis/notifications_v1.rb', line 35

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 = Peddler::Types::NotificationsV1::GetSubscriptionResponse if typed?
  meter(rate_limit).get(path, params:, parser:)
end

#get_subscription_by_id(subscription_id, notification_type, rate_limit: 1.0) ⇒ Peddler::Response

Note:

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).

Parameters:

  • subscription_id (String)

    The identifier for the subscription that you want to get.

  • notification_type (String)

    The type of notification. For more information about notification types, refer to [Notification Type Values](developer-docs.amazon.com/sp-api/docs/notification-type-values).

  • rate_limit (Float) (defaults to: 1.0)

    Requests per second

Returns:



71
72
73
74
75
# File 'lib/peddler/apis/notifications_v1.rb', line 71

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 = Peddler::Types::NotificationsV1::GetSubscriptionByIdResponse if typed?
  meter(rate_limit).get(path, parser:)
end