Class: ThePlaidApi::IncomeBreakdownType

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

Overview

The type of income. Possible values include: ‘“regular”`: regular income `“overtime”`: overtime income `“bonus”`: bonus income

Constant Summary collapse

INCOME_BREAKDOWN_TYPE =
[
  # TODO: Write general description for BONUS
  BONUS = 'bonus'.freeze,

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = BONUS) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/the_plaid_api/models/income_breakdown_type.rb', line 27

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

  str = value.to_s.strip

  case str.downcase
  when 'bonus' then BONUS
  when 'overtime' then OVERTIME
  when 'regular' then REGULAR
  else
    default_value
  end
end

.validate(value) ⇒ Object



21
22
23
24
25
# File 'lib/the_plaid_api/models/income_breakdown_type.rb', line 21

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

  INCOME_BREAKDOWN_TYPE.include?(value)
end