Class: Seam::Clients::UnmanagedAccessCodes

Inherits:
BaseClient
  • Object
show all
Defined in:
lib/seam/clients/unmanaged_access_codes.rb

Instance Attribute Summary

Attributes inherited from BaseClient

#client

Instance Method Summary collapse

Methods inherited from BaseClient

#initialize, #request_seam, #request_seam_object

Constructor Details

This class inherits a constructor from Seam::Clients::BaseClient

Instance Method Details

#convert_to_managed(access_code_id, allow_external_modification: nil) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/seam/clients/unmanaged_access_codes.rb', line 30

def convert_to_managed(access_code_id, allow_external_modification: nil)
  action_attempt = request_seam_object(
    :post,
    "/access_codes/unmanaged/convert_to_managed",
    Seam::ActionAttempt,
    "action_attempt",
    body: {
      access_code_id: access_code_id,
      allow_external_modification: allow_external_modification
    }.compact
  )
  action_attempt.wait_until_finished
  action_attempt
end

#delete(access_code_id) ⇒ Object



45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/seam/clients/unmanaged_access_codes.rb', line 45

def delete(access_code_id)
  action_attempt = request_seam_object(
    :post,
    "/access_codes/unmanaged/delete",
    Seam::ActionAttempt,
    "action_attempt",
    body: {
      access_code_id: access_code_id
    }
  )
  action_attempt.wait_until_finished
  action_attempt
end

#get(access_code_id = nil, device_id: nil, code: nil) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/seam/clients/unmanaged_access_codes.rb', line 6

def get(access_code_id = nil, device_id: nil, code: nil)
  request_seam_object(
    :post,
    "/access_codes/unmanaged/get",
    Seam::UnmanagedAccessCode,
    "access_code",
    body: {
      device_id: device_id,
      access_code_id: access_code_id,
      code: code
    }.compact
  )
end

#list(device_id) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'lib/seam/clients/unmanaged_access_codes.rb', line 20

def list(device_id)
  request_seam_object(
    :post,
    "/access_codes/unmanaged/list",
    Seam::UnmanagedAccessCode,
    "access_codes",
    body: {device_id: device_id}
  )
end