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/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/get_subscription_by_id_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, SqsResource, Subscription

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.

Parameters:

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

    Requests per second

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

Returns:



109
110
111
112
113
# File 'lib/peddler/apis/notifications_v1.rb', line 109

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

  • body (Hash)
  • notification_type (String)

    The type of notification. For more information about notification types, refer to Notification Type Values.

  • rate_limit (Float) (defaults to: 1.0)

    Requests per second

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

Returns:



49
50
51
52
53
# File 'lib/peddler/apis/notifications_v1.rb', line 49

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.

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:



136
137
138
139
140
# File 'lib/peddler/apis/notifications_v1.rb', line 136

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.

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.

  • rate_limit (Float) (defaults to: 1.0)

    Requests per second

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

Returns:



83
84
85
86
87
# File 'lib/peddler/apis/notifications_v1.rb', line 83

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.

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:



123
124
125
126
127
# File 'lib/peddler/apis/notifications_v1.rb', line 123

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.

Parameters:

  • rate_limit (Float) (defaults to: 1.0)

    Requests per second

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

Returns:



95
96
97
98
99
# File 'lib/peddler/apis/notifications_v1.rb', line 95

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

  • 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:



29
30
31
32
33
34
35
36
# File 'lib/peddler/apis/notifications_v1.rb', line 29

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.

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.

  • rate_limit (Float) (defaults to: 1.0)

    Requests per second

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

Returns:



65
66
67
68
69
# File 'lib/peddler/apis/notifications_v1.rb', line 65

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