Class: ThePlaidApi::CraBankIncomeWarningCode

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

Overview

The warning code identifies a specific kind of warning. ‘IDENTITY_UNAVAILABLE`: Unable to extract identity for the Item `TRANSACTIONS_UNAVAILABLE`: Unable to extract transactions for the Item `REPORT_DELETED`: Report deleted due to customer or consumer request `DATA_UNAVAILABLE`: No relevant data was found for the Item

Constant Summary collapse

CRA_BANK_INCOME_WARNING_CODE =
[
  # TODO: Write general description for IDENTITY_UNAVAILABLE
  IDENTITY_UNAVAILABLE = 'IDENTITY_UNAVAILABLE'.freeze,

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

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = IDENTITY_UNAVAILABLE) ⇒ Object



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

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

  str = value.to_s.strip

  case str.downcase
  when 'identity_unavailable' then IDENTITY_UNAVAILABLE
  when 'transactions_unavailable' then TRANSACTIONS_UNAVAILABLE
  when 'report_deleted' then REPORT_DELETED
  when 'data_unavailable' then DATA_UNAVAILABLE
  else
    default_value
  end
end

.validate(value) ⇒ Object



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

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

  CRA_BANK_INCOME_WARNING_CODE.include?(value)
end