Class: ThePlaidApi::OmittableTransferType

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

Overview

The type of transfer. Valid values are ‘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. This field is omitted for Plaid Ledger Sweep events.

Constant Summary collapse

OMITTABLE_TRANSFER_TYPE =
[
  # 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



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

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



20
21
22
23
24
# File 'lib/the_plaid_api/models/omittable_transfer_type.rb', line 20

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

  OMITTABLE_TRANSFER_TYPE.include?(value)
end