Class: ThePlaidApi::TransactionStreamStatus

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

Overview

The current status of the transaction stream. ‘MATURE`: A `MATURE` recurring stream should have at least 3 transactions and happen on a regular cadence (For Annual recurring stream, we will mark it `MATURE` after 2 instances). `EARLY_DETECTION`: When a recurring transaction first appears in the transaction history and before it fulfills the requirement of a mature stream, the status will be `EARLY_DETECTION`. `TOMBSTONED`: A stream that was previously in the `EARLY_DETECTION` status will move to the `TOMBSTONED` status when no further transactions were found at the next expected date. `UNKNOWN`: A stream is assigned an `UNKNOWN` status when none of the other statuses are applicable.

Constant Summary collapse

TRANSACTION_STREAM_STATUS =
[
  # TODO: Write general description for UNKNOWN
  UNKNOWN = 'UNKNOWN'.freeze,

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

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = UNKNOWN) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/the_plaid_api/models/transaction_stream_status.rb', line 38

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

  str = value.to_s.strip

  case str.downcase
  when 'unknown' then UNKNOWN
  when 'mature' then MATURE
  when 'early_detection' then EARLY_DETECTION
  when 'tombstoned' then TOMBSTONED
  else
    default_value
  end
end

.validate(value) ⇒ Object



32
33
34
35
36
# File 'lib/the_plaid_api/models/transaction_stream_status.rb', line 32

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

  TRANSACTION_STREAM_STATUS.include?(value)
end