Class: InventoryManagementAndItemManagementAndOrderManagementAndPriceManagement::NameValueAttribute

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

Overview

NameValueAttribute 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(name = nil, type = nil, value = nil, is_variant = nil, variant_resource_type = nil) ⇒ NameValueAttribute

Returns a new instance of NameValueAttribute.



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

def initialize(name = nil, type = nil, value = nil, is_variant = nil,
               variant_resource_type = nil)
  @name = name
  @type = type
  @value = value
  @is_variant = is_variant
  @variant_resource_type = variant_resource_type
end

Instance Attribute Details

#is_variantString

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/name_value_attribute.rb', line 27

def is_variant
  @is_variant
end

#nameString

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/name_value_attribute.rb', line 15

def name
  @name
end

#typeString

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/name_value_attribute.rb', line 19

def type
  @type
end

#valueArray[Value]

TODO: Write general description for this method

Returns:



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

def value
  @value
end

#variant_resource_typeString

TODO: Write general description for this method

Returns:

  • (String)


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

def variant_resource_type
  @variant_resource_type
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/name_value_attribute.rb', line 64

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  name = hash.key?('name') ? hash['name'] : nil
  type = hash.key?('type') ? hash['type'] : nil
  # Parameter is an array, so we need to iterate through it
  value = nil
  unless hash['value'].nil?
    value = []
    hash['value'].each do |structure|
      value << (Value.from_hash(structure) if structure)
    end
  end

  value = nil unless hash.key?('value')
  is_variant = hash.key?('isVariant') ? hash['isVariant'] : nil
  variant_resource_type =
    hash.key?('variantResourceType') ? hash['variantResourceType'] : nil

  # Create object from extracted values.
  NameValueAttribute.new(name,
                         type,
                         value,
                         is_variant,
                         variant_resource_type)
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/name_value_attribute.rb', line 34

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['name'] = 'name'
  @_hash['type'] = 'type'
  @_hash['value'] = 'value'
  @_hash['is_variant'] = 'isVariant'
  @_hash['variant_resource_type'] = 'variantResourceType'
  @_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/name_value_attribute.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/name_value_attribute.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/name_value_attribute.rb', line 100

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} name: #{@name.inspect}, type: #{@type.inspect}, value: #{@value.inspect},"\
  " is_variant: #{@is_variant.inspect}, variant_resource_type:"\
  " #{@variant_resource_type.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/name_value_attribute.rb', line 93

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} name: #{@name}, type: #{@type}, value: #{@value}, is_variant:"\
  " #{@is_variant}, variant_resource_type: #{@variant_resource_type}>"
end