Class: SSOReady::SCIMUser
- Inherits:
-
Object
- Object
- SSOReady::SCIMUser
- Defined in:
- lib/ssoready/types/scim_user.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#attributes ⇒ Hash{String => Object}
readonly
Arbitrary, potentially nested, attributes the Identity Provider included about the user.
-
#deleted ⇒ Boolean
readonly
Whether the SCIM user has been deleted or deprovisioned from its SCIM directory.
-
#email ⇒ String
readonly
The SCIM user’s email address.
-
#id ⇒ String
readonly
Unique identifier for this SCIM user.
-
#scim_directory_id ⇒ String
readonly
SCIM directory this SCIM user belongs to.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ SSOReady::SCIMUser
Deserialize a JSON object to an instance of SCIMUser.
-
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object’s property definitions.
Instance Method Summary collapse
- #initialize(id: OMIT, scim_directory_id: OMIT, email: OMIT, deleted: OMIT, attributes: OMIT, additional_properties: nil) ⇒ SSOReady::SCIMUser constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of SCIMUser to a JSON object.
Constructor Details
#initialize(id: OMIT, scim_directory_id: OMIT, email: OMIT, deleted: OMIT, attributes: OMIT, additional_properties: nil) ⇒ SSOReady::SCIMUser
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/ssoready/types/scim_user.rb', line 41 def initialize(id: OMIT, scim_directory_id: OMIT, email: OMIT, deleted: OMIT, attributes: OMIT, additional_properties: nil) @id = id if id != OMIT @scim_directory_id = scim_directory_id if scim_directory_id != OMIT @email = email if email != OMIT @deleted = deleted if deleted != OMIT @attributes = attributes if attributes != OMIT @additional_properties = additional_properties @_field_set = { "id": id, "scimDirectoryId": scim_directory_id, "email": email, "deleted": deleted, "attributes": attributes }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
23 24 25 |
# File 'lib/ssoready/types/scim_user.rb', line 23 def additional_properties @additional_properties end |
#attributes ⇒ Hash{String => Object} (readonly)
Returns Arbitrary, potentially nested, attributes the Identity Provider included about the user. Typically, these ‘attributes` are used to pass along the user’s first/last name, or whether they should be considered an admin within their company.
21 22 23 |
# File 'lib/ssoready/types/scim_user.rb', line 21 def attributes @attributes end |
#deleted ⇒ Boolean (readonly)
Returns Whether the SCIM user has been deleted or deprovisioned from its SCIM directory.
15 16 17 |
# File 'lib/ssoready/types/scim_user.rb', line 15 def deleted @deleted end |
#email ⇒ String (readonly)
Returns The SCIM user’s email address.
13 14 15 |
# File 'lib/ssoready/types/scim_user.rb', line 13 def email @email end |
#id ⇒ String (readonly)
Returns Unique identifier for this SCIM user.
9 10 11 |
# File 'lib/ssoready/types/scim_user.rb', line 9 def id @id end |
#scim_directory_id ⇒ String (readonly)
Returns SCIM directory this SCIM user belongs to.
11 12 13 |
# File 'lib/ssoready/types/scim_user.rb', line 11 def scim_directory_id @scim_directory_id end |
Class Method Details
.from_json(json_object:) ⇒ SSOReady::SCIMUser
Deserialize a JSON object to an instance of SCIMUser
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/ssoready/types/scim_user.rb', line 64 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) id = parsed_json["id"] scim_directory_id = parsed_json["scimDirectoryId"] email = parsed_json["email"] deleted = parsed_json["deleted"] attributes = parsed_json["attributes"] new( id: id, scim_directory_id: scim_directory_id, email: email, deleted: deleted, attributes: attributes, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given
hash and check each fields type against the current object's property
definitions.
95 96 97 98 99 100 101 |
# File 'lib/ssoready/types/scim_user.rb', line 95 def self.validate_raw(obj:) obj.id&.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") obj.scim_directory_id&.is_a?(String) != false || raise("Passed value for field obj.scim_directory_id is not the expected type, validation failed.") obj.email&.is_a?(String) != false || raise("Passed value for field obj.email is not the expected type, validation failed.") obj.deleted&.is_a?(Boolean) != false || raise("Passed value for field obj.deleted is not the expected type, validation failed.") obj.attributes&.is_a?(Hash) != false || raise("Passed value for field obj.attributes is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of SCIMUser to a JSON object
85 86 87 |
# File 'lib/ssoready/types/scim_user.rb', line 85 def to_json(*_args) @_field_set&.to_json end |