Class: Peddler::APIs::MessagingV1

Inherits:
Peddler::API show all
Defined in:
lib/peddler/apis/messaging_v1.rb

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.

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

#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

Returns:



55
56
57
58
59
60
61
62
# File 'lib/peddler/apis/messaging_v1.rb', line 55

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 = Peddler::Types::MessagingV1::CreateConfirmCustomizationDetailsResponse if typed?
  meter(rate_limit).post(path, body:, params:, parser:)
end

#create_amazon_motors(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 an Amazon Motors order. This message can only be sent by Amazon Motors sellers.

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

Returns:



153
154
155
156
157
158
159
160
# File 'lib/peddler/apis/messaging_v1.rb', line 153

def create_amazon_motors(amazon_order_id, marketplace_ids, body, rate_limit: 1.0)
  path = "/messaging/v1/orders/#{percent_encode(amazon_order_id)}/messages/amazonMotors"
  params = {
    "marketplaceIds" => stringify_array(marketplace_ids),
  }.compact
  parser = Peddler::Types::MessagingV1::CreateAmazonMotorsResponse if typed?
  meter(rate_limit).post(path, body:, params:, 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

Returns:



74
75
76
77
78
79
80
81
# File 'lib/peddler/apis/messaging_v1.rb', line 74

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 = Peddler::Types::MessagingV1::CreateConfirmDeliveryDetailsResponse if typed?
  meter(rate_limit).post(path, body:, params:, 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

Returns:



113
114
115
116
117
118
119
120
# File 'lib/peddler/apis/messaging_v1.rb', line 113

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 = Peddler::Types::MessagingV1::CreateConfirmOrderDetailsResponse if typed?
  meter(rate_limit).post(path, body:, params:, 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

Returns:



133
134
135
136
137
138
139
140
# File 'lib/peddler/apis/messaging_v1.rb', line 133

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 = Peddler::Types::MessagingV1::CreateConfirmServiceDetailsResponse if typed?
  meter(rate_limit).post(path, body:, params:, 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

Returns:



210
211
212
213
214
215
216
217
# File 'lib/peddler/apis/messaging_v1.rb', line 210

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 = Peddler::Types::MessagingV1::CreateDigitalAccessKeyResponse if typed?
  meter(rate_limit).post(path, body:, params:, 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

Returns:



94
95
96
97
98
99
100
101
# File 'lib/peddler/apis/messaging_v1.rb', line 94

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 = Peddler::Types::MessagingV1::CreateLegalDisclosureResponse if typed?
  meter(rate_limit).post(path, body:, params:, 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

Returns:



230
231
232
233
234
235
236
237
# File 'lib/peddler/apis/messaging_v1.rb', line 230

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 = Peddler::Types::MessagingV1::CreateUnexpectedProblemResponse if typed?
  meter(rate_limit).post(path, body:, params:, 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

Returns:



172
173
174
175
176
177
178
179
# File 'lib/peddler/apis/messaging_v1.rb', line 172

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 = Peddler::Types::MessagingV1::CreateWarrantyResponse if typed?
  meter(rate_limit).post(path, body:, params:, 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

Returns:



190
191
192
193
194
195
196
197
# File 'lib/peddler/apis/messaging_v1.rb', line 190

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

Returns:



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

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

Returns:



248
249
250
251
252
253
254
255
# File 'lib/peddler/apis/messaging_v1.rb', line 248

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 = Peddler::Types::MessagingV1::InvoiceResponse if typed?
  post(path, body:, params:, parser:)
end