Class: Plaid::AvailableBalance

Inherits:
Object
  • Object
show all
Defined in:
lib/plaid/models/available_balance.rb

Overview

The sign of the available balance for the receiver bank account associated with the receiver event at the time the matching transaction was found. Can be ‘positive`, `negative`, or null if the balance was not available at the time.

Constant Summary collapse

AVAILABLE_BALANCE =
[
  # TODO: Write general description for POSITIVE
  POSITIVE = 'positive'.freeze,

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = POSITIVE) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/plaid/models/available_balance.rb', line 26

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

  str = value.to_s.strip

  case str.downcase
  when 'positive' then POSITIVE
  when 'negative' then NEGATIVE
  else
    default_value
  end
end

.validate(value) ⇒ Object



20
21
22
23
24
# File 'lib/plaid/models/available_balance.rb', line 20

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

  true
end