Class: Seam::Clients::LocksSimulate

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

Instance Method Summary collapse

Constructor Details

#initialize(client:, defaults:) ⇒ LocksSimulate

Returns a new instance of LocksSimulate.



8
9
10
11
# File 'lib/seam/routes/clients/locks_simulate.rb', line 8

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

Instance Method Details

#keypad_code_entry(code:, device_id:, wait_for_action_attempt: nil) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/seam/routes/clients/locks_simulate.rb', line 13

def keypad_code_entry(code:, device_id:, wait_for_action_attempt: nil)
  res = @client.post("/locks/simulate/keypad_code_entry", {code: code, device_id: device_id}.compact)

  wait_for_action_attempt = wait_for_action_attempt.nil? ? @defaults.wait_for_action_attempt : wait_for_action_attempt

  Helpers::ActionAttempt.decide_and_wait(Seam::Resources::ActionAttempt.load_from_response(res.body["action_attempt"]), @client, wait_for_action_attempt)
end

#manual_lock_via_keypad(device_id:, wait_for_action_attempt: nil) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/seam/routes/clients/locks_simulate.rb', line 21

def manual_lock_via_keypad(device_id:, wait_for_action_attempt: nil)
  res = @client.post("/locks/simulate/manual_lock_via_keypad", {device_id: device_id}.compact)

  wait_for_action_attempt = wait_for_action_attempt.nil? ? @defaults.wait_for_action_attempt : wait_for_action_attempt

  Helpers::ActionAttempt.decide_and_wait(Seam::Resources::ActionAttempt.load_from_response(res.body["action_attempt"]), @client, wait_for_action_attempt)
end