Class: Seam::Clients::DevicesSimulate

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

Instance Method Summary collapse

Constructor Details

#initialize(client:, defaults:) ⇒ DevicesSimulate

Returns a new instance of DevicesSimulate.



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

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

Instance Method Details

#connect(device_id:) ⇒ nil

Simulates connecting a device to Seam. Only applicable for sandbox devices. See also Testing Your App Against Device Disconnection and Removal.

Parameters:

  • device_id

    ID of the device that you want to simulate connecting to Seam.

Returns:

  • (nil)

    OK



14
15
16
17
18
# File 'lib/seam/routes/devices_simulate.rb', line 14

def connect(device_id:)
  @client.post("/devices/simulate/connect", {device_id: device_id}.compact)

  nil
end

#connect_to_hub(device_id:) ⇒ nil

Simulates bringing the Wi‑Fi hub (bridge) back online for a device. Only applicable for sandbox workspaces and currently implemented for August and TTLock locks. This will clear the hub_disconnected error on the device.

Parameters:

  • device_id

    ID of the device whose hub you want to reconnect.

Returns:

  • (nil)

    OK



26
27
28
29
30
# File 'lib/seam/routes/devices_simulate.rb', line 26

def connect_to_hub(device_id:)
  @client.post("/devices/simulate/connect_to_hub", {device_id: device_id}.compact)

  nil
end

#disconnect(device_id:) ⇒ nil

Simulates disconnecting a device from Seam. Only applicable for sandbox devices. See also Testing Your App Against Device Disconnection and Removal.

Parameters:

  • device_id

    ID of the device that you want to simulate disconnecting from Seam.

Returns:

  • (nil)

    OK



35
36
37
38
39
# File 'lib/seam/routes/devices_simulate.rb', line 35

def disconnect(device_id:)
  @client.post("/devices/simulate/disconnect", {device_id: device_id}.compact)

  nil
end

#disconnect_from_hub(device_id:) ⇒ nil

Simulates taking the Wi‑Fi hub (bridge) offline for a device. Only applicable for sandbox workspaces and currently implemented for August, TTLock, and IglooHome devices. This will set the hub_disconnected error on the device, or mark the IglooHome bridge offline in sandbox.

Parameters:

  • device_id

    ID of the device whose hub you want to disconnect.

Returns:

  • (nil)

    OK



48
49
50
51
52
# File 'lib/seam/routes/devices_simulate.rb', line 48

def disconnect_from_hub(device_id:)
  @client.post("/devices/simulate/disconnect_from_hub", {device_id: device_id}.compact)

  nil
end

Toggle the simulated Nuki Smart Hosting subscription for a device (sandbox only). Send is_expired: true to simulate an expired subscription, or false to simulate an active subscription. The actual device error is created/cleared by the poller after this state change.

Parameters:

  • device_id
  • is_expired

Returns:

  • (nil)

    OK



60
61
62
63
64
# File 'lib/seam/routes/devices_simulate.rb', line 60

def paid_subscription(device_id:, is_expired:)
  @client.post("/devices/simulate/paid_subscription", {device_id: device_id, is_expired: is_expired}.compact)

  nil
end

#remove(device_id:) ⇒ nil

Simulates removing a device from Seam. Only applicable for sandbox devices. See also Testing Your App Against Device Disconnection and Removal.

Parameters:

  • device_id

    ID of the device that you want to simulate removing from Seam.

Returns:

  • (nil)

    OK



69
70
71
72
73
# File 'lib/seam/routes/devices_simulate.rb', line 69

def remove(device_id:)
  @client.post("/devices/simulate/remove", {device_id: device_id}.compact)

  nil
end