Class: ThePlaidApi::WarningCode

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

Overview

The warning code identifies a specific kind of warning. ‘OWNERS_UNAVAILABLE` indicates that account-owner information is not available.`INVESTMENTS_UNAVAILABLE` indicates that Investments specific information is not available. `TRANSACTIONS_UNAVAILABLE` indicates that transactions information associated with Credit and Depository accounts are unavailable.

Constant Summary collapse

WARNING_CODE =
[
  # TODO: Write general description for OWNERS_UNAVAILABLE
  OWNERS_UNAVAILABLE = 'OWNERS_UNAVAILABLE'.freeze,

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = OWNERS_UNAVAILABLE) ⇒ Object



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

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

  str = value.to_s.strip

  case str.downcase
  when 'owners_unavailable' then OWNERS_UNAVAILABLE
  when 'investments_unavailable' then INVESTMENTS_UNAVAILABLE
  when 'transactions_unavailable' then TRANSACTIONS_UNAVAILABLE
  else
    default_value
  end
end

.validate(value) ⇒ Object



25
26
27
28
29
# File 'lib/the_plaid_api/models/warning_code.rb', line 25

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

  WARNING_CODE.include?(value)
end