Skip to content

Commit a88452b

Browse files
louis-preclaude
andauthored
fix: Fix code formatting in 2N intercom guide (#1088)
* Fix code formatting and escaped GitBook tags in 2N intercom guide Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Fix code formatting and escaped GitBook tags in ControlByWeb guide Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Split inline GitBook tags onto separate lines Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Remove empty heading before Next Steps in 2N guide Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Reorder install tabs to match Python-first convention Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 7577497 commit a88452b

2 files changed

Lines changed: 105 additions & 74 deletions

File tree

docs/brand-guides/2n-intercom-systems/get-started-with-2n-intercoms.md

Lines changed: 61 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@ Seam provides client libraries for many languages, such as JavaScript, Python, R
2828
* C# ([nuget](https://www.nuget.org/packages/Seam), [GitHub](https://github.com/seamapi/csharp))
2929

3030
{% tabs %}
31-
{% tab title="JavaScript" %}
31+
{% tab title="Python" %}
3232
```bash
33-
npm i seam
33+
pip install seam
34+
# For some development environments, use pip3 in this command instead of pip.
3435
```
3536
{% endtab %}
3637

37-
{% tab title="Python" %}
38+
{% tab title="JavaScript" %}
3839
```bash
39-
pip install seam
40-
# For some development environments, use pip3 in this command instead of pip.
40+
npm i seam
4141
```
4242
{% endtab %}
4343

@@ -196,15 +196,15 @@ After a My2N account is linked with Seam, you can retrieve devices for this My2N
196196

197197
{% tabs %}
198198
{% tab title="Python" %}
199-
\`\`\`\`python all\_locks = seam.locks.list()
200-
201-
some\_lock = all\_locks\[0]
199+
```python
200+
all_locks = seam.locks.list()
202201

203-
assert some\_lock.properties\["online"] is True assert some\_lock.properties\["locked"] is True
202+
some_lock = all_locks[0]
204203

205-
print(some\_lock)
204+
assert some_lock.properties["online"] is True
205+
assert some_lock.properties["locked"] is True
206206

207-
```python
207+
print(some_lock)
208208
# Device(
209209
# device_id='f0c074d6-34d0-4910-a16a-dfe078d5d178',
210210
# device_type='two_n_intercom',
@@ -228,9 +228,9 @@ print(some\_lock)
228228
# )
229229
```
230230

231-
\{% endtab %\}
231+
{% endtab %}
232232

233-
\{% tab title="Javascript" %\}
233+
{% tab title="Javascript" %}
234234

235235
```javascript
236236
const allLocks = await seam.locks.list()
@@ -267,22 +267,42 @@ console.log(someLock)
267267
*/
268268
```
269269

270-
\{% endtab %\}
270+
{% endtab %}
271271

272-
\{% tab title="Ruby" %\}
272+
{% tab title="Ruby" %}
273273

274274
```ruby
275275
some_lock = seam.locks.list.first
276276

277277
puts some_lock.properties.online # true
278278
puts some_lock.properties.locked # true
279279

280-
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" # <Seam::Device:0x00c8bb8
280+
puts some_lock.inspect
281+
# <Seam::Device:0x00c8bb8
282+
# device_id="580365be-4f0f-42d9-9336-07f0bba09e28"
283+
# device_type="two_n_intercom"
284+
# properties={
285+
# "online"=>true,
286+
# "locked"=>true,
287+
# "manufacturer"=>"two_n",
288+
# "serial_number"=>"ef730e77-8cc0-4290-a818-14388e9fe84f",
289+
# "two_n_metadata"=>{
290+
# "device_id"=>1,
291+
# "device_name"=>"Device 0"
292+
# },
293+
# "supported_code_lengths"=>[4, 5, 6, 7, 8],
294+
# "name"=>"Device 0",
295+
# "image_url"=>"https://connect.getseam.com/assets/images/devices/unknown-lock.png",
296+
# "image_alt_text"=>"Placeholder Lock Image"
297+
# }
298+
# created_at=2023-05-03 18:01:16.965 UTC
299+
# errors=[]
300+
# warnings=[]
281301
```
282302

283-
\{% endtab %\}
303+
{% endtab %}
284304

285-
\{% tab title="PHP" %\}
305+
{% tab title="PHP" %}
286306

287307
```php
288308
use Seam\SeamClient;
@@ -294,13 +314,16 @@ $locks = $seam->locks->list();
294314
echo json_encode($locks);
295315
```
296316

297-
\{% endtab %\} \{% endtabs %\}
317+
{% endtab %}
318+
{% endtabs %}
298319

299320
#### 4 — Locking & Unlocking a Door
300321

301322
Next, you can perform the basic action of locking and unlocking the door.
302323

303-
\{% openapi src="../.gitbook/assets/openapi.json" path="/locks/lock\_door" method="post" %\} [openapi.json](../.gitbook/assets/openapi.json) \{% endopenapi %\}
324+
{% openapi src="../.gitbook/assets/openapi.json" path="/locks/lock_door" method="post" %}
325+
[openapi.json](../.gitbook/assets/openapi.json)
326+
{% endopenapi %}
304327

305328
#### Unlock a door
306329

@@ -312,7 +335,8 @@ Next, you can perform the basic action of locking and unlocking the door.
312335
| ---------- | ------ | ----------- |
313336
| device\_id | String | |
314337

315-
\{% tabs %\} \{% tab title="Python" %\}
338+
{% tabs %}
339+
{% tab title="Python" %}
316340

317341
```python
318342
# lock the door
@@ -326,9 +350,9 @@ updated_lock = seam.locks.get(device_id: some_lock.device_id)
326350
assert updated_lock.properties["locked"] is False
327351
```
328352

329-
\{% endtab %\}
353+
{% endtab %}
330354

331-
\{% tab title="Javascript" %\}
355+
{% tab title="Javascript" %}
332356

333357
```javascript
334358
// lock the door
@@ -342,9 +366,9 @@ updatedLock = await seam.locks.get(someLock.device_id)
342366
console.log(updatedLock.properties.locked) // false
343367
```
344368

345-
\{% endtab %\}
369+
{% endtab %}
346370

347-
\{% tab title="Ruby" %\}
371+
{% tab title="Ruby" %}
348372

349373
```ruby
350374
# lock the door
@@ -358,9 +382,9 @@ updated_lock = seam.locks.get(device_id: some_lock.device_id)
358382
puts updated_lock.properties.locked # false
359383
```
360384

361-
\{% endtab %\}
385+
{% endtab %}
362386

363-
\{% tab title="PHP" %\}
387+
{% tab title="PHP" %}
364388

365389
```php
366390
use Seam\SeamClient;
@@ -375,15 +399,17 @@ $seam->locks->unlock_door($lock->device_id);
375399
$seam->locks->lock_door($lock->device_id);
376400
```
377401

378-
\{% endtab %\} \{% endtabs %\}
402+
{% endtab %}
403+
{% endtabs %}
379404

380405
#### 5 — Creating Access Codes on 2N Intercoms
381406

382407
2N devices have a directory with residents. These residents can be assigned PIN codes to unlock the door.
383408

384409
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.
385410

386-
\{% tabs %\} \{% tab title="Python" %\}
411+
{% tabs %}
412+
{% tab title="Python" %}
387413

388414
```python
389415
# create an ongoing code
@@ -419,9 +445,9 @@ seam.access_codes.list(device=some_lock)
419445

420446
```
421447

422-
\{% endtab %\}
448+
{% endtab %}
423449

424-
\{% tab title="Javascript" %\}
450+
{% tab title="Javascript" %}
425451

426452
```javascript
427453
// create an ongoing code
@@ -465,9 +491,9 @@ await seam.accessCodes.list({
465491
*/
466492
```
467493

468-
\{% endtab %\}
494+
{% endtab %}
469495

470-
\{% tab title="Ruby" %\}
496+
{% tab title="Ruby" %}
471497

472498
```ruby
473499
# create an ongoing code
@@ -515,9 +541,9 @@ seam.access_codes.list(device_id: some_lock.device_id)
515541
# access_code_id="91a08a3d-a0bb-4ff0-bfb4-ced164353988">]
516542
```
517543

518-
\{% endtab %\}
544+
{% endtab %}
519545

520-
\{% tab title="PHP" %\}
546+
{% tab title="PHP" %}
521547

522548
```
523549
@@ -543,8 +569,6 @@ $seam->access_codes->create(
543569
{% endtab %}
544570
{% endtabs %}
545571

546-
###
547-
548572
## Next Steps
549573

550574
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.

docs/brand-guides/get-started-with-controlbyweb-devices.md

Lines changed: 44 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@ Seam provides client libraries for many languages, such as JavaScript, Python, R
2121
* C# ([nuget](https://www.nuget.org/packages/Seam), [GitHub](https://github.com/seamapi/csharp))
2222

2323
{% tabs %}
24-
{% tab title="JavaScript" %}
24+
{% tab title="Python" %}
2525
```bash
26-
npm i seam
26+
pip install seam
27+
# For some development environments, use pip3 in this command instead of pip.
2728
```
2829
{% endtab %}
2930

30-
{% tab title="Python" %}
31+
{% tab title="JavaScript" %}
3132
```bash
32-
pip install seam
33-
# For some development environments, use pip3 in this command instead of pip.
33+
npm i seam
3434
```
3535
{% endtab %}
3636

@@ -163,15 +163,15 @@ After a ControlByWeb account is linked with Seam, you can retrieve devices for t
163163

164164
{% tabs %}
165165
{% tab title="Python" %}
166-
\`\`\`\`python all\_locks = seam.locks.list()
167-
168-
some\_lock = all\_locks\[0]
166+
```python
167+
all_locks = seam.locks.list()
169168

170-
assert some\_lock.properties\["online"] is True assert some\_lock.properties\["locked"] is True
169+
some_lock = all_locks[0]
171170

172-
print(some\_lock)
171+
assert some_lock.properties["online"] is True
172+
assert some_lock.properties["locked"] is True
173173

174-
```python
174+
print(some_lock)
175175
# Device(
176176
# device_id='4a570d13-9704-46e0-b69c-9fea80d6a7aa',
177177
# device_type='controlbyweb_device',
@@ -193,7 +193,9 @@ print(some\_lock)
193193
# errors=[]
194194
# )
195195
```
196+
{% endtab %}
196197

198+
{% tab title="Javascript" %}
197199
```javascript
198200
const allLocks = await seam.locks.list()
199201

@@ -230,19 +232,38 @@ console.log(someLock)
230232
}
231233
*/
232234
```
235+
{% endtab %}
233236

234-
235-
237+
{% tab title="Ruby" %}
236238
```ruby
237239
some_lock = seam.locks.list.first
238240

239241
puts some_lock.properties.online # true
240242
puts some_lock.properties.locked # true
241243

242-
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" # <Seam::Device:0x00146639380
244+
puts some_lock.inspect
245+
# <Seam::Device:0x00146639380
246+
# device_id="4a570d13-9704-46e0-b69c-9fea80d6a7aa"
247+
# device_type="controlbyweb_device"
248+
# properties={
249+
# "locked"=>true,
250+
# "online"=>true,
251+
# "manufacturer"=>"controlbyweb",
252+
# "controlbyweb_metadata"=>{
253+
# "device_id"=>"9997",
254+
# "relay_name"=>"firstRelay",
255+
# "device_name"=>"Device 2"
256+
# },
257+
# "name"=>"Device 2",
258+
# "image_url"=>"https://connect.getseam.com/assets/images/devices/unknown-lock.png",
259+
# "image_alt_text"=>"Placeholder Lock Image"
260+
# }
261+
# created_at=2023-04-25 14:34:50 UTC
262+
# errors=[]
263+
# warnings=[]
243264
```
244-
245-
\{% endtab %\} \{% endtabs %\}
265+
{% endtab %}
266+
{% endtabs %}
246267

247268
**4 — Triggering a ControlByWeb relay**
248269

@@ -258,40 +279,26 @@ Next, you can perform the basic action of triggering a relay on the device. This
258279
| ---------- | ------ | ----------- |
259280
| device\_id | String | |
260281

261-
\{% tabs %\} \{% tab title="Python" %\}
262-
282+
{% tabs %}
283+
{% tab title="Python" %}
263284
```python
264285
# trigger the relay
265286
seam.locks.unlock_door(some_lock)
266287
```
288+
{% endtab %}
267289

268-
\{% endtab %\}
269-
270-
\{% tab title="Javascript" %\}
271-
290+
{% tab title="Javascript" %}
272291
```javascript
273292
// trigger the relay
274293
await seam.locks.unlockDoor(someLock.device_id)
275294
```
295+
{% endtab %}
276296

277-
\{% endtab %\}
278-
279-
\{% tab title="Ruby" %\}
280-
281-
```
282-
283-
ruby
297+
{% tab title="Ruby" %}
298+
```ruby
284299
# trigger the relay
285300
seam.locks.unlock_door(device_id: some_lock.device_id)
286301
```
287-
{% endtab %}
288-
289-
{% tab title="Javascript" %}
290-
291-
{% endtab %}
292-
293-
{% tab title="Ruby" %}
294-
295302
{% endtab %}
296303
{% endtabs %}
297304

0 commit comments

Comments
 (0)