Class: ThePlaidApi::TransactionType

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

Overview

Please use the ‘payment_channel` field, `transaction_type` will be deprecated in the future. `digital:` transactions that took place online. `place:` transactions that were made at a physical location. `special:` transactions that relate to banks, e.g. fees or deposits. `unresolved:` transactions that do not fit into the other three types.

Constant Summary collapse

TRANSACTION_TYPE =
[
  # TODO: Write general description for DIGITAL
  DIGITAL = 'digital'.freeze,

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

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = DIGITAL) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/the_plaid_api/models/transaction_type.rb', line 33

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

  str = value.to_s.strip

  case str.downcase
  when 'digital' then DIGITAL
  when 'place' then PLACE
  when 'special' then SPECIAL
  when 'unresolved' then UNRESOLVED
  else
    default_value
  end
end

.validate(value) ⇒ Object



27
28
29
30
31
# File 'lib/the_plaid_api/models/transaction_type.rb', line 27

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

  TRANSACTION_TYPE.include?(value)
end