Class: ThePlaidApi::PhysicalDocumentExtractedData

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

Overview

Data extracted from a user-submitted document.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(id_number:, category:, expiration_date:, issue_date:, issuing_country:, issuing_region:, date_of_birth:, address:, name: SKIP, additional_properties: nil) ⇒ PhysicalDocumentExtractedData

Returns a new instance of PhysicalDocumentExtractedData.



118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/the_plaid_api/models/physical_document_extracted_data.rb', line 118

def initialize(id_number:, category:, expiration_date:, issue_date:,
               issuing_country:, issuing_region:, date_of_birth:, address:,
               name: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @id_number = id_number
  @category = category
  @expiration_date = expiration_date
  @issue_date = issue_date
  @issuing_country = issuing_country
  @issuing_region = issuing_region
  @date_of_birth = date_of_birth
  @address = address
  @name = name unless name == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#addressIdentityVerificationDocumentAddressResponse

The address extracted from the document. The address must at least contain the following fields to be a valid address: ‘street`, `city`, `country`. If any are missing or unable to be extracted, the address will be null. `region`, and `postal_code` may be null based on the addressing system. For example: Addresses from the United Kingdom will not include a region Addresses from Hong Kong will not include postal code Note: Optical Character Recognition (OCR) technology may sometimes extract incorrect data from a document.



77
78
79
# File 'lib/the_plaid_api/models/physical_document_extracted_data.rb', line 77

def address
  @address
end

#categoryPhysicalDocumentCategory

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`



36
37
38
# File 'lib/the_plaid_api/models/physical_document_extracted_data.rb', line 36

def category
  @category
end

#date_of_birthDate

A date extracted from the document in the format YYYY-MM-DD (RFC 3339 Section 5.6).

Returns:

  • (Date)


65
66
67
# File 'lib/the_plaid_api/models/physical_document_extracted_data.rb', line 65

def date_of_birth
  @date_of_birth
end

#expiration_dateDate

The expiration date of the document in the format YYYY-MM-DD (RFC 3339 Section 5.6).

Returns:

  • (Date)


41
42
43
# File 'lib/the_plaid_api/models/physical_document_extracted_data.rb', line 41

def expiration_date
  @expiration_date
end

#id_numberString

Alpha-numeric ID number extracted via OCR from the user’s document image.

Returns:

  • (String)


14
15
16
# File 'lib/the_plaid_api/models/physical_document_extracted_data.rb', line 14

def id_number
  @id_number
end

#issue_dateDate

The issue date of the document in the format YYYY-MM-DD (RFC 3339 Section 5.6).

Returns:

  • (Date)


46
47
48
# File 'lib/the_plaid_api/models/physical_document_extracted_data.rb', line 46

def issue_date
  @issue_date
end

#issuing_countryString

Valid, capitalized, two-letter ISO code representing the country of this object. Must be in ISO 3166-1 alpha-2 form.

Returns:

  • (String)


51
52
53
# File 'lib/the_plaid_api/models/physical_document_extracted_data.rb', line 51

def issuing_country
  @issuing_country
end

#issuing_regionString

A subdivision code. “Subdivision” is a generic term for “state”, “province”, “prefecture”, “zone”, etc. For the list of valid codes, see [country subdivision codes](plaid.com/documents/country_subdivision_codes.json). Country prefixes are omitted, since they are inferred from the ‘country` field.

Returns:

  • (String)


60
61
62
# File 'lib/the_plaid_api/models/physical_document_extracted_data.rb', line 60

def issuing_region
  @issuing_region
end

#nameIdentityVerificationDocumentNameResponse

The individual’s name extracted from the document.



81
82
83
# File 'lib/the_plaid_api/models/physical_document_extracted_data.rb', line 81

def name
  @name
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# File 'lib/the_plaid_api/models/physical_document_extracted_data.rb', line 137

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id_number = hash.key?('id_number') ? hash['id_number'] : nil
  category = hash.key?('category') ? hash['category'] : nil
  expiration_date =
    hash.key?('expiration_date') ? hash['expiration_date'] : nil
  issue_date = hash.key?('issue_date') ? hash['issue_date'] : nil
  issuing_country =
    hash.key?('issuing_country') ? hash['issuing_country'] : nil
  issuing_region =
    hash.key?('issuing_region') ? hash['issuing_region'] : nil
  date_of_birth = hash.key?('date_of_birth') ? hash['date_of_birth'] : nil
  address = IdentityVerificationDocumentAddressResponse.from_hash(hash['address']) if
    hash['address']
  name = IdentityVerificationDocumentNameResponse.from_hash(hash['name']) if hash['name']

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  PhysicalDocumentExtractedData.new(id_number: id_number,
                                    category: category,
                                    expiration_date: expiration_date,
                                    issue_date: issue_date,
                                    issuing_country: issuing_country,
                                    issuing_region: issuing_region,
                                    date_of_birth: date_of_birth,
                                    address: address,
                                    name: name,
                                    additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/the_plaid_api/models/physical_document_extracted_data.rb', line 84

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id_number'] = 'id_number'
  @_hash['category'] = 'category'
  @_hash['expiration_date'] = 'expiration_date'
  @_hash['issue_date'] = 'issue_date'
  @_hash['issuing_country'] = 'issuing_country'
  @_hash['issuing_region'] = 'issuing_region'
  @_hash['date_of_birth'] = 'date_of_birth'
  @_hash['address'] = 'address'
  @_hash['name'] = 'name'
  @_hash
end

.nullablesObject

An array for nullable fields



106
107
108
109
110
111
112
113
114
115
116
# File 'lib/the_plaid_api/models/physical_document_extracted_data.rb', line 106

def self.nullables
  %w[
    id_number
    expiration_date
    issue_date
    issuing_region
    date_of_birth
    address
    name
  ]
end

.optionalsObject

An array for optional fields



99
100
101
102
103
# File 'lib/the_plaid_api/models/physical_document_extracted_data.rb', line 99

def self.optionals
  %w[
    name
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



185
186
187
188
189
190
191
192
# File 'lib/the_plaid_api/models/physical_document_extracted_data.rb', line 185

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} id_number: #{@id_number.inspect}, category: #{@category.inspect},"\
  " expiration_date: #{@expiration_date.inspect}, issue_date: #{@issue_date.inspect},"\
  " issuing_country: #{@issuing_country.inspect}, issuing_region: #{@issuing_region.inspect},"\
  " date_of_birth: #{@date_of_birth.inspect}, address: #{@address.inspect}, name:"\
  " #{@name.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



176
177
178
179
180
181
182
# File 'lib/the_plaid_api/models/physical_document_extracted_data.rb', line 176

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} id_number: #{@id_number}, category: #{@category}, expiration_date:"\
  " #{@expiration_date}, issue_date: #{@issue_date}, issuing_country: #{@issuing_country},"\
  " issuing_region: #{@issuing_region}, date_of_birth: #{@date_of_birth}, address:"\
  " #{@address}, name: #{@name}, additional_properties: #{@additional_properties}>"
end