Class: MistApi::ApZigbee

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

Overview

Zigbee 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(allow_join = ApZigbeeAllowJoinEnum::MANUAL, channel = 0, enabled = false, extended_pan_id = SKIP, pan_id = SKIP) ⇒ ApZigbee

Returns a new instance of ApZigbee.



64
65
66
67
68
69
70
71
# File 'lib/mist_api/models/ap_zigbee.rb', line 64

def initialize(allow_join = ApZigbeeAllowJoinEnum::MANUAL, channel = 0,
               enabled = false, extended_pan_id = SKIP, pan_id = SKIP)
  @allow_join = allow_join unless allow_join == SKIP
  @channel = channel unless channel == SKIP
  @enabled = enabled unless enabled == SKIP
  @extended_pan_id = extended_pan_id unless extended_pan_id == SKIP
  @pan_id = pan_id unless pan_id == SKIP
end

Instance Attribute Details

#allow_joinApZigbeeAllowJoinEnum

Controls whether new Zigbee devices are allowed to join the network. enum: ‘always`, `manual`



15
16
17
# File 'lib/mist_api/models/ap_zigbee.rb', line 15

def allow_join
  @allow_join
end

#channelInteger

Zigbee channel (2.4 GHz). ‘0` means auto; valid fixed values are 11–26

Returns:

  • (Integer)


19
20
21
# File 'lib/mist_api/models/ap_zigbee.rb', line 19

def channel
  @channel
end

#enabledTrueClass | FalseClass

Whether to enable Zigbee on this AP

Returns:

  • (TrueClass | FalseClass)


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

def enabled
  @enabled
end

#extended_pan_idString

Extended PAN ID in hex string format; only applicable when ‘pan_id` is also specified

Returns:

  • (String)


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

def extended_pan_id
  @extended_pan_id
end

#pan_idString

PAN ID in hex string format; if not specified, assigned automatically

Returns:

  • (String)


32
33
34
# File 'lib/mist_api/models/ap_zigbee.rb', line 32

def pan_id
  @pan_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/mist_api/models/ap_zigbee.rb', line 74

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  allow_join = hash['allow_join'] ||= ApZigbeeAllowJoinEnum::MANUAL
  channel = hash['channel'] ||= 0
  enabled = hash['enabled'] ||= false
  extended_pan_id =
    hash.key?('extended_pan_id') ? hash['extended_pan_id'] : SKIP
  pan_id = hash.key?('pan_id') ? hash['pan_id'] : SKIP

  # Create object from extracted values.
  ApZigbee.new(allow_join,
               channel,
               enabled,
               extended_pan_id,
               pan_id)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['allow_join'] = 'allow_join'
  @_hash['channel'] = 'channel'
  @_hash['enabled'] = 'enabled'
  @_hash['extended_pan_id'] = 'extended_pan_id'
  @_hash['pan_id'] = 'pan_id'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  %w[
    extended_pan_id
    pan_id
  ]
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    allow_join
    channel
    enabled
    extended_pan_id
    pan_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



101
102
103
104
105
106
# File 'lib/mist_api/models/ap_zigbee.rb', line 101

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

#to_sObject

Provides a human-readable string representation of the object.



94
95
96
97
98
# File 'lib/mist_api/models/ap_zigbee.rb', line 94

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