Class: ClerkHttpClient::UpdateUserRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/clerk-http-client/models/update_user_request.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ UpdateUserRequest

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
# File 'lib/clerk-http-client/models/update_user_request.rb', line 181

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `ClerkHttpClient::UpdateUserRequest` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!self.class.attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `ClerkHttpClient::UpdateUserRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'external_id')
    self.external_id = attributes[:'external_id']
  end

  if attributes.key?(:'first_name')
    self.first_name = attributes[:'first_name']
  end

  if attributes.key?(:'last_name')
    self.last_name = attributes[:'last_name']
  end

  if attributes.key?(:'primary_email_address_id')
    self.primary_email_address_id = attributes[:'primary_email_address_id']
  end

  if attributes.key?(:'notify_primary_email_address_changed')
    self.notify_primary_email_address_changed = attributes[:'notify_primary_email_address_changed']
  else
    self.notify_primary_email_address_changed = false
  end

  if attributes.key?(:'primary_phone_number_id')
    self.primary_phone_number_id = attributes[:'primary_phone_number_id']
  end

  if attributes.key?(:'primary_web3_wallet_id')
    self.primary_web3_wallet_id = attributes[:'primary_web3_wallet_id']
  end

  if attributes.key?(:'username')
    self.username = attributes[:'username']
  end

  if attributes.key?(:'profile_image_id')
    self.profile_image_id = attributes[:'profile_image_id']
  end

  if attributes.key?(:'password')
    self.password = attributes[:'password']
  end

  if attributes.key?(:'password_digest')
    self.password_digest = attributes[:'password_digest']
  end

  if attributes.key?(:'password_hasher')
    self.password_hasher = attributes[:'password_hasher']
  end

  if attributes.key?(:'skip_password_checks')
    self.skip_password_checks = attributes[:'skip_password_checks']
  end

  if attributes.key?(:'sign_out_of_other_sessions')
    self.sign_out_of_other_sessions = attributes[:'sign_out_of_other_sessions']
  end

  if attributes.key?(:'totp_secret')
    self.totp_secret = attributes[:'totp_secret']
  end

  if attributes.key?(:'backup_codes')
    if (value = attributes[:'backup_codes']).is_a?(Array)
      self.backup_codes = value
    end
  end

  if attributes.key?(:'public_metadata')
    if (value = attributes[:'public_metadata']).is_a?(Hash)
      self. = value
    end
  end

  if attributes.key?(:'private_metadata')
    if (value = attributes[:'private_metadata']).is_a?(Hash)
      self. = value
    end
  end

  if attributes.key?(:'unsafe_metadata')
    if (value = attributes[:'unsafe_metadata']).is_a?(Hash)
      self. = value
    end
  end

  if attributes.key?(:'delete_self_enabled')
    self.delete_self_enabled = attributes[:'delete_self_enabled']
  end

  if attributes.key?(:'create_organization_enabled')
    self.create_organization_enabled = attributes[:'create_organization_enabled']
  end

  if attributes.key?(:'legal_accepted_at')
    self.legal_accepted_at = attributes[:'legal_accepted_at']
  end

  if attributes.key?(:'skip_legal_checks')
    self.skip_legal_checks = attributes[:'skip_legal_checks']
  end

  if attributes.key?(:'create_organizations_limit')
    self.create_organizations_limit = attributes[:'create_organizations_limit']
  end

  if attributes.key?(:'created_at')
    self.created_at = attributes[:'created_at']
  end
end

Instance Attribute Details

#backup_codesObject

If Backup Codes are configured on the instance, you can provide them to enable it on the specific user without the need to reset them. You must provide the backup codes in plain format or the corresponding bcrypt digest.



64
65
66
# File 'lib/clerk-http-client/models/update_user_request.rb', line 64

def backup_codes
  @backup_codes
end

#create_organization_enabledObject

If true, the user can create organizations with the Frontend API.



79
80
81
# File 'lib/clerk-http-client/models/update_user_request.rb', line 79

def create_organization_enabled
  @create_organization_enabled
end

#create_organizations_limitObject

The maximum number of organizations the user can create. 0 means unlimited.



88
89
90
# File 'lib/clerk-http-client/models/update_user_request.rb', line 88

def create_organizations_limit
  @create_organizations_limit
end

#created_atObject

A custom date/time denoting when the user signed up to the application, specified in RFC3339 format (e.g. ‘2012-10-20T07:15:20.902Z`).



91
92
93
# File 'lib/clerk-http-client/models/update_user_request.rb', line 91

def created_at
  @created_at
end

#delete_self_enabledObject

If true, the user can delete themselves with the Frontend API.



76
77
78
# File 'lib/clerk-http-client/models/update_user_request.rb', line 76

def delete_self_enabled
  @delete_self_enabled
end

#external_idObject

The ID of the user as used in your external systems or your previous authentication solution. Must be unique across your instance.



19
20
21
# File 'lib/clerk-http-client/models/update_user_request.rb', line 19

def external_id
  @external_id
end

#first_nameObject

The first name to assign to the user



22
23
24
# File 'lib/clerk-http-client/models/update_user_request.rb', line 22

def first_name
  @first_name
end

#last_nameObject

The last name to assign to the user



25
26
27
# File 'lib/clerk-http-client/models/update_user_request.rb', line 25

def last_name
  @last_name
end

A custom timestamps denoting when the user accepted legal requirements, specified in RFC3339 format (e.g. ‘2012-10-20T07:15:20.902Z`).



82
83
84
# File 'lib/clerk-http-client/models/update_user_request.rb', line 82

def legal_accepted_at
  @legal_accepted_at
end

#notify_primary_email_address_changedObject

If set to ‘true`, the user will be notified that their primary email address has changed. By default, no notification is sent.



31
32
33
# File 'lib/clerk-http-client/models/update_user_request.rb', line 31

def notify_primary_email_address_changed
  @notify_primary_email_address_changed
end

#passwordObject

The plaintext password to give the user. Must be at least 8 characters long, and can not be in any list of hacked passwords.



46
47
48
# File 'lib/clerk-http-client/models/update_user_request.rb', line 46

def password
  @password
end

#password_digestObject

In case you already have the password digests and not the passwords, you can use them for the newly created user via this property. The digests should be generated with one of the supported algorithms. The hashing algorithm can be specified using the ‘password_hasher` property.



49
50
51
# File 'lib/clerk-http-client/models/update_user_request.rb', line 49

def password_digest
  @password_digest
end

#password_hasherObject

The hashing algorithm that was used to generate the password digest. The algorithms we support at the moment are [‘bcrypt`](en.wikipedia.org/wiki/Bcrypt), [`bcrypt_sha256_django`](docs.djangoproject.com/en/4.0/topics/auth/passwords/), [`md5`](en.wikipedia.org/wiki/MD5), `pbkdf2_sha1`, `pbkdf2_sha256`, [`pbkdf2_sha256_django`](docs.djangoproject.com/en/4.0/topics/auth/passwords/), [`phpass`](www.openwall.com/phpass/), [`scrypt_firebase`](firebaseopensource.com/projects/firebase/scrypt/), [`scrypt_werkzeug`](werkzeug.palletsprojects.com/en/3.0.x/utils/#werkzeug.security.generate_password_hash), [`sha256`](en.wikipedia.org/wiki/SHA-2), and the [`argon2`](argon2.online/) variants: `argon2i` and `argon2id`. Each of the supported hashers expects the incoming digest to be in a particular format. See the [Clerk docs](clerk.com/docs/references/backend/user/create-user) for more information.



52
53
54
# File 'lib/clerk-http-client/models/update_user_request.rb', line 52

def password_hasher
  @password_hasher
end

#primary_email_address_idObject

The ID of the email address to set as primary. It must be verified, and present on the current user.



28
29
30
# File 'lib/clerk-http-client/models/update_user_request.rb', line 28

def primary_email_address_id
  @primary_email_address_id
end

#primary_phone_number_idObject

The ID of the phone number to set as primary. It must be verified, and present on the current user.



34
35
36
# File 'lib/clerk-http-client/models/update_user_request.rb', line 34

def primary_phone_number_id
  @primary_phone_number_id
end

#primary_web3_wallet_idObject

The ID of the web3 wallets to set as primary. It must be verified, and present on the current user.



37
38
39
# File 'lib/clerk-http-client/models/update_user_request.rb', line 37

def primary_web3_wallet_id
  @primary_web3_wallet_id
end

#private_metadataObject

Metadata saved on the user, that is only visible to your Backend API



70
71
72
# File 'lib/clerk-http-client/models/update_user_request.rb', line 70

def 
  @private_metadata
end

#profile_image_idObject

The ID of the image to set as the user’s profile image



43
44
45
# File 'lib/clerk-http-client/models/update_user_request.rb', line 43

def profile_image_id
  @profile_image_id
end

#public_metadataObject

Metadata saved on the user, that is visible to both your Frontend and Backend APIs



67
68
69
# File 'lib/clerk-http-client/models/update_user_request.rb', line 67

def 
  @public_metadata
end

#sign_out_of_other_sessionsObject

Set to ‘true` to sign out the user from all their active sessions once their password is updated. This parameter can only be used when providing a `password`.



58
59
60
# File 'lib/clerk-http-client/models/update_user_request.rb', line 58

def sign_out_of_other_sessions
  @sign_out_of_other_sessions
end

When set to ‘true` all legal checks are skipped. It is not recommended to skip legal checks unless you are migrating a user to Clerk.



85
86
87
# File 'lib/clerk-http-client/models/update_user_request.rb', line 85

def skip_legal_checks
  @skip_legal_checks
end

#skip_password_checksObject

Set it to ‘true` if you’re updating the user’s password and want to skip any password policy settings check. This parameter can only be used when providing a ‘password`.



55
56
57
# File 'lib/clerk-http-client/models/update_user_request.rb', line 55

def skip_password_checks
  @skip_password_checks
end

#totp_secretObject

In case TOTP is configured on the instance, you can provide the secret to enable it on the specific user without the need to reset it. Please note that currently the supported options are: * Period: 30 seconds * Code length: 6 digits * Algorithm: SHA1



61
62
63
# File 'lib/clerk-http-client/models/update_user_request.rb', line 61

def totp_secret
  @totp_secret
end

#unsafe_metadataObject

Metadata saved on the user, that can be updated from both the Frontend and Backend APIs. Note: Since this data can be modified from the frontend, it is not guaranteed to be safe.



73
74
75
# File 'lib/clerk-http-client/models/update_user_request.rb', line 73

def 
  @unsafe_metadata
end

#usernameObject

The username to give to the user. It must be unique across your instance.



40
41
42
# File 'lib/clerk-http-client/models/update_user_request.rb', line 40

def username
  @username
end

Class Method Details

._deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
# File 'lib/clerk-http-client/models/update_user_request.rb', line 391

def self._deserialize(type, value)
  case type.to_sym
  when :Time
    Time.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    # models (e.g. Pet) or oneOf
    klass = ClerkHttpClient.const_get(type)
    klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



125
126
127
# File 'lib/clerk-http-client/models/update_user_request.rb', line 125

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



94
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
# File 'lib/clerk-http-client/models/update_user_request.rb', line 94

def self.attribute_map
  {
    :'external_id' => :'external_id',
    :'first_name' => :'first_name',
    :'last_name' => :'last_name',
    :'primary_email_address_id' => :'primary_email_address_id',
    :'notify_primary_email_address_changed' => :'notify_primary_email_address_changed',
    :'primary_phone_number_id' => :'primary_phone_number_id',
    :'primary_web3_wallet_id' => :'primary_web3_wallet_id',
    :'username' => :'username',
    :'profile_image_id' => :'profile_image_id',
    :'password' => :'password',
    :'password_digest' => :'password_digest',
    :'password_hasher' => :'password_hasher',
    :'skip_password_checks' => :'skip_password_checks',
    :'sign_out_of_other_sessions' => :'sign_out_of_other_sessions',
    :'totp_secret' => :'totp_secret',
    :'backup_codes' => :'backup_codes',
    :'public_metadata' => :'public_metadata',
    :'private_metadata' => :'private_metadata',
    :'unsafe_metadata' => :'unsafe_metadata',
    :'delete_self_enabled' => :'delete_self_enabled',
    :'create_organization_enabled' => :'create_organization_enabled',
    :'legal_accepted_at' => :'legal_accepted_at',
    :'skip_legal_checks' => :'skip_legal_checks',
    :'create_organizations_limit' => :'create_organizations_limit',
    :'created_at' => :'created_at'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
# File 'lib/clerk-http-client/models/update_user_request.rb', line 367

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# File 'lib/clerk-http-client/models/update_user_request.rb', line 161

def self.openapi_nullable
  Set.new([
    :'external_id',
    :'first_name',
    :'last_name',
    :'username',
    :'profile_image_id',
    :'password',
    :'skip_password_checks',
    :'sign_out_of_other_sessions',
    :'delete_self_enabled',
    :'create_organization_enabled',
    :'legal_accepted_at',
    :'skip_legal_checks',
    :'create_organizations_limit',
  ])
end

.openapi_typesObject

Attribute type mapping.



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
158
# File 'lib/clerk-http-client/models/update_user_request.rb', line 130

def self.openapi_types
  {
    :'external_id' => :'String',
    :'first_name' => :'String',
    :'last_name' => :'String',
    :'primary_email_address_id' => :'String',
    :'notify_primary_email_address_changed' => :'Boolean',
    :'primary_phone_number_id' => :'String',
    :'primary_web3_wallet_id' => :'String',
    :'username' => :'String',
    :'profile_image_id' => :'String',
    :'password' => :'String',
    :'password_digest' => :'String',
    :'password_hasher' => :'String',
    :'skip_password_checks' => :'Boolean',
    :'sign_out_of_other_sessions' => :'Boolean',
    :'totp_secret' => :'String',
    :'backup_codes' => :'Array<String>',
    :'public_metadata' => :'Hash<String, Object>',
    :'private_metadata' => :'Hash<String, Object>',
    :'unsafe_metadata' => :'Hash<String, Object>',
    :'delete_self_enabled' => :'Boolean',
    :'create_organization_enabled' => :'Boolean',
    :'legal_accepted_at' => :'String',
    :'skip_legal_checks' => :'Boolean',
    :'create_organizations_limit' => :'Integer',
    :'created_at' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
# File 'lib/clerk-http-client/models/update_user_request.rb', line 322

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      external_id == o.external_id &&
      first_name == o.first_name &&
      last_name == o.last_name &&
      primary_email_address_id == o.primary_email_address_id &&
      notify_primary_email_address_changed == o.notify_primary_email_address_changed &&
      primary_phone_number_id == o.primary_phone_number_id &&
      primary_web3_wallet_id == o.primary_web3_wallet_id &&
      username == o.username &&
      profile_image_id == o.profile_image_id &&
      password == o.password &&
      password_digest == o.password_digest &&
      password_hasher == o.password_hasher &&
      skip_password_checks == o.skip_password_checks &&
      sign_out_of_other_sessions == o.sign_out_of_other_sessions &&
      totp_secret == o.totp_secret &&
      backup_codes == o.backup_codes &&
       == o. &&
       == o. &&
       == o. &&
      delete_self_enabled == o.delete_self_enabled &&
      create_organization_enabled == o.create_organization_enabled &&
      legal_accepted_at == o.legal_accepted_at &&
      skip_legal_checks == o.skip_legal_checks &&
      create_organizations_limit == o.create_organizations_limit &&
      created_at == o.created_at
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



462
463
464
465
466
467
468
469
470
471
472
473
474
# File 'lib/clerk-http-client/models/update_user_request.rb', line 462

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


354
355
356
# File 'lib/clerk-http-client/models/update_user_request.rb', line 354

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



360
361
362
# File 'lib/clerk-http-client/models/update_user_request.rb', line 360

def hash
  [external_id, first_name, last_name, primary_email_address_id, notify_primary_email_address_changed, primary_phone_number_id, primary_web3_wallet_id, username, profile_image_id, password, password_digest, password_hasher, skip_password_checks, sign_out_of_other_sessions, totp_secret, backup_codes, , , , delete_self_enabled, create_organization_enabled, legal_accepted_at, skip_legal_checks, create_organizations_limit, created_at].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



307
308
309
310
311
# File 'lib/clerk-http-client/models/update_user_request.rb', line 307

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



438
439
440
# File 'lib/clerk-http-client/models/update_user_request.rb', line 438

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



444
445
446
447
448
449
450
451
452
453
454
455
456
# File 'lib/clerk-http-client/models/update_user_request.rb', line 444

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



432
433
434
# File 'lib/clerk-http-client/models/update_user_request.rb', line 432

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



315
316
317
318
# File 'lib/clerk-http-client/models/update_user_request.rb', line 315

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  true
end