Class: ThePlaidApi::IdentityVerificationUserData

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

Overview

The identity data that was either collected from the user or provided via API in order to perform an Identity Verification.

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(date_of_birth:, ip_address:, email_address:, name:, address:, id_number:, phone_number: SKIP, additional_properties: nil) ⇒ IdentityVerificationUserData

Returns a new instance of IdentityVerificationUserData.



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

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

  @phone_number = phone_number unless phone_number == SKIP
  @date_of_birth = date_of_birth
  @ip_address = ip_address
  @email_address = email_address
  @name = name
  @address = address
  @id_number = id_number
  @additional_properties = additional_properties
end

Instance Attribute Details

#addressIdentityVerificationUserAddress

Even if an address has been collected, 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



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

def address
  @address
end

#date_of_birthDate

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

Returns:

  • (Date)


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

def date_of_birth
  @date_of_birth
end

#email_addressString

A valid email address. Must not have leading or trailing spaces and address must be RFC compliant. For more information, see [RFC 3696](datatracker.ietf.org/doc/html/rfc3696).

Returns:

  • (String)


29
30
31
# File 'lib/the_plaid_api/models/identity_verification_user_data.rb', line 29

def email_address
  @email_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:



48
49
50
# File 'lib/the_plaid_api/models/identity_verification_user_data.rb', line 48

def id_number
  @id_number
end

#ip_addressString

An IPv4 or IPV6 address.

Returns:

  • (String)


23
24
25
# File 'lib/the_plaid_api/models/identity_verification_user_data.rb', line 23

def ip_address
  @ip_address
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.



35
36
37
# File 'lib/the_plaid_api/models/identity_verification_user_data.rb', line 35

def name
  @name
end

#phone_numberString

A valid phone number in E.164 format.

Returns:

  • (String)


15
16
17
# File 'lib/the_plaid_api/models/identity_verification_user_data.rb', line 15

def phone_number
  @phone_number
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/the_plaid_api/models/identity_verification_user_data.rb', line 99

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  date_of_birth = hash.key?('date_of_birth') ? hash['date_of_birth'] : nil
  ip_address = hash.key?('ip_address') ? hash['ip_address'] : nil
  email_address = hash.key?('email_address') ? hash['email_address'] : nil
  name = IdentityVerificationResponseUserName.from_hash(hash['name']) if hash['name']
  address = IdentityVerificationUserAddress.from_hash(hash['address']) if hash['address']
  id_number = UserIdNumber.from_hash(hash['id_number']) if hash['id_number']
  phone_number = hash.key?('phone_number') ? hash['phone_number'] : SKIP

  # 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.
  IdentityVerificationUserData.new(date_of_birth: date_of_birth,
                                   ip_address: ip_address,
                                   email_address: email_address,
                                   name: name,
                                   address: address,
                                   id_number: id_number,
                                   phone_number: phone_number,
                                   additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



51
52
53
54
55
56
57
58
59
60
61
# File 'lib/the_plaid_api/models/identity_verification_user_data.rb', line 51

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

.nullablesObject

An array for nullable fields



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

def self.nullables
  %w[
    phone_number
    date_of_birth
    ip_address
    email_address
    name
    address
    id_number
  ]
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    phone_number
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



138
139
140
141
142
143
144
# File 'lib/the_plaid_api/models/identity_verification_user_data.rb', line 138

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} phone_number: #{@phone_number.inspect}, date_of_birth:"\
  " #{@date_of_birth.inspect}, ip_address: #{@ip_address.inspect}, email_address:"\
  " #{@email_address.inspect}, 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.



130
131
132
133
134
135
# File 'lib/the_plaid_api/models/identity_verification_user_data.rb', line 130

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