Class: Peddler::APIs::NotificationsV1

Inherits:
Peddler::API show all
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,
sig/peddler/apis/notifications_v1.rbs

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.

Defined Under Namespace

Classes: AggregationFilter, AggregationSettings, CreateDestinationRequest, CreateDestinationResponse, CreateSubscriptionRequest, CreateSubscriptionResponse, DeleteDestinationResponse, DeleteSubscriptionByIdResponse, Destination, DestinationList, DestinationResource, DestinationResourceSpecification, Error, ErrorList, EventBridgeResource, EventBridgeResourceSpecification, EventFilter, GetDestinationResponse, GetDestinationsResponse, GetSubscriptionByIdResponse, GetSubscriptionResponse, MarketplaceFilter, MarketplaceIds, OrderChangeTypeFilter, OrderChangeTypes, ProcessingDirective, SendTestNotificationRequest, SendTestNotificationResponse, SqsResource, Subscription, TestNotification

Instance Attribute Summary

Attributes inherited from Peddler::API

#access_token, #endpoint, #retries

Instance Method Summary collapse

Methods inherited from Peddler::API

#cannot_sandbox!, #delete, #endpoint_uri, #get, #http, #initialize, #must_sandbox!, #patch, #percent_encode, #post, #put, #request, #sandbox, #sandbox?, #stringify_array, #timestamp, #user_agent

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 in the Selling Partner API Developer Guide.

Parameters:

  • body (Hash)

    The request schema for the createDestination operation.

  • rate_limit (Float) (defaults to: 1.0)

    Requests per second

  • (Hash[untyped, untyped])
  • rate_limit: (Float) (defaults to: 1.0)

Returns:



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

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

Parameters:

  • body (Hash)

    The request schema for the createSubscription operation.

  • notification_type (String)

    The type of notification. For more information about notification types, refer to the Notifications API v1 Use Case Guide.

  • rate_limit (Float) (defaults to: 1.0)

    Requests per second

  • (Hash[untyped, untyped])
  • (String)
  • rate_limit: (Float) (defaults to: 1.0)

Returns:



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

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 in the Selling Partner API Developer Guide.

Parameters:

  • destination_id (String)

    The identifier for the destination that you want to delete.

  • rate_limit (Float) (defaults to: 1.0)

    Requests per second

  • (String)
  • rate_limit: (Float) (defaults to: 1.0)

Returns:



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

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 in the Selling Partner API Developer Guide.

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 the Notifications API v1 Use Case Guide.

  • rate_limit (Float) (defaults to: 1.0)

    Requests per second

  • (String)
  • (String)
  • rate_limit: (Float) (defaults to: 1.0)

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 = -> { DeleteSubscriptionByIdResponse }
  delete(path, rate_limit:, 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 in the Selling Partner API Developer Guide.

Parameters:

  • destination_id (String)

    The identifier generated when you created the destination.

  • rate_limit (Float) (defaults to: 1.0)

    Requests per second

  • (String)
  • rate_limit: (Float) (defaults to: 1.0)

Returns:



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

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 in the Selling Partner API Developer Guide.

Parameters:

  • rate_limit (Float) (defaults to: 1.0)

    Requests per second

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

Returns:



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

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

Parameters:

  • notification_type (String)

    The type of notification. For more information about notification types, refer to the Notifications API v1 Use Case Guide.

  • payload_version (String) (defaults to: nil)

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

  • rate_limit (Float) (defaults to: 1.0)

    Requests per second

  • (String)
  • payload_version: (String, nil) (defaults to: nil)
  • rate_limit: (Float) (defaults to: 1.0)

Returns:



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

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 in the Selling Partner API Developer Guide.

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 the Notifications API v1 Use Case Guide.

  • rate_limit (Float) (defaults to: 1.0)

    Requests per second

  • (String)
  • (String)
  • rate_limit: (Float) (defaults to: 1.0)

Returns:



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

Note:

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.

Parameters:

  • body (Hash)

    The request schema for the sendTestNotification operation.

  • notification_type (String)

    The type of notification. For more information about notification types, refer to the Notifications API v1 Use Case Guide.

  • rate_limit (Float) (defaults to: 1.0)

    Requests per second

  • (Hash[untyped, untyped])
  • (String)
  • rate_limit: (Float) (defaults to: 1.0)

Returns:



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