Class: ThePlaidApi::TaxpayerIdentifierType

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

Overview

A value from a MISMO prescribed list that classifies identification numbers used by the Internal Revenue Service (IRS) in the administration of tax laws. A Social Security number (SSN) is issued by the SSA; all other taxpayer identification numbers are issued by the IRS.

Constant Summary collapse

TAXPAYER_IDENTIFIER_TYPE =
[
  # TODO: Write general description for
  # INDIVIDUALTAXPAYERIDENTIFICATIONNUMBER
  INDIVIDUALTAXPAYERIDENTIFICATIONNUMBER = 'IndividualTaxpayerIdentificationNumber'.freeze,

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = INDIVIDUALTAXPAYERIDENTIFICATIONNUMBER) ⇒ Object



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

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

  str = value.to_s.strip

  case str.downcase
  when 'individualtaxpayeridentificationnumber' then INDIVIDUALTAXPAYERIDENTIFICATIONNUMBER
  when 'socialsecuritynumber' then SOCIALSECURITYNUMBER
  else
    default_value
  end
end

.validate(value) ⇒ Object



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

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

  TAXPAYER_IDENTIFIER_TYPE.include?(value)
end