Class: Seam::Clients::UserIdentities

Inherits:
Object
  • Object
show all
Defined in:
lib/seam/routes/user_identities.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:, defaults:) ⇒ UserIdentities

Returns a new instance of UserIdentities.



6
7
8
9
# File 'lib/seam/routes/user_identities.rb', line 6

def initialize(client:, defaults:)
  @client = client
  @defaults = defaults
end

Instance Method Details

#add_acs_user(acs_user_id:, user_identity_id: nil, user_identity_key: nil) ⇒ nil

Adds a specified access system user to a specified user identity.

You must specify either user_identity_id or user_identity_key to identify the user identity.

If user_identity_key is provided, but the user identity doesn't exist, a new user identity will be created automatically using information from the ACS user.

Parameters:

  • acs_user_id (String)

    ID of the access system user that you want to add to the user identity.

  • user_identity_id (String, nil) (defaults to: nil)

    ID of the user identity to which you want to add an access system user.

  • user_identity_key (String, nil) (defaults to: nil)

    Key of the user identity to which you want to add an access system user.

Returns:

  • (nil)

    OK



24
25
26
27
28
# File 'lib/seam/routes/user_identities.rb', line 24

def add_acs_user(acs_user_id:, user_identity_id: nil, user_identity_key: nil)
  @client.put("/user_identities/add_acs_user", {acs_user_id: acs_user_id, user_identity_id: user_identity_id, user_identity_key: user_identity_key}.compact)

  nil
end

#create(acs_system_ids: nil, email_address: nil, full_name: nil, phone_number: nil, user_identity_key: nil) ⇒ Seam::Resources::UserIdentity

Creates a new user identity.

Parameters:

  • acs_system_ids (Array<String>, nil) (defaults to: nil)

    List of access system IDs to associate with the new user identity through access system users. If there's no user with the same email address or phone number in the specified access systems, a new access system user is created. If there is an existing user with the same email or phone number in the specified access systems, the user is linked to the user identity.

  • email_address (String, nil) (defaults to: nil)

    Unique email address for the new user identity.

  • full_name (String, nil) (defaults to: nil)

    Full name of the user associated with the new user identity.

  • phone_number (String, nil) (defaults to: nil)

    Unique phone number for the new user identity in E.164 format (for example, +15555550100).

  • user_identity_key (String, nil) (defaults to: nil)

    Unique key for the new user identity.

Returns:



37
38
39
40
41
# File 'lib/seam/routes/user_identities.rb', line 37

def create(acs_system_ids: nil, email_address: nil, full_name: nil, phone_number: nil, user_identity_key: nil)
  res = @client.post("/user_identities/create", {acs_system_ids: acs_system_ids, email_address: email_address, full_name: full_name, phone_number: phone_number, user_identity_key: user_identity_key}.compact)

  Seam::Resources::UserIdentity.load_from_response(res.body["user_identity"])
end

#delete(user_identity_id:) ⇒ nil

Deletes a specified user identity. This deletes the user identity and all associated resources, including any credentials, acs users and client sessions.

Parameters:

  • user_identity_id (String)

    ID of the user identity that you want to delete.

Returns:

  • (nil)

    OK



46
47
48
49
50
# File 'lib/seam/routes/user_identities.rb', line 46

def delete(user_identity_id:)
  @client.delete("/user_identities/delete", {user_identity_id: user_identity_id}.compact)

  nil
end

#generate_instant_key(user_identity_id:, customization_profile_id: nil, max_use_count: nil) ⇒ Seam::Resources::InstantKey

Generates a new instant key for a specified user identity.

Parameters:

  • user_identity_id (String)

    ID of the user identity for which you want to generate an instant key.

  • customization_profile_id (String, nil) (defaults to: nil)
  • max_use_count (Float, nil) (defaults to: nil)

    Maximum number of times the instant key can be used. Default: 1.

Returns:



57
58
59
60
61
# File 'lib/seam/routes/user_identities.rb', line 57

def generate_instant_key(user_identity_id:, customization_profile_id: nil, max_use_count: nil)
  res = @client.post("/user_identities/generate_instant_key", {user_identity_id: user_identity_id, customization_profile_id: customization_profile_id, max_use_count: max_use_count}.compact)

  Seam::Resources::InstantKey.load_from_response(res.body["instant_key"])
end

#get(user_identity_id: nil, user_identity_key: nil) ⇒ Seam::Resources::UserIdentity

Returns a specified user identity.

Parameters:

  • user_identity_id (String, nil) (defaults to: nil)

    ID of the user identity that you want to get.

  • user_identity_key (String, nil) (defaults to: nil)

Returns:



67
68
69
70
71
72
73
74
75
# File 'lib/seam/routes/user_identities.rb', line 67

def get(user_identity_id: nil, user_identity_key: nil)
  if user_identity_id.nil? && user_identity_key.nil?
    raise TypeError, "At least one parameter is required for /user_identities/get"
  end

  res = @client.get("/user_identities/get", {user_identity_id: user_identity_id, user_identity_key: user_identity_key}.compact)

  Seam::Resources::UserIdentity.load_from_response(res.body["user_identity"])
end

#grant_access_to_device(device_id:, user_identity_id:) ⇒ nil

Grants a specified user identity access to a specified device.

Parameters:

  • device_id (String)

    ID of the managed device to which you want to grant access to the user identity.

  • user_identity_id (String)

    ID of the user identity that you want to grant access to a device.

Returns:

  • (nil)

    OK



81
82
83
84
85
# File 'lib/seam/routes/user_identities.rb', line 81

def grant_access_to_device(device_id:, user_identity_id:)
  @client.put("/user_identities/grant_access_to_device", {device_id: device_id, user_identity_id: user_identity_id}.compact)

  nil
end

#list(created_before: nil, credential_manager_acs_system_id: nil, limit: nil, page_cursor: nil, search: nil, user_identity_ids: nil) ⇒ Seam::Resources::UserIdentity

Returns a list of all user identities.

Parameters:

  • created_before (Time, nil) (defaults to: nil)

    Timestamp by which to limit returned user identities. Returns user identities created before this timestamp.

  • credential_manager_acs_system_id (String, nil) (defaults to: nil)

    acs_system_id of the credential manager by which you want to filter the list of user identities.

  • limit (Integer, nil) (defaults to: nil)

    Maximum number of records to return per page.

  • page_cursor (String, nil) (defaults to: nil)

    Identifies the specific page of results to return, obtained from the previous page's next_page_cursor.

  • search (String, nil) (defaults to: nil)

    String for which to search. Filters returned user identities to include all records that satisfy a partial match using full_name, phone_number, email_address or user_identity_id.

  • user_identity_ids (Array<String>, nil) (defaults to: nil)

    Array of user identity IDs by which to filter the list of user identities.

Returns:



95
96
97
98
99
# File 'lib/seam/routes/user_identities.rb', line 95

def list(created_before: nil, credential_manager_acs_system_id: nil, limit: nil, page_cursor: nil, search: nil, user_identity_ids: nil)
  res = @client.post("/user_identities/list", {created_before: created_before, credential_manager_acs_system_id: credential_manager_acs_system_id, limit: limit, page_cursor: page_cursor, search: search, user_identity_ids: user_identity_ids}.compact)

  Seam::Resources::UserIdentity.load_from_response(res.body["user_identities"])
end

#list_accessible_devices(user_identity_id:) ⇒ Seam::Resources::Device

Returns a list of all devices associated with a specified user identity. This includes devices derived from the access grants assigned to the user identity and devices directly linked to the user identity.

Parameters:

  • user_identity_id (String)

    ID of the user identity for which you want to retrieve all accessible devices.

Returns:



104
105
106
107
108
# File 'lib/seam/routes/user_identities.rb', line 104

def list_accessible_devices(user_identity_id:)
  res = @client.get("/user_identities/list_accessible_devices", {user_identity_id: user_identity_id}.compact)

  Seam::Resources::Device.load_from_response(res.body["devices"])
end

#list_accessible_entrances(user_identity_id:) ⇒ Seam::Resources::AcsEntrance

Returns a list of all ACS entrances accessible to a specified user identity. This includes entrances derived from the access grants assigned to the user identity and entrances accessible through ACS users linked to the user identity.

Parameters:

  • user_identity_id (String)

    ID of the user identity for which you want to retrieve all accessible entrances.

Returns:



113
114
115
116
117
# File 'lib/seam/routes/user_identities.rb', line 113

def list_accessible_entrances(user_identity_id:)
  res = @client.get("/user_identities/list_accessible_entrances", {user_identity_id: user_identity_id}.compact)

  Seam::Resources::AcsEntrance.load_from_response(res.body["acs_entrances"])
end

#list_acs_systems(user_identity_id:) ⇒ Seam::Resources::AcsSystem

Returns a list of all access systems associated with a specified user identity.

Parameters:

  • user_identity_id (String)

    ID of the user identity for which you want to retrieve all access systems.

Returns:



122
123
124
125
126
# File 'lib/seam/routes/user_identities.rb', line 122

def list_acs_systems(user_identity_id:)
  res = @client.get("/user_identities/list_acs_systems", {user_identity_id: user_identity_id}.compact)

  Seam::Resources::AcsSystem.load_from_response(res.body["acs_systems"])
end

#list_acs_users(user_identity_id:) ⇒ Seam::Resources::AcsUser

Returns a list of all access system users assigned to a specified user identity.

Parameters:

  • user_identity_id (String)

    ID of the user identity for which you want to retrieve all access system users.

Returns:



131
132
133
134
135
# File 'lib/seam/routes/user_identities.rb', line 131

def list_acs_users(user_identity_id:)
  res = @client.get("/user_identities/list_acs_users", {user_identity_id: user_identity_id}.compact)

  Seam::Resources::AcsUser.load_from_response(res.body["acs_users"])
end

#remove_acs_user(acs_user_id:, user_identity_id:) ⇒ nil

Removes a specified access system user from a specified user identity.

Parameters:

  • acs_user_id (String)

    ID of the access system user that you want to remove from the user identity..

  • user_identity_id (String)

    ID of the user identity from which you want to remove an access system user.

Returns:

  • (nil)

    OK



141
142
143
144
145
# File 'lib/seam/routes/user_identities.rb', line 141

def remove_acs_user(acs_user_id:, user_identity_id:)
  @client.delete("/user_identities/remove_acs_user", {acs_user_id: acs_user_id, user_identity_id: user_identity_id}.compact)

  nil
end

#revoke_access_to_device(device_id:, user_identity_id:) ⇒ nil

Revokes access to a specified device from a specified user identity.

Parameters:

  • device_id (String)

    ID of the managed device to which you want to revoke access from the user identity.

  • user_identity_id (String)

    ID of the user identity from which you want to revoke access to a device.

Returns:

  • (nil)

    OK



151
152
153
154
155
# File 'lib/seam/routes/user_identities.rb', line 151

def revoke_access_to_device(device_id:, user_identity_id:)
  @client.delete("/user_identities/revoke_access_to_device", {device_id: device_id, user_identity_id: user_identity_id}.compact)

  nil
end

#unmanagedObject



11
12
13
# File 'lib/seam/routes/user_identities.rb', line 11

def unmanaged
  @unmanaged ||= Seam::Clients::UserIdentitiesUnmanaged.new(client: @client, defaults: @defaults)
end

#update(user_identity_id:, email_address: nil, full_name: nil, phone_number: nil, user_identity_key: nil) ⇒ nil

Updates a specified user identity.

Parameters:

  • user_identity_id (String)

    ID of the user identity that you want to update.

  • email_address (String, nil) (defaults to: nil)

    Unique email address for the user identity.

  • full_name (String, nil) (defaults to: nil)

    Full name of the user associated with the user identity.

  • phone_number (String, nil) (defaults to: nil)

    Unique phone number for the user identity.

  • user_identity_key (String, nil) (defaults to: nil)

    Unique key for the user identity.

Returns:

  • (nil)

    OK



164
165
166
167
168
# File 'lib/seam/routes/user_identities.rb', line 164

def update(user_identity_id:, email_address: nil, full_name: nil, phone_number: nil, user_identity_key: nil)
  @client.patch("/user_identities/update", {user_identity_id: user_identity_id, email_address: email_address, full_name: full_name, phone_number: phone_number, user_identity_key: user_identity_key}.compact)

  nil
end