Class: MistApi::Dot11Bandwidth5Enum

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

Overview

channel width for the 5GHz band. enum: ‘0`(disabled, response only), `20`, `40`, `80`

Constant Summary collapse

DOT11_BANDWIDTH5_ENUM =
[
  # TODO: Write general description for ENUM_0
  ENUM_0 = 0,

  # TODO: Write general description for ENUM_20
  ENUM_20 = 20,

  # TODO: Write general description for ENUM_40
  ENUM_40 = 40,

  # TODO: Write general description for ENUM_80
  ENUM_80 = 80
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = ENUM_0) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/mist_api/models/dot11_bandwidth5_enum.rb', line 30

def self.from_value(value, default_value = ENUM_0)
  return default_value if value.nil?

  str = value.to_s.strip
  if str.match?(/\A\d+\z/)
    num = str.to_i
    return num if DOT11_BANDWIDTH5_ENUM.include?(num)

    return default_value
  end

  case str.downcase
  when 'enum_0' then ENUM_0
  when 'enum_20' then ENUM_20
  when 'enum_40' then ENUM_40
  when 'enum_80' then ENUM_80
  else
    default_value
  end
end

.validate(value) ⇒ Object



24
25
26
27
28
# File 'lib/mist_api/models/dot11_bandwidth5_enum.rb', line 24

def self.validate(value)
  return false if value.nil?

  DOT11_BANDWIDTH5_ENUM.include?(value)
end