Class: ThePlaidApi::AccountType

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

Overview

‘investment:` Investment account. In API versions 2018-05-22 and earlier, this type is called `brokerage` instead. `credit:` Credit card `depository:` Depository account `loan:` Loan account `other:` Non-specified account type See the [Account type schema](plaid.com/docs/api/accounts#account-type-schema) for a full listing of account types and corresponding subtypes.

Constant Summary collapse

ACCOUNT_TYPE =
[
  # TODO: Write general description for INVESTMENT
  INVESTMENT = 'investment'.freeze,

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

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

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

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = INVESTMENT) ⇒ Object



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

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

  str = value.to_s.strip

  case str.downcase
  when 'investment' then INVESTMENT
  when 'credit' then CREDIT
  when 'depository' then DEPOSITORY
  when 'loan' then LOAN
  when 'brokerage' then BROKERAGE
  when 'other' then OTHER
  else
    default_value
  end
end

.validate(value) ⇒ Object



34
35
36
37
38
# File 'lib/the_plaid_api/models/account_type.rb', line 34

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

  ACCOUNT_TYPE.include?(value)
end