Class: ThePlaidApi::SweepStatus

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

Overview

The status of a sweep transfer ‘“pending”` - The sweep is currently pending `“posted”` - The sweep has been posted `“settled”` - The sweep has settled. This is the terminal state of a successful credit sweep. `“returned”` - The sweep has been returned. This is the terminal state of a returned sweep. Returns of a sweep are extremely rare, since sweeps are money movement between your own bank account and your own Ledger. `“funds_available”` - Funds from the sweep have been released from hold and applied to the ledger’s available balance. (Only applicable to deposits.) This is the terminal state of a successful deposit sweep. ‘“failed”` - The sweep has failed. This is the terminal state of a failed sweep.

Constant Summary collapse

SWEEP_STATUS =
[
  # TODO: Write general description for PENDING
  PENDING = 'pending'.freeze,

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

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

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

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = PENDING) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/the_plaid_api/models/sweep_status.rb', line 44

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

  str = value.to_s.strip

  case str.downcase
  when 'pending' then PENDING
  when 'posted' then POSTED
  when 'settled' then SETTLED
  when 'funds_available' then FUNDS_AVAILABLE
  when 'returned' then RETURNED
  when 'failed' then FAILED
  else
    default_value
  end
end

.validate(value) ⇒ Object



38
39
40
41
42
# File 'lib/the_plaid_api/models/sweep_status.rb', line 38

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

  SWEEP_STATUS.include?(value)
end