Class: MistApi::ModuleStatItemPicsItem

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/mist_api/models/module_stat_item_pics_item.rb

Overview

ModuleStatItemPicsItem 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(index = SKIP, model_number = SKIP, port_groups = SKIP) ⇒ ModuleStatItemPicsItem

Returns a new instance of ModuleStatItemPicsItem.



47
48
49
50
51
# File 'lib/mist_api/models/module_stat_item_pics_item.rb', line 47

def initialize(index = SKIP, model_number = SKIP, port_groups = SKIP)
  @index = index unless index == SKIP
  @model_number = model_number unless model_number == SKIP
  @port_groups = port_groups unless port_groups == SKIP
end

Instance Attribute Details

#indexInteger

TODO: Write general description for this method

Returns:

  • (Integer)


14
15
16
# File 'lib/mist_api/models/module_stat_item_pics_item.rb', line 14

def index
  @index
end

#model_numberString

TODO: Write general description for this method

Returns:

  • (String)


18
19
20
# File 'lib/mist_api/models/module_stat_item_pics_item.rb', line 18

def model_number
  @model_number
end

#port_groupsArray[ModuleStatItemPicsItemPortGroupsItem]

TODO: Write general description for this method



22
23
24
# File 'lib/mist_api/models/module_stat_item_pics_item.rb', line 22

def port_groups
  @port_groups
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/mist_api/models/module_stat_item_pics_item.rb', line 54

def self.from_hash(hash)
  return nil unless hash

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

  port_groups = SKIP unless hash.key?('port_groups')

  # Create object from extracted values.
  ModuleStatItemPicsItem.new(index,
                             model_number,
                             port_groups)
end

.namesObject

A mapping from model property names to API property names.



25
26
27
28
29
30
31
# File 'lib/mist_api/models/module_stat_item_pics_item.rb', line 25

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['index'] = 'index'
  @_hash['model_number'] = 'model_number'
  @_hash['port_groups'] = 'port_groups'
  @_hash
end

.nullablesObject

An array for nullable fields



43
44
45
# File 'lib/mist_api/models/module_stat_item_pics_item.rb', line 43

def self.nullables
  []
end

.optionalsObject

An array for optional fields



34
35
36
37
38
39
40
# File 'lib/mist_api/models/module_stat_item_pics_item.rb', line 34

def self.optionals
  %w[
    index
    model_number
    port_groups
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



85
86
87
88
89
# File 'lib/mist_api/models/module_stat_item_pics_item.rb', line 85

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} index: #{@index.inspect}, model_number: #{@model_number.inspect},"\
  " port_groups: #{@port_groups.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



78
79
80
81
82
# File 'lib/mist_api/models/module_stat_item_pics_item.rb', line 78

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} index: #{@index}, model_number: #{@model_number}, port_groups:"\
  " #{@port_groups}>"
end