class UltracartClient::Order

Attributes

affiliates[RW]

Affiliates if any were associated with the order. The first one in the array sent the order and each subsequent affiliate is the recruiter that earns a downline commission.

auto_order[RW]
billing[RW]
buysafe[RW]
channel_partner[RW]
checkout[RW]
coupons[RW]

Coupons

creation_dts[RW]

Date/time that the order was created

currency_code[RW]

Currency code that the customer used if different than the merchant's base currency code

current_stage[RW]

Current stage that the order is in.

customer_profile[RW]
digital_order[RW]
edi[RW]
exchange_rate[RW]

Exchange rate at the time the order was placed if currency code is different than the base currency

fraud_score[RW]
gift[RW]
gift_certificate[RW]
internal[RW]
items[RW]

Items

language_iso_code[RW]

Three letter ISO-639 language code used by the customer during the checkout if different than the default language

linked_shipment[RW]
marketing[RW]
merchant_id[RW]

UltraCart merchant ID owning this order

order_id[RW]

Order ID

payment[RW]
properties[RW]

Properties, available only through update, not through insert due to the nature of how properties are handled internally

quote[RW]
refund_dts[RW]

If the order was refunded, the date/time that the last refund occurred

reject_dts[RW]

If the order was rejected, the date/time that the rejection occurred

salesforce[RW]
shipping[RW]
summary[RW]
tags[RW]

tags, available only through update, not through insert due to the nature of how tags are handled internally

taxes[RW]

Public Class Methods

attribute_map() click to toggle source

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

# File lib/ultracart_api/models/order.rb, line 122
def self.attribute_map
  {
    :'affiliates' => :'affiliates',
    :'auto_order' => :'auto_order',
    :'billing' => :'billing',
    :'buysafe' => :'buysafe',
    :'channel_partner' => :'channel_partner',
    :'checkout' => :'checkout',
    :'coupons' => :'coupons',
    :'creation_dts' => :'creation_dts',
    :'currency_code' => :'currency_code',
    :'current_stage' => :'current_stage',
    :'customer_profile' => :'customer_profile',
    :'digital_order' => :'digital_order',
    :'edi' => :'edi',
    :'exchange_rate' => :'exchange_rate',
    :'fraud_score' => :'fraud_score',
    :'gift' => :'gift',
    :'gift_certificate' => :'gift_certificate',
    :'internal' => :'internal',
    :'items' => :'items',
    :'language_iso_code' => :'language_iso_code',
    :'linked_shipment' => :'linked_shipment',
    :'marketing' => :'marketing',
    :'merchant_id' => :'merchant_id',
    :'order_id' => :'order_id',
    :'payment' => :'payment',
    :'properties' => :'properties',
    :'quote' => :'quote',
    :'refund_dts' => :'refund_dts',
    :'reject_dts' => :'reject_dts',
    :'salesforce' => :'salesforce',
    :'shipping' => :'shipping',
    :'summary' => :'summary',
    :'tags' => :'Tags',
    :'taxes' => :'taxes'
  }
end
new(attributes = {}) click to toggle source

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

# File lib/ultracart_api/models/order.rb, line 203
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?(:'affiliates')
    if (value = attributes[:'affiliates']).is_a?(Array)
      self.affiliates = value
    end
  end

  if attributes.has_key?(:'auto_order')
    self.auto_order = attributes[:'auto_order']
  end

  if attributes.has_key?(:'billing')
    self.billing = attributes[:'billing']
  end

  if attributes.has_key?(:'buysafe')
    self.buysafe = attributes[:'buysafe']
  end

  if attributes.has_key?(:'channel_partner')
    self.channel_partner = attributes[:'channel_partner']
  end

  if attributes.has_key?(:'checkout')
    self.checkout = attributes[:'checkout']
  end

  if attributes.has_key?(:'coupons')
    if (value = attributes[:'coupons']).is_a?(Array)
      self.coupons = value
    end
  end

  if attributes.has_key?(:'creation_dts')
    self.creation_dts = attributes[:'creation_dts']
  end

  if attributes.has_key?(:'currency_code')
    self.currency_code = attributes[:'currency_code']
  end

  if attributes.has_key?(:'current_stage')
    self.current_stage = attributes[:'current_stage']
  end

  if attributes.has_key?(:'customer_profile')
    self.customer_profile = attributes[:'customer_profile']
  end

  if attributes.has_key?(:'digital_order')
    self.digital_order = attributes[:'digital_order']
  end

  if attributes.has_key?(:'edi')
    self.edi = attributes[:'edi']
  end

  if attributes.has_key?(:'exchange_rate')
    self.exchange_rate = attributes[:'exchange_rate']
  end

  if attributes.has_key?(:'fraud_score')
    self.fraud_score = attributes[:'fraud_score']
  end

  if attributes.has_key?(:'gift')
    self.gift = attributes[:'gift']
  end

  if attributes.has_key?(:'gift_certificate')
    self.gift_certificate = attributes[:'gift_certificate']
  end

  if attributes.has_key?(:'internal')
    self.internal = attributes[:'internal']
  end

  if attributes.has_key?(:'items')
    if (value = attributes[:'items']).is_a?(Array)
      self.items = value
    end
  end

  if attributes.has_key?(:'language_iso_code')
    self.language_iso_code = attributes[:'language_iso_code']
  end

  if attributes.has_key?(:'linked_shipment')
    self.linked_shipment = attributes[:'linked_shipment']
  end

  if attributes.has_key?(:'marketing')
    self.marketing = attributes[:'marketing']
  end

  if attributes.has_key?(:'merchant_id')
    self.merchant_id = attributes[:'merchant_id']
  end

  if attributes.has_key?(:'order_id')
    self.order_id = attributes[:'order_id']
  end

  if attributes.has_key?(:'payment')
    self.payment = attributes[:'payment']
  end

  if attributes.has_key?(:'properties')
    if (value = attributes[:'properties']).is_a?(Array)
      self.properties = value
    end
  end

  if attributes.has_key?(:'quote')
    self.quote = attributes[:'quote']
  end

  if attributes.has_key?(:'refund_dts')
    self.refund_dts = attributes[:'refund_dts']
  end

  if attributes.has_key?(:'reject_dts')
    self.reject_dts = attributes[:'reject_dts']
  end

  if attributes.has_key?(:'salesforce')
    self.salesforce = attributes[:'salesforce']
  end

  if attributes.has_key?(:'shipping')
    self.shipping = attributes[:'shipping']
  end

  if attributes.has_key?(:'summary')
    self.summary = attributes[:'summary']
  end

  if attributes.has_key?(:'Tags')
    if (value = attributes[:'Tags']).is_a?(Array)
      self.tags = value
    end
  end

  if attributes.has_key?(:'taxes')
    self.taxes = attributes[:'taxes']
  end
end
swagger_types() click to toggle source

Attribute type mapping.

# File lib/ultracart_api/models/order.rb, line 162
def self.swagger_types
  {
    :'affiliates' => :'Array<OrderAffiliate>',
    :'auto_order' => :'OrderAutoOrder',
    :'billing' => :'OrderBilling',
    :'buysafe' => :'OrderBuysafe',
    :'channel_partner' => :'OrderChannelPartner',
    :'checkout' => :'OrderCheckout',
    :'coupons' => :'Array<OrderCoupon>',
    :'creation_dts' => :'String',
    :'currency_code' => :'String',
    :'current_stage' => :'String',
    :'customer_profile' => :'Customer',
    :'digital_order' => :'OrderDigitalOrder',
    :'edi' => :'OrderEdi',
    :'exchange_rate' => :'Float',
    :'fraud_score' => :'OrderFraudScore',
    :'gift' => :'OrderGift',
    :'gift_certificate' => :'OrderGiftCertificate',
    :'internal' => :'OrderInternal',
    :'items' => :'Array<OrderItem>',
    :'language_iso_code' => :'String',
    :'linked_shipment' => :'OrderLinkedShipment',
    :'marketing' => :'OrderMarketing',
    :'merchant_id' => :'String',
    :'order_id' => :'String',
    :'payment' => :'OrderPayment',
    :'properties' => :'Array<OrderProperty>',
    :'quote' => :'OrderQuote',
    :'refund_dts' => :'String',
    :'reject_dts' => :'String',
    :'salesforce' => :'OrderSalesforce',
    :'shipping' => :'OrderShipping',
    :'summary' => :'OrderSummary',
    :'tags' => :'Array<OrderTag>',
    :'taxes' => :'OrderTaxes'
  }
end

Public Instance Methods

==(o) click to toggle source

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

# File lib/ultracart_api/models/order.rb, line 413
def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      affiliates == o.affiliates &&
      auto_order == o.auto_order &&
      billing == o.billing &&
      buysafe == o.buysafe &&
      channel_partner == o.channel_partner &&
      checkout == o.checkout &&
      coupons == o.coupons &&
      creation_dts == o.creation_dts &&
      currency_code == o.currency_code &&
      current_stage == o.current_stage &&
      customer_profile == o.customer_profile &&
      digital_order == o.digital_order &&
      edi == o.edi &&
      exchange_rate == o.exchange_rate &&
      fraud_score == o.fraud_score &&
      gift == o.gift &&
      gift_certificate == o.gift_certificate &&
      internal == o.internal &&
      items == o.items &&
      language_iso_code == o.language_iso_code &&
      linked_shipment == o.linked_shipment &&
      marketing == o.marketing &&
      merchant_id == o.merchant_id &&
      order_id == o.order_id &&
      payment == o.payment &&
      properties == o.properties &&
      quote == o.quote &&
      refund_dts == o.refund_dts &&
      reject_dts == o.reject_dts &&
      salesforce == o.salesforce &&
      shipping == o.shipping &&
      summary == o.summary &&
      tags == o.tags &&
      taxes == o.taxes
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/ultracart_api/models/order.rb, line 488
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
_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/ultracart_api/models/order.rb, line 554
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/ultracart_api/models/order.rb, line 467
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
currency_code=(currency_code) click to toggle source

Custom attribute writer method with validation @param [Object] currency_code Value to be assigned

# File lib/ultracart_api/models/order.rb, line 383
def currency_code=(currency_code)
  if !currency_code.nil? && currency_code.to_s.length > 3
    fail ArgumentError, 'invalid value for "currency_code", the character length must be smaller than or equal to 3.'
  end

  @currency_code = currency_code
end
current_stage=(current_stage) click to toggle source

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

# File lib/ultracart_api/models/order.rb, line 393
def current_stage=(current_stage)
  validator = EnumAttributeValidator.new('String', ['Accounts Receivable', 'Pending Clearance', 'Fraud Review', 'Rejected', 'Shipping Department', 'Completed Order', 'Quote Request', 'Quote Sent', 'Least Cost Routing', 'Unknown', 'Pre-ordered'])
  unless validator.valid?(current_stage)
    fail ArgumentError, 'invalid value for "current_stage", must be one of #{validator.allowable_values}.'
  end
  @current_stage = current_stage
end
eql?(o) click to toggle source

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

# File lib/ultracart_api/models/order.rb, line 454
def eql?(o)
  self == o
end
hash() click to toggle source

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

# File lib/ultracart_api/models/order.rb, line 460
def hash
  [affiliates, auto_order, billing, buysafe, channel_partner, checkout, coupons, creation_dts, currency_code, current_stage, customer_profile, digital_order, edi, exchange_rate, fraud_score, gift, gift_certificate, internal, items, language_iso_code, linked_shipment, marketing, merchant_id, order_id, payment, properties, quote, refund_dts, reject_dts, salesforce, shipping, summary, tags, taxes].hash
end
language_iso_code=(language_iso_code) click to toggle source

Custom attribute writer method with validation @param [Object] language_iso_code Value to be assigned

# File lib/ultracart_api/models/order.rb, line 403
def language_iso_code=(language_iso_code)
  if !language_iso_code.nil? && language_iso_code.to_s.length > 3
    fail ArgumentError, 'invalid value for "language_iso_code", the character length must be smaller than or equal to 3.'
  end

  @language_iso_code = language_iso_code
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/ultracart_api/models/order.rb, line 358
def list_invalid_properties
  invalid_properties = Array.new
  if !@currency_code.nil? && @currency_code.to_s.length > 3
    invalid_properties.push('invalid value for "currency_code", the character length must be smaller than or equal to 3.')
  end

  if !@language_iso_code.nil? && @language_iso_code.to_s.length > 3
    invalid_properties.push('invalid value for "language_iso_code", the character length must be smaller than or equal to 3.')
  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/ultracart_api/models/order.rb, line 534
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/ultracart_api/models/order.rb, line 540
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
to_s() click to toggle source

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

# File lib/ultracart_api/models/order.rb, line 528
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/ultracart_api/models/order.rb, line 373
def valid?
  return false if !@currency_code.nil? && @currency_code.to_s.length > 3
  current_stage_validator = EnumAttributeValidator.new('String', ['Accounts Receivable', 'Pending Clearance', 'Fraud Review', 'Rejected', 'Shipping Department', 'Completed Order', 'Quote Request', 'Quote Sent', 'Least Cost Routing', 'Unknown', 'Pre-ordered'])
  return false unless current_stage_validator.valid?(@current_stage)
  return false if !@language_iso_code.nil? && @language_iso_code.to_s.length > 3
  true
end