Class: ThePlaidApi::CraLoanType

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

Overview

The type of loan the user applied for.

Constant Summary collapse

CRA_LOAN_TYPE =
[
  # TODO: Write general description for PERSONAL
  PERSONAL = 'PERSONAL'.freeze,

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

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

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

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

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

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

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = PERSONAL) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/the_plaid_api/models/cra_loan_type.rb', line 44

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

  str = value.to_s.strip

  case str.downcase
  when 'personal' then PERSONAL
  when 'credit_card' then CREDIT_CARD
  when 'business' then BUSINESS
  when 'mortgage' then MORTGAGE
  when 'auto' then AUTO
  when 'payday' then PAYDAY
  when 'student' then STUDENT
  when 'home_equity' then HOME_EQUITY
  when 'other' then OTHER
  else
    default_value
  end
end

.validate(value) ⇒ Object



38
39
40
41
42
# File 'lib/the_plaid_api/models/cra_loan_type.rb', line 38

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

  CRA_LOAN_TYPE.include?(value)
end