Class: Seam::Clients::AccessGrants
- Inherits:
-
Object
- Object
- Seam::Clients::AccessGrants
- Defined in:
- lib/seam/routes/access_grants.rb
Instance Method Summary collapse
-
#create(requested_access_methods:, user_identity_id: nil, user_identity: nil, access_grant_key: nil, acs_entrance_ids: nil, customization_profile_id: nil, device_ids: nil, ends_at: nil, location: nil, location_ids: nil, name: nil, reservation_key: nil, space_ids: nil, space_keys: nil, starts_at: nil) ⇒ Seam::Resources::AccessGrant
deprecated
Deprecated.
location: Create a space first, then reference it using
space_ids. -
#delete(access_grant_id:) ⇒ nil
Delete an Access Grant.
-
#get(access_grant_id: nil, access_grant_key: nil) ⇒ Seam::Resources::AccessGrant
Get an Access Grant.
-
#get_related(access_grant_ids: nil, access_grant_keys: nil, exclude: nil, include: nil) ⇒ Seam::Resources::Batch
Gets all related resources for one or more Access Grants.
-
#initialize(client:, defaults:) ⇒ AccessGrants
constructor
A new instance of AccessGrants.
-
#list(access_code_id: nil, access_grant_ids: nil, access_grant_key: nil, acs_entrance_id: nil, acs_system_id: nil, customer_key: nil, device_id: nil, limit: nil, location_id: nil, page_cursor: nil, reservation_key: nil, space_id: nil, user_identity_id: nil) ⇒ Seam::Resources::AccessGrant
deprecated
Deprecated.
location_id: Use
space_id. -
#request_access_methods(access_grant_id:, requested_access_methods:) ⇒ Seam::Resources::AccessGrant
Adds additional requested access methods to an existing Access Grant.
- #unmanaged ⇒ Object
-
#update(access_grant_id: nil, access_grant_key: nil, ends_at: nil, name: nil, starts_at: nil) ⇒ nil
Updates an existing Access Grant's time window.
Constructor Details
#initialize(client:, defaults:) ⇒ AccessGrants
Returns a new instance of AccessGrants.
6 7 8 9 |
# File 'lib/seam/routes/access_grants.rb', line 6 def initialize(client:, defaults:) @client = client @defaults = defaults end |
Instance Method Details
#create(requested_access_methods:, user_identity_id: nil, user_identity: nil, access_grant_key: nil, acs_entrance_ids: nil, customization_profile_id: nil, device_ids: nil, ends_at: nil, location: nil, location_ids: nil, name: nil, reservation_key: nil, space_ids: nil, space_keys: nil, starts_at: nil) ⇒ Seam::Resources::AccessGrant
location: Create a space first, then reference it using space_ids.
Creates a new Access Grant. Access Grants are the default and recommended way to grant a user access to any physical space, irrespective of the locking hardware. They work with both standalone smart locks (using device_ids) and access control systems (using acs_entrance_ids or space_ids), and can issue PIN codes, key cards, and mobile keys through a single request.
34 35 36 37 38 |
# File 'lib/seam/routes/access_grants.rb', line 34 def create(requested_access_methods:, user_identity_id: nil, user_identity: nil, access_grant_key: nil, acs_entrance_ids: nil, customization_profile_id: nil, device_ids: nil, ends_at: nil, location: nil, location_ids: nil, name: nil, reservation_key: nil, space_ids: nil, space_keys: nil, starts_at: nil) res = @client.post("/access_grants/create", {requested_access_methods: requested_access_methods, user_identity_id: user_identity_id, user_identity: user_identity, access_grant_key: access_grant_key, acs_entrance_ids: acs_entrance_ids, customization_profile_id: customization_profile_id, device_ids: device_ids, ends_at: ends_at, location: location, location_ids: location_ids, name: name, reservation_key: reservation_key, space_ids: space_ids, space_keys: space_keys, starts_at: starts_at}.compact) Seam::Resources::AccessGrant.load_from_response(res.body["access_grant"]) end |
#delete(access_grant_id:) ⇒ nil
Delete an Access Grant.
43 44 45 46 47 |
# File 'lib/seam/routes/access_grants.rb', line 43 def delete(access_grant_id:) @client.post("/access_grants/delete", {access_grant_id: access_grant_id}.compact) nil end |
#get(access_grant_id: nil, access_grant_key: nil) ⇒ Seam::Resources::AccessGrant
Get an Access Grant.
53 54 55 56 57 |
# File 'lib/seam/routes/access_grants.rb', line 53 def get(access_grant_id: nil, access_grant_key: nil) res = @client.post("/access_grants/get", {access_grant_id: access_grant_id, access_grant_key: access_grant_key}.compact) Seam::Resources::AccessGrant.load_from_response(res.body["access_grant"]) end |
#get_related(access_grant_ids: nil, access_grant_keys: nil, exclude: nil, include: nil) ⇒ Seam::Resources::Batch
Gets all related resources for one or more Access Grants.
65 66 67 68 69 |
# File 'lib/seam/routes/access_grants.rb', line 65 def (access_grant_ids: nil, access_grant_keys: nil, exclude: nil, include: nil) res = @client.post("/access_grants/get_related", {access_grant_ids: access_grant_ids, access_grant_keys: access_grant_keys, exclude: exclude, include: include}.compact) Seam::Resources::Batch.load_from_response(res.body["batch"]) end |
#list(access_code_id: nil, access_grant_ids: nil, access_grant_key: nil, acs_entrance_id: nil, acs_system_id: nil, customer_key: nil, device_id: nil, limit: nil, location_id: nil, page_cursor: nil, reservation_key: nil, space_id: nil, user_identity_id: nil) ⇒ Seam::Resources::AccessGrant
location_id: Use space_id.
Gets an Access Grant.
87 88 89 90 91 |
# File 'lib/seam/routes/access_grants.rb', line 87 def list(access_code_id: nil, access_grant_ids: nil, access_grant_key: nil, acs_entrance_id: nil, acs_system_id: nil, customer_key: nil, device_id: nil, limit: nil, location_id: nil, page_cursor: nil, reservation_key: nil, space_id: nil, user_identity_id: nil) res = @client.post("/access_grants/list", {access_code_id: access_code_id, access_grant_ids: access_grant_ids, access_grant_key: access_grant_key, acs_entrance_id: acs_entrance_id, acs_system_id: acs_system_id, customer_key: customer_key, device_id: device_id, limit: limit, location_id: location_id, page_cursor: page_cursor, reservation_key: reservation_key, space_id: space_id, user_identity_id: user_identity_id}.compact) Seam::Resources::AccessGrant.load_from_response(res.body["access_grants"]) end |
#request_access_methods(access_grant_id:, requested_access_methods:) ⇒ Seam::Resources::AccessGrant
Adds additional requested access methods to an existing Access Grant.
97 98 99 100 101 |
# File 'lib/seam/routes/access_grants.rb', line 97 def request_access_methods(access_grant_id:, requested_access_methods:) res = @client.post("/access_grants/request_access_methods", {access_grant_id: access_grant_id, requested_access_methods: requested_access_methods}.compact) Seam::Resources::AccessGrant.load_from_response(res.body["access_grant"]) end |
#unmanaged ⇒ Object
11 12 13 |
# File 'lib/seam/routes/access_grants.rb', line 11 def unmanaged @unmanaged ||= Seam::Clients::AccessGrantsUnmanaged.new(client: @client, defaults: @defaults) end |
#update(access_grant_id: nil, access_grant_key: nil, ends_at: nil, name: nil, starts_at: nil) ⇒ nil
Updates an existing Access Grant's time window.
110 111 112 113 114 |
# File 'lib/seam/routes/access_grants.rb', line 110 def update(access_grant_id: nil, access_grant_key: nil, ends_at: nil, name: nil, starts_at: nil) @client.post("/access_grants/update", {access_grant_id: access_grant_id, access_grant_key: access_grant_key, ends_at: ends_at, name: name, starts_at: starts_at}.compact) nil end |