Class: MistApi::PortAuthStateEnum

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

Overview

enum: ‘authenticated`, `authenticating`, `held`, `init`

Constant Summary collapse

PORT_AUTH_STATE_ENUM =
[
  # TODO: Write general description for AUTHENTICATED
  AUTHENTICATED = 'authenticated'.freeze,

  # TODO: Write general description for AUTHENTICATING
  AUTHENTICATING = 'authenticating'.freeze,

  # TODO: Write general description for HELD
  HELD = 'held'.freeze,

  # TODO: Write general description for INIT
  INIT = 'init'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = AUTHENTICATED) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/mist_api/models/port_auth_state_enum.rb', line 29

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

  str = value.to_s.strip

  case str.downcase
  when 'authenticated' then AUTHENTICATED
  when 'authenticating' then AUTHENTICATING
  when 'held' then HELD
  when 'init' then INIT
  else
    default_value
  end
end

.validate(value) ⇒ Object



23
24
25
26
27
# File 'lib/mist_api/models/port_auth_state_enum.rb', line 23

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

  PORT_AUTH_STATE_ENUM.include?(value)
end