Class: Seam::Clients::AcsCredentials

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

Instance Method Summary collapse

Constructor Details

#initialize(client:, defaults:) ⇒ AcsCredentials

Returns a new instance of AcsCredentials.



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

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

Instance Method Details

#assign(acs_credential_id:, acs_user_id: nil, user_identity_id: nil) ⇒ nil

Assigns a specified credential to a specified access system user.

Parameters:

  • acs_credential_id

    ID of the credential that you want to assign to an access system user.

  • acs_user_id (defaults to: nil)

    ID of the access system user to whom you want to assign a credential. You can only provide one of acs_user_id or user_identity_id.

  • user_identity_id (defaults to: nil)

    ID of the user identity to whom you want to assign a credential. You can only provide one of acs_user_id or user_identity_id. If the ACS system contains an ACS user with the same email_address or phone_number as the user identity that you specify, they are linked, and the credential belongs to the ACS user. If the ACS system does not have a corresponding ACS user, one is created.

Returns:

  • (nil)

    OK



16
17
18
19
20
# File 'lib/seam/routes/acs_credentials.rb', line 16

def assign(acs_credential_id:, acs_user_id: nil, user_identity_id: nil)
  @client.post("/acs/credentials/assign", {acs_credential_id: acs_credential_id, acs_user_id: acs_user_id, user_identity_id: user_identity_id}.compact)

  nil
end

#create(access_method:, acs_system_id: nil, acs_user_id: nil, allowed_acs_entrance_ids: nil, assa_abloy_vostio_metadata: nil, code: nil, credential_manager_acs_system_id: nil, ends_at: nil, is_multi_phone_sync_credential: nil, salto_space_metadata: nil, starts_at: nil, user_identity_id: nil, visionline_metadata: nil) ⇒ Seam::Resources::AcsCredential

Creates a new credential for a specified ACS user. For granting access, we recommend Access Grants instead: they create and manage the underlying credentials for you, across access systems and standalone smart locks alike. Use this low-level endpoint only when you need direct control over an individual ACS credential.

Parameters:

  • access_method

    Access method for the new credential. Supported values: code, card, mobile_key, cloud_key.

  • acs_system_id (defaults to: nil)

    ID of the access system to which the new credential belongs. You must provide either acs_user_id or the combination of user_identity_id and acs_system_id.

  • acs_user_id (defaults to: nil)

    ID of the access system user to whom the new credential belongs. You must provide either acs_user_id or the combination of user_identity_id and acs_system_id.

  • allowed_acs_entrance_ids (defaults to: nil)

    Set of IDs of the entrances for which the new credential grants access.

  • assa_abloy_vostio_metadata (defaults to: nil)

    Vostio-specific metadata for the new credential.

  • code (defaults to: nil)

    Access (PIN) code for the new credential. There may be manufacturer-specific code restrictions. For details, see the applicable device or system integration guide.

  • credential_manager_acs_system_id (defaults to: nil)

    ACS system ID of the credential manager for the new credential.

  • ends_at (defaults to: nil)

    Date and time at which the validity of the new credential ends, in ISO 8601 format. Must be a time in the future and after starts_at.

  • is_multi_phone_sync_credential (defaults to: nil)

    Indicates whether the new credential is a multi-phone sync credential.

  • salto_space_metadata (defaults to: nil)

    Salto Space-specific metadata for the new credential.

  • starts_at (defaults to: nil)

    Date and time at which the validity of the new credential starts, in ISO 8601 format.

  • user_identity_id (defaults to: nil)

    ID of the user identity to whom the new credential belongs. You must provide either acs_user_id or the combination of user_identity_id and acs_system_id. If the access system contains a user with the same email_address or phone_number as the user identity that you specify, they are linked, and the credential belongs to the access system user. If the access system does not have a corresponding user, one is created.

  • visionline_metadata (defaults to: nil)

    Visionline-specific metadata for the new credential.

Returns:



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

def create(access_method:, acs_system_id: nil, acs_user_id: nil, allowed_acs_entrance_ids: nil, assa_abloy_vostio_metadata: nil, code: nil, credential_manager_acs_system_id: nil, ends_at: nil, is_multi_phone_sync_credential: nil, salto_space_metadata: nil, starts_at: nil, user_identity_id: nil, visionline_metadata: nil)
  res = @client.post("/acs/credentials/create", {access_method: access_method, acs_system_id: acs_system_id, acs_user_id: acs_user_id, allowed_acs_entrance_ids: allowed_acs_entrance_ids, assa_abloy_vostio_metadata: , code: code, credential_manager_acs_system_id: credential_manager_acs_system_id, ends_at: ends_at, is_multi_phone_sync_credential: is_multi_phone_sync_credential, salto_space_metadata: , starts_at: starts_at, user_identity_id: user_identity_id, visionline_metadata: }.compact)

  Seam::Resources::AcsCredential.load_from_response(res.body["acs_credential"])
end

#delete(acs_credential_id:) ⇒ nil

Deletes a specified credential.

Parameters:

  • acs_credential_id

    ID of the credential that you want to delete.

Returns:

  • (nil)

    OK



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

def delete(acs_credential_id:)
  @client.post("/acs/credentials/delete", {acs_credential_id: acs_credential_id}.compact)

  nil
end

#get(acs_credential_id:) ⇒ Seam::Resources::AcsCredential

Returns a specified credential.

Parameters:

  • acs_credential_id

    ID of the credential that you want to get.

Returns:



55
56
57
58
59
# File 'lib/seam/routes/acs_credentials.rb', line 55

def get(acs_credential_id:)
  res = @client.post("/acs/credentials/get", {acs_credential_id: acs_credential_id}.compact)

  Seam::Resources::AcsCredential.load_from_response(res.body["acs_credential"])
end

#list(acs_user_id: nil, acs_system_id: nil, user_identity_id: nil, created_before: nil, is_multi_phone_sync_credential: nil, limit: nil, page_cursor: nil, search: nil) ⇒ Seam::Resources::AcsCredential

Returns a list of all credentials.

Parameters:

  • acs_user_id (defaults to: nil)

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

  • acs_system_id (defaults to: nil)

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

  • user_identity_id (defaults to: nil)

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

  • created_before (defaults to: nil)

    Date and time, in ISO 8601 format, before which events to return were created.

  • is_multi_phone_sync_credential (defaults to: nil)

    Indicates whether you want to retrieve only multi-phone sync credentials or non-multi-phone sync credentials.

  • limit (defaults to: nil)

    Number of credentials to return.

  • 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 credentials to include all records that satisfy a partial match using display_name, code, card_number, acs_user_id or acs_credential_id.

Returns:



71
72
73
74
75
# File 'lib/seam/routes/acs_credentials.rb', line 71

def list(acs_user_id: nil, acs_system_id: nil, user_identity_id: nil, created_before: nil, is_multi_phone_sync_credential: nil, limit: nil, page_cursor: nil, search: nil)
  res = @client.post("/acs/credentials/list", {acs_user_id: acs_user_id, acs_system_id: acs_system_id, user_identity_id: user_identity_id, created_before: created_before, is_multi_phone_sync_credential: is_multi_phone_sync_credential, limit: limit, page_cursor: page_cursor, search: search}.compact)

  Seam::Resources::AcsCredential.load_from_response(res.body["acs_credentials"])
end

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

Returns a list of all entrances to which a credential grants access.

Parameters:

  • acs_credential_id

    ID of the credential for which you want to retrieve all entrances to which the credential grants access.

Returns:



80
81
82
83
84
# File 'lib/seam/routes/acs_credentials.rb', line 80

def list_accessible_entrances(acs_credential_id:)
  res = @client.post("/acs/credentials/list_accessible_entrances", {acs_credential_id: acs_credential_id}.compact)

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

#unassign(acs_credential_id:, acs_user_id: nil, user_identity_id: nil) ⇒ nil

Unassigns a specified credential from a specified access system user.

Parameters:

  • acs_credential_id

    ID of the credential that you want to unassign from an access system user.

  • acs_user_id (defaults to: nil)

    ID of the access system user from which you want to unassign a credential. You can only provide one of acs_user_id or user_identity_id.

  • user_identity_id (defaults to: nil)

    ID of the user identity from which you want to unassign a credential. You can only provide one of acs_user_id or user_identity_id.

Returns:

  • (nil)

    OK



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

def unassign(acs_credential_id:, acs_user_id: nil, user_identity_id: nil)
  @client.post("/acs/credentials/unassign", {acs_credential_id: acs_credential_id, acs_user_id: acs_user_id, user_identity_id: user_identity_id}.compact)

  nil
end

#update(acs_credential_id:, code: nil, ends_at: nil) ⇒ nil

Updates the code and ends at date and time for a specified credential.

Parameters:

  • acs_credential_id

    ID of the credential that you want to update.

  • code (defaults to: nil)

    Replacement access (PIN) code for the credential that you want to update.

  • ends_at (defaults to: nil)

    Replacement date and time at which the validity of the credential ends, in ISO 8601 format. Must be a time in the future and after the starts_at value that you set when creating the credential.

Returns:

  • (nil)

    OK



102
103
104
105
106
# File 'lib/seam/routes/acs_credentials.rb', line 102

def update(acs_credential_id:, code: nil, ends_at: nil)
  @client.post("/acs/credentials/update", {acs_credential_id: acs_credential_id, code: code, ends_at: ends_at}.compact)

  nil
end