Class: ThePlaidApi::CraBankIncomeBonusType

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

Overview

The type of bonus that this transaction represents, if it is a bonus. ‘BONUS_INCLUDED`: Bonus is included in this transaction along with the normal pay `BONUS_ONLY`: This transaction is a standalone bonus

Constant Summary collapse

CRA_BANK_INCOME_BONUS_TYPE =
[
  # TODO: Write general description for BONUS_INCLUDED
  BONUS_INCLUDED = 'BONUS_INCLUDED'.freeze,

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = BONUS_INCLUDED) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/the_plaid_api/models/cra_bank_income_bonus_type.rb', line 25

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

  str = value.to_s.strip

  case str.downcase
  when 'bonus_included' then BONUS_INCLUDED
  when 'bonus_only' then BONUS_ONLY
  else
    default_value
  end
end

.validate(value) ⇒ Object



19
20
21
22
23
# File 'lib/the_plaid_api/models/cra_bank_income_bonus_type.rb', line 19

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

  CRA_BANK_INCOME_BONUS_TYPE.include?(value)
end