Class: ThePlaidApi::BaseReportTransactionType

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

Overview

‘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 types.

Constant Summary collapse

BASE_REPORT_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



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

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



26
27
28
29
30
# File 'lib/the_plaid_api/models/base_report_transaction_type.rb', line 26

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

  BASE_REPORT_TRANSACTION_TYPE.include?(value)
end