Class: ThePlaidApi::AprType

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

Overview

The type of balance to which the APR applies.

Constant Summary collapse

APR_TYPE =
[
  # TODO: Write general description for BALANCE_TRANSFER_APR
  BALANCE_TRANSFER_APR = 'balance_transfer_apr'.freeze,

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

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = BALANCE_TRANSFER_APR) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/the_plaid_api/models/apr_type.rb', line 29

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

  str = value.to_s.strip

  case str.downcase
  when 'balance_transfer_apr' then BALANCE_TRANSFER_APR
  when 'cash_apr' then CASH_APR
  when 'purchase_apr' then PURCHASE_APR
  when 'special' then SPECIAL
  else
    default_value
  end
end

.validate(value) ⇒ Object



23
24
25
26
27
# File 'lib/the_plaid_api/models/apr_type.rb', line 23

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

  APR_TYPE.include?(value)
end