diff --git a/docs/brand-guides/2n-intercom-systems/get-started-with-2n-intercoms.md b/docs/brand-guides/2n-intercom-systems/get-started-with-2n-intercoms.md index 6045ce9c4..6607ab622 100644 --- a/docs/brand-guides/2n-intercom-systems/get-started-with-2n-intercoms.md +++ b/docs/brand-guides/2n-intercom-systems/get-started-with-2n-intercoms.md @@ -28,16 +28,16 @@ Seam provides client libraries for many languages, such as JavaScript, Python, R * C# ([nuget](https://www.nuget.org/packages/Seam), [GitHub](https://github.com/seamapi/csharp)) {% tabs %} -{% tab title="JavaScript" %} +{% tab title="Python" %} ```bash -npm i seam +pip install seam +# For some development environments, use pip3 in this command instead of pip. ``` {% endtab %} -{% tab title="Python" %} +{% tab title="JavaScript" %} ```bash -pip install seam -# For some development environments, use pip3 in this command instead of pip. +npm i seam ``` {% endtab %} @@ -196,15 +196,15 @@ After a My2N account is linked with Seam, you can retrieve devices for this My2N {% tabs %} {% tab title="Python" %} -\`\`\`\`python all\_locks = seam.locks.list() - -some\_lock = all\_locks\[0] +```python +all_locks = seam.locks.list() -assert some\_lock.properties\["online"] is True assert some\_lock.properties\["locked"] is True +some_lock = all_locks[0] -print(some\_lock) +assert some_lock.properties["online"] is True +assert some_lock.properties["locked"] is True -```python +print(some_lock) # Device( # device_id='f0c074d6-34d0-4910-a16a-dfe078d5d178', # device_type='two_n_intercom', @@ -228,9 +228,9 @@ print(some\_lock) # ) ``` -\{% endtab %\} +{% endtab %} -\{% tab title="Javascript" %\} +{% tab title="Javascript" %} ```javascript const allLocks = await seam.locks.list() @@ -267,9 +267,9 @@ console.log(someLock) */ ``` -\{% endtab %\} +{% endtab %} -\{% tab title="Ruby" %\} +{% tab title="Ruby" %} ```ruby some_lock = seam.locks.list.first @@ -277,12 +277,32 @@ some_lock = seam.locks.list.first puts some_lock.properties.online # true puts some_lock.properties.locked # true -puts some_lock.inspect # > # warnings=[] # errors=[] # created_at=2023-05-03 18:01:16.965 UTC # } # "image_alt_text"=>"Placeholder Lock Image" # "image_url"=>"https://connect.getseam.com/assets/images/devices/unknown-lock.png", # "name"=>"Device 0", # "supported_code_lengths"=>[4, 5, 6, 7, 8], # }, # "device_name"=>"Device 0" # "device_id"=>1, # "two_n_metadata"=>{ # "serial_number"=>"ef730e77-8cc0-4290-a818-14388e9fe84f", # "manufacturer"=>"two_n", # "locked"=>true, # "online"=>true, # properties={ # device_type="two_n_intercom" # device_id="580365be-4f0f-42d9-9336-07f0bba09e28" # true, +# "locked"=>true, +# "manufacturer"=>"two_n", +# "serial_number"=>"ef730e77-8cc0-4290-a818-14388e9fe84f", +# "two_n_metadata"=>{ +# "device_id"=>1, +# "device_name"=>"Device 0" +# }, +# "supported_code_lengths"=>[4, 5, 6, 7, 8], +# "name"=>"Device 0", +# "image_url"=>"https://connect.getseam.com/assets/images/devices/unknown-lock.png", +# "image_alt_text"=>"Placeholder Lock Image" +# } +# created_at=2023-05-03 18:01:16.965 UTC +# errors=[] +# warnings=[] ``` -\{% endtab %\} +{% endtab %} -\{% tab title="PHP" %\} +{% tab title="PHP" %} ```php use Seam\SeamClient; @@ -294,13 +314,16 @@ $locks = $seam->locks->list(); echo json_encode($locks); ``` -\{% endtab %\} \{% endtabs %\} +{% endtab %} +{% endtabs %} #### 4 — Locking & Unlocking a Door Next, you can perform the basic action of locking and unlocking the door. -\{% openapi src="../.gitbook/assets/openapi.json" path="/locks/lock\_door" method="post" %\} [openapi.json](../.gitbook/assets/openapi.json) \{% endopenapi %\} +{% openapi src="../.gitbook/assets/openapi.json" path="/locks/lock_door" method="post" %} +[openapi.json](../.gitbook/assets/openapi.json) +{% endopenapi %} #### Unlock a door @@ -312,7 +335,8 @@ Next, you can perform the basic action of locking and unlocking the door. | ---------- | ------ | ----------- | | device\_id | String | | -\{% tabs %\} \{% tab title="Python" %\} +{% tabs %} +{% tab title="Python" %} ```python # lock the door @@ -326,9 +350,9 @@ updated_lock = seam.locks.get(device_id: some_lock.device_id) assert updated_lock.properties["locked"] is False ``` -\{% endtab %\} +{% endtab %} -\{% tab title="Javascript" %\} +{% tab title="Javascript" %} ```javascript // lock the door @@ -342,9 +366,9 @@ updatedLock = await seam.locks.get(someLock.device_id) console.log(updatedLock.properties.locked) // false ``` -\{% endtab %\} +{% endtab %} -\{% tab title="Ruby" %\} +{% tab title="Ruby" %} ```ruby # lock the door @@ -358,9 +382,9 @@ updated_lock = seam.locks.get(device_id: some_lock.device_id) puts updated_lock.properties.locked # false ``` -\{% endtab %\} +{% endtab %} -\{% tab title="PHP" %\} +{% tab title="PHP" %} ```php use Seam\SeamClient; @@ -375,7 +399,8 @@ $seam->locks->unlock_door($lock->device_id); $seam->locks->lock_door($lock->device_id); ``` -\{% endtab %\} \{% endtabs %\} +{% endtab %} +{% endtabs %} #### 5 — Creating Access Codes on 2N Intercoms @@ -383,7 +408,8 @@ $seam->locks->lock_door($lock->device_id); Seam maps these residents to [access codes](https://docs.seam.co/latest/capability-guides/smart-locks/access-codes) and allows you to create and manage them through the Seam API. -\{% tabs %\} \{% tab title="Python" %\} +{% tabs %} +{% tab title="Python" %} ```python # create an ongoing code @@ -419,9 +445,9 @@ seam.access_codes.list(device=some_lock) ``` -\{% endtab %\} +{% endtab %} -\{% tab title="Javascript" %\} +{% tab title="Javascript" %} ```javascript // create an ongoing code @@ -465,9 +491,9 @@ await seam.accessCodes.list({ */ ``` -\{% endtab %\} +{% endtab %} -\{% tab title="Ruby" %\} +{% tab title="Ruby" %} ```ruby # create an ongoing code @@ -515,9 +541,9 @@ seam.access_codes.list(device_id: some_lock.device_id) # access_code_id="91a08a3d-a0bb-4ff0-bfb4-ced164353988">] ``` -\{% endtab %\} +{% endtab %} -\{% tab title="PHP" %\} +{% tab title="PHP" %} ``` @@ -543,8 +569,6 @@ $seam->access_codes->create( {% endtab %} {% endtabs %} -### - ## Next Steps Now that you've completed this guide, you can try to connect a real 2N device. To do so, make sure to switch to a non-sandbox workspace and API key as real devices cannot be connected to sandbox workspaces. diff --git a/docs/brand-guides/get-started-with-controlbyweb-devices.md b/docs/brand-guides/get-started-with-controlbyweb-devices.md index 598ddbd8e..f62163728 100644 --- a/docs/brand-guides/get-started-with-controlbyweb-devices.md +++ b/docs/brand-guides/get-started-with-controlbyweb-devices.md @@ -21,16 +21,16 @@ Seam provides client libraries for many languages, such as JavaScript, Python, R * C# ([nuget](https://www.nuget.org/packages/Seam), [GitHub](https://github.com/seamapi/csharp)) {% tabs %} -{% tab title="JavaScript" %} +{% tab title="Python" %} ```bash -npm i seam +pip install seam +# For some development environments, use pip3 in this command instead of pip. ``` {% endtab %} -{% tab title="Python" %} +{% tab title="JavaScript" %} ```bash -pip install seam -# For some development environments, use pip3 in this command instead of pip. +npm i seam ``` {% endtab %} @@ -163,15 +163,15 @@ After a ControlByWeb account is linked with Seam, you can retrieve devices for t {% tabs %} {% tab title="Python" %} -\`\`\`\`python all\_locks = seam.locks.list() - -some\_lock = all\_locks\[0] +```python +all_locks = seam.locks.list() -assert some\_lock.properties\["online"] is True assert some\_lock.properties\["locked"] is True +some_lock = all_locks[0] -print(some\_lock) +assert some_lock.properties["online"] is True +assert some_lock.properties["locked"] is True -```python +print(some_lock) # Device( # device_id='4a570d13-9704-46e0-b69c-9fea80d6a7aa', # device_type='controlbyweb_device', @@ -193,7 +193,9 @@ print(some\_lock) # errors=[] # ) ``` +{% endtab %} +{% tab title="Javascript" %} ```javascript const allLocks = await seam.locks.list() @@ -230,19 +232,38 @@ console.log(someLock) } */ ``` +{% endtab %} - - +{% tab title="Ruby" %} ```ruby some_lock = seam.locks.list.first puts some_lock.properties.online # true puts some_lock.properties.locked # true -puts some_lock.inspect # > # warnings=[] # errors=[] # created_at=2023-04-25 14:34:50 UTC # } # "image_alt_text"=>"Placeholder Lock Image" # "image_url"=>"https://connect.getseam.com/assets/images/devices/unknown-lock.png", # "name"=>"Device 2", # }, # "device_name"=>"Device 2" # "relay_name"=>"firstRelay", # "device_id"=>"9997", # "controlbyweb_metadata"=>{ # "manufacturer"=>"controlbyweb", # "online"=>true, # "locked"=>true, # properties={ # device_type="controlbyweb_device" # device_id="4a570d13-9704-46e0-b69c-9fea80d6a7aa" # true, +# "online"=>true, +# "manufacturer"=>"controlbyweb", +# "controlbyweb_metadata"=>{ +# "device_id"=>"9997", +# "relay_name"=>"firstRelay", +# "device_name"=>"Device 2" +# }, +# "name"=>"Device 2", +# "image_url"=>"https://connect.getseam.com/assets/images/devices/unknown-lock.png", +# "image_alt_text"=>"Placeholder Lock Image" +# } +# created_at=2023-04-25 14:34:50 UTC +# errors=[] +# warnings=[] ``` - -\{% endtab %\} \{% endtabs %\} +{% endtab %} +{% endtabs %} **4 — Triggering a ControlByWeb relay** @@ -258,40 +279,26 @@ Next, you can perform the basic action of triggering a relay on the device. This | ---------- | ------ | ----------- | | device\_id | String | | -\{% tabs %\} \{% tab title="Python" %\} - +{% tabs %} +{% tab title="Python" %} ```python # trigger the relay seam.locks.unlock_door(some_lock) ``` +{% endtab %} -\{% endtab %\} - -\{% tab title="Javascript" %\} - +{% tab title="Javascript" %} ```javascript // trigger the relay await seam.locks.unlockDoor(someLock.device_id) ``` +{% endtab %} -\{% endtab %\} - -\{% tab title="Ruby" %\} - -``` - -ruby +{% tab title="Ruby" %} +```ruby # trigger the relay seam.locks.unlock_door(device_id: some_lock.device_id) ``` -{% endtab %} - -{% tab title="Javascript" %} - -{% endtab %} - -{% tab title="Ruby" %} - {% endtab %} {% endtabs %}