Class: Seam::Clients::AccessCodes

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

Instance Method Summary collapse

Constructor Details

#initialize(client:, defaults:) ⇒ AccessCodes

Returns a new instance of AccessCodes.



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

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

Instance Method Details

#create(device_id:, allow_external_modification: nil, attempt_for_offline_device: nil, code: nil, common_code_key: nil, ends_at: nil, is_external_modification_allowed: nil, is_offline_access_code: nil, is_one_time_use: nil, max_time_rounding: nil, name: nil, prefer_native_scheduling: nil, preferred_code_length: nil, starts_at: nil, sync: nil, use_backup_access_code_pool: nil, use_offline_access_code: nil) ⇒ Object



19
20
21
22
23
# File 'lib/seam/routes/clients/access_codes.rb', line 19

def create(device_id:, allow_external_modification: nil, attempt_for_offline_device: nil, code: nil, common_code_key: nil, ends_at: nil, is_external_modification_allowed: nil, is_offline_access_code: nil, is_one_time_use: nil, max_time_rounding: nil, name: nil, prefer_native_scheduling: nil, preferred_code_length: nil, starts_at: nil, sync: nil, use_backup_access_code_pool: nil, use_offline_access_code: nil)
  res = @client.post("/access_codes/create", {device_id: device_id, allow_external_modification: allow_external_modification, attempt_for_offline_device: attempt_for_offline_device, code: code, common_code_key: common_code_key, ends_at: ends_at, is_external_modification_allowed: is_external_modification_allowed, is_offline_access_code: is_offline_access_code, is_one_time_use: is_one_time_use, max_time_rounding: max_time_rounding, name: name, prefer_native_scheduling: prefer_native_scheduling, preferred_code_length: preferred_code_length, starts_at: starts_at, sync: sync, use_backup_access_code_pool: use_backup_access_code_pool, use_offline_access_code: use_offline_access_code}.compact)

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

#create_multiple(device_ids:, allow_external_modification: nil, attempt_for_offline_device: nil, behavior_when_code_cannot_be_shared: nil, code: nil, ends_at: nil, is_external_modification_allowed: nil, is_offline_access_code: nil, is_one_time_use: nil, max_time_rounding: nil, name: nil, prefer_native_scheduling: nil, preferred_code_length: nil, starts_at: nil, use_backup_access_code_pool: nil, use_offline_access_code: nil) ⇒ Object



25
26
27
28
29
# File 'lib/seam/routes/clients/access_codes.rb', line 25

def create_multiple(device_ids:, allow_external_modification: nil, attempt_for_offline_device: nil, behavior_when_code_cannot_be_shared: nil, code: nil, ends_at: nil, is_external_modification_allowed: nil, is_offline_access_code: nil, is_one_time_use: nil, max_time_rounding: nil, name: nil, prefer_native_scheduling: nil, preferred_code_length: nil, starts_at: nil, use_backup_access_code_pool: nil, use_offline_access_code: nil)
  res = @client.post("/access_codes/create_multiple", {device_ids: device_ids, allow_external_modification: allow_external_modification, attempt_for_offline_device: attempt_for_offline_device, behavior_when_code_cannot_be_shared: behavior_when_code_cannot_be_shared, code: code, ends_at: ends_at, is_external_modification_allowed: is_external_modification_allowed, is_offline_access_code: is_offline_access_code, is_one_time_use: is_one_time_use, max_time_rounding: max_time_rounding, name: name, prefer_native_scheduling: prefer_native_scheduling, preferred_code_length: preferred_code_length, starts_at: starts_at, use_backup_access_code_pool: use_backup_access_code_pool, use_offline_access_code: use_offline_access_code}.compact)

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

#delete(access_code_id:, device_id: nil, sync: nil) ⇒ Object



31
32
33
34
35
# File 'lib/seam/routes/clients/access_codes.rb', line 31

def delete(access_code_id:, device_id: nil, sync: nil)
  @client.post("/access_codes/delete", {access_code_id: access_code_id, device_id: device_id, sync: sync}.compact)

  nil
end

#generate_code(device_id:) ⇒ Object



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

def generate_code(device_id:)
  res = @client.post("/access_codes/generate_code", {device_id: device_id}.compact)

  Seam::Resources::AccessCode.load_from_response(res.body["generated_code"])
end

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



43
44
45
46
47
# File 'lib/seam/routes/clients/access_codes.rb', line 43

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

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

#list(access_code_ids: nil, customer_key: nil, device_id: nil, limit: nil, page_cursor: nil, user_identifier_key: nil) ⇒ Object



49
50
51
52
53
# File 'lib/seam/routes/clients/access_codes.rb', line 49

def list(access_code_ids: nil, customer_key: nil, device_id: nil, limit: nil, page_cursor: nil, user_identifier_key: nil)
  res = @client.post("/access_codes/list", {access_code_ids: access_code_ids, customer_key: customer_key, device_id: device_id, limit: limit, page_cursor: page_cursor, user_identifier_key: user_identifier_key}.compact)

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

#pull_backup_access_code(access_code_id:) ⇒ Object



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

def pull_backup_access_code(access_code_id:)
  res = @client.post("/access_codes/pull_backup_access_code", {access_code_id: access_code_id}.compact)

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

#report_device_constraints(device_id:, max_code_length: nil, min_code_length: nil, supported_code_lengths: nil) ⇒ Object



61
62
63
64
65
# File 'lib/seam/routes/clients/access_codes.rb', line 61

def report_device_constraints(device_id:, max_code_length: nil, min_code_length: nil, supported_code_lengths: nil)
  @client.post("/access_codes/report_device_constraints", {device_id: device_id, max_code_length: max_code_length, min_code_length: min_code_length, supported_code_lengths: supported_code_lengths}.compact)

  nil
end

#simulateObject



11
12
13
# File 'lib/seam/routes/clients/access_codes.rb', line 11

def simulate
  @simulate ||= Seam::Clients::AccessCodesSimulate.new(client: @client, defaults: @defaults)
end

#unmanagedObject



15
16
17
# File 'lib/seam/routes/clients/access_codes.rb', line 15

def unmanaged
  @unmanaged ||= Seam::Clients::AccessCodesUnmanaged.new(client: @client, defaults: @defaults)
end

#update(access_code_id:, allow_external_modification: nil, attempt_for_offline_device: nil, code: nil, device_id: nil, ends_at: nil, is_external_modification_allowed: nil, is_managed: nil, is_offline_access_code: nil, is_one_time_use: nil, max_time_rounding: nil, name: nil, prefer_native_scheduling: nil, preferred_code_length: nil, starts_at: nil, sync: nil, type: nil, use_backup_access_code_pool: nil, use_offline_access_code: nil) ⇒ Object



67
68
69
70
71
# File 'lib/seam/routes/clients/access_codes.rb', line 67

def update(access_code_id:, allow_external_modification: nil, attempt_for_offline_device: nil, code: nil, device_id: nil, ends_at: nil, is_external_modification_allowed: nil, is_managed: nil, is_offline_access_code: nil, is_one_time_use: nil, max_time_rounding: nil, name: nil, prefer_native_scheduling: nil, preferred_code_length: nil, starts_at: nil, sync: nil, type: nil, use_backup_access_code_pool: nil, use_offline_access_code: nil)
  @client.post("/access_codes/update", {access_code_id: access_code_id, allow_external_modification: allow_external_modification, attempt_for_offline_device: attempt_for_offline_device, code: code, device_id: device_id, ends_at: ends_at, is_external_modification_allowed: is_external_modification_allowed, is_managed: is_managed, is_offline_access_code: is_offline_access_code, is_one_time_use: is_one_time_use, max_time_rounding: max_time_rounding, name: name, prefer_native_scheduling: prefer_native_scheduling, preferred_code_length: preferred_code_length, starts_at: starts_at, sync: sync, type: type, use_backup_access_code_pool: use_backup_access_code_pool, use_offline_access_code: use_offline_access_code}.compact)

  nil
end

#update_multiple(common_code_key:, ends_at: nil, name: nil, starts_at: nil) ⇒ Object



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

def update_multiple(common_code_key:, ends_at: nil, name: nil, starts_at: nil)
  @client.post("/access_codes/update_multiple", {common_code_key: common_code_key, ends_at: ends_at, name: name, starts_at: starts_at}.compact)

  nil
end