Class: ModernTreasury::ReconciliationMethod

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

Overview

One of manual if this expected payment was manually reconciled in the dashboard, automatic if it was automatically reconciled by Modern Treasury, or null if it is unreconciled.

Constant Summary collapse

RECONCILIATION_METHOD =
[
  # TODO: Write general description for AUTOMATIC
  AUTOMATIC = 'automatic'.freeze,

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = AUTOMATIC) ⇒ Object



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

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

  str = value.to_s.strip

  case str.downcase
  when 'automatic' then AUTOMATIC
  when 'manual' then MANUAL
  else
    default_value
  end
end

.validate(value) ⇒ Object



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

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

  RECONCILIATION_METHOD.include?(value)
end