Class: InventoryManagementAndItemManagementAndOrderManagementAndPriceManagement::VariantDatum

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/inventory_management_and_item_management_and_order_management_and_price_management/models/variant_datum.rb

Overview

VariantDatum Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(product_image_url = nil, item_id = nil, is_available = nil, title = nil, variant_values = nil) ⇒ VariantDatum

Returns a new instance of VariantDatum.



54
55
56
57
58
59
60
61
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/variant_datum.rb', line 54

def initialize(product_image_url = nil, item_id = nil, is_available = nil,
               title = nil, variant_values = nil)
  @product_image_url = product_image_url
  @item_id = item_id
  @is_available = is_available
  @title = title
  @variant_values = variant_values
end

Instance Attribute Details

#is_availableString

TODO: Write general description for this method

Returns:

  • (String)


23
24
25
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/variant_datum.rb', line 23

def is_available
  @is_available
end

#item_idString

TODO: Write general description for this method

Returns:

  • (String)


19
20
21
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/variant_datum.rb', line 19

def item_id
  @item_id
end

#product_image_urlString

TODO: Write general description for this method

Returns:

  • (String)


15
16
17
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/variant_datum.rb', line 15

def product_image_url
  @product_image_url
end

#titleString

TODO: Write general description for this method

Returns:

  • (String)


27
28
29
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/variant_datum.rb', line 27

def title
  @title
end

#variant_valuesArray[VariantValue]

TODO: Write general description for this method

Returns:



31
32
33
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/variant_datum.rb', line 31

def variant_values
  @variant_values
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/variant_datum.rb', line 64

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  product_image_url =
    hash.key?('productImageUrl') ? hash['productImageUrl'] : nil
  item_id = hash.key?('itemId') ? hash['itemId'] : nil
  is_available = hash.key?('isAvailable') ? hash['isAvailable'] : nil
  title = hash.key?('title') ? hash['title'] : nil
  # Parameter is an array, so we need to iterate through it
  variant_values = nil
  unless hash['variantValues'].nil?
    variant_values = []
    hash['variantValues'].each do |structure|
      variant_values << (VariantValue.from_hash(structure) if structure)
    end
  end

  variant_values = nil unless hash.key?('variantValues')

  # Create object from extracted values.
  VariantDatum.new(product_image_url,
                   item_id,
                   is_available,
                   title,
                   variant_values)
end

.namesObject

A mapping from model property names to API property names.



34
35
36
37
38
39
40
41
42
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/variant_datum.rb', line 34

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['product_image_url'] = 'productImageUrl'
  @_hash['item_id'] = 'itemId'
  @_hash['is_available'] = 'isAvailable'
  @_hash['title'] = 'title'
  @_hash['variant_values'] = 'variantValues'
  @_hash
end

.nullablesObject

An array for nullable fields



50
51
52
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/variant_datum.rb', line 50

def self.nullables
  []
end

.optionalsObject

An array for optional fields



45
46
47
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/variant_datum.rb', line 45

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



100
101
102
103
104
105
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/variant_datum.rb', line 100

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} product_image_url: #{@product_image_url.inspect}, item_id:"\
  " #{@item_id.inspect}, is_available: #{@is_available.inspect}, title: #{@title.inspect},"\
  " variant_values: #{@variant_values.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



93
94
95
96
97
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/variant_datum.rb', line 93

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} product_image_url: #{@product_image_url}, item_id: #{@item_id},"\
  " is_available: #{@is_available}, title: #{@title}, variant_values: #{@variant_values}>"
end