Class: ThePlaidApi::UserCreateRequest

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

Overview

UserCreateRequest defines the request schema for ‘/user/create`

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(client_user_id:, client_id: SKIP, secret: SKIP, identity: SKIP, end_customer: SKIP, consumer_report_user_identity: SKIP, with_upgraded_user: SKIP, additional_properties: nil) ⇒ UserCreateRequest

Returns a new instance of UserCreateRequest.



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/the_plaid_api/models/user_create_request.rb', line 100

def initialize(client_user_id:, client_id: SKIP, secret: SKIP,
               identity: SKIP, end_customer: SKIP,
               consumer_report_user_identity: SKIP,
               with_upgraded_user: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @client_id = client_id unless client_id == SKIP
  @secret = secret unless secret == SKIP
  @client_user_id = client_user_id
  @identity = identity unless identity == SKIP
  @end_customer = end_customer unless end_customer == SKIP
  unless consumer_report_user_identity == SKIP
    @consumer_report_user_identity =
      consumer_report_user_identity
  end
  @with_upgraded_user = with_upgraded_user unless with_upgraded_user == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#client_idString

Your Plaid API ‘client_id`. The `client_id` is required and may be provided either in the `PLAID-CLIENT-ID` header or as part of a request body.

Returns:

  • (String)


16
17
18
# File 'lib/the_plaid_api/models/user_create_request.rb', line 16

def client_id
  @client_id
end

#client_user_idString

A unique ID representing the end user. Maximum of 128 characters. Typically this will be a user ID number from your application. Personally identifiable information, such as an email address or phone number, should not be used in the ‘client_user_id`.

Returns:

  • (String)


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

def client_user_id
  @client_user_id
end

#consumer_report_user_identityConsumerReportUserIdentity

This field is only used by integrations created before December 10, 2025. All other integrations must use the ‘identity` object instead. For more details, see [new user APIs](plaid.com/docs/api/users/user-apis). To create a Plaid Check Consumer Report for a user when using a `user_token`, this field must be present. If this field is not provided during user token creation, you can add it to the user later by calling `/user/update`. Once the field has been added to the user, you will be able to call `/link/token/create` with a non-empty `consumer_report_permissible_purpose` (which will automatically create a Plaid Check Consumer Report), or call `/cra/check_report/create` for that user.



57
58
59
# File 'lib/the_plaid_api/models/user_create_request.rb', line 57

def consumer_report_user_identity
  @consumer_report_user_identity
end

#end_customerString

A unique ID representing a CRA reseller’s end customer. Maximum of 128 characters.

Returns:

  • (String)


43
44
45
# File 'lib/the_plaid_api/models/user_create_request.rb', line 43

def end_customer
  @end_customer
end

#identityClientUserIdentity

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.

Returns:



38
39
40
# File 'lib/the_plaid_api/models/user_create_request.rb', line 38

def identity
  @identity
end

#secretString

Your Plaid API ‘secret`. The `secret` is required and may be provided either in the `PLAID-SECRET` header or as part of a request body.

Returns:

  • (String)


21
22
23
# File 'lib/the_plaid_api/models/user_create_request.rb', line 21

def secret
  @secret
end

#with_upgraded_userTrueClass | FalseClass

If your integration with the User API predates December 10, 2025, set this field to ‘true` to opt into the [new User API](plaid.com/docs/api/users/user-apis/). When enabled, you can use the `identity` field instead of `consumer_report_user_identity`.

Returns:

  • (TrueClass | FalseClass)


64
65
66
# File 'lib/the_plaid_api/models/user_create_request.rb', line 64

def with_upgraded_user
  @with_upgraded_user
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  client_user_id =
    hash.key?('client_user_id') ? hash['client_user_id'] : nil
  client_id = hash.key?('client_id') ? hash['client_id'] : SKIP
  secret = hash.key?('secret') ? hash['secret'] : SKIP
  identity = ClientUserIdentity.from_hash(hash['identity']) if hash['identity']
  end_customer = hash.key?('end_customer') ? hash['end_customer'] : SKIP
  if hash['consumer_report_user_identity']
    consumer_report_user_identity = ConsumerReportUserIdentity.from_hash(hash['consumer_report_user_identity'])
  end
  with_upgraded_user =
    hash.key?('with_upgraded_user') ? hash['with_upgraded_user'] : 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.
  UserCreateRequest.new(client_user_id: client_user_id,
                        client_id: client_id,
                        secret: secret,
                        identity: identity,
                        end_customer: end_customer,
                        consumer_report_user_identity: consumer_report_user_identity,
                        with_upgraded_user: with_upgraded_user,
                        additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['client_id'] = 'client_id'
  @_hash['secret'] = 'secret'
  @_hash['client_user_id'] = 'client_user_id'
  @_hash['identity'] = 'identity'
  @_hash['end_customer'] = 'end_customer'
  @_hash['consumer_report_user_identity'] =
    'consumer_report_user_identity'
  @_hash['with_upgraded_user'] = 'with_upgraded_user'
  @_hash
end

.nullablesObject

An array for nullable fields



93
94
95
96
97
98
# File 'lib/the_plaid_api/models/user_create_request.rb', line 93

def self.nullables
  %w[
    identity
    consumer_report_user_identity
  ]
end

.optionalsObject

An array for optional fields



81
82
83
84
85
86
87
88
89
90
# File 'lib/the_plaid_api/models/user_create_request.rb', line 81

def self.optionals
  %w[
    client_id
    secret
    identity
    end_customer
    consumer_report_user_identity
    with_upgraded_user
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



165
166
167
168
169
170
171
172
# File 'lib/the_plaid_api/models/user_create_request.rb', line 165

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} client_id: #{@client_id.inspect}, secret: #{@secret.inspect},"\
  " client_user_id: #{@client_user_id.inspect}, identity: #{@identity.inspect}, end_customer:"\
  " #{@end_customer.inspect}, consumer_report_user_identity:"\
  " #{@consumer_report_user_identity.inspect}, with_upgraded_user:"\
  " #{@with_upgraded_user.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



156
157
158
159
160
161
162
# File 'lib/the_plaid_api/models/user_create_request.rb', line 156

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} client_id: #{@client_id}, secret: #{@secret}, client_user_id:"\
  " #{@client_user_id}, identity: #{@identity}, end_customer: #{@end_customer},"\
  " consumer_report_user_identity: #{@consumer_report_user_identity}, with_upgraded_user:"\
  " #{@with_upgraded_user}, additional_properties: #{@additional_properties}>"
end