Class: MistApi::ApRedundancy

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

Overview

ApRedundancy 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(modules = SKIP, num_aps = SKIP, num_aps_with_switch_redundancy = SKIP) ⇒ ApRedundancy

Returns a new instance of ApRedundancy.



48
49
50
51
52
53
54
55
56
# File 'lib/mist_api/models/ap_redundancy.rb', line 48

def initialize(modules = SKIP, num_aps = SKIP,
               num_aps_with_switch_redundancy = SKIP)
  @modules = modules unless modules == SKIP
  @num_aps = num_aps unless num_aps == SKIP
  unless num_aps_with_switch_redundancy == SKIP
    @num_aps_with_switch_redundancy =
      num_aps_with_switch_redundancy
  end
end

Instance Attribute Details

#modulesHash[String, ApRedundancyModule]

Property key is the node id

Returns:



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

def modules
  @modules
end

#num_apsInteger

Property key is the node id

Returns:

  • (Integer)


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

def num_aps
  @num_aps
end

#num_aps_with_switch_redundancyInteger

Property key is the node id

Returns:

  • (Integer)


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

def num_aps_with_switch_redundancy
  @num_aps_with_switch_redundancy
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/mist_api/models/ap_redundancy.rb', line 59

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  modules = ApRedundancyModule.from_hash(hash['modules']) if hash['modules']

  modules = SKIP unless hash.key?('modules')
  num_aps = hash.key?('num_aps') ? hash['num_aps'] : SKIP
  num_aps_with_switch_redundancy =
    hash.key?('num_aps_with_switch_redundancy') ? hash['num_aps_with_switch_redundancy'] : SKIP

  # Create object from extracted values.
  ApRedundancy.new(modules,
                   num_aps,
                   num_aps_with_switch_redundancy)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['modules'] = 'modules'
  @_hash['num_aps'] = 'num_aps'
  @_hash['num_aps_with_switch_redundancy'] =
    'num_aps_with_switch_redundancy'
  @_hash
end

.nullablesObject

An array for nullable fields



44
45
46
# File 'lib/mist_api/models/ap_redundancy.rb', line 44

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    modules
    num_aps
    num_aps_with_switch_redundancy
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



84
85
86
87
88
# File 'lib/mist_api/models/ap_redundancy.rb', line 84

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

#to_sObject

Provides a human-readable string representation of the object.



77
78
79
80
81
# File 'lib/mist_api/models/ap_redundancy.rb', line 77

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