Class: ThePlaidApi::EnrichTransactionDirection

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

Overview

The direction of the transaction from the perspective of the account holder: ‘OUTFLOW` - Includes outgoing transfers, purchases, and fees. (Typically represented as a negative value on checking accounts and debit cards and a positive value on credit cards.) `INFLOW` - Includes incoming transfers, refunds, and income. (Typically represented as a positive value on checking accounts and debit cards and a negative value on credit cards.)

Constant Summary collapse

ENRICH_TRANSACTION_DIRECTION =
[
  # TODO: Write general description for INFLOW
  INFLOW = 'INFLOW'.freeze,

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = INFLOW) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/the_plaid_api/models/enrich_transaction_direction.rb', line 28

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

  str = value.to_s.strip

  case str.downcase
  when 'inflow' then INFLOW
  when 'outflow' then OUTFLOW
  else
    default_value
  end
end

.validate(value) ⇒ Object



22
23
24
25
26
# File 'lib/the_plaid_api/models/enrich_transaction_direction.rb', line 22

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

  ENRICH_TRANSACTION_DIRECTION.include?(value)
end