Class: KeycloakAdmin::UserRepresentation

Inherits:
Representation show all
Defined in:
lib/keycloak-admin/representation/user_representation.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Representation

#as_json, from_json, #to_json

Methods included from CamelJson

#camelize

Instance Attribute Details

#attributesObject

Returns the value of attribute attributes.



3
4
5
# File 'lib/keycloak-admin/representation/user_representation.rb', line 3

def attributes
  @attributes
end

#created_timestampObject

Returns the value of attribute created_timestamp.



3
4
5
# File 'lib/keycloak-admin/representation/user_representation.rb', line 3

def created_timestamp
  @created_timestamp
end

#credentialsObject

Returns the value of attribute credentials.



3
4
5
# File 'lib/keycloak-admin/representation/user_representation.rb', line 3

def credentials
  @credentials
end

#emailObject

Returns the value of attribute email.



3
4
5
# File 'lib/keycloak-admin/representation/user_representation.rb', line 3

def email
  @email
end

#email_verifiedObject

Returns the value of attribute email_verified.



3
4
5
# File 'lib/keycloak-admin/representation/user_representation.rb', line 3

def email_verified
  @email_verified
end

#enabledObject

Returns the value of attribute enabled.



3
4
5
# File 'lib/keycloak-admin/representation/user_representation.rb', line 3

def enabled
  @enabled
end

#federated_identitiesObject

Returns the value of attribute federated_identities.



3
4
5
# File 'lib/keycloak-admin/representation/user_representation.rb', line 3

def federated_identities
  @federated_identities
end

#first_nameObject

Returns the value of attribute first_name.



3
4
5
# File 'lib/keycloak-admin/representation/user_representation.rb', line 3

def first_name
  @first_name
end

#idObject

Returns the value of attribute id.



3
4
5
# File 'lib/keycloak-admin/representation/user_representation.rb', line 3

def id
  @id
end

#last_nameObject

Returns the value of attribute last_name.



3
4
5
# File 'lib/keycloak-admin/representation/user_representation.rb', line 3

def last_name
  @last_name
end

#originObject

Returns the value of attribute origin.



3
4
5
# File 'lib/keycloak-admin/representation/user_representation.rb', line 3

def origin
  @origin
end

#required_actionsObject

Returns the value of attribute required_actions.



3
4
5
# File 'lib/keycloak-admin/representation/user_representation.rb', line 3

def required_actions
  @required_actions
end

#totpObject

Returns the value of attribute totp.



3
4
5
# File 'lib/keycloak-admin/representation/user_representation.rb', line 3

def totp
  @totp
end

#usernameObject

Returns the value of attribute username.



3
4
5
# File 'lib/keycloak-admin/representation/user_representation.rb', line 3

def username
  @username
end

Class Method Details

.from_hash(hash) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/keycloak-admin/representation/user_representation.rb', line 18

def self.from_hash(hash)
  user                      = new
  user.id                   = hash["id"]
  user.created_timestamp    = hash["createdTimestamp"]
  user.origin               = hash["origin"]
  user.username             = hash["username"]
  user.email                = hash["email"]
  user.enabled              = hash["enabled"]
  user.email_verified       = hash["emailVerified"]
  user.first_name           = hash["firstName"]
  user.last_name            = hash["lastName"]
  user.attributes           = hash["attributes"]
  user.required_actions     = hash["requiredActions"] || []
  user.totp                 = hash["totp"] || false
  user.credentials          = hash["credentials"]&.map{ |hash| CredentialRepresentation.from_hash(hash) } || []
  user.federated_identities = hash["federatedIdentities"]&.map { |hash| FederatedIdentityRepresentation.from_hash(hash) } || []
  user
end

Instance Method Details

#add_credential(credential_representation) ⇒ Object



37
38
39
40
# File 'lib/keycloak-admin/representation/user_representation.rb', line 37

def add_credential(credential_representation)
  @credentials ||= []
  @credentials.push(credential_representation)
end

#add_federated_identity(federated_identity_representation) ⇒ Object



42
43
44
45
# File 'lib/keycloak-admin/representation/user_representation.rb', line 42

def add_federated_identity(federated_identity_representation)
  @federated_identities ||= []
  @federated_identities.push(federated_identity_representation)
end