Class: ThePlaidApi::NotificationSeverity

Inherits:
Object
  • Object
show all
Defined in:
lib/the_plaid_api/models/notification_severity.rb

Overview

Severity level of notification

Constant Summary collapse

NOTIFICATION_SEVERITY =
[
  # TODO: Write general description for EMERGENCY
  EMERGENCY = 'EMERGENCY'.freeze,

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

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

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = EMERGENCY) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/the_plaid_api/models/notification_severity.rb', line 32

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

  str = value.to_s.strip

  case str.downcase
  when 'emergency' then EMERGENCY
  when 'alert' then ALERT
  when 'warning' then WARNING
  when 'notice' then NOTICE
  when 'info' then INFO
  else
    default_value
  end
end

.validate(value) ⇒ Object



26
27
28
29
30
# File 'lib/the_plaid_api/models/notification_severity.rb', line 26

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

  NOTIFICATION_SEVERITY.include?(value)
end