Class: MistApi::ApSwitch

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

Overview

For people who want to fully control the vlans (advanced)

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(enabled = false, eth0 = SKIP, eth1 = SKIP, eth2 = SKIP, eth3 = SKIP, mmodule = SKIP, wds = SKIP) ⇒ ApSwitch

Returns a new instance of ApSwitch.



71
72
73
74
75
76
77
78
79
80
# File 'lib/mist_api/models/ap_switch.rb', line 71

def initialize(enabled = false, eth0 = SKIP, eth1 = SKIP, eth2 = SKIP,
               eth3 = SKIP, mmodule = SKIP, wds = SKIP)
  @enabled = enabled unless enabled == SKIP
  @eth0 = eth0 unless eth0 == SKIP
  @eth1 = eth1 unless eth1 == SKIP
  @eth2 = eth2 unless eth2 == SKIP
  @eth3 = eth3 unless eth3 == SKIP
  @mmodule = mmodule unless mmodule == SKIP
  @wds = wds unless wds == SKIP
end

Instance Attribute Details

#enabledTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


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

def enabled
  @enabled
end

#eth0ApSwitchSetting

TODO: Write general description for this method

Returns:



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

def eth0
  @eth0
end

#eth1ApSwitchSetting

TODO: Write general description for this method

Returns:



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

def eth1
  @eth1
end

#eth2ApSwitchSetting

TODO: Write general description for this method

Returns:



26
27
28
# File 'lib/mist_api/models/ap_switch.rb', line 26

def eth2
  @eth2
end

#eth3ApSwitchSetting

TODO: Write general description for this method

Returns:



30
31
32
# File 'lib/mist_api/models/ap_switch.rb', line 30

def eth3
  @eth3
end

#mmoduleApSwitchSetting

TODO: Write general description for this method

Returns:



34
35
36
# File 'lib/mist_api/models/ap_switch.rb', line 34

def mmodule
  @mmodule
end

#wdsApSwitchSetting

TODO: Write general description for this method

Returns:



38
39
40
# File 'lib/mist_api/models/ap_switch.rb', line 38

def wds
  @wds
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/mist_api/models/ap_switch.rb', line 83

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  enabled = hash['enabled'] ||= false
  eth0 = ApSwitchSetting.from_hash(hash['eth0']) if hash['eth0']
  eth1 = ApSwitchSetting.from_hash(hash['eth1']) if hash['eth1']
  eth2 = ApSwitchSetting.from_hash(hash['eth2']) if hash['eth2']
  eth3 = ApSwitchSetting.from_hash(hash['eth3']) if hash['eth3']
  mmodule = ApSwitchSetting.from_hash(hash['module']) if hash['module']
  wds = ApSwitchSetting.from_hash(hash['wds']) if hash['wds']

  # Create object from extracted values.
  ApSwitch.new(enabled,
               eth0,
               eth1,
               eth2,
               eth3,
               mmodule,
               wds)
end

.namesObject

A mapping from model property names to API property names.



41
42
43
44
45
46
47
48
49
50
51
# File 'lib/mist_api/models/ap_switch.rb', line 41

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['enabled'] = 'enabled'
  @_hash['eth0'] = 'eth0'
  @_hash['eth1'] = 'eth1'
  @_hash['eth2'] = 'eth2'
  @_hash['eth3'] = 'eth3'
  @_hash['mmodule'] = 'module'
  @_hash['wds'] = 'wds'
  @_hash
end

.nullablesObject

An array for nullable fields



67
68
69
# File 'lib/mist_api/models/ap_switch.rb', line 67

def self.nullables
  []
end

.optionalsObject

An array for optional fields



54
55
56
57
58
59
60
61
62
63
64
# File 'lib/mist_api/models/ap_switch.rb', line 54

def self.optionals
  %w[
    enabled
    eth0
    eth1
    eth2
    eth3
    mmodule
    wds
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



113
114
115
116
117
118
# File 'lib/mist_api/models/ap_switch.rb', line 113

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} enabled: #{@enabled.inspect}, eth0: #{@eth0.inspect}, eth1:"\
  " #{@eth1.inspect}, eth2: #{@eth2.inspect}, eth3: #{@eth3.inspect}, mmodule:"\
  " #{@mmodule.inspect}, wds: #{@wds.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



106
107
108
109
110
# File 'lib/mist_api/models/ap_switch.rb', line 106

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} enabled: #{@enabled}, eth0: #{@eth0}, eth1: #{@eth1}, eth2: #{@eth2}, eth3:"\
  " #{@eth3}, mmodule: #{@mmodule}, wds: #{@wds}>"
end