Class: Seam::Clients::AccessCodesUnmanaged

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

Instance Method Summary collapse

Constructor Details

#initialize(client:, defaults:) ⇒ AccessCodesUnmanaged

Returns a new instance of AccessCodesUnmanaged.



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

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

Instance Method Details

#convert_to_managed(access_code_id:, allow_external_modification: nil, force: nil, is_external_modification_allowed: nil) ⇒ nil

Converts an unmanaged access code to an access code managed through Seam.

An unmanaged access code has a limited set of operations that you can perform on it. Once you convert an unmanaged access code to a managed access code, the full set of access code operations and lifecycle events becomes available for it.

Note that not all device providers support converting an unmanaged access code to a managed access code.

Parameters:

  • access_code_id (String)

    ID of the unmanaged access code that you want to convert to a managed access code.

  • allow_external_modification (Boolean, nil) (defaults to: nil)

    Indicates whether external modification of the access code is allowed.

  • force (Boolean, nil) (defaults to: nil)

    Indicates whether to force the access code conversion. To switch management of an access code from one Seam workspace to another, set force to true.

  • is_external_modification_allowed (Boolean, nil) (defaults to: nil)

    Indicates whether external modification of the access code is allowed.

Returns:

  • (nil)

    OK



21
22
23
24
25
# File 'lib/seam/routes/access_codes_unmanaged.rb', line 21

def convert_to_managed(access_code_id:, allow_external_modification: nil, force: nil, is_external_modification_allowed: nil)
  @client.patch("/access_codes/unmanaged/convert_to_managed", {access_code_id: access_code_id, allow_external_modification: allow_external_modification, force: force, is_external_modification_allowed: is_external_modification_allowed}.compact)

  nil
end

#delete(access_code_id:) ⇒ nil

Deletes an unmanaged access code.

Parameters:

  • access_code_id (String)

    ID of the unmanaged access code that you want to delete.

Returns:

  • (nil)

    OK



30
31
32
33
34
# File 'lib/seam/routes/access_codes_unmanaged.rb', line 30

def delete(access_code_id:)
  @client.delete("/access_codes/unmanaged/delete", {access_code_id: access_code_id}.compact)

  nil
end

#get(access_code_id: nil, code: nil, device_id: nil) ⇒ Seam::Resources::UnmanagedAccessCode

Returns a specified unmanaged access code.

You must specify either access_code_id or both device_id and code.

Parameters:

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

    ID of the unmanaged access code that you want to get. You must specify either access_code_id or both device_id and code.

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

    Code of the unmanaged access code that you want to get. You must specify either access_code_id or both device_id and code.

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

    ID of the device containing the unmanaged access code that you want to get. You must specify either access_code_id or both device_id and code.

Returns:



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

def get(access_code_id: nil, code: nil, device_id: nil)
  if access_code_id.nil? && code.nil? && device_id.nil?
    raise TypeError, "At least one parameter is required for /access_codes/unmanaged/get"
  end

  res = @client.get("/access_codes/unmanaged/get", {access_code_id: access_code_id, code: code, device_id: device_id}.compact)

  Seam::Resources::UnmanagedAccessCode.load_from_response(res.body["access_code"])
end

#list(device_id:, limit: nil, page_cursor: nil, search: nil, user_identifier_key: nil) ⇒ Seam::Resources::UnmanagedAccessCode

Returns a list of all unmanaged access codes.

Parameters:

  • device_id (String)

    ID of the device for which you want to list unmanaged access codes.

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

    Numerical limit on the number of unmanaged access codes to return.

  • 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 access codes to include all records that satisfy a partial match using name, code or access_code_id.

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

    Your user ID for the user by which to filter unmanaged access codes.

Returns:



60
61
62
63
64
# File 'lib/seam/routes/access_codes_unmanaged.rb', line 60

def list(device_id:, limit: nil, page_cursor: nil, search: nil, user_identifier_key: nil)
  res = @client.get("/access_codes/unmanaged/list", {device_id: device_id, limit: limit, page_cursor: page_cursor, search: search, user_identifier_key: user_identifier_key}.compact)

  Seam::Resources::UnmanagedAccessCode.load_from_response(res.body["access_codes"])
end

#update(access_code_id:, is_managed:, allow_external_modification: nil, force: nil, is_external_modification_allowed: nil) ⇒ nil

Updates a specified unmanaged access code.

Parameters:

  • access_code_id (String)

    ID of the unmanaged access code that you want to update.

  • is_managed (Boolean)
  • allow_external_modification (Boolean, nil) (defaults to: nil)

    Indicates whether external modification of the code is allowed.

  • force (Boolean, nil) (defaults to: nil)

    Indicates whether to force the unmanaged access code update.

  • is_external_modification_allowed (Boolean, nil) (defaults to: nil)

    Indicates whether external modification of the code is allowed.

Returns:

  • (nil)

    OK



73
74
75
76
77
# File 'lib/seam/routes/access_codes_unmanaged.rb', line 73

def update(access_code_id:, is_managed:, allow_external_modification: nil, force: nil, is_external_modification_allowed: nil)
  @client.patch("/access_codes/unmanaged/update", {access_code_id: access_code_id, is_managed: is_managed, allow_external_modification: allow_external_modification, force: force, is_external_modification_allowed: is_external_modification_allowed}.compact)

  nil
end