Class: ThePlaidApi::NotificationPriority

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

Overview

Priority of notification

Constant Summary collapse

NOTIFICATION_PRIORITY =
[
  # TODO: Write general description for HIGH
  HIGH = 'HIGH'.freeze,

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = HIGH) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/the_plaid_api/models/notification_priority.rb', line 26

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

  str = value.to_s.strip

  case str.downcase
  when 'high' then HIGH
  when 'medium' then MEDIUM
  when 'low' then LOW
  else
    default_value
  end
end

.validate(value) ⇒ Object



20
21
22
23
24
# File 'lib/the_plaid_api/models/notification_priority.rb', line 20

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

  NOTIFICATION_PRIORITY.include?(value)
end