Class: ThePlaidApi::ClientUserIdentity

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

Overview

The identity fields associated with a user. For a user to be eligible for a Plaid Check Consumer Report, all fields are required except ‘id_number`. Providing a partial SSN is strongly recommended, and improves the accuracy of matching user records during compliance processes such as file disclosure, dispute, or security freeze requests. If creating a report that will be shared with GSEs such as Fannie or Freddie, a full Social Security Number must be provided via the `id_number` field.

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: SKIP, date_of_birth: SKIP, emails: SKIP, phone_numbers: SKIP, addresses: SKIP, id_numbers: SKIP, additional_properties: nil) ⇒ ClientUserIdentity

Returns a new instance of ClientUserIdentity.



79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/the_plaid_api/models/client_user_identity.rb', line 79

def initialize(name: SKIP, date_of_birth: SKIP, emails: SKIP,
               phone_numbers: SKIP, addresses: SKIP, id_numbers: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @name = name unless name == SKIP
  @date_of_birth = date_of_birth unless date_of_birth == SKIP
  @emails = emails unless emails == SKIP
  @phone_numbers = phone_numbers unless phone_numbers == SKIP
  @addresses = addresses unless addresses == SKIP
  @id_numbers = id_numbers unless id_numbers == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#addressesArray[ClientUserIdentityAddress]

The user’s addresses.

Returns:



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

def addresses
  @addresses
end

#date_of_birthDate

The user’s date of birth, to be provided in the format “yyyy-mm-dd”.

Returns:

  • (Date)


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

def date_of_birth
  @date_of_birth
end

#emailsArray[ClientUserIdentityEmail]

The user’s emails.

Returns:



28
29
30
# File 'lib/the_plaid_api/models/client_user_identity.rb', line 28

def emails
  @emails
end

#id_numbersArray[UserIdNumber]

The user’s ID numbers.

Returns:



45
46
47
# File 'lib/the_plaid_api/models/client_user_identity.rb', line 45

def id_numbers
  @id_numbers
end

#nameClientUserIdentityName

User name information.



20
21
22
# File 'lib/the_plaid_api/models/client_user_identity.rb', line 20

def name
  @name
end

#phone_numbersArray[ClientUserIdentityPhoneNumber]

The user’s phone numbers, in E.164 format: {countrycode}{number}. For example: “14157452130”. Phone numbers provided in other formats will be parsed on a best-effort basis. Phone number input is validated against valid number ranges; number strings that do not match a real-world phone numbering scheme may cause the request to fail, even in the Sandbox test environment.

Returns:



37
38
39
# File 'lib/the_plaid_api/models/client_user_identity.rb', line 37

def phone_numbers
  @phone_numbers
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



95
96
97
98
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# File 'lib/the_plaid_api/models/client_user_identity.rb', line 95

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  name = ClientUserIdentityName.from_hash(hash['name']) if hash['name']
  date_of_birth = hash.key?('date_of_birth') ? hash['date_of_birth'] : SKIP
  # Parameter is an array, so we need to iterate through it
  emails = nil
  unless hash['emails'].nil?
    emails = []
    hash['emails'].each do |structure|
      emails << (ClientUserIdentityEmail.from_hash(structure) if structure)
    end
  end

  emails = SKIP unless hash.key?('emails')
  # Parameter is an array, so we need to iterate through it
  phone_numbers = nil
  unless hash['phone_numbers'].nil?
    phone_numbers = []
    hash['phone_numbers'].each do |structure|
      phone_numbers << (ClientUserIdentityPhoneNumber.from_hash(structure) if structure)
    end
  end

  phone_numbers = SKIP unless hash.key?('phone_numbers')
  # Parameter is an array, so we need to iterate through it
  addresses = nil
  unless hash['addresses'].nil?
    addresses = []
    hash['addresses'].each do |structure|
      addresses << (ClientUserIdentityAddress.from_hash(structure) if structure)
    end
  end

  addresses = SKIP unless hash.key?('addresses')
  # Parameter is an array, so we need to iterate through it
  id_numbers = nil
  unless hash['id_numbers'].nil?
    id_numbers = []
    hash['id_numbers'].each do |structure|
      id_numbers << (UserIdNumber.from_hash(structure) if structure)
    end
  end

  id_numbers = SKIP unless hash.key?('id_numbers')

  # 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.
  ClientUserIdentity.new(name: name,
                         date_of_birth: date_of_birth,
                         emails: emails,
                         phone_numbers: phone_numbers,
                         addresses: addresses,
                         id_numbers: id_numbers,
                         additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



48
49
50
51
52
53
54
55
56
57
# File 'lib/the_plaid_api/models/client_user_identity.rb', line 48

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['name'] = 'name'
  @_hash['date_of_birth'] = 'date_of_birth'
  @_hash['emails'] = 'emails'
  @_hash['phone_numbers'] = 'phone_numbers'
  @_hash['addresses'] = 'addresses'
  @_hash['id_numbers'] = 'id_numbers'
  @_hash
end

.nullablesObject

An array for nullable fields



72
73
74
75
76
77
# File 'lib/the_plaid_api/models/client_user_identity.rb', line 72

def self.nullables
  %w[
    name
    date_of_birth
  ]
end

.optionalsObject

An array for optional fields



60
61
62
63
64
65
66
67
68
69
# File 'lib/the_plaid_api/models/client_user_identity.rb', line 60

def self.optionals
  %w[
    name
    date_of_birth
    emails
    phone_numbers
    addresses
    id_numbers
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



168
169
170
171
172
173
174
# File 'lib/the_plaid_api/models/client_user_identity.rb', line 168

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} name: #{@name.inspect}, date_of_birth: #{@date_of_birth.inspect}, emails:"\
  " #{@emails.inspect}, phone_numbers: #{@phone_numbers.inspect}, addresses:"\
  " #{@addresses.inspect}, id_numbers: #{@id_numbers.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



160
161
162
163
164
165
# File 'lib/the_plaid_api/models/client_user_identity.rb', line 160

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} name: #{@name}, date_of_birth: #{@date_of_birth}, emails: #{@emails},"\
  " phone_numbers: #{@phone_numbers}, addresses: #{@addresses}, id_numbers: #{@id_numbers},"\
  " additional_properties: #{@additional_properties}>"
end