Class: MistApi::ApIotOutput

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

Overview

IoT output AP settings

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, name = SKIP, output = SKIP, pullup = ApIotPullupEnum::NONE, value = SKIP) ⇒ ApIotOutput

Returns a new instance of ApIotOutput.



60
61
62
63
64
65
66
67
# File 'lib/mist_api/models/ap_iot_output.rb', line 60

def initialize(enabled = false, name = SKIP, output = SKIP,
               pullup = ApIotPullupEnum::NONE, value = SKIP)
  @enabled = enabled unless enabled == SKIP
  @name = name unless name == SKIP
  @output = output unless output == SKIP
  @pullup = pullup unless pullup == SKIP
  @value = value unless value == SKIP
end

Instance Attribute Details

#enabledTrueClass | FalseClass

Whether to enable a pin

Returns:

  • (TrueClass | FalseClass)


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

def enabled
  @enabled
end

#nameString

Optional; descriptive pin name

Returns:

  • (String)


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

def name
  @name
end

#outputTrueClass | FalseClass

Whether the pin is configured as an output. DO and A1-A4 can be repurposed by changing

Returns:

  • (TrueClass | FalseClass)


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

def output
  @output
end

#pullupApIotPullupEnum

the type of pull-up the pin uses. enum: ‘external`, `internal`, `none`

Returns:



27
28
29
# File 'lib/mist_api/models/ap_iot_output.rb', line 27

def pullup
  @pullup
end

#valueInteger

Output pin signal level, default 0

Returns:

  • (Integer)


31
32
33
# File 'lib/mist_api/models/ap_iot_output.rb', line 31

def value
  @value
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/mist_api/models/ap_iot_output.rb', line 70

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  enabled = hash['enabled'] ||= false
  name = hash.key?('name') ? hash['name'] : SKIP
  output = hash.key?('output') ? hash['output'] : SKIP
  pullup = hash['pullup'] ||= ApIotPullupEnum::NONE
  value = hash.key?('value') ? hash['value'] : SKIP

  # Create object from extracted values.
  ApIotOutput.new(enabled,
                  name,
                  output,
                  pullup,
                  value)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['enabled'] = 'enabled'
  @_hash['name'] = 'name'
  @_hash['output'] = 'output'
  @_hash['pullup'] = 'pullup'
  @_hash['value'] = 'value'
  @_hash
end

.nullablesObject

An array for nullable fields



56
57
58
# File 'lib/mist_api/models/ap_iot_output.rb', line 56

def self.nullables
  []
end

.optionalsObject

An array for optional fields



45
46
47
48
49
50
51
52
53
# File 'lib/mist_api/models/ap_iot_output.rb', line 45

def self.optionals
  %w[
    enabled
    name
    output
    pullup
    value
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



96
97
98
99
100
# File 'lib/mist_api/models/ap_iot_output.rb', line 96

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

#to_sObject

Provides a human-readable string representation of the object.



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

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