Class: ThePlaidApi::CraLoanPaymentSchedule

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

Overview

The frequency of a loan’s payment schedule. ‘BIWEEKLY` represents one payment every two weeks.

Constant Summary collapse

CRA_LOAN_PAYMENT_SCHEDULE =
[
  # TODO: Write general description for DAILY
  DAILY = 'DAILY'.freeze,

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

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

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

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

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = DAILY) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/the_plaid_api/models/cra_loan_payment_schedule.rb', line 39

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

  str = value.to_s.strip

  case str.downcase
  when 'daily' then DAILY
  when 'weekly' then WEEKLY
  when 'biweekly' then BIWEEKLY
  when 'monthly' then MONTHLY
  when 'quarterly' then QUARTERLY
  when 'annually' then ANNUALLY
  when 'other' then OTHER
  else
    default_value
  end
end

.validate(value) ⇒ Object



33
34
35
36
37
# File 'lib/the_plaid_api/models/cra_loan_payment_schedule.rb', line 33

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

  CRA_LOAN_PAYMENT_SCHEDULE.include?(value)
end