Class: ThePlaidApi::PhysicalDocumentCategory

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

Overview

The type of identity document detected in the images provided. Will always be one of the following values: ‘drivers_license` - A driver’s license issued by the associated country, establishing identity without any guarantee as to citizenship, and granting driving privileges ‘id_card` - A general national identification card, distinct from driver’s licenses as it only establishes identity ‘passport` - A travel passport issued by the associated country for one of its citizens `residence_permit_card` - An identity document issued by the associated country permitting a foreign citizen to temporarily reside there `resident_card` - An identity document issued by the associated country permitting a foreign citizen to permanently reside there `visa` - An identity document issued by the associated country permitting a foreign citizen entry for a short duration and for a specific purpose, typically no longer than 6 months Note: This value may be different from the ID type that the user selects within Link. For example, if they select “Driver’s License” but then submit a picture of a passport, this field will say ‘passport`

Constant Summary collapse

PHYSICAL_DOCUMENT_CATEGORY =
[
  # TODO: Write general description for DRIVERS_LICENSE
  DRIVERS_LICENSE = 'drivers_license'.freeze,

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

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

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

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = DRIVERS_LICENSE) ⇒ Object



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/the_plaid_api/models/physical_document_category.rb', line 50

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

  str = value.to_s.strip

  case str.downcase
  when 'drivers_license' then DRIVERS_LICENSE
  when 'id_card' then ID_CARD
  when 'passport' then PASSPORT
  when 'residence_permit_card' then RESIDENCE_PERMIT_CARD
  when 'resident_card' then RESIDENT_CARD
  when 'visa' then VISA
  else
    default_value
  end
end

.validate(value) ⇒ Object



44
45
46
47
48
# File 'lib/the_plaid_api/models/physical_document_category.rb', line 44

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

  PHYSICAL_DOCUMENT_CATEGORY.include?(value)
end