Class: MistApi::SwitchIotPort

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

Overview

Switch IOT port configuration

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(alarm_class = SwitchIotPortAlarmClassEnum::MINOR, enabled = false, input_src = SwitchIotPortInputSrcEnum::IN0, name = SKIP) ⇒ SwitchIotPort

Returns a new instance of SwitchIotPort.



55
56
57
58
59
60
61
62
# File 'lib/mist_api/models/switch_iot_port.rb', line 55

def initialize(alarm_class = SwitchIotPortAlarmClassEnum::MINOR,
               enabled = false, input_src = SwitchIotPortInputSrcEnum::IN0,
               name = SKIP)
  @alarm_class = alarm_class unless alarm_class == SKIP
  @enabled = enabled unless enabled == SKIP
  @input_src = input_src unless input_src == SKIP
  @name = name unless name == SKIP
end

Instance Attribute Details

#alarm_classSwitchIotPortAlarmClassEnum

Alarm class for the switch iot port in. enum: ‘minor`, `major`



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

def alarm_class
  @alarm_class
end

#enabledTrueClass | FalseClass

Alarm class for the switch iot port in. enum: ‘minor`, `major`

Returns:

  • (TrueClass | FalseClass)


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

def enabled
  @enabled
end

#input_srcSwitchIotPortInputSrcEnum

Only for “OUT” ports, input source for the switch iot port out. enum: ‘IN0`, `IN1`



23
24
25
# File 'lib/mist_api/models/switch_iot_port.rb', line 23

def input_src
  @input_src
end

#nameString

Only for “OUT” ports, input source for the switch iot port out. enum: ‘IN0`, `IN1`

Returns:

  • (String)


28
29
30
# File 'lib/mist_api/models/switch_iot_port.rb', line 28

def name
  @name
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/mist_api/models/switch_iot_port.rb', line 65

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  alarm_class = hash['alarm_class'] ||= SwitchIotPortAlarmClassEnum::MINOR
  enabled = hash['enabled'] ||= false
  input_src = hash['input_src'] ||= SwitchIotPortInputSrcEnum::IN0
  name = hash.key?('name') ? hash['name'] : SKIP

  # Create object from extracted values.
  SwitchIotPort.new(alarm_class,
                    enabled,
                    input_src,
                    name)
end

.namesObject

A mapping from model property names to API property names.



31
32
33
34
35
36
37
38
# File 'lib/mist_api/models/switch_iot_port.rb', line 31

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['alarm_class'] = 'alarm_class'
  @_hash['enabled'] = 'enabled'
  @_hash['input_src'] = 'input_src'
  @_hash['name'] = 'name'
  @_hash
end

.nullablesObject

An array for nullable fields



51
52
53
# File 'lib/mist_api/models/switch_iot_port.rb', line 51

def self.nullables
  []
end

.optionalsObject

An array for optional fields



41
42
43
44
45
46
47
48
# File 'lib/mist_api/models/switch_iot_port.rb', line 41

def self.optionals
  %w[
    alarm_class
    enabled
    input_src
    name
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



89
90
91
92
93
# File 'lib/mist_api/models/switch_iot_port.rb', line 89

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

#to_sObject

Provides a human-readable string representation of the object.



82
83
84
85
86
# File 'lib/mist_api/models/switch_iot_port.rb', line 82

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