class AmzSpApi::CatalogItemsApiModel::RelationshipType

Specific variations of the item.

Attributes

color[RW]

The color variation of the item.

edition[RW]

The edition variation of the item.

flavor[RW]

The flavor variation of the item.

gem_type[RW]

The gem type variations of the item.

golf_club_flex[RW]

The golf club flex variation of an item.

golf_club_loft[RW]
hand_orientation[RW]

The hand orientation variation of an item.

hardware_platform[RW]

The hardware platform variation of an item.

item_dimensions[RW]
material_type[RW]

The material type variations of an item.

metal_type[RW]

The metal type variation of an item.

model[RW]

The model variation of an item.

operating_system[RW]

The operating system variations of an item.

package_quantity[RW]

The package quantity variation of an item.

product_type_subcategory[RW]

The product type subcategory variation of an item.

ring_size[RW]

The ring size variation of an item.

scent[RW]

The scent variation of an item.

shaft_material[RW]

The shaft material variation of an item.

size[RW]

The size variation of an item.

size_per_pearl[RW]

The size per pearl variation of an item.

total_diamond_weight[RW]
total_gem_weight[RW]

Public Class Methods

attribute_map() click to toggle source

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

# File lib/catalog-items-api-model/models/relationship_type.rb, line 80
def self.attribute_map
  {
    :'color' => :'Color',
    :'edition' => :'Edition',
    :'flavor' => :'Flavor',
    :'gem_type' => :'GemType',
    :'golf_club_flex' => :'GolfClubFlex',
    :'hand_orientation' => :'HandOrientation',
    :'hardware_platform' => :'HardwarePlatform',
    :'material_type' => :'MaterialType',
    :'metal_type' => :'MetalType',
    :'model' => :'Model',
    :'operating_system' => :'OperatingSystem',
    :'product_type_subcategory' => :'ProductTypeSubcategory',
    :'ring_size' => :'RingSize',
    :'shaft_material' => :'ShaftMaterial',
    :'scent' => :'Scent',
    :'size' => :'Size',
    :'size_per_pearl' => :'SizePerPearl',
    :'golf_club_loft' => :'GolfClubLoft',
    :'total_diamond_weight' => :'TotalDiamondWeight',
    :'total_gem_weight' => :'TotalGemWeight',
    :'package_quantity' => :'PackageQuantity',
    :'item_dimensions' => :'ItemDimensions'
  }
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/catalog-items-api-model/models/relationship_type.rb, line 308
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/catalog-items-api-model/models/relationship_type.rb, line 143
def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `AmzSpApi::CatalogItemsApiModel::RelationshipType` 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::CatalogItemsApiModel::RelationshipType`. 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?(:'color')
    self.color = attributes[:'color']
  end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

List of attributes with nullable: true

# File lib/catalog-items-api-model/models/relationship_type.rb, line 136
def self.openapi_nullable
  Set.new([
  ])
end
openapi_types() click to toggle source

Attribute type mapping.

# File lib/catalog-items-api-model/models/relationship_type.rb, line 108
def self.openapi_types
  {
    :'color' => :'Object',
    :'edition' => :'Object',
    :'flavor' => :'Object',
    :'gem_type' => :'Object',
    :'golf_club_flex' => :'Object',
    :'hand_orientation' => :'Object',
    :'hardware_platform' => :'Object',
    :'material_type' => :'Object',
    :'metal_type' => :'Object',
    :'model' => :'Object',
    :'operating_system' => :'Object',
    :'product_type_subcategory' => :'Object',
    :'ring_size' => :'Object',
    :'shaft_material' => :'Object',
    :'scent' => :'Object',
    :'size' => :'Object',
    :'size_per_pearl' => :'Object',
    :'golf_club_loft' => :'Object',
    :'total_diamond_weight' => :'Object',
    :'total_gem_weight' => :'Object',
    :'package_quantity' => :'Object',
    :'item_dimensions' => :'Object'
  }
end

Public Instance Methods

==(o) click to toggle source

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

# File lib/catalog-items-api-model/models/relationship_type.rb, line 266
def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      color == o.color &&
      edition == o.edition &&
      flavor == o.flavor &&
      gem_type == o.gem_type &&
      golf_club_flex == o.golf_club_flex &&
      hand_orientation == o.hand_orientation &&
      hardware_platform == o.hardware_platform &&
      material_type == o.material_type &&
      metal_type == o.metal_type &&
      model == o.model &&
      operating_system == o.operating_system &&
      product_type_subcategory == o.product_type_subcategory &&
      ring_size == o.ring_size &&
      shaft_material == o.shaft_material &&
      scent == o.scent &&
      size == o.size &&
      size_per_pearl == o.size_per_pearl &&
      golf_club_loft == o.golf_club_loft &&
      total_diamond_weight == o.total_diamond_weight &&
      total_gem_weight == o.total_gem_weight &&
      package_quantity == o.package_quantity &&
      item_dimensions == o.item_dimensions
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/catalog-items-api-model/models/relationship_type.rb, line 338
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::CatalogItemsApiModel.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/catalog-items-api-model/models/relationship_type.rb, line 407
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/catalog-items-api-model/models/relationship_type.rb, line 315
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
eql?(o) click to toggle source

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

# File lib/catalog-items-api-model/models/relationship_type.rb, line 295
def eql?(o)
  self == o
end
hash() click to toggle source

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

# File lib/catalog-items-api-model/models/relationship_type.rb, line 301
def hash
  [color, edition, flavor, gem_type, golf_club_flex, hand_orientation, hardware_platform, material_type, metal_type, model, operating_system, product_type_subcategory, ring_size, shaft_material, scent, size, size_per_pearl, golf_club_loft, total_diamond_weight, total_gem_weight, package_quantity, item_dimensions].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/catalog-items-api-model/models/relationship_type.rb, line 253
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/catalog-items-api-model/models/relationship_type.rb, line 383
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/catalog-items-api-model/models/relationship_type.rb, line 389
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/catalog-items-api-model/models/relationship_type.rb, line 377
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/catalog-items-api-model/models/relationship_type.rb, line 260
def valid?
  true
end