Class: ThePlaidApi::IdentityVerificationDocumentAddressResponse

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

Overview

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.

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(street:, city:, region:, postal_code:, country:, additional_properties: nil) ⇒ IdentityVerificationDocumentAddressResponse

Returns a new instance of IdentityVerificationDocumentAddressResponse.



70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/the_plaid_api/models/identity_verification_document_address_response.rb', line 70

def initialize(street:, city:, region:, postal_code:, country:,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @street = street
  @city = city
  @region = region
  @postal_code = postal_code
  @country = country
  @additional_properties = additional_properties
end

Instance Attribute Details

#cityString

City extracted from the document.

Returns:

  • (String)


25
26
27
# File 'lib/the_plaid_api/models/identity_verification_document_address_response.rb', line 25

def city
  @city
end

#countryString

Valid, capitalized, two-letter ISO code representing the country extracted from the document. Must be in ISO 3166-1 alpha-2 form.

Returns:

  • (String)


44
45
46
# File 'lib/the_plaid_api/models/identity_verification_document_address_response.rb', line 44

def country
  @country
end

#postal_codeString

The postal code extracted from the document. Between 2 and 10 alphanumeric characters. For US-based addresses this must be 5 numeric digits.

Returns:

  • (String)


39
40
41
# File 'lib/the_plaid_api/models/identity_verification_document_address_response.rb', line 39

def postal_code
  @postal_code
end

#regionString

A subdivision code extracted from the document. Related terms would be “state”, “province”, “prefecture”, “zone”, “subdivision”, etc. For a full list of valid codes, see [country subdivision codes](plaid.com/documents/country_subdivision_codes.json). Country prefixes are omitted, since they can be inferred from the ‘country` field.

Returns:

  • (String)


34
35
36
# File 'lib/the_plaid_api/models/identity_verification_document_address_response.rb', line 34

def region
  @region
end

#streetString

The full street address extracted from the document.

Returns:

  • (String)


21
22
23
# File 'lib/the_plaid_api/models/identity_verification_document_address_response.rb', line 21

def street
  @street
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/the_plaid_api/models/identity_verification_document_address_response.rb', line 84

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  street = hash.key?('street') ? hash['street'] : nil
  city = hash.key?('city') ? hash['city'] : nil
  region = hash.key?('region') ? hash['region'] : nil
  postal_code = hash.key?('postal_code') ? hash['postal_code'] : nil
  country = hash.key?('country') ? hash['country'] : nil

  # 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.
  IdentityVerificationDocumentAddressResponse.new(street: street,
                                                  city: city,
                                                  region: region,
                                                  postal_code: postal_code,
                                                  country: country,
                                                  additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



47
48
49
50
51
52
53
54
55
# File 'lib/the_plaid_api/models/identity_verification_document_address_response.rb', line 47

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['street'] = 'street'
  @_hash['city'] = 'city'
  @_hash['region'] = 'region'
  @_hash['postal_code'] = 'postal_code'
  @_hash['country'] = 'country'
  @_hash
end

.nullablesObject

An array for nullable fields



63
64
65
66
67
68
# File 'lib/the_plaid_api/models/identity_verification_document_address_response.rb', line 63

def self.nullables
  %w[
    region
    postal_code
  ]
end

.optionalsObject

An array for optional fields



58
59
60
# File 'lib/the_plaid_api/models/identity_verification_document_address_response.rb', line 58

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



118
119
120
121
122
123
# File 'lib/the_plaid_api/models/identity_verification_document_address_response.rb', line 118

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} street: #{@street.inspect}, city: #{@city.inspect}, region:"\
  " #{@region.inspect}, postal_code: #{@postal_code.inspect}, country: #{@country.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



111
112
113
114
115
# File 'lib/the_plaid_api/models/identity_verification_document_address_response.rb', line 111

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} street: #{@street}, city: #{@city}, region: #{@region}, postal_code:"\
  " #{@postal_code}, country: #{@country}, additional_properties: #{@additional_properties}>"
end