Class: Peddler::APIs::MessagingV1

Inherits:
Peddler::API show all
Defined in:
lib/peddler/apis/messaging_v1.rb,
lib/peddler/apis/messaging_v1/error.rb,
lib/peddler/apis/messaging_v1/attachment.rb,
lib/peddler/apis/messaging_v1/error_list.rb,
lib/peddler/apis/messaging_v1/link_object.rb,
lib/peddler/apis/messaging_v1/invoice_request.rb,
lib/peddler/apis/messaging_v1/invoice_response.rb,
lib/peddler/apis/messaging_v1/messaging_action.rb,
lib/peddler/apis/messaging_v1/get_schema_response.rb,
lib/peddler/apis/messaging_v1/create_warranty_request.rb,
lib/peddler/apis/messaging_v1/get_attributes_response.rb,
lib/peddler/apis/messaging_v1/create_warranty_response.rb,
lib/peddler/apis/messaging_v1/get_messaging_action_response.rb,
lib/peddler/apis/messaging_v1/create_legal_disclosure_request.rb,
lib/peddler/apis/messaging_v1/create_legal_disclosure_response.rb,
lib/peddler/apis/messaging_v1/create_digital_access_key_request.rb,
lib/peddler/apis/messaging_v1/create_unexpected_problem_request.rb,
lib/peddler/apis/messaging_v1/create_digital_access_key_response.rb,
lib/peddler/apis/messaging_v1/create_unexpected_problem_response.rb,
lib/peddler/apis/messaging_v1/create_confirm_order_details_request.rb,
lib/peddler/apis/messaging_v1/create_confirm_order_details_response.rb,
lib/peddler/apis/messaging_v1/create_confirm_service_details_request.rb,
lib/peddler/apis/messaging_v1/create_confirm_delivery_details_request.rb,
lib/peddler/apis/messaging_v1/create_confirm_service_details_response.rb,
lib/peddler/apis/messaging_v1/create_confirm_delivery_details_response.rb,
lib/peddler/apis/messaging_v1/get_messaging_actions_for_order_response.rb,
lib/peddler/apis/messaging_v1/create_confirm_customization_details_request.rb,
lib/peddler/apis/messaging_v1/create_confirm_customization_details_response.rb,
sig/peddler/apis/messaging_v1.rbs

Overview

Selling Partner API for Messaging

With the Messaging API you can build applications that send messages to buyers. You can get a list of message types that are available for an order that you specify, then call an operation that sends a message to the buyer for that order. The Messaging API returns responses that are formed according to the JSON Hypertext Application Language (HAL) standard.

Defined Under Namespace

Classes: Attachment, CreateConfirmCustomizationDetailsRequest, CreateConfirmCustomizationDetailsResponse, CreateConfirmDeliveryDetailsRequest, CreateConfirmDeliveryDetailsResponse, CreateConfirmOrderDetailsRequest, CreateConfirmOrderDetailsResponse, CreateConfirmServiceDetailsRequest, CreateConfirmServiceDetailsResponse, CreateDigitalAccessKeyRequest, CreateDigitalAccessKeyResponse, CreateLegalDisclosureRequest, CreateLegalDisclosureResponse, CreateUnexpectedProblemRequest, CreateUnexpectedProblemResponse, CreateWarrantyRequest, CreateWarrantyResponse, Error, ErrorList, GetAttributesResponse, GetMessagingActionResponse, GetMessagingActionsForOrderResponse, GetSchemaResponse, InvoiceRequest, InvoiceResponse, LinkObject, MessagingAction

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

#confirm_customization_details(amazon_order_id, marketplace_ids, body, rate_limit: 1.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Sends a message asking a buyer to provide or verify customization details such as name spelling, images, initials, etc.

Parameters:

  • amazon_order_id (String)

    An Amazon order identifier. This identifies the order for which a message is sent.

  • marketplace_ids (Array<String>)

    A marketplace identifier. This identifies the marketplace in which the order was placed. You can only specify one marketplace.

  • body (Hash)

    This contains the message body for a message.

  • rate_limit (Float) (defaults to: 1.0)

    Requests per second

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

Returns:



47
48
49
50
51
52
53
54
# File 'lib/peddler/apis/messaging_v1.rb', line 47

def confirm_customization_details(amazon_order_id, marketplace_ids, body, rate_limit: 1.0)
  path = "/messaging/v1/orders/#{percent_encode(amazon_order_id)}/messages/confirmCustomizationDetails"
  params = {
    "marketplaceIds" => stringify_array(marketplace_ids),
  }.compact
  parser = -> { CreateConfirmCustomizationDetailsResponse }
  post(path, body:, params:, rate_limit:, parser:)
end

#create_confirm_delivery_details(amazon_order_id, marketplace_ids, body, rate_limit: 1.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Sends a message to a buyer to arrange a delivery or to confirm contact information for making a delivery.

Parameters:

  • amazon_order_id (String)

    An Amazon order identifier. This identifies the order for which a message is sent.

  • marketplace_ids (Array<String>)

    A marketplace identifier. This identifies the marketplace in which the order was placed. You can only specify one marketplace.

  • body (Hash)

    This contains the message body for a message.

  • rate_limit (Float) (defaults to: 1.0)

    Requests per second

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

Returns:



66
67
68
69
70
71
72
73
# File 'lib/peddler/apis/messaging_v1.rb', line 66

def create_confirm_delivery_details(amazon_order_id, marketplace_ids, body, rate_limit: 1.0)
  path = "/messaging/v1/orders/#{percent_encode(amazon_order_id)}/messages/confirmDeliveryDetails"
  params = {
    "marketplaceIds" => stringify_array(marketplace_ids),
  }.compact
  parser = -> { CreateConfirmDeliveryDetailsResponse }
  post(path, body:, params:, rate_limit:, parser:)
end

#create_confirm_order_details(amazon_order_id, marketplace_ids, body, rate_limit: 1.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Sends a message to ask a buyer an order-related question prior to shipping their order.

Parameters:

  • amazon_order_id (String)

    An Amazon order identifier. This identifies the order for which a message is sent.

  • marketplace_ids (Array<String>)

    A marketplace identifier. This identifies the marketplace in which the order was placed. You can only specify one marketplace.

  • body (Hash)

    This contains the message body for a message.

  • rate_limit (Float) (defaults to: 1.0)

    Requests per second

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

Returns:



105
106
107
108
109
110
111
112
# File 'lib/peddler/apis/messaging_v1.rb', line 105

def create_confirm_order_details(amazon_order_id, marketplace_ids, body, rate_limit: 1.0)
  path = "/messaging/v1/orders/#{percent_encode(amazon_order_id)}/messages/confirmOrderDetails"
  params = {
    "marketplaceIds" => stringify_array(marketplace_ids),
  }.compact
  parser = -> { CreateConfirmOrderDetailsResponse }
  post(path, body:, params:, rate_limit:, parser:)
end

#create_confirm_service_details(amazon_order_id, marketplace_ids, body, rate_limit: 1.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Sends a message to contact a Home Service customer to arrange a service call or to gather information prior to a service call.

Parameters:

  • amazon_order_id (String)

    An Amazon order identifier. This identifies the order for which a message is sent.

  • marketplace_ids (Array<String>)

    A marketplace identifier. This identifies the marketplace in which the order was placed. You can only specify one marketplace.

  • body (Hash)

    This contains the message body for a message.

  • rate_limit (Float) (defaults to: 1.0)

    Requests per second

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

Returns:



125
126
127
128
129
130
131
132
# File 'lib/peddler/apis/messaging_v1.rb', line 125

def create_confirm_service_details(amazon_order_id, marketplace_ids, body, rate_limit: 1.0)
  path = "/messaging/v1/orders/#{percent_encode(amazon_order_id)}/messages/confirmServiceDetails"
  params = {
    "marketplaceIds" => stringify_array(marketplace_ids),
  }.compact
  parser = -> { CreateConfirmServiceDetailsResponse }
  post(path, body:, params:, rate_limit:, parser:)
end

#create_digital_access_key(amazon_order_id, marketplace_ids, body, rate_limit: 1.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Sends a buyer a message to share a digital access key that is required to utilize digital content in their order.

Parameters:

  • amazon_order_id (String)

    An Amazon order identifier. This identifies the order for which a message is sent.

  • marketplace_ids (Array<String>)

    A marketplace identifier. This identifies the marketplace in which the order was placed. You can only specify one marketplace.

  • body (Hash)

    This contains the message body for a message.

  • rate_limit (Float) (defaults to: 1.0)

    Requests per second

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

Returns:



182
183
184
185
186
187
188
189
# File 'lib/peddler/apis/messaging_v1.rb', line 182

def create_digital_access_key(amazon_order_id, marketplace_ids, body, rate_limit: 1.0)
  path = "/messaging/v1/orders/#{percent_encode(amazon_order_id)}/messages/digitalAccessKey"
  params = {
    "marketplaceIds" => stringify_array(marketplace_ids),
  }.compact
  parser = -> { CreateDigitalAccessKeyResponse }
  post(path, body:, params:, rate_limit:, parser:)
end
Note:

This operation can make a static sandbox call.

Sends a critical message that contains documents that a seller is legally obligated to provide to the buyer. This message should only be used to deliver documents that are required by law.

Parameters:

  • amazon_order_id (String)

    An Amazon order identifier. This identifies the order for which a message is sent.

  • marketplace_ids (Array<String>)

    A marketplace identifier. This identifies the marketplace in which the order was placed. You can only specify one marketplace.

  • body (Hash)

    This contains the message body for a message.

  • rate_limit (Float) (defaults to: 1.0)

    Requests per second

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

Returns:



86
87
88
89
90
91
92
93
# File 'lib/peddler/apis/messaging_v1.rb', line 86

def create_legal_disclosure(amazon_order_id, marketplace_ids, body, rate_limit: 1.0)
  path = "/messaging/v1/orders/#{percent_encode(amazon_order_id)}/messages/legalDisclosure"
  params = {
    "marketplaceIds" => stringify_array(marketplace_ids),
  }.compact
  parser = -> { CreateLegalDisclosureResponse }
  post(path, body:, params:, rate_limit:, parser:)
end

#create_unexpected_problem(amazon_order_id, marketplace_ids, body, rate_limit: 1.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Sends a critical message to a buyer that an unexpected problem was encountered affecting the completion of the order.

Parameters:

  • amazon_order_id (String)

    An Amazon order identifier. This identifies the order for which a message is sent.

  • marketplace_ids (Array<String>)

    A marketplace identifier. This identifies the marketplace in which the order was placed. You can only specify one marketplace.

  • body (Hash)

    This contains the message body for a message.

  • rate_limit (Float) (defaults to: 1.0)

    Requests per second

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

Returns:



202
203
204
205
206
207
208
209
# File 'lib/peddler/apis/messaging_v1.rb', line 202

def create_unexpected_problem(amazon_order_id, marketplace_ids, body, rate_limit: 1.0)
  path = "/messaging/v1/orders/#{percent_encode(amazon_order_id)}/messages/unexpectedProblem"
  params = {
    "marketplaceIds" => stringify_array(marketplace_ids),
  }.compact
  parser = -> { CreateUnexpectedProblemResponse }
  post(path, body:, params:, rate_limit:, parser:)
end

#create_warranty(amazon_order_id, marketplace_ids, body, rate_limit: 1.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Sends a message to a buyer to provide details about warranty information on a purchase in their order.

Parameters:

  • amazon_order_id (String)

    An Amazon order identifier. This identifies the order for which a message is sent.

  • marketplace_ids (Array<String>)

    A marketplace identifier. This identifies the marketplace in which the order was placed. You can only specify one marketplace.

  • body (Hash)

    This contains the message body for a message.

  • rate_limit (Float) (defaults to: 1.0)

    Requests per second

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

Returns:



144
145
146
147
148
149
150
151
# File 'lib/peddler/apis/messaging_v1.rb', line 144

def create_warranty(amazon_order_id, marketplace_ids, body, rate_limit: 1.0)
  path = "/messaging/v1/orders/#{percent_encode(amazon_order_id)}/messages/warranty"
  params = {
    "marketplaceIds" => stringify_array(marketplace_ids),
  }.compact
  parser = -> { CreateWarrantyResponse }
  post(path, body:, params:, rate_limit:, parser:)
end

#get_attributes(amazon_order_id, marketplace_ids, rate_limit: 1.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Returns a response containing attributes related to an order. This includes buyer preferences.

Parameters:

  • amazon_order_id (String)

    An Amazon order identifier. This identifies the order for which a message is sent.

  • marketplace_ids (Array<String>)

    A marketplace identifier. This identifies the marketplace in which the order was placed. You can only specify one marketplace.

  • rate_limit (Float) (defaults to: 1.0)

    Requests per second

  • (String)
  • (Array[String])
  • rate_limit: (Float) (defaults to: 1.0)

Returns:



162
163
164
165
166
167
168
169
# File 'lib/peddler/apis/messaging_v1.rb', line 162

def get_attributes(amazon_order_id, marketplace_ids, rate_limit: 1.0)
  path = "/messaging/v1/orders/#{percent_encode(amazon_order_id)}/attributes"
  params = {
    "marketplaceIds" => stringify_array(marketplace_ids),
  }.compact
  parser = -> { GetAttributesResponse }
  get(path, params:, rate_limit:, parser:)
end

#get_messaging_actions_for_order(amazon_order_id, marketplace_ids, rate_limit: 1.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Returns a list of message types that are available for an order that you specify. A message type is represented by an actions object, which contains a path and query parameter(s). You can use the path and parameter(s) to call an operation that sends a message.

Parameters:

  • amazon_order_id (String)

    An Amazon order identifier. This specifies the order for which you want a list of available message types.

  • marketplace_ids (Array<String>)

    A marketplace identifier. This identifies the marketplace in which the order was placed. You can only specify one marketplace.

  • rate_limit (Float) (defaults to: 1.0)

    Requests per second

  • (String)
  • (Array[String])
  • rate_limit: (Float) (defaults to: 1.0)

Returns:



27
28
29
30
31
32
33
34
# File 'lib/peddler/apis/messaging_v1.rb', line 27

def get_messaging_actions_for_order(amazon_order_id, marketplace_ids, rate_limit: 1.0)
  path = "/messaging/v1/orders/#{percent_encode(amazon_order_id)}"
  params = {
    "marketplaceIds" => stringify_array(marketplace_ids),
  }.compact
  parser = -> { GetMessagingActionsForOrderResponse }
  get(path, params:, rate_limit:, parser:)
end

#send_invoice(amazon_order_id, marketplace_ids, body) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Sends a message providing the buyer an invoice

Parameters:

  • amazon_order_id (String)

    An Amazon order identifier. This identifies the order for which a message is sent.

  • marketplace_ids (Array<String>)

    A marketplace identifier. This identifies the marketplace in which the order was placed. You can only specify one marketplace.

  • body (Hash)

    This contains the message body for a message.

  • (String)
  • (Array[String])
  • (Hash[untyped, untyped])

Returns:



220
221
222
223
224
225
226
227
# File 'lib/peddler/apis/messaging_v1.rb', line 220

def send_invoice(amazon_order_id, marketplace_ids, body)
  path = "/messaging/v1/orders/#{percent_encode(amazon_order_id)}/messages/invoice"
  params = {
    "marketplaceIds" => stringify_array(marketplace_ids),
  }.compact
  parser = -> { InvoiceResponse }
  post(path, body:, params:, parser:)
end