class UltracartClient::OrderItem
Attributes
QuickBooks code
Activation codes assigned to this item
Date/time of the last rebill, used only during order insert to help project future rebills
Auto order schedule, used only during inserts supplying the recurring schedule
Barcode
Channel partner item id if this order came through a channel partner and the channel partner item id was mapped to an internal item id
Cost of goods sold
Value of the kit component item
Country
of origin (ISO-3166 two letter code)
Customs description
Description
Discount quantity
Distribution center code responsible for shipping this item
True if this item is excluded from coupons
True if the item receives free shipping
Hazardous materials indicator
Item
reference object identifier used to linked to auto order item record
True if this item is a kit
True if this item is a kit component
Manufacturer SKU
Maximum days that the item can be in transit before spoilage (perishable products)
Item
ID
Mix and match group name
Mix and match group object identifier
True if this item is excluded from shipping discounts
Options
Packed by user
Perishable class of the item
Pricing tier that granted the particular price for this item if the customer profile had pricing tiers assigned
Properties
Quantity
Quantity refunded on this item (read only except refund operation)
QuickBooks class
True if this item ships in a separate box
Shipped by user
Date/time that this item was marked shipped
Special product type (USPS Media Mail)
True if the item is tax free
Tracking number, if null or missing, use order level tracking number(s). Used if there are multiple shipments for one order
Date/time that this item was transmitted to the distribution center
True if this item was added to the order as part of an upsell
Public Class Methods
Attribute mapping from ruby-style variable name to JSON key.
# File lib/ultracart_api/models/order_item.rb, line 170 def self.attribute_map { :'accounting_code' => :'accounting_code', :'activation_codes' => :'activation_codes', :'arbitrary_unit_cost' => :'arbitrary_unit_cost', :'auto_order_last_rebill_dts' => :'auto_order_last_rebill_dts', :'auto_order_schedule' => :'auto_order_schedule', :'barcode' => :'barcode', :'channel_partner_item_id' => :'channel_partner_item_id', :'cogs' => :'cogs', :'component_unit_value' => :'component_unit_value', :'cost' => :'cost', :'country_code_of_origin' => :'country_code_of_origin', :'customs_description' => :'customs_description', :'description' => :'description', :'discount' => :'discount', :'discount_quantity' => :'discount_quantity', :'discount_shipping_weight' => :'discount_shipping_weight', :'distribution_center_code' => :'distribution_center_code', :'edi' => :'edi', :'exclude_coupon' => :'exclude_coupon', :'free_shipping' => :'free_shipping', :'hazmat' => :'hazmat', :'height' => :'height', :'item_reference_oid' => :'item_reference_oid', :'kit' => :'kit', :'kit_component' => :'kit_component', :'length' => :'length', :'manufacturer_sku' => :'manufacturer_sku', :'max_days_time_in_transit' => :'max_days_time_in_transit', :'merchant_item_id' => :'merchant_item_id', :'mix_and_match_group_name' => :'mix_and_match_group_name', :'mix_and_match_group_oid' => :'mix_and_match_group_oid', :'no_shipping_discount' => :'no_shipping_discount', :'options' => :'options', :'packed_by_user' => :'packed_by_user', :'perishable_class' => :'perishable_class', :'pricing_tier_name' => :'pricing_tier_name', :'properties' => :'properties', :'quantity' => :'quantity', :'quantity_refunded' => :'quantity_refunded', :'quickbooks_class' => :'quickbooks_class', :'ship_separately' => :'ship_separately', :'shipped_by_user' => :'shipped_by_user', :'shipped_dts' => :'shipped_dts', :'special_product_type' => :'special_product_type', :'tags' => :'tags', :'tax_free' => :'tax_free', :'taxable_cost' => :'taxable_cost', :'total_cost_with_discount' => :'total_cost_with_discount', :'total_refunded' => :'total_refunded', :'tracking_number' => :'tracking_number', :'transmitted_to_distribution_center_dts' => :'transmitted_to_distribution_center_dts', :'unit_cost_with_discount' => :'unit_cost_with_discount', :'upsell' => :'upsell', :'weight' => :'weight', :'width' => :'width' } end
Initializes the object @param [Hash] attributes Model attributes in the form of hash
# File lib/ultracart_api/models/order_item.rb, line 293 def initialize(attributes = {}) return unless attributes.is_a?(Hash) # convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } if attributes.has_key?(:'accounting_code') self.accounting_code = attributes[:'accounting_code'] end if attributes.has_key?(:'activation_codes') if (value = attributes[:'activation_codes']).is_a?(Array) self.activation_codes = value end end if attributes.has_key?(:'arbitrary_unit_cost') self.arbitrary_unit_cost = attributes[:'arbitrary_unit_cost'] end if attributes.has_key?(:'auto_order_last_rebill_dts') self.auto_order_last_rebill_dts = attributes[:'auto_order_last_rebill_dts'] end if attributes.has_key?(:'auto_order_schedule') self.auto_order_schedule = attributes[:'auto_order_schedule'] end if attributes.has_key?(:'barcode') self.barcode = attributes[:'barcode'] end if attributes.has_key?(:'channel_partner_item_id') self.channel_partner_item_id = attributes[:'channel_partner_item_id'] end if attributes.has_key?(:'cogs') self.cogs = attributes[:'cogs'] end if attributes.has_key?(:'component_unit_value') self.component_unit_value = attributes[:'component_unit_value'] end if attributes.has_key?(:'cost') self.cost = attributes[:'cost'] end if attributes.has_key?(:'country_code_of_origin') self.country_code_of_origin = attributes[:'country_code_of_origin'] end if attributes.has_key?(:'customs_description') self.customs_description = attributes[:'customs_description'] end if attributes.has_key?(:'description') self.description = attributes[:'description'] end if attributes.has_key?(:'discount') self.discount = attributes[:'discount'] end if attributes.has_key?(:'discount_quantity') self.discount_quantity = attributes[:'discount_quantity'] end if attributes.has_key?(:'discount_shipping_weight') self.discount_shipping_weight = attributes[:'discount_shipping_weight'] end if attributes.has_key?(:'distribution_center_code') self.distribution_center_code = attributes[:'distribution_center_code'] end if attributes.has_key?(:'edi') self.edi = attributes[:'edi'] end if attributes.has_key?(:'exclude_coupon') self.exclude_coupon = attributes[:'exclude_coupon'] end if attributes.has_key?(:'free_shipping') self.free_shipping = attributes[:'free_shipping'] end if attributes.has_key?(:'hazmat') self.hazmat = attributes[:'hazmat'] end if attributes.has_key?(:'height') self.height = attributes[:'height'] end if attributes.has_key?(:'item_reference_oid') self.item_reference_oid = attributes[:'item_reference_oid'] end if attributes.has_key?(:'kit') self.kit = attributes[:'kit'] end if attributes.has_key?(:'kit_component') self.kit_component = attributes[:'kit_component'] end if attributes.has_key?(:'length') self.length = attributes[:'length'] end if attributes.has_key?(:'manufacturer_sku') self.manufacturer_sku = attributes[:'manufacturer_sku'] end if attributes.has_key?(:'max_days_time_in_transit') self.max_days_time_in_transit = attributes[:'max_days_time_in_transit'] end if attributes.has_key?(:'merchant_item_id') self.merchant_item_id = attributes[:'merchant_item_id'] end if attributes.has_key?(:'mix_and_match_group_name') self.mix_and_match_group_name = attributes[:'mix_and_match_group_name'] end if attributes.has_key?(:'mix_and_match_group_oid') self.mix_and_match_group_oid = attributes[:'mix_and_match_group_oid'] end if attributes.has_key?(:'no_shipping_discount') self.no_shipping_discount = attributes[:'no_shipping_discount'] end if attributes.has_key?(:'options') if (value = attributes[:'options']).is_a?(Array) self.options = value end end if attributes.has_key?(:'packed_by_user') self.packed_by_user = attributes[:'packed_by_user'] end if attributes.has_key?(:'perishable_class') self.perishable_class = attributes[:'perishable_class'] end if attributes.has_key?(:'pricing_tier_name') self.pricing_tier_name = attributes[:'pricing_tier_name'] end if attributes.has_key?(:'properties') if (value = attributes[:'properties']).is_a?(Array) self.properties = value end end if attributes.has_key?(:'quantity') self.quantity = attributes[:'quantity'] end if attributes.has_key?(:'quantity_refunded') self.quantity_refunded = attributes[:'quantity_refunded'] end if attributes.has_key?(:'quickbooks_class') self.quickbooks_class = attributes[:'quickbooks_class'] end if attributes.has_key?(:'ship_separately') self.ship_separately = attributes[:'ship_separately'] end if attributes.has_key?(:'shipped_by_user') self.shipped_by_user = attributes[:'shipped_by_user'] end if attributes.has_key?(:'shipped_dts') self.shipped_dts = attributes[:'shipped_dts'] end if attributes.has_key?(:'special_product_type') self.special_product_type = attributes[:'special_product_type'] end if attributes.has_key?(:'tags') if (value = attributes[:'tags']).is_a?(Array) self.tags = value end end if attributes.has_key?(:'tax_free') self.tax_free = attributes[:'tax_free'] end if attributes.has_key?(:'taxable_cost') self.taxable_cost = attributes[:'taxable_cost'] end if attributes.has_key?(:'total_cost_with_discount') self.total_cost_with_discount = attributes[:'total_cost_with_discount'] end if attributes.has_key?(:'total_refunded') self.total_refunded = attributes[:'total_refunded'] end if attributes.has_key?(:'tracking_number') self.tracking_number = attributes[:'tracking_number'] end if attributes.has_key?(:'transmitted_to_distribution_center_dts') self.transmitted_to_distribution_center_dts = attributes[:'transmitted_to_distribution_center_dts'] end if attributes.has_key?(:'unit_cost_with_discount') self.unit_cost_with_discount = attributes[:'unit_cost_with_discount'] end if attributes.has_key?(:'upsell') self.upsell = attributes[:'upsell'] end if attributes.has_key?(:'weight') self.weight = attributes[:'weight'] end if attributes.has_key?(:'width') self.width = attributes[:'width'] end end
Attribute type mapping.
# File lib/ultracart_api/models/order_item.rb, line 231 def self.swagger_types { :'accounting_code' => :'String', :'activation_codes' => :'Array<String>', :'arbitrary_unit_cost' => :'Currency', :'auto_order_last_rebill_dts' => :'String', :'auto_order_schedule' => :'String', :'barcode' => :'String', :'channel_partner_item_id' => :'String', :'cogs' => :'Float', :'component_unit_value' => :'Float', :'cost' => :'Currency', :'country_code_of_origin' => :'String', :'customs_description' => :'String', :'description' => :'String', :'discount' => :'Currency', :'discount_quantity' => :'Float', :'discount_shipping_weight' => :'Weight', :'distribution_center_code' => :'String', :'edi' => :'OrderItemEdi', :'exclude_coupon' => :'BOOLEAN', :'free_shipping' => :'BOOLEAN', :'hazmat' => :'BOOLEAN', :'height' => :'Distance', :'item_reference_oid' => :'Integer', :'kit' => :'BOOLEAN', :'kit_component' => :'BOOLEAN', :'length' => :'Distance', :'manufacturer_sku' => :'String', :'max_days_time_in_transit' => :'Integer', :'merchant_item_id' => :'String', :'mix_and_match_group_name' => :'String', :'mix_and_match_group_oid' => :'Integer', :'no_shipping_discount' => :'BOOLEAN', :'options' => :'Array<OrderItemOption>', :'packed_by_user' => :'String', :'perishable_class' => :'String', :'pricing_tier_name' => :'String', :'properties' => :'Array<OrderItemProperty>', :'quantity' => :'Float', :'quantity_refunded' => :'Float', :'quickbooks_class' => :'String', :'ship_separately' => :'BOOLEAN', :'shipped_by_user' => :'String', :'shipped_dts' => :'String', :'special_product_type' => :'String', :'tags' => :'Array<OrderItemTag>', :'tax_free' => :'BOOLEAN', :'taxable_cost' => :'Currency', :'total_cost_with_discount' => :'Currency', :'total_refunded' => :'Currency', :'tracking_number' => :'String', :'transmitted_to_distribution_center_dts' => :'String', :'unit_cost_with_discount' => :'Currency', :'upsell' => :'BOOLEAN', :'weight' => :'Weight', :'width' => :'Distance' } end
Public Instance Methods
Checks equality by comparing each attribute. @param [Object] Object to be compared
# File lib/ultracart_api/models/order_item.rb, line 633 def ==(o) return true if self.equal?(o) self.class == o.class && accounting_code == o.accounting_code && activation_codes == o.activation_codes && arbitrary_unit_cost == o.arbitrary_unit_cost && auto_order_last_rebill_dts == o.auto_order_last_rebill_dts && auto_order_schedule == o.auto_order_schedule && barcode == o.barcode && channel_partner_item_id == o.channel_partner_item_id && cogs == o.cogs && component_unit_value == o.component_unit_value && cost == o.cost && country_code_of_origin == o.country_code_of_origin && customs_description == o.customs_description && description == o.description && discount == o.discount && discount_quantity == o.discount_quantity && discount_shipping_weight == o.discount_shipping_weight && distribution_center_code == o.distribution_center_code && edi == o.edi && exclude_coupon == o.exclude_coupon && free_shipping == o.free_shipping && hazmat == o.hazmat && height == o.height && item_reference_oid == o.item_reference_oid && kit == o.kit && kit_component == o.kit_component && length == o.length && manufacturer_sku == o.manufacturer_sku && max_days_time_in_transit == o.max_days_time_in_transit && merchant_item_id == o.merchant_item_id && mix_and_match_group_name == o.mix_and_match_group_name && mix_and_match_group_oid == o.mix_and_match_group_oid && no_shipping_discount == o.no_shipping_discount && options == o.options && packed_by_user == o.packed_by_user && perishable_class == o.perishable_class && pricing_tier_name == o.pricing_tier_name && properties == o.properties && quantity == o.quantity && quantity_refunded == o.quantity_refunded && quickbooks_class == o.quickbooks_class && ship_separately == o.ship_separately && shipped_by_user == o.shipped_by_user && shipped_dts == o.shipped_dts && special_product_type == o.special_product_type && tags == o.tags && tax_free == o.tax_free && taxable_cost == o.taxable_cost && total_cost_with_discount == o.total_cost_with_discount && total_refunded == o.total_refunded && tracking_number == o.tracking_number && transmitted_to_distribution_center_dts == o.transmitted_to_distribution_center_dts && unit_cost_with_discount == o.unit_cost_with_discount && upsell == o.upsell && weight == o.weight && width == o.width 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/ultracart_api/models/order_item.rb, line 729 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 temp_model = UltracartClient.const_get(type).new temp_model.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/ultracart_api/models/order_item.rb, line 795 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/ultracart_api/models/order_item.rb, line 708 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.swagger_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]])) end # or else data not found in attributes(hash), not an issue as the data can be optional end self end
Custom attribute writer method with validation @param [Object] channel_partner_item_id
Value to be assigned
# File lib/ultracart_api/models/order_item.rb, line 573 def channel_partner_item_id=(channel_partner_item_id) if !channel_partner_item_id.nil? && channel_partner_item_id.to_s.length > 30 fail ArgumentError, 'invalid value for "channel_partner_item_id", the character length must be smaller than or equal to 30.' end @channel_partner_item_id = channel_partner_item_id end
Custom attribute writer method with validation @param [Object] country_code_of_origin
Value to be assigned
# File lib/ultracart_api/models/order_item.rb, line 583 def country_code_of_origin=(country_code_of_origin) if !country_code_of_origin.nil? && country_code_of_origin.to_s.length > 2 fail ArgumentError, 'invalid value for "country_code_of_origin", the character length must be smaller than or equal to 2.' end @country_code_of_origin = country_code_of_origin end
Custom attribute writer method with validation @param [Object] description Value to be assigned
# File lib/ultracart_api/models/order_item.rb, line 593 def description=(description) if !description.nil? && description.to_s.length > 2000 fail ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 2000.' end @description = description end
@see the `==` method @param [Object] Object to be compared
# File lib/ultracart_api/models/order_item.rb, line 695 def eql?(o) self == o end
Calculates hash code according to all attributes. @return [Fixnum] Hash code
# File lib/ultracart_api/models/order_item.rb, line 701 def hash [accounting_code, activation_codes, arbitrary_unit_cost, auto_order_last_rebill_dts, auto_order_schedule, barcode, channel_partner_item_id, cogs, component_unit_value, cost, country_code_of_origin, customs_description, description, discount, discount_quantity, discount_shipping_weight, distribution_center_code, edi, exclude_coupon, free_shipping, hazmat, height, item_reference_oid, kit, kit_component, length, manufacturer_sku, max_days_time_in_transit, merchant_item_id, mix_and_match_group_name, mix_and_match_group_oid, no_shipping_discount, options, packed_by_user, perishable_class, pricing_tier_name, properties, quantity, quantity_refunded, quickbooks_class, ship_separately, shipped_by_user, shipped_dts, special_product_type, tags, tax_free, taxable_cost, total_cost_with_discount, total_refunded, tracking_number, transmitted_to_distribution_center_dts, unit_cost_with_discount, upsell, weight, width].hash end
Show invalid properties with the reasons. Usually used together with valid? @return Array for valid properties with the reasons
# File lib/ultracart_api/models/order_item.rb, line 530 def list_invalid_properties invalid_properties = Array.new if !@channel_partner_item_id.nil? && @channel_partner_item_id.to_s.length > 30 invalid_properties.push('invalid value for "channel_partner_item_id", the character length must be smaller than or equal to 30.') end if !@country_code_of_origin.nil? && @country_code_of_origin.to_s.length > 2 invalid_properties.push('invalid value for "country_code_of_origin", the character length must be smaller than or equal to 2.') end if !@description.nil? && @description.to_s.length > 2000 invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 2000.') end if !@merchant_item_id.nil? && @merchant_item_id.to_s.length > 20 invalid_properties.push('invalid value for "merchant_item_id", the character length must be smaller than or equal to 20.') end if !@perishable_class.nil? && @perishable_class.to_s.length > 50 invalid_properties.push('invalid value for "perishable_class", the character length must be smaller than or equal to 50.') end if !@quickbooks_class.nil? && @quickbooks_class.to_s.length > 31 invalid_properties.push('invalid value for "quickbooks_class", the character length must be smaller than or equal to 31.') end invalid_properties end
Custom attribute writer method with validation @param [Object] merchant_item_id
Value to be assigned
# File lib/ultracart_api/models/order_item.rb, line 603 def merchant_item_id=(merchant_item_id) if !merchant_item_id.nil? && merchant_item_id.to_s.length > 20 fail ArgumentError, 'invalid value for "merchant_item_id", the character length must be smaller than or equal to 20.' end @merchant_item_id = merchant_item_id end
Custom attribute writer method with validation @param [Object] perishable_class
Value to be assigned
# File lib/ultracart_api/models/order_item.rb, line 613 def perishable_class=(perishable_class) if !perishable_class.nil? && perishable_class.to_s.length > 50 fail ArgumentError, 'invalid value for "perishable_class", the character length must be smaller than or equal to 50.' end @perishable_class = perishable_class end
Custom attribute writer method with validation @param [Object] quickbooks_class
Value to be assigned
# File lib/ultracart_api/models/order_item.rb, line 623 def quickbooks_class=(quickbooks_class) if !quickbooks_class.nil? && quickbooks_class.to_s.length > 31 fail ArgumentError, 'invalid value for "quickbooks_class", the character length must be smaller than or equal to 31.' end @quickbooks_class = quickbooks_class end
Returns the object in the form of hash @return [Hash] Returns the object in the form of hash
# File lib/ultracart_api/models/order_item.rb, line 781 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) next if value.nil? hash[param] = _to_hash(value) end hash end
Returns the string representation of the object @return [String] String presentation of the object
# File lib/ultracart_api/models/order_item.rb, line 769 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/ultracart_api/models/order_item.rb, line 561 def valid? return false if !@channel_partner_item_id.nil? && @channel_partner_item_id.to_s.length > 30 return false if !@country_code_of_origin.nil? && @country_code_of_origin.to_s.length > 2 return false if !@description.nil? && @description.to_s.length > 2000 return false if !@merchant_item_id.nil? && @merchant_item_id.to_s.length > 20 return false if !@perishable_class.nil? && @perishable_class.to_s.length > 50 return false if !@quickbooks_class.nil? && @quickbooks_class.to_s.length > 31 true end