Class: SSOReady::SCIMUser

Inherits:
Object
  • Object
show all
Defined in:
lib/ssoready/types/scim_user.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id: OMIT, scim_directory_id: OMIT, email: OMIT, deleted: OMIT, attributes: OMIT, additional_properties: nil) ⇒ SSOReady::SCIMUser

Parameters:

  • id (String) (defaults to: OMIT)

    Unique identifier for this SCIM user.

  • scim_directory_id (String) (defaults to: OMIT)

    SCIM directory this SCIM user belongs to.

  • email (String) (defaults to: OMIT)

    The SCIM user’s email address.

  • deleted (Boolean) (defaults to: OMIT)

    Whether the SCIM user has been deleted or deprovisioned from its SCIM directory.

  • attributes (Hash{String => Object}) (defaults to: OMIT)

    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.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



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_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    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

#attributesHash{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.

Returns:

  • (Hash{String => Object})

    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

#deletedBoolean (readonly)

Returns Whether the SCIM user has been deleted or deprovisioned from its SCIM directory.

Returns:

  • (Boolean)

    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

#emailString (readonly)

Returns The SCIM user’s email address.

Returns:

  • (String)

    The SCIM user’s email address.



13
14
15
# File 'lib/ssoready/types/scim_user.rb', line 13

def email
  @email
end

#idString (readonly)

Returns Unique identifier for this SCIM user.

Returns:

  • (String)

    Unique identifier for this SCIM user.



9
10
11
# File 'lib/ssoready/types/scim_user.rb', line 9

def id
  @id
end

#scim_directory_idString (readonly)

Returns SCIM directory this SCIM user belongs to.

Returns:

  • (String)

    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

Parameters:

  • json_object (String)

Returns:



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.

Parameters:

  • obj (Object)

Returns:

  • (Void)


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

Returns:

  • (String)


85
86
87
# File 'lib/ssoready/types/scim_user.rb', line 85

def to_json(*_args)
  @_field_set&.to_json
end