Class: MistApi::ApIotOutput
- Defined in:
- lib/mist_api/models/ap_iot_output.rb
Overview
IoT output AP settings
Instance Attribute Summary collapse
-
#enabled ⇒ TrueClass | FalseClass
Whether to enable a pin.
-
#name ⇒ String
Optional; descriptive pin name.
-
#output ⇒ TrueClass | FalseClass
Whether the pin is configured as an output.
-
#pullup ⇒ ApIotPullupEnum
the type of pull-up the pin uses.
-
#value ⇒ Integer
Output pin signal level, default 0.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(enabled = false, name = SKIP, output = SKIP, pullup = ApIotPullupEnum::NONE, value = SKIP) ⇒ ApIotOutput
constructor
A new instance of ApIotOutput.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
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
#enabled ⇒ TrueClass | FalseClass
Whether to enable a pin
14 15 16 |
# File 'lib/mist_api/models/ap_iot_output.rb', line 14 def enabled @enabled end |
#name ⇒ String
Optional; descriptive pin name
18 19 20 |
# File 'lib/mist_api/models/ap_iot_output.rb', line 18 def name @name end |
#output ⇒ TrueClass | FalseClass
Whether the pin is configured as an output. DO and A1-A4 can be repurposed by changing
23 24 25 |
# File 'lib/mist_api/models/ap_iot_output.rb', line 23 def output @output end |
#pullup ⇒ ApIotPullupEnum
the type of pull-up the pin uses. enum: ‘external`, `internal`, `none`
27 28 29 |
# File 'lib/mist_api/models/ap_iot_output.rb', line 27 def pullup @pullup end |
#value ⇒ Integer
Output pin signal level, default 0
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 |
.names ⇒ Object
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 |
.nullables ⇒ Object
An array for nullable fields
56 57 58 |
# File 'lib/mist_api/models/ap_iot_output.rb', line 56 def self.nullables [] end |
.optionals ⇒ Object
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
#inspect ⇒ Object
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_s ⇒ Object
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 |