Class: Peddler::API::VendorOrdersV1

Inherits:
Peddler::API show all
Defined in:
lib/peddler/api/vendor_orders_v1.rb

Overview

Selling Partner API for Retail Procurement Orders

The Selling Partner API for Retail Procurement Orders provides programmatic access to vendor orders data.

Instance Attribute Summary

Attributes inherited from Peddler::API

#access_token, #endpoint

Instance Method Summary collapse

Methods inherited from Peddler::API

#cannot_sandbox!, #endpoint_uri, #http, #initialize, #meter, #must_sandbox!, #retriable, #sandbox, #sandbox?, #use, #via

Constructor Details

This class inherits a constructor from Peddler::API

Instance Method Details

#get_purchase_order(purchase_order_number, rate_limit: 10.0) ⇒ Hash

Note:

This operation can make a static sandbox call.

Returns a purchase order based on the ‘purchaseOrderNumber` value that you specify.

Parameters:

  • purchase_order_number (String)

    The purchase order identifier for the order that you want. Formatting Notes: 8-character alpha-numeric code.

  • rate_limit (Float) (defaults to: 10.0)

    Requests per second

Returns:

  • (Hash)

    The API response



80
81
82
83
84
# File 'lib/peddler/api/vendor_orders_v1.rb', line 80

def get_purchase_order(purchase_order_number, rate_limit: 10.0)
  path = "/vendor/orders/v1/purchaseOrders/#{purchase_order_number}"

  meter(rate_limit).get(path)
end

#get_purchase_orders(limit: nil, created_after: nil, created_before: nil, sort_order: nil, next_token: nil, include_details: nil, changed_after: nil, changed_before: nil, po_item_state: nil, is_po_changed: nil, purchase_order_state: nil, ordering_vendor_code: nil, rate_limit: 10.0) ⇒ Hash

Note:

This operation can make a static sandbox call.

Returns a list of purchase orders created or changed during the time frame that you specify. You define the time frame using the ‘createdAfter`, `createdBefore`, `changedAfter` and `changedBefore` parameters. The date range to search must not be more than 7 days. You can choose to get only the purchase order numbers by setting `includeDetails` to false. You can then use the `getPurchaseOrder` operation to receive details for a specific purchase order.

Parameters:

  • limit (Integer) (defaults to: nil)

    The limit to the number of records returned. Default value is 100 records.

  • created_after (String) (defaults to: nil)

    Purchase orders that became available after this time will be included in the result. Must be in ISO-8601 date/time format.

  • created_before (String) (defaults to: nil)

    Purchase orders that became available before this time will be included in the result. Must be in ISO-8601 date/time format.

  • sort_order (String) (defaults to: nil)

    Sort in ascending or descending order by purchase order creation date.

  • next_token (String) (defaults to: nil)

    Used for pagination when there is more purchase orders than the specified result size limit. The token value is returned in the previous API call

  • include_details (String) (defaults to: nil)

    When true, returns purchase orders with complete details. Otherwise, only purchase order numbers are returned. Default value is true.

  • changed_after (String) (defaults to: nil)

    Purchase orders that changed after this timestamp will be included in the result. Must be in ISO-8601 date/time format.

  • changed_before (String) (defaults to: nil)

    Purchase orders that changed before this timestamp will be included in the result. Must be in ISO-8601 date/time format.

  • po_item_state (String) (defaults to: nil)

    Current state of the purchase order item. If this value is Cancelled, this API will return purchase orders which have one or more items cancelled by Amazon with updated item quantity as zero.

  • is_po_changed (String) (defaults to: nil)

    When true, returns purchase orders which were modified after the order was placed. Vendors are required to pull the changed purchase order and fulfill the updated purchase order and not the original one. Default value is false.

  • purchase_order_state (String) (defaults to: nil)

    Filters purchase orders based on the purchase order state.

  • ordering_vendor_code (String) (defaults to: nil)

    Filters purchase orders based on the specified ordering vendor code. This value should be same as ‘sellingParty.partyId’ in the purchase order. If not included in the filter, all purchase orders for all of the vendor codes that exist in the vendor group used to authorize the API client application are returned.

  • rate_limit (Float) (defaults to: 10.0)

    Requests per second

Returns:

  • (Hash)

    The API response



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/peddler/api/vendor_orders_v1.rb', line 51

def get_purchase_orders(limit: nil, created_after: nil, created_before: nil, sort_order: nil, next_token: nil,
  include_details: nil, changed_after: nil, changed_before: nil, po_item_state: nil, is_po_changed: nil,
  purchase_order_state: nil, ordering_vendor_code: nil, rate_limit: 10.0)
  path = "/vendor/orders/v1/purchaseOrders"
  params = {
    "limit" => limit,
    "createdAfter" => created_after,
    "createdBefore" => created_before,
    "sortOrder" => sort_order,
    "nextToken" => next_token,
    "includeDetails" => include_details,
    "changedAfter" => changed_after,
    "changedBefore" => changed_before,
    "poItemState" => po_item_state,
    "isPOChanged" => is_po_changed,
    "purchaseOrderState" => purchase_order_state,
    "orderingVendorCode" => ordering_vendor_code,
  }.compact

  meter(rate_limit).get(path, params:)
end

#get_purchase_orders_status(limit: nil, sort_order: nil, next_token: nil, created_after: nil, created_before: nil, updated_after: nil, updated_before: nil, purchase_order_number: nil, purchase_order_status: nil, item_confirmation_status: nil, item_receive_status: nil, ordering_vendor_code: nil, ship_to_party_id: nil, rate_limit: 10.0) ⇒ Hash

Note:

This operation can make a static sandbox call.

Returns purchase order statuses based on the filters that you specify. Date range to search must not be more than 7 days. You can return a list of purchase order statuses using the available filters, or a single purchase order status by providing the purchase order number.

Parameters:

  • limit (Integer) (defaults to: nil)

    The limit to the number of records returned. Default value is 100 records.

  • sort_order (String) (defaults to: nil)

    Sort in ascending or descending order by purchase order creation date.

  • next_token (String) (defaults to: nil)

    Used for pagination when there are more purchase orders than the specified result size limit.

  • created_after (String) (defaults to: nil)

    Purchase orders that became available after this timestamp will be included in the result. Must be in ISO-8601 date/time format.

  • created_before (String) (defaults to: nil)

    Purchase orders that became available before this timestamp will be included in the result. Must be in ISO-8601 date/time format.

  • updated_after (String) (defaults to: nil)

    Purchase orders for which the last purchase order update happened after this timestamp will be included in the result. Must be in ISO-8601 date/time format.

  • updated_before (String) (defaults to: nil)

    Purchase orders for which the last purchase order update happened before this timestamp will be included in the result. Must be in ISO-8601 date/time format.

  • purchase_order_number (String) (defaults to: nil)

    Provides purchase order status for the specified purchase order number.

  • purchase_order_status (String) (defaults to: nil)

    Filters purchase orders based on the specified purchase order status. If not included in filter, this will return purchase orders for all statuses.

  • item_confirmation_status (String) (defaults to: nil)

    Filters purchase orders based on their item confirmation status. If the item confirmation status is not included in the filter, purchase orders for all confirmation statuses are included.

  • item_receive_status (String) (defaults to: nil)

    Filters purchase orders based on the purchase order’s item receive status. If the item receive status is not included in the filter, purchase orders for all receive statuses are included.

  • ordering_vendor_code (String) (defaults to: nil)

    Filters purchase orders based on the specified ordering vendor code. This value should be same as ‘sellingParty.partyId’ in the purchase order. If not included in filter, all purchase orders for all the vendor codes that exist in the vendor group used to authorize API client application are returned.

  • ship_to_party_id (String) (defaults to: nil)

    Filters purchase orders for a specific buyer’s Fulfillment Center/warehouse by providing ship to location id here. This value should be same as ‘shipToParty.partyId’ in the purchase order. If not included in filter, this will return purchase orders for all the buyer’s warehouses used for vendor group purchase orders.

  • rate_limit (Float) (defaults to: 10.0)

    Requests per second

Returns:

  • (Hash)

    The API response



134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# File 'lib/peddler/api/vendor_orders_v1.rb', line 134

def get_purchase_orders_status(limit: nil, sort_order: nil, next_token: nil, created_after: nil,
  created_before: nil, updated_after: nil, updated_before: nil, purchase_order_number: nil,
  purchase_order_status: nil, item_confirmation_status: nil, item_receive_status: nil, ordering_vendor_code: nil,
  ship_to_party_id: nil, rate_limit: 10.0)
  path = "/vendor/orders/v1/purchaseOrdersStatus"
  params = {
    "limit" => limit,
    "sortOrder" => sort_order,
    "nextToken" => next_token,
    "createdAfter" => created_after,
    "createdBefore" => created_before,
    "updatedAfter" => updated_after,
    "updatedBefore" => updated_before,
    "purchaseOrderNumber" => purchase_order_number,
    "purchaseOrderStatus" => purchase_order_status,
    "itemConfirmationStatus" => item_confirmation_status,
    "itemReceiveStatus" => item_receive_status,
    "orderingVendorCode" => ordering_vendor_code,
    "shipToPartyId" => ship_to_party_id,
  }.compact

  meter(rate_limit).get(path, params:)
end

#submit_acknowledgement(body, rate_limit: 10.0) ⇒ Hash

Note:

This operation can make a static sandbox call.

Submits acknowledgements for one or more purchase orders.

Parameters:

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

    Requests per second

Returns:

  • (Hash)

    The API response



92
93
94
95
96
# File 'lib/peddler/api/vendor_orders_v1.rb', line 92

def submit_acknowledgement(body, rate_limit: 10.0)
  path = "/vendor/orders/v1/acknowledgements"

  meter(rate_limit).post(path, body:)
end