class AmzSpApi::OrdersApiModel::Order
Order
information.
Attributes
An Amazon-defined order identifier, in 3-7-7 format.
Custom ship label for Checkout by Amazon (CBA).
The start of the time period within which you have committed to fulfill the order. In ISO 8601 date time format. Returned only for seller-fulfilled orders.
The start of the time period within which you have committed to ship the order. In ISO 8601 date time format. Returned only for seller-fulfilled orders. Note: EarliestShipDate might not be returned for orders placed before February 1, 2013.
The status of the Amazon Easy Ship order. This property is included only for Amazon Easy Ship orders. Possible values: PendingPickUp, LabelCanceled, PickedUp, OutForDelivery, Damaged, Delivered, RejectedByBuyer, Undeliverable, ReturnedToSeller, ReturningToSeller.
Whether the order was fulfilled by Amazon (AFN) or by the seller (MFN).
When true, the order is an Amazon Business order. An Amazon Business order is an order where the buyer is a Verified Business Buyer.
When true, the estimated ship date is set for the order. Returned only for Sourcing on Demand orders.
When true, the order is a GlobalExpress order.
When true, the order is a seller-fulfilled Amazon Prime order.
When true, this is a replacement order.
When true, the item within this order was bought and re-sold by Amazon Business EU SARL (ABEU). By buying and instantly re-selling your items, ABEU becomes the seller of record, making your inventory available for sale to customers who would not otherwise purchase from a third-party seller.
The date when the order was last updated. Note: LastUpdateDate is returned with an incorrect date for orders that were last updated before 2009-04-01.
The end of the time period within which you have 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.
The end of the time period within which you have committed to ship the order. In ISO 8601 date time format. Returned only for seller-fulfilled orders. Note: LatestShipDate might not be returned for orders placed before February 1, 2013.
The identifier for the marketplace where the order was placed.
The number of items shipped.
The number of items unshipped.
The order channel of the first item in the order.
The current order status.
The type of the order.
The payment method for the order. This property is limited to Cash On Delivery (COD) and Convenience Store (CVS) payment methods. Unless you need the specific COD payment information provided by the PaymentExecutionDetailItem
object, we recommend using the PaymentMethodDetails property to get payment method information.
Indicates the date by which the seller must respond to the buyer with an estimated ship date. Returned only for Sourcing on Demand orders.
The date when the order was created.
The order ID value for the order that is being replaced. Returned only if IsReplacementOrder = true.
The sales channel of the first item in the order.
A seller-defined order identifier.
The shipment service level of the order.
The shipment service level category of the order. Possible values: Expedited, FreeEconomy, NextDay, SameDay, SecondDay, Scheduled, Standard.
Public Class Methods
Attribute mapping from ruby-style variable name to JSON key.
# File lib/orders-api-model/models/order.rb, line 140 def self.attribute_map { :'amazon_order_id' => :'AmazonOrderId', :'seller_order_id' => :'SellerOrderId', :'purchase_date' => :'PurchaseDate', :'last_update_date' => :'LastUpdateDate', :'order_status' => :'OrderStatus', :'fulfillment_channel' => :'FulfillmentChannel', :'sales_channel' => :'SalesChannel', :'order_channel' => :'OrderChannel', :'ship_service_level' => :'ShipServiceLevel', :'order_total' => :'OrderTotal', :'number_of_items_shipped' => :'NumberOfItemsShipped', :'number_of_items_unshipped' => :'NumberOfItemsUnshipped', :'payment_execution_detail' => :'PaymentExecutionDetail', :'payment_method' => :'PaymentMethod', :'payment_method_details' => :'PaymentMethodDetails', :'marketplace_id' => :'MarketplaceId', :'shipment_service_level_category' => :'ShipmentServiceLevelCategory', :'easy_ship_shipment_status' => :'EasyShipShipmentStatus', :'cba_displayable_shipping_label' => :'CbaDisplayableShippingLabel', :'order_type' => :'OrderType', :'earliest_ship_date' => :'EarliestShipDate', :'latest_ship_date' => :'LatestShipDate', :'earliest_delivery_date' => :'EarliestDeliveryDate', :'latest_delivery_date' => :'LatestDeliveryDate', :'is_business_order' => :'IsBusinessOrder', :'is_prime' => :'IsPrime', :'is_premium_order' => :'IsPremiumOrder', :'is_global_express_enabled' => :'IsGlobalExpressEnabled', :'replaced_order_id' => :'ReplacedOrderId', :'is_replacement_order' => :'IsReplacementOrder', :'promise_response_due_date' => :'PromiseResponseDueDate', :'is_estimated_ship_date_set' => :'IsEstimatedShipDateSet', :'is_sold_by_ab' => :'IsSoldByAB', :'assigned_ship_from_location_address' => :'AssignedShipFromLocationAddress', :'fulfillment_instruction' => :'FulfillmentInstruction' } end
Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself
# File lib/orders-api-model/models/order.rb, line 521 def self.build_from_hash(attributes) new.build_from_hash(attributes) end
Initializes the object @param [Hash] attributes Model attributes in the form of hash
# File lib/orders-api-model/models/order.rb, line 229 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `AmzSpApi::OrdersApiModel::Order` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `AmzSpApi::OrdersApiModel::Order`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'amazon_order_id') self.amazon_order_id = attributes[:'amazon_order_id'] end if attributes.key?(:'seller_order_id') self.seller_order_id = attributes[:'seller_order_id'] end if attributes.key?(:'purchase_date') self.purchase_date = attributes[:'purchase_date'] end if attributes.key?(:'last_update_date') self.last_update_date = attributes[:'last_update_date'] end if attributes.key?(:'order_status') self.order_status = attributes[:'order_status'] end if attributes.key?(:'fulfillment_channel') self.fulfillment_channel = attributes[:'fulfillment_channel'] end if attributes.key?(:'sales_channel') self.sales_channel = attributes[:'sales_channel'] end if attributes.key?(:'order_channel') self.order_channel = attributes[:'order_channel'] end if attributes.key?(:'ship_service_level') self.ship_service_level = attributes[:'ship_service_level'] end if attributes.key?(:'order_total') self.order_total = attributes[:'order_total'] end if attributes.key?(:'number_of_items_shipped') self.number_of_items_shipped = attributes[:'number_of_items_shipped'] end if attributes.key?(:'number_of_items_unshipped') self.number_of_items_unshipped = attributes[:'number_of_items_unshipped'] end if attributes.key?(:'payment_execution_detail') self.payment_execution_detail = attributes[:'payment_execution_detail'] end if attributes.key?(:'payment_method') self.payment_method = attributes[:'payment_method'] end if attributes.key?(:'payment_method_details') self.payment_method_details = attributes[:'payment_method_details'] end if attributes.key?(:'marketplace_id') self.marketplace_id = attributes[:'marketplace_id'] end if attributes.key?(:'shipment_service_level_category') self.shipment_service_level_category = attributes[:'shipment_service_level_category'] end if attributes.key?(:'easy_ship_shipment_status') self.easy_ship_shipment_status = attributes[:'easy_ship_shipment_status'] end if attributes.key?(:'cba_displayable_shipping_label') self.cba_displayable_shipping_label = attributes[:'cba_displayable_shipping_label'] end if attributes.key?(:'order_type') self.order_type = attributes[:'order_type'] end if attributes.key?(:'earliest_ship_date') self.earliest_ship_date = attributes[:'earliest_ship_date'] end if attributes.key?(:'latest_ship_date') self.latest_ship_date = attributes[:'latest_ship_date'] end if attributes.key?(:'earliest_delivery_date') self.earliest_delivery_date = attributes[:'earliest_delivery_date'] end if attributes.key?(:'latest_delivery_date') self.latest_delivery_date = attributes[:'latest_delivery_date'] end if attributes.key?(:'is_business_order') self.is_business_order = attributes[:'is_business_order'] end if attributes.key?(:'is_prime') self.is_prime = attributes[:'is_prime'] end if attributes.key?(:'is_premium_order') self.is_premium_order = attributes[:'is_premium_order'] end if attributes.key?(:'is_global_express_enabled') self.is_global_express_enabled = attributes[:'is_global_express_enabled'] end if attributes.key?(:'replaced_order_id') self.replaced_order_id = attributes[:'replaced_order_id'] end if attributes.key?(:'is_replacement_order') self.is_replacement_order = attributes[:'is_replacement_order'] end if attributes.key?(:'promise_response_due_date') self.promise_response_due_date = attributes[:'promise_response_due_date'] end if attributes.key?(:'is_estimated_ship_date_set') self.is_estimated_ship_date_set = attributes[:'is_estimated_ship_date_set'] end if attributes.key?(:'is_sold_by_ab') self.is_sold_by_ab = attributes[:'is_sold_by_ab'] end if attributes.key?(:'assigned_ship_from_location_address') self.assigned_ship_from_location_address = attributes[:'assigned_ship_from_location_address'] end if attributes.key?(:'fulfillment_instruction') self.fulfillment_instruction = attributes[:'fulfillment_instruction'] end end
List of attributes with nullable: true
# File lib/orders-api-model/models/order.rb, line 222 def self.openapi_nullable Set.new([ ]) end
Attribute type mapping.
# File lib/orders-api-model/models/order.rb, line 181 def self.openapi_types { :'amazon_order_id' => :'Object', :'seller_order_id' => :'Object', :'purchase_date' => :'Object', :'last_update_date' => :'Object', :'order_status' => :'Object', :'fulfillment_channel' => :'Object', :'sales_channel' => :'Object', :'order_channel' => :'Object', :'ship_service_level' => :'Object', :'order_total' => :'Object', :'number_of_items_shipped' => :'Object', :'number_of_items_unshipped' => :'Object', :'payment_execution_detail' => :'Object', :'payment_method' => :'Object', :'payment_method_details' => :'Object', :'marketplace_id' => :'Object', :'shipment_service_level_category' => :'Object', :'easy_ship_shipment_status' => :'Object', :'cba_displayable_shipping_label' => :'Object', :'order_type' => :'Object', :'earliest_ship_date' => :'Object', :'latest_ship_date' => :'Object', :'earliest_delivery_date' => :'Object', :'latest_delivery_date' => :'Object', :'is_business_order' => :'Object', :'is_prime' => :'Object', :'is_premium_order' => :'Object', :'is_global_express_enabled' => :'Object', :'replaced_order_id' => :'Object', :'is_replacement_order' => :'Object', :'promise_response_due_date' => :'Object', :'is_estimated_ship_date_set' => :'Object', :'is_sold_by_ab' => :'Object', :'assigned_ship_from_location_address' => :'Object', :'fulfillment_instruction' => :'Object' } end
Public Instance Methods
Checks equality by comparing each attribute. @param [Object] Object to be compared
# File lib/orders-api-model/models/order.rb, line 466 def ==(o) return true if self.equal?(o) self.class == o.class && amazon_order_id == o.amazon_order_id && seller_order_id == o.seller_order_id && purchase_date == o.purchase_date && last_update_date == o.last_update_date && order_status == o.order_status && fulfillment_channel == o.fulfillment_channel && sales_channel == o.sales_channel && order_channel == o.order_channel && ship_service_level == o.ship_service_level && order_total == o.order_total && number_of_items_shipped == o.number_of_items_shipped && number_of_items_unshipped == o.number_of_items_unshipped && payment_execution_detail == o.payment_execution_detail && payment_method == o.payment_method && payment_method_details == o.payment_method_details && marketplace_id == o.marketplace_id && shipment_service_level_category == o.shipment_service_level_category && easy_ship_shipment_status == o.easy_ship_shipment_status && cba_displayable_shipping_label == o.cba_displayable_shipping_label && order_type == o.order_type && earliest_ship_date == o.earliest_ship_date && latest_ship_date == o.latest_ship_date && earliest_delivery_date == o.earliest_delivery_date && latest_delivery_date == o.latest_delivery_date && is_business_order == o.is_business_order && is_prime == o.is_prime && is_premium_order == o.is_premium_order && is_global_express_enabled == o.is_global_express_enabled && replaced_order_id == o.replaced_order_id && is_replacement_order == o.is_replacement_order && promise_response_due_date == o.promise_response_due_date && is_estimated_ship_date_set == o.is_estimated_ship_date_set && is_sold_by_ab == o.is_sold_by_ab && assigned_ship_from_location_address == o.assigned_ship_from_location_address && fulfillment_instruction == o.fulfillment_instruction end
Deserializes the data based on type @param string type Data type @param string value Value to be deserialized @return [Object] Deserialized data
# File lib/orders-api-model/models/order.rb, line 551 def _deserialize(type, value) case type.to_sym when :DateTime DateTime.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model AmzSpApi::OrdersApiModel.const_get(type).build_from_hash(value) end end
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value @param [Object] value Any valid value @return [Hash] Returns the value in the form of hash
# File lib/orders-api-model/models/order.rb, line 620 def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end
Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself
# File lib/orders-api-model/models/order.rb, line 528 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.openapi_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) self.send("#{key}=", nil) end end self end
@see the `==` method @param [Object] Object to be compared
# File lib/orders-api-model/models/order.rb, line 508 def eql?(o) self == o end
Custom attribute writer method checking allowed values (enum). @param [Object] fulfillment_channel
Object to be assigned
# File lib/orders-api-model/models/order.rb, line 436 def fulfillment_channel=(fulfillment_channel) validator = EnumAttributeValidator.new('Object', ['MFN', 'AFN']) unless validator.valid?(fulfillment_channel) fail ArgumentError, "invalid value for \"fulfillment_channel\", must be one of #{validator.allowable_values}." end @fulfillment_channel = fulfillment_channel end
Calculates hash code according to all attributes. @return [Integer] Hash code
# File lib/orders-api-model/models/order.rb, line 514 def hash [amazon_order_id, seller_order_id, purchase_date, last_update_date, order_status, fulfillment_channel, sales_channel, order_channel, ship_service_level, order_total, number_of_items_shipped, number_of_items_unshipped, payment_execution_detail, payment_method, payment_method_details, marketplace_id, shipment_service_level_category, easy_ship_shipment_status, cba_displayable_shipping_label, order_type, earliest_ship_date, latest_ship_date, earliest_delivery_date, latest_delivery_date, is_business_order, is_prime, is_premium_order, is_global_express_enabled, replaced_order_id, is_replacement_order, promise_response_due_date, is_estimated_ship_date_set, is_sold_by_ab, assigned_ship_from_location_address, fulfillment_instruction].hash end
Show invalid properties with the reasons. Usually used together with valid? @return Array for valid properties with the reasons
# File lib/orders-api-model/models/order.rb, line 385 def list_invalid_properties invalid_properties = Array.new if @amazon_order_id.nil? invalid_properties.push('invalid value for "amazon_order_id", amazon_order_id cannot be nil.') end if @purchase_date.nil? invalid_properties.push('invalid value for "purchase_date", purchase_date cannot be nil.') end if @last_update_date.nil? invalid_properties.push('invalid value for "last_update_date", last_update_date cannot be nil.') end if @order_status.nil? invalid_properties.push('invalid value for "order_status", order_status cannot be nil.') end invalid_properties end
Custom attribute writer method checking allowed values (enum). @param [Object] order_status
Object to be assigned
# File lib/orders-api-model/models/order.rb, line 426 def order_status=(order_status) validator = EnumAttributeValidator.new('Object', ['Pending', 'Unshipped', 'PartiallyShipped', 'Shipped', 'Canceled', 'Unfulfillable', 'InvoiceUnconfirmed', 'PendingAvailability']) unless validator.valid?(order_status) fail ArgumentError, "invalid value for \"order_status\", must be one of #{validator.allowable_values}." end @order_status = order_status end
Custom attribute writer method checking allowed values (enum). @param [Object] order_type
Object to be assigned
# File lib/orders-api-model/models/order.rb, line 456 def order_type=(order_type) validator = EnumAttributeValidator.new('Object', ['StandardOrder', 'LongLeadTimeOrder', 'Preorder', 'BackOrder', 'SourcingOnDemandOrder']) unless validator.valid?(order_type) fail ArgumentError, "invalid value for \"order_type\", must be one of #{validator.allowable_values}." end @order_type = order_type end
Custom attribute writer method checking allowed values (enum). @param [Object] payment_method
Object to be assigned
# File lib/orders-api-model/models/order.rb, line 446 def payment_method=(payment_method) validator = EnumAttributeValidator.new('Object', ['COD', 'CVS', 'Other']) unless validator.valid?(payment_method) fail ArgumentError, "invalid value for \"payment_method\", must be one of #{validator.allowable_values}." end @payment_method = payment_method end
Returns the object in the form of hash @return [Hash] Returns the object in the form of hash
# File lib/orders-api-model/models/order.rb, line 602 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end
Returns the string representation of the object @return [String] String presentation of the object
# File lib/orders-api-model/models/order.rb, line 590 def to_s to_hash.to_s end
Check to see if the all the properties in the model are valid @return true if the model is valid
# File lib/orders-api-model/models/order.rb, line 408 def valid? return false if @amazon_order_id.nil? return false if @purchase_date.nil? return false if @last_update_date.nil? return false if @order_status.nil? order_status_validator = EnumAttributeValidator.new('Object', ['Pending', 'Unshipped', 'PartiallyShipped', 'Shipped', 'Canceled', 'Unfulfillable', 'InvoiceUnconfirmed', 'PendingAvailability']) return false unless order_status_validator.valid?(@order_status) fulfillment_channel_validator = EnumAttributeValidator.new('Object', ['MFN', 'AFN']) return false unless fulfillment_channel_validator.valid?(@fulfillment_channel) payment_method_validator = EnumAttributeValidator.new('Object', ['COD', 'CVS', 'Other']) return false unless payment_method_validator.valid?(@payment_method) order_type_validator = EnumAttributeValidator.new('Object', ['StandardOrder', 'LongLeadTimeOrder', 'Preorder', 'BackOrder', 'SourcingOnDemandOrder']) return false unless order_type_validator.valid?(@order_type) true end