Class: ClerkHttpClient::CreateUserRequest
- Inherits:
-
Object
- Object
- ClerkHttpClient::CreateUserRequest
- Defined in:
- lib/clerk-http-client/models/create_user_request.rb
Instance Attribute Summary collapse
-
#backup_codes ⇒ Object
If Backup Codes are configured on the instance, you can provide them to enable it on the newly created user without the need to reset them.
-
#create_organization_enabled ⇒ Object
If enabled, user can create organizations via FAPI.
-
#create_organizations_limit ⇒ Object
The maximum number of organizations the user can create.
-
#created_at ⇒ Object
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`).
-
#delete_self_enabled ⇒ Object
If enabled, user can delete themselves via FAPI.
-
#email_address ⇒ Object
Email addresses to add to the user.
-
#external_id ⇒ Object
The ID of the user as used in your external systems or your previous authentication solution.
-
#first_name ⇒ Object
The first name to assign to the user.
-
#last_name ⇒ Object
The last name to assign to the user.
-
#legal_accepted_at ⇒ Object
A custom timestamp denoting when the user accepted legal requirements, specified in RFC3339 format (e.g. ‘2012-10-20T07:15:20.902Z`).
-
#password ⇒ Object
The plaintext password to give the user.
-
#password_digest ⇒ Object
In case you already have the password digests and not the passwords, you can use them for the newly created user via this property.
-
#password_hasher ⇒ Object
The hashing algorithm that was used to generate the password digest.
-
#phone_number ⇒ Object
Phone numbers to add to the user.
-
#private_metadata ⇒ Object
Metadata saved on the user, that is only visible to your Backend API.
-
#public_metadata ⇒ Object
Metadata saved on the user, that is visible to both your Frontend and Backend APIs.
-
#skip_legal_checks ⇒ Object
When set to ‘true` all legal checks are skipped.
-
#skip_password_checks ⇒ Object
When set to ‘true` all password checks are skipped.
-
#skip_password_requirement ⇒ Object
When set to ‘true`, `password` is not required anymore when creating the user and can be omitted.
-
#totp_secret ⇒ Object
In case TOTP is configured on the instance, you can provide the secret to enable it on the newly created user without the need to reset it.
-
#unsafe_metadata ⇒ Object
Metadata saved on the user, that can be updated from both the Frontend and Backend APIs.
-
#username ⇒ Object
The username to give to the user.
-
#web3_wallet ⇒ Object
Web3 wallets to add to the user.
Class Method Summary collapse
-
._deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ CreateUserRequest
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ CreateUserRequest
Initializes the object
168 169 170 171 172 173 174 175 176 177 178 179 180 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 |
# File 'lib/clerk-http-client/models/create_user_request.rb', line 168 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `ClerkHttpClient::CreateUserRequest` 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::CreateUserRequest`. 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?(:'email_address') if (value = attributes[:'email_address']).is_a?(Array) self.email_address = value end end if attributes.key?(:'phone_number') if (value = attributes[:'phone_number']).is_a?(Array) self.phone_number = value end end if attributes.key?(:'web3_wallet') if (value = attributes[:'web3_wallet']).is_a?(Array) self.web3_wallet = value end end if attributes.key?(:'username') self.username = attributes[:'username'] 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?(:'skip_password_requirement') self.skip_password_requirement = attributes[:'skip_password_requirement'] 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?(:'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_organization_enabled') self.create_organization_enabled = attributes[:'create_organization_enabled'] 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_codes ⇒ Object
If Backup Codes are configured on the instance, you can provide them to enable it on the newly created user without the need to reset them. You must provide the backup codes in plain format or the corresponding bcrypt digest.
58 59 60 |
# File 'lib/clerk-http-client/models/create_user_request.rb', line 58 def backup_codes @backup_codes end |
#create_organization_enabled ⇒ Object
If enabled, user can create organizations via FAPI.
79 80 81 |
# File 'lib/clerk-http-client/models/create_user_request.rb', line 79 def create_organization_enabled @create_organization_enabled end |
#create_organizations_limit ⇒ Object
The maximum number of organizations the user can create. 0 means unlimited.
82 83 84 |
# File 'lib/clerk-http-client/models/create_user_request.rb', line 82 def create_organizations_limit @create_organizations_limit end |
#created_at ⇒ Object
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`).
85 86 87 |
# File 'lib/clerk-http-client/models/create_user_request.rb', line 85 def created_at @created_at end |
#delete_self_enabled ⇒ Object
If enabled, user can delete themselves via FAPI.
70 71 72 |
# File 'lib/clerk-http-client/models/create_user_request.rb', line 70 def delete_self_enabled @delete_self_enabled end |
#email_address ⇒ Object
Email addresses to add to the user. Must be unique across your instance. The first email address will be set as the user’s primary email address.
28 29 30 |
# File 'lib/clerk-http-client/models/create_user_request.rb', line 28 def email_address @email_address end |
#external_id ⇒ Object
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/create_user_request.rb', line 19 def external_id @external_id end |
#first_name ⇒ Object
The first name to assign to the user
22 23 24 |
# File 'lib/clerk-http-client/models/create_user_request.rb', line 22 def first_name @first_name end |
#last_name ⇒ Object
The last name to assign to the user
25 26 27 |
# File 'lib/clerk-http-client/models/create_user_request.rb', line 25 def last_name @last_name end |
#legal_accepted_at ⇒ Object
A custom timestamp denoting when the user accepted legal requirements, specified in RFC3339 format (e.g. ‘2012-10-20T07:15:20.902Z`).
73 74 75 |
# File 'lib/clerk-http-client/models/create_user_request.rb', line 73 def legal_accepted_at @legal_accepted_at end |
#password ⇒ Object
The plaintext password to give the user. Must be at least 8 characters long, and can not be in any list of hacked passwords.
40 41 42 |
# File 'lib/clerk-http-client/models/create_user_request.rb', line 40 def password @password end |
#password_digest ⇒ Object
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.
43 44 45 |
# File 'lib/clerk-http-client/models/create_user_request.rb', line 43 def password_digest @password_digest end |
#password_hasher ⇒ Object
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.
46 47 48 |
# File 'lib/clerk-http-client/models/create_user_request.rb', line 46 def password_hasher @password_hasher end |
#phone_number ⇒ Object
Phone numbers to add to the user. Must be unique across your instance. The first phone number will be set as the user’s primary phone number.
31 32 33 |
# File 'lib/clerk-http-client/models/create_user_request.rb', line 31 def phone_number @phone_number end |
#private_metadata ⇒ Object
Metadata saved on the user, that is only visible to your Backend API
64 65 66 |
# File 'lib/clerk-http-client/models/create_user_request.rb', line 64 def @private_metadata end |
#public_metadata ⇒ Object
Metadata saved on the user, that is visible to both your Frontend and Backend APIs
61 62 63 |
# File 'lib/clerk-http-client/models/create_user_request.rb', line 61 def @public_metadata end |
#skip_legal_checks ⇒ Object
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.
76 77 78 |
# File 'lib/clerk-http-client/models/create_user_request.rb', line 76 def skip_legal_checks @skip_legal_checks end |
#skip_password_checks ⇒ Object
When set to ‘true` all password checks are skipped. It is recommended to use this method only when migrating plaintext passwords to Clerk. Upon migration the user base should be prompted to pick stronger password.
49 50 51 |
# File 'lib/clerk-http-client/models/create_user_request.rb', line 49 def skip_password_checks @skip_password_checks end |
#skip_password_requirement ⇒ Object
When set to ‘true`, `password` is not required anymore when creating the user and can be omitted. This is useful when you are trying to create a user that doesn’t have a password, in an instance that is using passwords. Please note that you cannot use this flag if password is the only way for a user to sign into your instance.
52 53 54 |
# File 'lib/clerk-http-client/models/create_user_request.rb', line 52 def skip_password_requirement @skip_password_requirement end |
#totp_secret ⇒ Object
In case TOTP is configured on the instance, you can provide the secret to enable it on the newly created user without the need to reset it. Please note that currently the supported options are: * Period: 30 seconds * Code length: 6 digits * Algorithm: SHA1
55 56 57 |
# File 'lib/clerk-http-client/models/create_user_request.rb', line 55 def totp_secret @totp_secret end |
#unsafe_metadata ⇒ Object
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.
67 68 69 |
# File 'lib/clerk-http-client/models/create_user_request.rb', line 67 def @unsafe_metadata end |
#username ⇒ Object
The username to give to the user. It must be unique across your instance.
37 38 39 |
# File 'lib/clerk-http-client/models/create_user_request.rb', line 37 def username @username end |
#web3_wallet ⇒ Object
Web3 wallets to add to the user. Must be unique across your instance. The first wallet will be set as the user’s primary wallet.
34 35 36 |
# File 'lib/clerk-http-client/models/create_user_request.rb', line 34 def web3_wallet @web3_wallet end |
Class Method Details
._deserialize(type, value) ⇒ Object
Deserializes the data based on type
372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 |
# File 'lib/clerk-http-client/models/create_user_request.rb', line 372 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_attributes ⇒ Object
Returns all the JSON keys this model knows about
117 118 119 |
# File 'lib/clerk-http-client/models/create_user_request.rb', line 117 def self.acceptable_attributes attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/clerk-http-client/models/create_user_request.rb', line 88 def self.attribute_map { :'external_id' => :'external_id', :'first_name' => :'first_name', :'last_name' => :'last_name', :'email_address' => :'email_address', :'phone_number' => :'phone_number', :'web3_wallet' => :'web3_wallet', :'username' => :'username', :'password' => :'password', :'password_digest' => :'password_digest', :'password_hasher' => :'password_hasher', :'skip_password_checks' => :'skip_password_checks', :'skip_password_requirement' => :'skip_password_requirement', :'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', :'legal_accepted_at' => :'legal_accepted_at', :'skip_legal_checks' => :'skip_legal_checks', :'create_organization_enabled' => :'create_organization_enabled', :'create_organizations_limit' => :'create_organizations_limit', :'created_at' => :'created_at' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 |
# File 'lib/clerk-http-client/models/create_user_request.rb', line 348 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_nullable ⇒ Object
List of attributes with nullable: true
151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
# File 'lib/clerk-http-client/models/create_user_request.rb', line 151 def self.openapi_nullable Set.new([ :'external_id', :'first_name', :'last_name', :'username', :'password', :'delete_self_enabled', :'legal_accepted_at', :'skip_legal_checks', :'create_organization_enabled', :'create_organizations_limit', ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
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 |
# File 'lib/clerk-http-client/models/create_user_request.rb', line 122 def self.openapi_types { :'external_id' => :'String', :'first_name' => :'String', :'last_name' => :'String', :'email_address' => :'Array<String>', :'phone_number' => :'Array<String>', :'web3_wallet' => :'Array<String>', :'username' => :'String', :'password' => :'String', :'password_digest' => :'String', :'password_hasher' => :'String', :'skip_password_checks' => :'Boolean', :'skip_password_requirement' => :'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', :'legal_accepted_at' => :'String', :'skip_legal_checks' => :'Boolean', :'create_organization_enabled' => :'Boolean', :'create_organizations_limit' => :'Integer', :'created_at' => :'String' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 |
# File 'lib/clerk-http-client/models/create_user_request.rb', line 305 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 && email_address == o.email_address && phone_number == o.phone_number && web3_wallet == o.web3_wallet && username == o.username && password == o.password && password_digest == o.password_digest && password_hasher == o.password_hasher && skip_password_checks == o.skip_password_checks && skip_password_requirement == o.skip_password_requirement && totp_secret == o.totp_secret && backup_codes == o.backup_codes && == o. && == o. && == o. && delete_self_enabled == o.delete_self_enabled && legal_accepted_at == o.legal_accepted_at && skip_legal_checks == o.skip_legal_checks && create_organization_enabled == o.create_organization_enabled && 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
443 444 445 446 447 448 449 450 451 452 453 454 455 |
# File 'lib/clerk-http-client/models/create_user_request.rb', line 443 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
335 336 337 |
# File 'lib/clerk-http-client/models/create_user_request.rb', line 335 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
341 342 343 |
# File 'lib/clerk-http-client/models/create_user_request.rb', line 341 def hash [external_id, first_name, last_name, email_address, phone_number, web3_wallet, username, password, password_digest, password_hasher, skip_password_checks, skip_password_requirement, totp_secret, backup_codes, , , , delete_self_enabled, legal_accepted_at, skip_legal_checks, create_organization_enabled, create_organizations_limit, created_at].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
290 291 292 293 294 |
# File 'lib/clerk-http-client/models/create_user_request.rb', line 290 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
419 420 421 |
# File 'lib/clerk-http-client/models/create_user_request.rb', line 419 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
425 426 427 428 429 430 431 432 433 434 435 436 437 |
# File 'lib/clerk-http-client/models/create_user_request.rb', line 425 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_s ⇒ String
Returns the string representation of the object
413 414 415 |
# File 'lib/clerk-http-client/models/create_user_request.rb', line 413 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
298 299 300 301 |
# File 'lib/clerk-http-client/models/create_user_request.rb', line 298 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' true end |