Class: Seam::Clients::LocksSimulate
- Inherits:
-
Object
- Object
- Seam::Clients::LocksSimulate
- Defined in:
- lib/seam/routes/locks_simulate.rb
Instance Method Summary collapse
-
#initialize(client:, defaults:) ⇒ LocksSimulate
constructor
A new instance of LocksSimulate.
-
#keypad_code_entry(code:, device_id:, wait_for_action_attempt: nil) ⇒ Seam::Resources::ActionAttempt
Simulates the entry of a code on a keypad.
-
#manual_lock_via_keypad(device_id:, wait_for_action_attempt: nil) ⇒ Seam::Resources::ActionAttempt
Simulates a manual lock action using a keypad.
Constructor Details
#initialize(client:, defaults:) ⇒ LocksSimulate
Returns a new instance of LocksSimulate.
8 9 10 11 |
# File 'lib/seam/routes/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) ⇒ Seam::Resources::ActionAttempt
Simulates the entry of a code on a keypad. You can only perform this action for August devices within sandbox workspaces.
17 18 19 20 21 22 23 |
# File 'lib/seam/routes/locks_simulate.rb', line 17 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) ⇒ Seam::Resources::ActionAttempt
Simulates a manual lock action using a keypad. You can only perform this action for August devices within sandbox workspaces.
28 29 30 31 32 33 34 |
# File 'lib/seam/routes/locks_simulate.rb', line 28 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 |