Class: ThePlaidApi::UserAccountIdentity

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

Overview

The identity data permissioned by the end user during the authorization flow.

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, address: SKIP, phone_number: SKIP, email: SKIP, date_of_birth: SKIP, ssn: SKIP, ssn_last_4: SKIP, additional_properties: nil) ⇒ UserAccountIdentity

Returns a new instance of UserAccountIdentity.



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

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

  @name = name unless name == SKIP
  @address = address unless address == SKIP
  @phone_number = phone_number unless phone_number == SKIP
  @email = email unless email == SKIP
  @date_of_birth = date_of_birth unless date_of_birth == SKIP
  @ssn = ssn unless ssn == SKIP
  @ssn_last_4 = ssn_last_4 unless ssn_last_4 == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#addressUserAccountIdentityAddress

The user’s address.



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

def address
  @address
end

#date_of_birthString

The user’s date of birth.

Returns:

  • (String)


33
34
35
# File 'lib/the_plaid_api/models/user_account_identity.rb', line 33

def date_of_birth
  @date_of_birth
end

#emailString

The user’s email address. Note: email is currently not returned.

Returns:

  • (String)


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

def email
  @email
end

#nameUserAccountIdentityName

The user’s first name and last name.



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

def name
  @name
end

#phone_numberString

The user’s phone number in [E.164](en.wikipedia.org/wiki/E.164) format

Returns:

  • (String)


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

def phone_number
  @phone_number
end

#ssnString

The user’s social security number.

Returns:

  • (String)


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

def ssn
  @ssn
end

#ssn_last_4String

The last 4 digits of the user’s social security number.

Returns:

  • (String)


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

def ssn_last_4
  @ssn_last_4
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
# File 'lib/the_plaid_api/models/user_account_identity.rb', line 98

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  name = UserAccountIdentityName.from_hash(hash['name']) if hash['name']
  address = UserAccountIdentityAddress.from_hash(hash['address']) if hash['address']
  phone_number = hash.key?('phone_number') ? hash['phone_number'] : SKIP
  email = hash.key?('email') ? hash['email'] : SKIP
  date_of_birth = hash.key?('date_of_birth') ? hash['date_of_birth'] : SKIP
  ssn = hash.key?('ssn') ? hash['ssn'] : SKIP
  ssn_last_4 = hash.key?('ssn_last_4') ? hash['ssn_last_4'] : 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.
  UserAccountIdentity.new(name: name,
                          address: address,
                          phone_number: phone_number,
                          email: email,
                          date_of_birth: date_of_birth,
                          ssn: ssn,
                          ssn_last_4: ssn_last_4,
                          additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



44
45
46
47
48
49
50
51
52
53
54
# File 'lib/the_plaid_api/models/user_account_identity.rb', line 44

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['name'] = 'name'
  @_hash['address'] = 'address'
  @_hash['phone_number'] = 'phone_number'
  @_hash['email'] = 'email'
  @_hash['date_of_birth'] = 'date_of_birth'
  @_hash['ssn'] = 'ssn'
  @_hash['ssn_last_4'] = 'ssn_last_4'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  %w[
    name
    address
    email
    date_of_birth
    ssn
    ssn_last_4
  ]
end

.optionalsObject

An array for optional fields



57
58
59
60
61
62
63
64
65
66
67
# File 'lib/the_plaid_api/models/user_account_identity.rb', line 57

def self.optionals
  %w[
    name
    address
    phone_number
    email
    date_of_birth
    ssn
    ssn_last_4
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

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

#to_sObject

Provides a human-readable string representation of the object.



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

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