Class: Seam::Clients::AcsUsers

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

Instance Method Summary collapse

Constructor Details

#initialize(client:, defaults:) ⇒ AcsUsers

Returns a new instance of AcsUsers.



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

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

Instance Method Details

#add_to_access_group(acs_access_group_id:, acs_user_id:) ⇒ nil

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

Parameters:

  • acs_access_group_id (String)

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

  • acs_user_id (String)

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

Returns:

  • (nil)

    OK



15
16
17
18
19
# File 'lib/seam/routes/acs_users.rb', line 15

def add_to_access_group(acs_access_group_id:, acs_user_id:)
  @client.put("/acs/users/add_to_access_group", {acs_access_group_id: acs_access_group_id, acs_user_id: acs_user_id}.compact)

  nil
end

#create(acs_system_id:, full_name:, access_schedule: nil, acs_access_group_ids: nil, email: nil, email_address: nil, phone_number: nil, user_identity_id: nil) ⇒ Seam::Resources::AcsUser

Deprecated.

email: use email_address.

Creates a new access system user.

Parameters:

  • acs_system_id (String)

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

  • full_name (String)

    Full name of the new access system user.

  • access_schedule (Hash, nil) (defaults to: nil)

    starts_at and ends_at timestamps for the new access system user's access. If you specify an access_schedule, you may include both starts_at and ends_at. If you omit starts_at, it defaults to the current time. ends_at is optional and must be a time in the future and after starts_at.

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

    Array of access group IDs to indicate the access groups to which you want to add the new access system user.

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

    Email address of the access system user.

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

    Phone number of the access system user in E.164 format (for example, +15555550100).

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

    ID of the user identity with which you want to associate the new access system user.

Returns:



32
33
34
35
36
# File 'lib/seam/routes/acs_users.rb', line 32

def create(acs_system_id:, full_name:, access_schedule: nil, acs_access_group_ids: nil, email: nil, email_address: nil, phone_number: nil, user_identity_id: nil)
  res = @client.post("/acs/users/create", {acs_system_id: acs_system_id, full_name: full_name, access_schedule: access_schedule, acs_access_group_ids: acs_access_group_ids, email: email, email_address: email_address, phone_number: phone_number, user_identity_id: user_identity_id}.compact)

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

#delete(acs_system_id: nil, acs_user_id: nil, user_identity_id: nil) ⇒ nil

Deletes a specified access system user and invalidates the access system user's credentials.

Parameters:

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

    ID of the access system that you want to delete. You must provide acs_system_id with user_identity_id.

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

    ID of the access system user that you want to delete. You must provide either acs_user_id or user_identity_id

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

    ID of the user identity that you want to delete. You must provide either acs_user_id or user_identity_id. If you provide user_identity_id, you must also provide acs_system_id.

Returns:

  • (nil)

    OK



43
44
45
46
47
48
49
50
51
# File 'lib/seam/routes/acs_users.rb', line 43

def delete(acs_system_id: nil, acs_user_id: nil, user_identity_id: nil)
  if acs_system_id.nil? && acs_user_id.nil? && user_identity_id.nil?
    raise TypeError, "At least one parameter is required for /acs/users/delete"
  end

  @client.delete("/acs/users/delete", {acs_system_id: acs_system_id, acs_user_id: acs_user_id, user_identity_id: user_identity_id}.compact)

  nil
end

#get(acs_user_id: nil, acs_system_id: nil, user_identity_id: nil) ⇒ Seam::Resources::AcsUser

Returns a specified access system user.

Parameters:

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

    ID of the access system user that you want to get. You can only provide acs_user_id or user_identity_id.

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

    ID of the access system that you want to get. You can only provide acs_user_id or user_identity_id.

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

    ID of the user identity that you want to get. You can only provide acs_user_id or user_identity_id.

Returns:



58
59
60
61
62
63
64
65
66
# File 'lib/seam/routes/acs_users.rb', line 58

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

  res = @client.get("/acs/users/get", {acs_user_id: acs_user_id, acs_system_id: acs_system_id, user_identity_id: user_identity_id}.compact)

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

#list(acs_system_id: nil, created_before: nil, limit: nil, page_cursor: nil, search: nil, user_identity_email_address: nil, user_identity_id: nil, user_identity_phone_number: nil) ⇒ Seam::Resources::AcsUser

Returns a list of all access system users.

Parameters:

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

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

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

    Timestamp by which to limit returned access system users. Returns users created before this timestamp.

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

    Maximum number of records to return per page.

  • page_cursor (String, Seam::Null, 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 access system users to include all records that satisfy a partial match using full_name, phone_number, email_address, acs_user_id, user_identity_id, user_identity_full_name or user_identity_phone_number.

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

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

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

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

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

    Phone number of the user identity for which you want to retrieve all access system users, in E.164 format (for example, +15555550100).

Returns:



78
79
80
81
82
# File 'lib/seam/routes/acs_users.rb', line 78

def list(acs_system_id: nil, created_before: nil, limit: nil, page_cursor: nil, search: nil, user_identity_email_address: nil, user_identity_id: nil, user_identity_phone_number: nil)
  res = @client.get("/acs/users/list", {acs_system_id: acs_system_id, created_before: created_before, limit: limit, page_cursor: page_cursor, search: search, user_identity_email_address: user_identity_email_address, user_identity_id: user_identity_id, user_identity_phone_number: user_identity_phone_number}.compact)

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

#list_accessible_entrances(acs_system_id: nil, acs_user_id: nil, user_identity_id: nil) ⇒ Seam::Resources::AcsEntrance

Lists the entrances to which a specified access system user has access.

Parameters:

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

    ID of the access system for which you want to list accessible entrances. You can only provide acs_system_id with user_identity_id.

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

    ID of the access system user for whom you want to list accessible entrances. You can only provide acs_user_id or user_identity_id.

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

    ID of the user identity for whom you want to list accessible entrances. You can only provide acs_user_id or user_identity_id.

Returns:



89
90
91
92
93
94
95
96
97
# File 'lib/seam/routes/acs_users.rb', line 89

def list_accessible_entrances(acs_system_id: nil, acs_user_id: nil, user_identity_id: nil)
  if acs_system_id.nil? && acs_user_id.nil? && user_identity_id.nil?
    raise TypeError, "At least one parameter is required for /acs/users/list_accessible_entrances"
  end

  res = @client.get("/acs/users/list_accessible_entrances", {acs_system_id: acs_system_id, acs_user_id: acs_user_id, user_identity_id: user_identity_id}.compact)

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

#remove_from_access_group(acs_access_group_id:, acs_user_id: nil, user_identity_id: nil) ⇒ nil

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

Parameters:

  • acs_access_group_id (String)

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

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

    ID of the access system user that you want to remove from an access group. You can only provide acs_user_id or user_identity_id.

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

    ID of the user identity that you want to remove from an access group. You can only provide acs_user_id or user_identity_id.

Returns:

  • (nil)

    OK



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

def remove_from_access_group(acs_access_group_id:, acs_user_id: nil, user_identity_id: nil)
  @client.delete("/acs/users/remove_from_access_group", {acs_access_group_id: acs_access_group_id, acs_user_id: acs_user_id, user_identity_id: user_identity_id}.compact)

  nil
end

#revoke_access_to_all_entrances(acs_system_id: nil, acs_user_id: nil, user_identity_id: nil) ⇒ nil

Revokes access to all entrances for a specified access system user.

Parameters:

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

    ID of the access system for which you want to revoke access. You can only provide acs_system_id with user_identity_id.

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

    ID of the access system user for whom you want to revoke access. You can only provide acs_user_id or user_identity_id.

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

    ID of the user identity for whom you want to revoke access. You can only provide acs_user_id or user_identity_id.

Returns:

  • (nil)

    OK



115
116
117
118
119
120
121
122
123
# File 'lib/seam/routes/acs_users.rb', line 115

def revoke_access_to_all_entrances(acs_system_id: nil, acs_user_id: nil, user_identity_id: nil)
  if acs_system_id.nil? && acs_user_id.nil? && user_identity_id.nil?
    raise TypeError, "At least one parameter is required for /acs/users/revoke_access_to_all_entrances"
  end

  @client.post("/acs/users/revoke_access_to_all_entrances", {acs_system_id: acs_system_id, acs_user_id: acs_user_id, user_identity_id: user_identity_id}.compact)

  nil
end

#suspend(acs_system_id: nil, acs_user_id: nil, user_identity_id: nil) ⇒ nil

Suspends a specified access system user. Suspending an access system user revokes their access temporarily. To restore an access system user's access, you can unsuspend them.

Parameters:

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

    ID of the access system that you want to suspend. You can only provide acs_user_id or the combination of acs_system_id and user_identity_id.

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

    ID of the access system user that you want to suspend. You can only provide acs_user_id or the combination of acs_system_id and user_identity_id.

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

    ID of the user identity that you want to suspend. You can only provide acs_user_id or the combination of acs_system_id and user_identity_id.

Returns:

  • (nil)

    OK



130
131
132
133
134
135
136
137
138
# File 'lib/seam/routes/acs_users.rb', line 130

def suspend(acs_system_id: nil, acs_user_id: nil, user_identity_id: nil)
  if acs_system_id.nil? && acs_user_id.nil? && user_identity_id.nil?
    raise TypeError, "At least one parameter is required for /acs/users/suspend"
  end

  @client.post("/acs/users/suspend", {acs_system_id: acs_system_id, acs_user_id: acs_user_id, user_identity_id: user_identity_id}.compact)

  nil
end

#unsuspend(acs_system_id: nil, acs_user_id: nil, user_identity_id: nil) ⇒ nil

Unsuspends a specified suspended access system user. While suspending an access system user revokes their access temporarily, unsuspending the access system user restores their access.

Parameters:

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

    ID of the access system of the user that you want to unsuspend. You can only provide acs_system_id with user_identity_id.

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

    ID of the access system user that you want to unsuspend. You can only provide acs_user_id or the combination of acs_system_id and user_identity_id.

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

    ID of the user identity that you want to unsuspend. You can only provide acs_user_id or the combination of acs_system_id and user_identity_id.

Returns:

  • (nil)

    OK



145
146
147
148
149
150
151
152
153
# File 'lib/seam/routes/acs_users.rb', line 145

def unsuspend(acs_system_id: nil, acs_user_id: nil, user_identity_id: nil)
  if acs_system_id.nil? && acs_user_id.nil? && user_identity_id.nil?
    raise TypeError, "At least one parameter is required for /acs/users/unsuspend"
  end

  @client.post("/acs/users/unsuspend", {acs_system_id: acs_system_id, acs_user_id: acs_user_id, user_identity_id: user_identity_id}.compact)

  nil
end

#update(access_schedule: nil, acs_system_id: nil, acs_user_id: nil, email: nil, email_address: nil, full_name: nil, hid_acs_system_id: nil, phone_number: nil, user_identity_id: nil) ⇒ nil

Deprecated.

email: use email_address.

Updates the properties of a specified access system user.

Parameters:

  • access_schedule (Hash, Seam::Null, nil) (defaults to: nil)

    starts_at and ends_at timestamps for the access system user's access. If you specify an access_schedule, you may include both starts_at and ends_at. If you omit starts_at, it defaults to the current time. ends_at is optional and must be a time in the future and after starts_at.

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

    ID of the access system that you want to update. You can only provide acs_system_id with user_identity_id.

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

    ID of the access system user that you want to update. You can only provide acs_user_id or user_identity_id.

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

    Email address of the access system user.

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

    Full name of the access system user.

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

    ID of the HID access control system associated with the user.

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

    Phone number of the access system user in E.164 format (for example, +15555550100).

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

    ID of the user identity that you want to update. You can only provide acs_user_id or user_identity_id. If you provide user_identity_id, you must also provide acs_system_id.

Returns:

  • (nil)

    OK



167
168
169
170
171
172
173
174
175
# File 'lib/seam/routes/acs_users.rb', line 167

def update(access_schedule: nil, acs_system_id: nil, acs_user_id: nil, email: nil, email_address: nil, full_name: nil, hid_acs_system_id: nil, phone_number: nil, user_identity_id: nil)
  if access_schedule.nil? && acs_system_id.nil? && acs_user_id.nil? && email.nil? && email_address.nil? && full_name.nil? && hid_acs_system_id.nil? && phone_number.nil? && user_identity_id.nil?
    raise TypeError, "At least one parameter is required for /acs/users/update"
  end

  @client.patch("/acs/users/update", {access_schedule: access_schedule, acs_system_id: acs_system_id, acs_user_id: acs_user_id, email: email, email_address: email_address, full_name: full_name, hid_acs_system_id: hid_acs_system_id, phone_number: phone_number, user_identity_id: user_identity_id}.compact)

  nil
end