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

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

  • user_identity_id (defaults to: nil)

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

  • user_identity_key (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.post("/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 (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 (defaults to: nil)

    Unique email address for the new user identity.

  • full_name (defaults to: nil)

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

  • phone_number (defaults to: nil)

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

  • user_identity_key (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

    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.post("/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

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

  • customization_profile_id (defaults to: nil)
  • max_use_count (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 (defaults to: nil)

    ID of the user identity that you want to get.

  • user_identity_key (defaults to: nil)

Returns:



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

def get(user_identity_id: nil, user_identity_key: nil)
  res = @client.post("/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

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

  • user_identity_id

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

Returns:

  • (nil)

    OK



77
78
79
80
81
# File 'lib/seam/routes/user_identities.rb', line 77

def grant_access_to_device(device_id:, user_identity_id:)
  @client.post("/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 (defaults to: nil)

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

  • credential_manager_acs_system_id (defaults to: nil)

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

  • limit (defaults to: nil)

    Maximum number of records to return per page.

  • page_cursor (defaults to: nil)

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

  • search (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 (defaults to: nil)

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

Returns:



91
92
93
94
95
# File 'lib/seam/routes/user_identities.rb', line 91

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

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

Returns:



100
101
102
103
104
# File 'lib/seam/routes/user_identities.rb', line 100

def list_accessible_devices(user_identity_id:)
  res = @client.post("/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

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

Returns:



109
110
111
112
113
# File 'lib/seam/routes/user_identities.rb', line 109

def list_accessible_entrances(user_identity_id:)
  res = @client.post("/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

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

Returns:



118
119
120
121
122
# File 'lib/seam/routes/user_identities.rb', line 118

def list_acs_systems(user_identity_id:)
  res = @client.post("/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

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

Returns:



127
128
129
130
131
# File 'lib/seam/routes/user_identities.rb', line 127

def list_acs_users(user_identity_id:)
  res = @client.post("/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

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

  • user_identity_id

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

Returns:

  • (nil)

    OK



137
138
139
140
141
# File 'lib/seam/routes/user_identities.rb', line 137

def remove_acs_user(acs_user_id:, user_identity_id:)
  @client.post("/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

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

  • user_identity_id

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

Returns:

  • (nil)

    OK



147
148
149
150
151
# File 'lib/seam/routes/user_identities.rb', line 147

def revoke_access_to_device(device_id:, user_identity_id:)
  @client.post("/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

    ID of the user identity that you want to update.

  • email_address (defaults to: nil)

    Unique email address for the user identity.

  • full_name (defaults to: nil)

    Full name of the user associated with the user identity.

  • phone_number (defaults to: nil)

    Unique phone number for the user identity.

  • user_identity_key (defaults to: nil)

    Unique key for the user identity.

Returns:

  • (nil)

    OK



160
161
162
163
164
# File 'lib/seam/routes/user_identities.rb', line 160

def update(user_identity_id:, email_address: nil, full_name: nil, phone_number: nil, user_identity_key: nil)
  @client.post("/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