Class: ThePlaidApi::IdentityVerificationAutofillAddress

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

Overview

Even if an address has been autofilled, some fields may be null depending on the region’s addressing system. For example: Addresses from the United Kingdom will not include a region Addresses from Hong Kong will not include postal code

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:, street2:, city:, region:, postal_code:, country:, po_box:, type:, additional_properties: nil) ⇒ IdentityVerificationAutofillAddress

Returns a new instance of IdentityVerificationAutofillAddress.



94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/the_plaid_api/models/identity_verification_autofill_address.rb', line 94

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

  @street = street
  @street2 = street2
  @city = city
  @region = region
  @postal_code = postal_code
  @country = country
  @po_box = po_box
  @type = type
  @additional_properties = additional_properties
end

Instance Attribute Details

#cityString

City from the address. A string with at least one non-whitespace alphabetical character, with a max length of 100 characters.

Returns:

  • (String)


30
31
32
# File 'lib/the_plaid_api/models/identity_verification_autofill_address.rb', line 30

def city
  @city
end

#countryString

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

Returns:

  • (String)


49
50
51
# File 'lib/the_plaid_api/models/identity_verification_autofill_address.rb', line 49

def country
  @country
end

#po_boxPoBoxStatus

Field describing whether the associated address is a post office box. Will be ‘yes` when a P.O. box is detected, `no` when Plaid confirmed the address is not a P.O. box, and `no_data` when Plaid was not able to determine if the address is a P.O. box.

Returns:



56
57
58
# File 'lib/the_plaid_api/models/identity_verification_autofill_address.rb', line 56

def po_box
  @po_box
end

#postal_codeString

The postal code for the associated address. Between 2 and 10 alphanumeric characters. For US-based addresses this must be 5 numeric digits.

Returns:

  • (String)


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

def postal_code
  @postal_code
end

#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)


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

def region
  @region
end

#streetString

The primary street portion of an address. If an address is provided, this field will always be filled. A string with at least one non-whitespace alphabetical character, with a max length of 80 characters.

Returns:

  • (String)


19
20
21
# File 'lib/the_plaid_api/models/identity_verification_autofill_address.rb', line 19

def street
  @street
end

#street2String

Extra street information, like an apartment or suite number. If provided, a string with at least one non-whitespace character, with a max length of 50 characters.

Returns:

  • (String)


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

def street2
  @street2
end

#typeAddressPurposeLabel

Field describing whether the associated address is being used for commercial or residential purposes. Note: This value will be ‘no_data` when Plaid does not have sufficient data to determine the address’s use.

Returns:



63
64
65
# File 'lib/the_plaid_api/models/identity_verification_autofill_address.rb', line 63

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# File 'lib/the_plaid_api/models/identity_verification_autofill_address.rb', line 111

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  street = hash.key?('street') ? hash['street'] : nil
  street2 = hash.key?('street2') ? hash['street2'] : 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
  po_box = hash.key?('po_box') ? hash['po_box'] : nil
  type = hash.key?('type') ? hash['type'] : 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.
  IdentityVerificationAutofillAddress.new(street: street,
                                          street2: street2,
                                          city: city,
                                          region: region,
                                          postal_code: postal_code,
                                          country: country,
                                          po_box: po_box,
                                          type: type,
                                          additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/the_plaid_api/models/identity_verification_autofill_address.rb', line 66

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

.nullablesObject

An array for nullable fields



85
86
87
88
89
90
91
92
# File 'lib/the_plaid_api/models/identity_verification_autofill_address.rb', line 85

def self.nullables
  %w[
    street2
    city
    region
    postal_code
  ]
end

.optionalsObject

An array for optional fields



80
81
82
# File 'lib/the_plaid_api/models/identity_verification_autofill_address.rb', line 80

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



152
153
154
155
156
157
158
# File 'lib/the_plaid_api/models/identity_verification_autofill_address.rb', line 152

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

#to_sObject

Provides a human-readable string representation of the object.



144
145
146
147
148
149
# File 'lib/the_plaid_api/models/identity_verification_autofill_address.rb', line 144

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