Module: Peddler::Notifications::OrderChange

Defined in:
lib/peddler/notifications/order_change.rb,
lib/peddler/notifications/order_change/payload.rb,
lib/peddler/notifications/order_change/summary.rb,
lib/peddler/notifications/order_change/order_item.rb,
lib/peddler/notifications/order_change/notification.rb,
lib/peddler/notifications/order_change/order_change_trigger.rb,
lib/peddler/notifications/order_change/order_change_notification.rb

Overview

The root schema

The notification response schema that comprises the entire JSON document for ORDER_CHANGE notification.

Constant Summary collapse

Payload =

Notification payload that wraps nested notification data

Structure.new do
  # @return [OrderChangeNotification]
  attribute(:order_change_notification, OrderChangeNotification, from: "OrderChangeNotification")
end
Summary =

Information about the order and order items that had the change.

Structure.new do
  # @return [String] The destination postal code. It will be null when there is no related information.
  attribute(:destination_postal_code, String, from: "DestinationPostalCode")

  # @return [String] Fulfillment type of the affected order, MFN or AFN.
  attribute(:fulfillment_type, String, from: "FulfillmentType")

  # @return [String] The Amazon marketplace identifier of the order.
  attribute(:marketplace_id, String, from: "MarketplaceId")

  # @return [Array<OrderItem>] Information about order items included in this order. For OrderItemLevel
  # notifications, one payload includes one item, while for OrderLevel notifications, one payload includes all
  # items.
  attribute(:order_items, [OrderItem], from: "OrderItems")

  # @return [String] The current order status.
  attribute(:order_status, String, from: "OrderStatus")

  # @return [String] The type of the order.
  attribute(:order_type, String, from: "OrderType")

  # @return [String] The purchase date of the order, in ISO-8601 date/time format. It will be null when there is
  # no related information.
  attribute(:purchase_date, String, from: "PurchaseDate")

  # @return [String] The end of the time period during which you must notify the seller of possible cancellation,
  # in ISO-8601 date/time format.
  attribute?(:cancel_notify_date, String, from: "CancelNotifyDate")

  # @return [String] The start of the time period during which you committed to fulfill the order, in ISO-8601
  # date/time format. Returned only for seller-fulfilled orders.
  attribute?(:earliest_delivery_date, String, from: "EarliestDeliveryDate")

  # @return [String] The start of the time period during which you committed to ship the order, in ISO-8601
  # date/time format.
  attribute?(:earliest_ship_date, String, from: "EarliestShipDate")

  # @return [String] The status of the Amazon Easy Ship order. This property is included only for Amazon Easy Ship
  # orders.
  attribute?(:easy_ship_shipment_status, String, from: "EasyShipShipmentStatus")

  # @return [String] The status of the electronic invoice.
  attribute?(:electronic_invoice_status, String, from: "ElectronicInvoiceStatus")

  # @return [String] The end of the time period during which you committed to fulfill the order, in ISO-8601
  # date/time format. Returned only for seller-fulfilled orders that do not have a PendingAvailability, Pending,
  # or Canceled status.
  attribute?(:latest_delivery_date, String, from: "LatestDeliveryDate")

  # @return [String] The end of the time period during which you committed to ship the order, in ISO-8601
  # date/time format.
  attribute?(:latest_ship_date, String, from: "LatestShipDate")

  # @return [Integer] The number of items shipped.
  attribute?(:number_of_items_shipped, Integer, from: "NumberOfItemsShipped")

  # @return [Integer] The number of items unshipped.
  attribute?(:number_of_items_unshipped, Integer, from: "NumberOfItemsUnshipped")

  # @return [Array<String>] The order programs in which this order participates.
  attribute?(:order_programs, [String], from: "OrderPrograms")

  # @return [Array<String>] The shipping programs in which this order participates.
  attribute?(:shipping_programs, [String], from: "ShippingPrograms")
end
OrderItem =

Information about every order item.

Structure.new do
  # @return [String] The Amazon-defined order item identifier.
  attribute(:order_item_id, String, from: "OrderItemId")

  # @return [Integer] The number of items in the order.
  attribute(:quantity, Integer, from: "Quantity")

  # @return [String] The seller-specific SKU for an item.
  attribute(:seller_sku, String, from: "SellerSKU")

  # @return [String] The unique identifier of the supply source. Will be null when there is no related
  # information.
  attribute(:supply_source_id, String, from: "SupplySourceId")

  # @return [:boolean] True when the buyer has requested cancelation.
  attribute?(:buyer_requested_cancel, :boolean, from: "IsBuyerRequestedCancel")

  # @return [String] The start of the time period during which you have committed to fulfill the order.
  attribute?(:item_earliest_delivery_date, String, from: "ItemEarliestDeliveryDate")

  # @return [String] The end of the time period during which you have committed to fulfill the order.
  attribute?(:item_latest_delivery_date, String, from: "ItemLatestDeliveryDate")

  # @return [String] The current status of the order item. This field Will have a non-null value when items'
  # statuses are different.
  attribute?(:order_item_status, String, from: "OrderItemStatus")

  # @return [Integer] The number of items shipped.
  attribute?(:quantity_shipped, Integer, from: "QuantityShipped")
end
Notification =

The notification response schema that comprises the entire JSON document for ORDER_CHANGE notification.

Structure.new do
  # @return [String] The time when this notification was published, in ISO-8601 date/time format.
  attribute(:event_time, String, from: "EventTime")

  # @return [Hash] The notification metadata.
  attribute(:notification_metadata, Hash, from: "NotificationMetadata")

  # @return [String] The type of this notification, used to differentiate different notifications. Combined with
  # payload version, this controls the structure of the payload object.
  attribute(:notification_type, String, from: "NotificationType")

  # @return [String] The notification version.
  attribute(:notification_version, String, from: "NotificationVersion")

  # @return [Payload] The payload for the ORDER_CHANGE notification.
  attribute(:payload, Payload, from: "Payload")

  # @return [String] The payload version of the notification.
  attribute(:payload_version, String, from: "PayloadVersion")
end
OrderChangeTrigger =

Details about what caused this ORDER_CHANGE notification to be sent.

Structure.new do
  # @return [String] The reason this ORDER_CHANGE notification was sent.
  attribute(:change_reason, String, from: "ChangeReason")

  # @return [String] The time of the change that caused this notification, in ISO-8601 date/time format. Will be
  # null when there is no related timestamp.
  attribute(:time_of_order_change, String, from: "TimeOfOrderChange")
end
OrderChangeNotification =

Nested notification data

Structure.new do
  # @return [String] The Amazon order identifier, in 3-7-7 format.
  attribute(:amazon_order_id, String, from: "AmazonOrderId")

  # @return [String] The notification level of current notification.
  attribute(:notification_level, String, from: "NotificationLevel")

  # @return [OrderChangeTrigger]
  attribute(:order_change_trigger, OrderChangeTrigger, from: "OrderChangeTrigger")

  # @return [String] The type of order change that caused the notification to be sent. Possible values are
  # BuyerRequestedChange and OrderStatusChange.
  attribute(:order_change_type, String, from: "OrderChangeType")

  # @return [String] The selling partner identifier.
  attribute(:seller_id, String, from: "SellerId")

  # @return [Summary]
  attribute(:summary, Summary, from: "Summary")
end

Class Method Summary collapse

Class Method Details

.parse(hash) ⇒ Object



12
13
14
# File 'lib/peddler/notifications/order_change.rb', line 12

def parse(hash)
  Notification.parse(hash)
end