Class: ThePlaidApi::TransferType1

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

Overview

The type of transfer. This will be either ‘debit` or `credit`. A `debit` indicates a transfer of money into the origination account; a `credit` indicates a transfer of money out of the origination account.

Constant Summary collapse

TRANSFER_TYPE1 =
[
  # TODO: Write general description for DEBIT
  DEBIT = 'debit'.freeze,

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = DEBIT) ⇒ Object



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

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

  str = value.to_s.strip

  case str.downcase
  when 'debit' then DEBIT
  when 'credit' then CREDIT
  else
    default_value
  end
end

.validate(value) ⇒ Object



19
20
21
22
23
# File 'lib/the_plaid_api/models/transfer_type1.rb', line 19

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

  TRANSFER_TYPE1.include?(value)
end