Class: MistApi::IdpProfileActionEnum

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

Overview

enum: * alert (default) * drop: silently dropping packets * close: notify client/server to close connection

Constant Summary collapse

IDP_PROFILE_ACTION_ENUM =
[
  # TODO: Write general description for ALERT
  ALERT = 'alert'.freeze,

  # TODO: Write general description for CLOSE
  CLOSE = 'close'.freeze,

  # TODO: Write general description for DROP
  DROP = 'drop'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = ALERT) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/mist_api/models/idp_profile_action_enum.rb', line 27

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

  str = value.to_s.strip

  case str.downcase
  when 'alert' then ALERT
  when 'close' then CLOSE
  when 'drop' then DROP
  else
    default_value
  end
end

.validate(value) ⇒ Object



21
22
23
24
25
# File 'lib/mist_api/models/idp_profile_action_enum.rb', line 21

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

  IDP_PROFILE_ACTION_ENUM.include?(value)
end