Class: ThePlaidApi::IdentityVerificationAutofillUserData

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

Overview

User information that was autofilled. All this information should be confirmed by the user before using.

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(name:, address:, id_number:, additional_properties: nil) ⇒ IdentityVerificationAutofillUserData

Returns a new instance of IdentityVerificationAutofillUserData.



55
56
57
58
59
60
61
62
63
# File 'lib/the_plaid_api/models/identity_verification_autofill_user_data.rb', line 55

def initialize(name:, address:, id_number:, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @name = name
  @address = address
  @id_number = id_number
  @additional_properties = additional_properties
end

Instance Attribute Details

#addressIdentityVerificationAutofillAddress

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



24
25
26
# File 'lib/the_plaid_api/models/identity_verification_autofill_user_data.rb', line 24

def address
  @address
end

#id_numberUserIdNumber

ID number submitted by the user, currently used only for the Identity Verification product. If the user has not submitted this data yet, this field will be ‘null`. Otherwise, both fields are guaranteed to be filled.

Returns:



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

def id_number
  @id_number
end

#nameIdentityVerificationResponseUserName

The full name provided by the user. If the user has not submitted their name, this field will be null. Otherwise, both fields are guaranteed to be filled.



17
18
19
# File 'lib/the_plaid_api/models/identity_verification_autofill_user_data.rb', line 17

def name
  @name
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/the_plaid_api/models/identity_verification_autofill_user_data.rb', line 66

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  name = IdentityVerificationResponseUserName.from_hash(hash['name']) if hash['name']
  address = IdentityVerificationAutofillAddress.from_hash(hash['address']) if hash['address']
  id_number = UserIdNumber.from_hash(hash['id_number']) if hash['id_number']

  # 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.
  IdentityVerificationAutofillUserData.new(name: name,
                                           address: address,
                                           id_number: id_number,
                                           additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



33
34
35
36
37
38
39
# File 'lib/the_plaid_api/models/identity_verification_autofill_user_data.rb', line 33

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['name'] = 'name'
  @_hash['address'] = 'address'
  @_hash['id_number'] = 'id_number'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  %w[
    name
    address
    id_number
  ]
end

.optionalsObject

An array for optional fields



42
43
44
# File 'lib/the_plaid_api/models/identity_verification_autofill_user_data.rb', line 42

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



96
97
98
99
100
# File 'lib/the_plaid_api/models/identity_verification_autofill_user_data.rb', line 96

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

#to_sObject

Provides a human-readable string representation of the object.



89
90
91
92
93
# File 'lib/the_plaid_api/models/identity_verification_autofill_user_data.rb', line 89

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