Class: Seam::Clients::Locks
- Inherits:
-
Object
- Object
- Seam::Clients::Locks
- Defined in:
- lib/seam/routes/clients/locks.rb
Instance Method Summary collapse
- #configure_auto_lock(auto_lock_enabled:, device_id:, auto_lock_delay_seconds: nil, wait_for_action_attempt: nil) ⇒ Object
- #get(device_id: nil, name: nil) ⇒ Object
-
#initialize(client:, defaults:) ⇒ Locks
constructor
A new instance of Locks.
- #list(connect_webview_id: nil, connected_account_id: nil, connected_account_ids: nil, created_before: nil, custom_metadata_has: nil, customer_key: nil, device_ids: nil, device_type: nil, device_types: nil, limit: nil, manufacturer: nil, page_cursor: nil, search: nil, space_id: nil, unstable_location_id: nil, user_identifier_key: nil) ⇒ Object
- #lock_door(device_id:, wait_for_action_attempt: nil) ⇒ Object
- #simulate ⇒ Object
- #unlock_door(device_id:, wait_for_action_attempt: nil) ⇒ Object
Constructor Details
#initialize(client:, defaults:) ⇒ Locks
Returns a new instance of Locks.
8 9 10 11 |
# File 'lib/seam/routes/clients/locks.rb', line 8 def initialize(client:, defaults:) @client = client @defaults = defaults end |
Instance Method Details
#configure_auto_lock(auto_lock_enabled:, device_id:, auto_lock_delay_seconds: nil, wait_for_action_attempt: nil) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/seam/routes/clients/locks.rb', line 17 def configure_auto_lock(auto_lock_enabled:, device_id:, auto_lock_delay_seconds: nil, wait_for_action_attempt: nil) res = @client.post("/locks/configure_auto_lock", {auto_lock_enabled: auto_lock_enabled, device_id: device_id, auto_lock_delay_seconds: auto_lock_delay_seconds}.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 |
#get(device_id: nil, name: nil) ⇒ Object
25 26 27 28 29 |
# File 'lib/seam/routes/clients/locks.rb', line 25 def get(device_id: nil, name: nil) res = @client.post("/locks/get", {device_id: device_id, name: name}.compact) Seam::Resources::Device.load_from_response(res.body["device"]) end |
#list(connect_webview_id: nil, connected_account_id: nil, connected_account_ids: nil, created_before: nil, custom_metadata_has: nil, customer_key: nil, device_ids: nil, device_type: nil, device_types: nil, limit: nil, manufacturer: nil, page_cursor: nil, search: nil, space_id: nil, unstable_location_id: nil, user_identifier_key: nil) ⇒ Object
31 32 33 34 35 |
# File 'lib/seam/routes/clients/locks.rb', line 31 def list(connect_webview_id: nil, connected_account_id: nil, connected_account_ids: nil, created_before: nil, custom_metadata_has: nil, customer_key: nil, device_ids: nil, device_type: nil, device_types: nil, limit: nil, manufacturer: nil, page_cursor: nil, search: nil, space_id: nil, unstable_location_id: nil, user_identifier_key: nil) res = @client.post("/locks/list", {connect_webview_id: connect_webview_id, connected_account_id: connected_account_id, connected_account_ids: connected_account_ids, created_before: created_before, custom_metadata_has: , customer_key: customer_key, device_ids: device_ids, device_type: device_type, device_types: device_types, limit: limit, manufacturer: manufacturer, page_cursor: page_cursor, search: search, space_id: space_id, unstable_location_id: unstable_location_id, user_identifier_key: user_identifier_key}.compact) Seam::Resources::Device.load_from_response(res.body["devices"]) end |
#lock_door(device_id:, wait_for_action_attempt: nil) ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/seam/routes/clients/locks.rb', line 37 def lock_door(device_id:, wait_for_action_attempt: nil) res = @client.post("/locks/lock_door", {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 |
#simulate ⇒ Object
13 14 15 |
# File 'lib/seam/routes/clients/locks.rb', line 13 def simulate @simulate ||= Seam::Clients::LocksSimulate.new(client: @client, defaults: @defaults) end |
#unlock_door(device_id:, wait_for_action_attempt: nil) ⇒ Object
45 46 47 48 49 50 51 |
# File 'lib/seam/routes/clients/locks.rb', line 45 def unlock_door(device_id:, wait_for_action_attempt: nil) res = @client.post("/locks/unlock_door", {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 |