class AmzSpApi::OrdersApiModel::OrderItem

A single order item.

Attributes

asin[RW]

The Amazon Standard Identification Number (ASIN) of the item.

cod_fee[RW]
cod_fee_discount[RW]
condition_id[RW]

The condition of the item. Possible values: New, Used, Collectible, Refurbished, Preorder, Club.

condition_note[RW]

The condition of the item as described by the seller.

condition_subtype_id[RW]

The subcondition of the item. Possible values: New, Mint, Very Good, Good, Acceptable, Poor, Club, OEM, Warranty, Refurbished Warranty, Refurbished, Open Box, Any, Other.

deemed_reseller_category[RW]

The category of deemed reseller. This applies to selling partners that are not based in the EU and is used to help them meet the VAT Deemed Reseller tax laws in the EU and UK.

ioss_number[RW]

The IOSS number of the seller. Sellers selling in the EU will be assigned a unique IOSS number that must be listed on all packages sent to the EU.

is_gift[RW]

When true, the item is a gift.

is_transparency[RW]

When true, transparency codes are required.

item_price[RW]
item_tax[RW]
order_item_id[RW]

An Amazon-defined order item identifier.

points_granted[RW]
price_designation[RW]

Indicates that the selling price is a special price that is available only for Amazon Business orders. For more information about the Amazon Business Seller Program, see the [Amazon Business website](www.amazon.com/b2b/info/amazon-business). Possible values: BusinessPrice - A special price that is available only for Amazon Business orders.

product_info[RW]
promotion_discount[RW]
promotion_discount_tax[RW]
promotion_ids[RW]
quantity_ordered[RW]

The number of items in the order.

quantity_shipped[RW]

The number of items shipped.

scheduled_delivery_end_date[RW]

The end date of the scheduled delivery window in the time zone of the order destination. In ISO 8601 date time format.

scheduled_delivery_start_date[RW]

The start date of the scheduled delivery window in the time zone of the order destination. In ISO 8601 date time format.

seller_sku[RW]

The seller stock keeping unit (SKU) of the item.

serial_number_required[RW]

When true, the product type for this item has a serial number. Returned only for Amazon Easy Ship orders.

shipping_discount[RW]
shipping_discount_tax[RW]
shipping_price[RW]
shipping_tax[RW]
tax_collection[RW]
title[RW]

The name of the item.

Public Class Methods

attribute_map() click to toggle source

Attribute mapping from ruby-style variable name to JSON key.

# File lib/orders-api-model/models/order_item.rb, line 119
def self.attribute_map
  {
    :'asin' => :'ASIN',
    :'seller_sku' => :'SellerSKU',
    :'order_item_id' => :'OrderItemId',
    :'title' => :'Title',
    :'quantity_ordered' => :'QuantityOrdered',
    :'quantity_shipped' => :'QuantityShipped',
    :'product_info' => :'ProductInfo',
    :'points_granted' => :'PointsGranted',
    :'item_price' => :'ItemPrice',
    :'shipping_price' => :'ShippingPrice',
    :'item_tax' => :'ItemTax',
    :'shipping_tax' => :'ShippingTax',
    :'shipping_discount' => :'ShippingDiscount',
    :'shipping_discount_tax' => :'ShippingDiscountTax',
    :'promotion_discount' => :'PromotionDiscount',
    :'promotion_discount_tax' => :'PromotionDiscountTax',
    :'promotion_ids' => :'PromotionIds',
    :'cod_fee' => :'CODFee',
    :'cod_fee_discount' => :'CODFeeDiscount',
    :'is_gift' => :'IsGift',
    :'condition_note' => :'ConditionNote',
    :'condition_id' => :'ConditionId',
    :'condition_subtype_id' => :'ConditionSubtypeId',
    :'scheduled_delivery_start_date' => :'ScheduledDeliveryStartDate',
    :'scheduled_delivery_end_date' => :'ScheduledDeliveryEndDate',
    :'price_designation' => :'PriceDesignation',
    :'tax_collection' => :'TaxCollection',
    :'serial_number_required' => :'SerialNumberRequired',
    :'is_transparency' => :'IsTransparency',
    :'ioss_number' => :'IossNumber',
    :'deemed_reseller_category' => :'DeemedResellerCategory'
  }
end
build_from_hash(attributes) click to toggle source

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_item.rb, line 431
def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end
new(attributes = {}) click to toggle source

Initializes the object @param [Hash] attributes Model attributes in the form of hash

# File lib/orders-api-model/models/order_item.rb, line 200
def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `AmzSpApi::OrdersApiModel::OrderItem` 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::OrderItem`. 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?(:'asin')
    self.asin = attributes[:'asin']
  end

  if attributes.key?(:'seller_sku')
    self.seller_sku = attributes[:'seller_sku']
  end

  if attributes.key?(:'order_item_id')
    self.order_item_id = attributes[:'order_item_id']
  end

  if attributes.key?(:'title')
    self.title = attributes[:'title']
  end

  if attributes.key?(:'quantity_ordered')
    self.quantity_ordered = attributes[:'quantity_ordered']
  end

  if attributes.key?(:'quantity_shipped')
    self.quantity_shipped = attributes[:'quantity_shipped']
  end

  if attributes.key?(:'product_info')
    self.product_info = attributes[:'product_info']
  end

  if attributes.key?(:'points_granted')
    self.points_granted = attributes[:'points_granted']
  end

  if attributes.key?(:'item_price')
    self.item_price = attributes[:'item_price']
  end

  if attributes.key?(:'shipping_price')
    self.shipping_price = attributes[:'shipping_price']
  end

  if attributes.key?(:'item_tax')
    self.item_tax = attributes[:'item_tax']
  end

  if attributes.key?(:'shipping_tax')
    self.shipping_tax = attributes[:'shipping_tax']
  end

  if attributes.key?(:'shipping_discount')
    self.shipping_discount = attributes[:'shipping_discount']
  end

  if attributes.key?(:'shipping_discount_tax')
    self.shipping_discount_tax = attributes[:'shipping_discount_tax']
  end

  if attributes.key?(:'promotion_discount')
    self.promotion_discount = attributes[:'promotion_discount']
  end

  if attributes.key?(:'promotion_discount_tax')
    self.promotion_discount_tax = attributes[:'promotion_discount_tax']
  end

  if attributes.key?(:'promotion_ids')
    self.promotion_ids = attributes[:'promotion_ids']
  end

  if attributes.key?(:'cod_fee')
    self.cod_fee = attributes[:'cod_fee']
  end

  if attributes.key?(:'cod_fee_discount')
    self.cod_fee_discount = attributes[:'cod_fee_discount']
  end

  if attributes.key?(:'is_gift')
    self.is_gift = attributes[:'is_gift']
  end

  if attributes.key?(:'condition_note')
    self.condition_note = attributes[:'condition_note']
  end

  if attributes.key?(:'condition_id')
    self.condition_id = attributes[:'condition_id']
  end

  if attributes.key?(:'condition_subtype_id')
    self.condition_subtype_id = attributes[:'condition_subtype_id']
  end

  if attributes.key?(:'scheduled_delivery_start_date')
    self.scheduled_delivery_start_date = attributes[:'scheduled_delivery_start_date']
  end

  if attributes.key?(:'scheduled_delivery_end_date')
    self.scheduled_delivery_end_date = attributes[:'scheduled_delivery_end_date']
  end

  if attributes.key?(:'price_designation')
    self.price_designation = attributes[:'price_designation']
  end

  if attributes.key?(:'tax_collection')
    self.tax_collection = attributes[:'tax_collection']
  end

  if attributes.key?(:'serial_number_required')
    self.serial_number_required = attributes[:'serial_number_required']
  end

  if attributes.key?(:'is_transparency')
    self.is_transparency = attributes[:'is_transparency']
  end

  if attributes.key?(:'ioss_number')
    self.ioss_number = attributes[:'ioss_number']
  end

  if attributes.key?(:'deemed_reseller_category')
    self.deemed_reseller_category = attributes[:'deemed_reseller_category']
  end
end
openapi_nullable() click to toggle source

List of attributes with nullable: true

# File lib/orders-api-model/models/order_item.rb, line 193
def self.openapi_nullable
  Set.new([
  ])
end
openapi_types() click to toggle source

Attribute type mapping.

# File lib/orders-api-model/models/order_item.rb, line 156
def self.openapi_types
  {
    :'asin' => :'Object',
    :'seller_sku' => :'Object',
    :'order_item_id' => :'Object',
    :'title' => :'Object',
    :'quantity_ordered' => :'Object',
    :'quantity_shipped' => :'Object',
    :'product_info' => :'Object',
    :'points_granted' => :'Object',
    :'item_price' => :'Object',
    :'shipping_price' => :'Object',
    :'item_tax' => :'Object',
    :'shipping_tax' => :'Object',
    :'shipping_discount' => :'Object',
    :'shipping_discount_tax' => :'Object',
    :'promotion_discount' => :'Object',
    :'promotion_discount_tax' => :'Object',
    :'promotion_ids' => :'Object',
    :'cod_fee' => :'Object',
    :'cod_fee_discount' => :'Object',
    :'is_gift' => :'Object',
    :'condition_note' => :'Object',
    :'condition_id' => :'Object',
    :'condition_subtype_id' => :'Object',
    :'scheduled_delivery_start_date' => :'Object',
    :'scheduled_delivery_end_date' => :'Object',
    :'price_designation' => :'Object',
    :'tax_collection' => :'Object',
    :'serial_number_required' => :'Object',
    :'is_transparency' => :'Object',
    :'ioss_number' => :'Object',
    :'deemed_reseller_category' => :'Object'
  }
end

Public Instance Methods

==(o) click to toggle source

Checks equality by comparing each attribute. @param [Object] Object to be compared

# File lib/orders-api-model/models/order_item.rb, line 380
def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      asin == o.asin &&
      seller_sku == o.seller_sku &&
      order_item_id == o.order_item_id &&
      title == o.title &&
      quantity_ordered == o.quantity_ordered &&
      quantity_shipped == o.quantity_shipped &&
      product_info == o.product_info &&
      points_granted == o.points_granted &&
      item_price == o.item_price &&
      shipping_price == o.shipping_price &&
      item_tax == o.item_tax &&
      shipping_tax == o.shipping_tax &&
      shipping_discount == o.shipping_discount &&
      shipping_discount_tax == o.shipping_discount_tax &&
      promotion_discount == o.promotion_discount &&
      promotion_discount_tax == o.promotion_discount_tax &&
      promotion_ids == o.promotion_ids &&
      cod_fee == o.cod_fee &&
      cod_fee_discount == o.cod_fee_discount &&
      is_gift == o.is_gift &&
      condition_note == o.condition_note &&
      condition_id == o.condition_id &&
      condition_subtype_id == o.condition_subtype_id &&
      scheduled_delivery_start_date == o.scheduled_delivery_start_date &&
      scheduled_delivery_end_date == o.scheduled_delivery_end_date &&
      price_designation == o.price_designation &&
      tax_collection == o.tax_collection &&
      serial_number_required == o.serial_number_required &&
      is_transparency == o.is_transparency &&
      ioss_number == o.ioss_number &&
      deemed_reseller_category == o.deemed_reseller_category
end
_deserialize(type, value) click to toggle source

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_item.rb, line 461
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
_to_hash(value) click to toggle source

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_item.rb, line 530
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
build_from_hash(attributes) click to toggle source

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_item.rb, line 438
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
deemed_reseller_category=(deemed_reseller_category) click to toggle source

Custom attribute writer method checking allowed values (enum). @param [Object] deemed_reseller_category Object to be assigned

# File lib/orders-api-model/models/order_item.rb, line 370
def deemed_reseller_category=(deemed_reseller_category)
  validator = EnumAttributeValidator.new('Object', ['IOSS', 'UOSS'])
  unless validator.valid?(deemed_reseller_category)
    fail ArgumentError, "invalid value for \"deemed_reseller_category\", must be one of #{validator.allowable_values}."
  end
  @deemed_reseller_category = deemed_reseller_category
end
eql?(o) click to toggle source

@see the `==` method @param [Object] Object to be compared

# File lib/orders-api-model/models/order_item.rb, line 418
def eql?(o)
  self == o
end
hash() click to toggle source

Calculates hash code according to all attributes. @return [Integer] Hash code

# File lib/orders-api-model/models/order_item.rb, line 424
def hash
  [asin, seller_sku, order_item_id, title, quantity_ordered, quantity_shipped, product_info, points_granted, item_price, shipping_price, item_tax, shipping_tax, shipping_discount, shipping_discount_tax, promotion_discount, promotion_discount_tax, promotion_ids, cod_fee, cod_fee_discount, is_gift, condition_note, condition_id, condition_subtype_id, scheduled_delivery_start_date, scheduled_delivery_end_date, price_designation, tax_collection, serial_number_required, is_transparency, ioss_number, deemed_reseller_category].hash
end
list_invalid_properties() click to toggle source

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_item.rb, line 340
def list_invalid_properties
  invalid_properties = Array.new
  if @asin.nil?
    invalid_properties.push('invalid value for "asin", asin cannot be nil.')
  end

  if @order_item_id.nil?
    invalid_properties.push('invalid value for "order_item_id", order_item_id cannot be nil.')
  end

  if @quantity_ordered.nil?
    invalid_properties.push('invalid value for "quantity_ordered", quantity_ordered cannot be nil.')
  end

  invalid_properties
end
to_body() click to toggle source

to_body is an alias to to_hash (backward compatibility) @return [Hash] Returns the object in the form of hash

# File lib/orders-api-model/models/order_item.rb, line 506
def to_body
  to_hash
end
to_hash() click to toggle source

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_item.rb, line 512
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
to_s() click to toggle source

Returns the string representation of the object @return [String] String presentation of the object

# File lib/orders-api-model/models/order_item.rb, line 500
def to_s
  to_hash.to_s
end
valid?() click to toggle source

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_item.rb, line 359
def valid?
  return false if @asin.nil?
  return false if @order_item_id.nil?
  return false if @quantity_ordered.nil?
  deemed_reseller_category_validator = EnumAttributeValidator.new('Object', ['IOSS', 'UOSS'])
  return false unless deemed_reseller_category_validator.valid?(@deemed_reseller_category)
  true
end