Class: ThePlaidApi::RecurringTransactionFrequency

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

Overview

Describes the frequency of the transaction stream. ‘WEEKLY`: Assigned to a transaction stream that occurs approximately every week. `BIWEEKLY`: Assigned to a transaction stream that occurs approximately every 2 weeks. `SEMI_MONTHLY`: Assigned to a transaction stream that occurs approximately twice per month. This frequency is typically seen for inflow transaction streams. `MONTHLY`: Assigned to a transaction stream that occurs approximately every month. `ANNUALLY`: Assigned to a transaction stream that occurs approximately every year. `UNKNOWN`: Assigned to a transaction stream that does not fit any of the pre-defined frequencies.

Constant Summary collapse

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

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

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

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

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = UNKNOWN) ⇒ Object



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

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 'weekly' then WEEKLY
  when 'biweekly' then BIWEEKLY
  when 'semi_monthly' then SEMI_MONTHLY
  when 'monthly' then MONTHLY
  when 'annually' then ANNUALLY
  else
    default_value
  end
end

.validate(value) ⇒ Object



37
38
39
40
41
# File 'lib/the_plaid_api/models/recurring_transaction_frequency.rb', line 37

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

  RECURRING_TRANSACTION_FREQUENCY.include?(value)
end