class WineShipping::TrackingResult

Attributes

carrier[RW]
carrier_status[RW]
carrier_status_message[RW]
estimated_delivery_date[RW]
ice_pack[RW]
order_number[RW]
package_items[RW]
service[RW]
ship_date[RW]
ship_to_address[RW]
ship_to_address2[RW]
ship_to_city[RW]
ship_to_contact[RW]
ship_to_name[RW]
ship_to_state[RW]
ship_to_zip_code[RW]
site[RW]
status[RW]
tracking_no[RW]
type[RW]
warehouse[RW]

Public Class Methods

attribute_map() click to toggle source

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

# File lib/wine_shipping/models/tracking_result.rb, line 60
def self.attribute_map
  {
    :'order_number' => :'OrderNumber',
    :'carrier' => :'Carrier',
    :'service' => :'Service',
    :'tracking_no' => :'TrackingNo',
    :'ship_date' => :'ShipDate',
    :'status' => :'Status',
    :'type' => :'Type',
    :'site' => :'Site',
    :'warehouse' => :'Warehouse',
    :'ice_pack' => :'IcePack',
    :'carrier_status' => :'CarrierStatus',
    :'carrier_status_message' => :'CarrierStatusMessage',
    :'estimated_delivery_date' => :'EstimatedDeliveryDate',
    :'ship_to_name' => :'ShipToName',
    :'ship_to_contact' => :'ShipToContact',
    :'ship_to_address' => :'ShipToAddress',
    :'ship_to_address2' => :'ShipToAddress2',
    :'ship_to_city' => :'ShipToCity',
    :'ship_to_state' => :'ShipToState',
    :'ship_to_zip_code' => :'ShipToZipCode',
    :'package_items' => :'PackageItems'
  }
end
new(attributes = {}) click to toggle source

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

# File lib/wine_shipping/models/tracking_result.rb, line 115
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?(:'OrderNumber')
    self.order_number = attributes[:'OrderNumber']
  end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  if attributes.has_key?(:'PackageItems')
    if (value = attributes[:'PackageItems']).is_a?(Array)
      self.package_items = value
    end
  end
end
swagger_types() click to toggle source

Attribute type mapping.

# File lib/wine_shipping/models/tracking_result.rb, line 87
def self.swagger_types
  {
    :'order_number' => :'String',
    :'carrier' => :'String',
    :'service' => :'String',
    :'tracking_no' => :'String',
    :'ship_date' => :'String',
    :'status' => :'String',
    :'type' => :'String',
    :'site' => :'String',
    :'warehouse' => :'String',
    :'ice_pack' => :'String',
    :'carrier_status' => :'String',
    :'carrier_status_message' => :'String',
    :'estimated_delivery_date' => :'String',
    :'ship_to_name' => :'String',
    :'ship_to_contact' => :'String',
    :'ship_to_address' => :'String',
    :'ship_to_address2' => :'String',
    :'ship_to_city' => :'String',
    :'ship_to_state' => :'String',
    :'ship_to_zip_code' => :'String',
    :'package_items' => :'Array<PackageItem>'
  }
end

Public Instance Methods

==(o) click to toggle source

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

# File lib/wine_shipping/models/tracking_result.rb, line 223
def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      order_number == o.order_number &&
      carrier == o.carrier &&
      service == o.service &&
      tracking_no == o.tracking_no &&
      ship_date == o.ship_date &&
      status == o.status &&
      type == o.type &&
      site == o.site &&
      warehouse == o.warehouse &&
      ice_pack == o.ice_pack &&
      carrier_status == o.carrier_status &&
      carrier_status_message == o.carrier_status_message &&
      estimated_delivery_date == o.estimated_delivery_date &&
      ship_to_name == o.ship_to_name &&
      ship_to_contact == o.ship_to_contact &&
      ship_to_address == o.ship_to_address &&
      ship_to_address2 == o.ship_to_address2 &&
      ship_to_city == o.ship_to_city &&
      ship_to_state == o.ship_to_state &&
      ship_to_zip_code == o.ship_to_zip_code &&
      package_items == o.package_items
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/wine_shipping/models/tracking_result.rb, line 285
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 = WineShipping.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/wine_shipping/models/tracking_result.rb, line 351
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/wine_shipping/models/tracking_result.rb, line 264
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 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
eql?(o) click to toggle source

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

# File lib/wine_shipping/models/tracking_result.rb, line 251
def eql?(o)
  self == o
end
hash() click to toggle source

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

# File lib/wine_shipping/models/tracking_result.rb, line 257
def hash
  [order_number, carrier, service, tracking_no, ship_date, status, type, site, warehouse, ice_pack, carrier_status, carrier_status_message, estimated_delivery_date, ship_to_name, ship_to_contact, ship_to_address, ship_to_address2, ship_to_city, ship_to_state, ship_to_zip_code, package_items].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/wine_shipping/models/tracking_result.rb, line 210
def list_invalid_properties
  invalid_properties = Array.new
  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/wine_shipping/models/tracking_result.rb, line 331
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/wine_shipping/models/tracking_result.rb, line 337
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/wine_shipping/models/tracking_result.rb, line 325
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/wine_shipping/models/tracking_result.rb, line 217
def valid?
  true
end