Class: ThePlaidApi::CashFlowInsight

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

Overview

An insight that can be detected by the Cash Flow Updates product

Constant Summary collapse

CASH_FLOW_INSIGHT =
[
  # TODO: Write general description for LARGE_DEPOSIT_DETECTED
  LARGE_DEPOSIT_DETECTED = 'LARGE_DEPOSIT_DETECTED'.freeze,

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

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = LARGE_DEPOSIT_DETECTED) ⇒ Object



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

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

  str = value.to_s.strip

  case str.downcase
  when 'large_deposit_detected' then LARGE_DEPOSIT_DETECTED
  when 'low_balance_detected' then LOW_BALANCE_DETECTED
  when 'new_loan_payment_detected' then NEW_LOAN_PAYMENT_DETECTED
  when 'nsf_overdraft_detected' then NSF_OVERDRAFT_DETECTED
  else
    default_value
  end
end

.validate(value) ⇒ Object



23
24
25
26
27
# File 'lib/the_plaid_api/models/cash_flow_insight.rb', line 23

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

  CASH_FLOW_INSIGHT.include?(value)
end