Class: DeviseScim::Scim::User
- Inherits:
-
Object
- Object
- DeviseScim::Scim::User
- Defined in:
- lib/devise_scim/scim/user.rb
Overview
rubocop:disable Metrics/ClassLength
Constant Summary collapse
- SCHEMAS =
[USER_SCHEMA].freeze
Instance Attribute Summary collapse
-
#active ⇒ Object
Returns the value of attribute active.
-
#display_name ⇒ Object
Returns the value of attribute display_name.
-
#emails ⇒ Object
Returns the value of attribute emails.
-
#external_id ⇒ Object
Returns the value of attribute external_id.
-
#groups ⇒ Object
Returns the value of attribute groups.
-
#id ⇒ Object
Returns the value of attribute id.
-
#locale ⇒ Object
Returns the value of attribute locale.
-
#meta ⇒ Object
Returns the value of attribute meta.
-
#name ⇒ Object
Returns the value of attribute name.
-
#nick_name ⇒ Object
Returns the value of attribute nick_name.
-
#phone_numbers ⇒ Object
Returns the value of attribute phone_numbers.
-
#preferred_language ⇒ Object
Returns the value of attribute preferred_language.
-
#profile_url ⇒ Object
Returns the value of attribute profile_url.
-
#timezone ⇒ Object
Returns the value of attribute timezone.
-
#title ⇒ Object
Returns the value of attribute title.
-
#user_name ⇒ Object
Returns the value of attribute user_name.
-
#user_type ⇒ Object
Returns the value of attribute user_type.
Class Method Summary collapse
Instance Method Summary collapse
- #primary_email ⇒ Object
-
#to_h ⇒ Object
rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity.
-
#to_json ⇒ Object
rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity.
Instance Attribute Details
#active ⇒ Object
Returns the value of attribute active.
21 22 23 |
# File 'lib/devise_scim/scim/user.rb', line 21 def active @active end |
#display_name ⇒ Object
Returns the value of attribute display_name.
21 22 23 |
# File 'lib/devise_scim/scim/user.rb', line 21 def display_name @display_name end |
#emails ⇒ Object
Returns the value of attribute emails.
21 22 23 |
# File 'lib/devise_scim/scim/user.rb', line 21 def emails @emails end |
#external_id ⇒ Object
Returns the value of attribute external_id.
21 22 23 |
# File 'lib/devise_scim/scim/user.rb', line 21 def external_id @external_id end |
#groups ⇒ Object
Returns the value of attribute groups.
21 22 23 |
# File 'lib/devise_scim/scim/user.rb', line 21 def groups @groups end |
#id ⇒ Object
Returns the value of attribute id.
21 22 23 |
# File 'lib/devise_scim/scim/user.rb', line 21 def id @id end |
#locale ⇒ Object
Returns the value of attribute locale.
21 22 23 |
# File 'lib/devise_scim/scim/user.rb', line 21 def locale @locale end |
#meta ⇒ Object
Returns the value of attribute meta.
21 22 23 |
# File 'lib/devise_scim/scim/user.rb', line 21 def @meta end |
#name ⇒ Object
Returns the value of attribute name.
21 22 23 |
# File 'lib/devise_scim/scim/user.rb', line 21 def name @name end |
#nick_name ⇒ Object
Returns the value of attribute nick_name.
21 22 23 |
# File 'lib/devise_scim/scim/user.rb', line 21 def nick_name @nick_name end |
#phone_numbers ⇒ Object
Returns the value of attribute phone_numbers.
21 22 23 |
# File 'lib/devise_scim/scim/user.rb', line 21 def phone_numbers @phone_numbers end |
#preferred_language ⇒ Object
Returns the value of attribute preferred_language.
21 22 23 |
# File 'lib/devise_scim/scim/user.rb', line 21 def preferred_language @preferred_language end |
#profile_url ⇒ Object
Returns the value of attribute profile_url.
21 22 23 |
# File 'lib/devise_scim/scim/user.rb', line 21 def profile_url @profile_url end |
#timezone ⇒ Object
Returns the value of attribute timezone.
21 22 23 |
# File 'lib/devise_scim/scim/user.rb', line 21 def timezone @timezone end |
#title ⇒ Object
Returns the value of attribute title.
21 22 23 |
# File 'lib/devise_scim/scim/user.rb', line 21 def title @title end |
#user_name ⇒ Object
Returns the value of attribute user_name.
21 22 23 |
# File 'lib/devise_scim/scim/user.rb', line 21 def user_name @user_name end |
#user_type ⇒ Object
Returns the value of attribute user_type.
21 22 23 |
# File 'lib/devise_scim/scim/user.rb', line 21 def user_type @user_type end |
Class Method Details
.from_h(hash) ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/devise_scim/scim/user.rb', line 27 def from_h(hash) user = new assign_scalars(user, hash) assign_name(user, hash) user.emails = parse_emails(hash) user.phone_numbers = parse_phones(hash) user end |
Instance Method Details
#primary_email ⇒ Object
98 99 100 |
# File 'lib/devise_scim/scim/user.rb', line 98 def primary_email emails&.find(&:primary)&.value || user_name end |
#to_h ⇒ Object
rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
82 83 84 85 86 87 88 89 90 91 |
# File 'lib/devise_scim/scim/user.rb', line 82 def to_h h = base_hash.compact h["schemas"] = SCHEMAS h["name"] = serialize_name if name h["emails"] = serialize_emails if emails&.any? h["phoneNumbers"] = serialize_phones if phone_numbers&.any? h["groups"] = groups if groups&.any? h["meta"] = (, "User") if h end |
#to_json ⇒ Object
rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
94 95 96 |
# File 'lib/devise_scim/scim/user.rb', line 94 def to_json(*) to_h.to_json end |