Class: ModernTreasury::Priority

Inherits:
Object
  • Object
show all
Defined in:
lib/modern_treasury/models/priority.rb

Overview

Either ‘normal` or `high`. For ACH and EFT payments, `high` represents a same-day ACH or EFT transfer, respectively. For check payments, `high` can mean an overnight check rather than standard mail.

Constant Summary collapse

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = HIGH) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/modern_treasury/models/priority.rb', line 25

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 'normal' then NORMAL
  else
    default_value
  end
end

.validate(value) ⇒ Object



19
20
21
22
23
# File 'lib/modern_treasury/models/priority.rb', line 19

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

  PRIORITY.include?(value)
end