Class: MWS::Orders::Client

Inherits:
Peddler::Client show all
Defined in:
lib/mws/orders/client.rb

Overview

With the MWS Orders API, you can list orders created or updated during a time frame you specify or retrieve information about specific orders.

Instance Attribute Summary

Attributes inherited from Peddler::Client

#auth_token, #body, #marketplace, #merchant_id

Instance Method Summary collapse

Methods inherited from Peddler::Client

#initialize

Constructor Details

This class inherits a constructor from Peddler::Client

Instance Method Details

#get_order(*amazon_order_ids) ⇒ Peddler::XMLParser

Gets one or more orders

Parameters:

  • amazon_order_ids (Array<String>)

Returns:

  • (Peddler::XMLParser)

See Also:


69
70
71
72
73
74
75
# File 'lib/mws/orders/client.rb', line 69

def get_order(*amazon_order_ids)
  operation('GetOrder')
    .add('AmazonOrderId' => amazon_order_ids)
    .structure!('AmazonOrderId', 'Id')

  run
end

#get_service_statusPeddler::XMLParser

Gets the service status of the API


105
106
107
108
# File 'lib/mws/orders/client.rb', line 105

def get_service_status
  operation('GetServiceStatus')
  run
end

#list_order_items(amazon_order_id) ⇒ Peddler::XMLParser

Lists order items for an order

Parameters:

  • amazon_order_id (String)

Returns:

  • (Peddler::XMLParser)

See Also:


82
83
84
85
86
87
# File 'lib/mws/orders/client.rb', line 82

def list_order_items(amazon_order_id)
  operation('ListOrderItems')
    .add('AmazonOrderId' => amazon_order_id)

  run
end

#list_order_items_by_next_token(next_token) ⇒ Peddler::XMLParser

Lists the next page of order items for an order

Parameters:

  • next_token (String)

Returns:

  • (Peddler::XMLParser)

See Also:


94
95
96
97
98
99
# File 'lib/mws/orders/client.rb', line 94

def list_order_items_by_next_token(next_token)
  operation('ListOrderItemsByNextToken')
    .add('NextToken' => next_token)

  run
end

#list_orders(*marketplace_id, opts = {}) ⇒ Peddler::XMLParser

Note:

When calling this operation, you must specify a time frame using either created_after or last_updated_after. When requesting orders by “Unshipped” status you must also request “PartiallyShipped” orders.

Lists orders

Parameters:

  • marketplace_id (Array<String>)
  • opts (Hash) (defaults to: {})

Options Hash (opts):

  • :created_after (String, #iso8601)
  • :created_before (String, #iso8601)
  • :last_updated_after (String, #iso8601)
  • :last_updated_before (String, #iso8601)
  • :order_status (Array<String>, String)
  • :fulfillment_channel (Array<String>, String)
  • :payment_method (Array<String>, String)
  • :buyer_email (String)
  • :seller_order_id (String)
  • :max_results_per_page (String)
  • :tfm_shipment_status (String)

Returns:

  • (Peddler::XMLParser)

See Also:


34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/mws/orders/client.rb', line 34

def list_orders(*marketplace_id)
  marketplace_id = marketplace_id.dup
  opts = extract_options(marketplace_id)
  opts['TFMShipmentStatus'] = opts.delete(:tfm_shipment_status) if opts.key?(:tfm_shipment_status)

  operation('ListOrders')
    .add(opts)
    .add('MarketplaceId' => marketplace_id)
    .structure!('OrderStatus', 'Status')
    .structure!('FulfillmentChannel', 'Channel')
    .structure!('MarketplaceId', 'Id')
    .structure!('PaymentMethod')
    .structure!('TFMShipmentStatus', 'Status')
  require_start_time!

  run
end

#list_orders_by_next_token(next_token) ⇒ Peddler::XMLParser

Lists the next page of orders

Parameters:

  • next_token (String)

Returns:

  • (Peddler::XMLParser)

See Also:


57
58
59
60
61
62
# File 'lib/mws/orders/client.rb', line 57

def list_orders_by_next_token(next_token)
  operation('ListOrdersByNextToken')
    .add('NextToken' => next_token)

  run
end