seam 2.143.0 → 2.145.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/README.md +11 -7
- data/lib/seam/base_resource.rb +24 -3
- data/lib/seam/resources/access_code.rb +682 -43
- data/lib/seam/resources/access_grant.rb +189 -25
- data/lib/seam/resources/access_method.rb +105 -3
- data/lib/seam/resources/acs_access_group.rb +52 -0
- data/lib/seam/resources/acs_credential.rb +153 -6
- data/lib/seam/resources/acs_encoder.rb +2 -0
- data/lib/seam/resources/acs_entrance.rb +105 -0
- data/lib/seam/resources/acs_system.rb +278 -6
- data/lib/seam/resources/acs_user.rb +201 -0
- data/lib/seam/resources/action_attempt.rb +1457 -279
- data/lib/seam/resources/connect_webview.rb +14 -0
- data/lib/seam/resources/connected_account.rb +284 -40
- data/lib/seam/resources/device.rb +928 -13
- data/lib/seam/resources/device_provider.rb +74 -0
- data/lib/seam/resources/event.rb +5205 -316
- data/lib/seam/resources/phone.rb +3 -0
- data/lib/seam/resources/unmanaged_access_code.rb +677 -43
- data/lib/seam/resources/unmanaged_access_grant.rb +189 -25
- data/lib/seam/resources/unmanaged_access_method.rb +105 -3
- data/lib/seam/resources/unmanaged_device.rb +826 -13
- data/lib/seam/resources/unmanaged_user_identity.rb +67 -0
- data/lib/seam/resources/user_identity.rb +67 -0
- data/lib/seam/resources/workspace.rb +3 -0
- data/lib/seam/routes/access_codes.rb +1 -1
- data/lib/seam/routes/access_grants.rb +2 -2
- data/lib/seam/routes/access_methods.rb +1 -1
- data/lib/seam/routes/acs_encoders.rb +1 -1
- data/lib/seam/routes/acs_entrances.rb +2 -2
- data/lib/seam/routes/action_attempts.rb +1 -1
- data/lib/seam/routes/connect_webviews.rb +1 -1
- data/lib/seam/routes/connected_accounts.rb +1 -1
- data/lib/seam/routes/customers.rb +1 -1
- data/lib/seam/routes/devices.rb +1 -1
- data/lib/seam/routes/devices_unmanaged.rb +1 -1
- data/lib/seam/routes/events.rb +1 -1
- data/lib/seam/routes/locks.rb +1 -1
- data/lib/seam/routes/noise_sensors.rb +1 -1
- data/lib/seam/routes/spaces.rb +3 -3
- data/lib/seam/routes/thermostats.rb +1 -1
- data/lib/seam/routes/user_identities.rb +1 -1
- data/lib/seam/version.rb +1 -1
- data/lib/seam/webhook.rb +5 -2
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 86d8cf2a61186f64568c6604e6917819447ff105c6921f7cf62ee66d50e1299f
|
|
4
|
+
data.tar.gz: 9d1d7eaf0d580309207c73b88e22800907cca39bf70e77d089a5a75864f21b82
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c9044764690069612b01f145aa5fe1b02fe2d5ac1c0f7bea8b05f68f616abac06830fa387f203d0d5d430b7b18cbaee0cd2ceeec3e7e1bae953a88a18a3294dc
|
|
7
|
+
data.tar.gz: 9f2f841bdd627b134e4eaa621ad71c1570f21a3829284f01cbaec8faa95b9079894232144bfd9c5aa5828a1c643ac0072634c35838bbb1d04f8b066561bf14e9
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
seam (2.
|
|
4
|
+
seam (2.145.0)
|
|
5
5
|
faraday (~> 2.7)
|
|
6
6
|
faraday-retry (~> 2.2)
|
|
7
7
|
svix (~> 1.30)
|
|
@@ -171,7 +171,7 @@ CHECKSUMS
|
|
|
171
171
|
rubocop-ast (1.50.0) sha256=b9ca88300da0803ee222ad20cdb30494c0a784eed06fdc35d254b06d662788db
|
|
172
172
|
rubocop-performance (1.26.1) sha256=cd19b936ff196df85829d264b522fd4f98b6c89ad271fa52744a8c11b8f71834
|
|
173
173
|
ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33
|
|
174
|
-
seam (2.
|
|
174
|
+
seam (2.145.0)
|
|
175
175
|
simplecov (1.1.1) sha256=25825ef13f0b2e74694d769817dad6ab8e90131dabdaa666e522fea105521e78
|
|
176
176
|
simplecov-console (0.9.5) sha256=b1108bcfff5f210143e2b8301698c367b01586f20d25a73e95475a5df6fc6ff6
|
|
177
177
|
standard (1.56.0) sha256=ae2af4d9669589162ac69ed5ef59dcf9f346d4afc81f7e62b84339310dfcb787
|
data/README.md
CHANGED
|
@@ -383,8 +383,9 @@ workspaces = seam.workspaces.list
|
|
|
383
383
|
|
|
384
384
|
### Webhooks
|
|
385
385
|
|
|
386
|
-
The Seam API implements webhooks using [Svix](https://www.svix.com).This SDK exports a thin wrapper `Seam::Webhook` around the svix package.
|
|
386
|
+
The Seam API implements webhooks using [Svix](https://www.svix.com). This SDK exports a thin wrapper `Seam::Webhook` around the svix package.
|
|
387
387
|
Use it to parse and validate Seam webhook events.
|
|
388
|
+
Known event types load as `Seam::Resources::SeamEvent` subclasses with only that event's accessors; unknown types remain generic `SeamEvent` instances for forward compatibility.
|
|
388
389
|
|
|
389
390
|
> [!TIP]
|
|
390
391
|
> This example is for [Sinatra](https://sinatrarb.com/), see the [Svix docs for more examples in specific frameworks](https://docs.svix.com/receiving/verifying-payloads/how).
|
|
@@ -402,23 +403,26 @@ post "/webhook" do
|
|
|
402
403
|
"svix-signature" => request.env["HTTP_SVIX_SIGNATURE"],
|
|
403
404
|
"svix-timestamp" => request.env["HTTP_SVIX_TIMESTAMP"]
|
|
404
405
|
}
|
|
405
|
-
|
|
406
|
+
event = webhook.verify(request.body.read, headers)
|
|
406
407
|
rescue Seam::WebhookVerificationError
|
|
407
408
|
halt 400, "Bad Request"
|
|
408
409
|
end
|
|
409
410
|
|
|
410
411
|
begin
|
|
411
|
-
|
|
412
|
+
case event.event_type
|
|
413
|
+
when "access_code.created"
|
|
414
|
+
puts "Access code created: #{event.access_code_id}"
|
|
415
|
+
when "device.connected"
|
|
416
|
+
puts "Device connected: #{event.device_id}"
|
|
417
|
+
else
|
|
418
|
+
puts event
|
|
419
|
+
end
|
|
412
420
|
rescue
|
|
413
421
|
halt 500, "Internal Server Error"
|
|
414
422
|
end
|
|
415
423
|
|
|
416
424
|
204
|
|
417
425
|
end
|
|
418
|
-
|
|
419
|
-
def store_event(data)
|
|
420
|
-
puts data
|
|
421
|
-
end
|
|
422
426
|
```
|
|
423
427
|
|
|
424
428
|
### Advanced Usage
|
data/lib/seam/base_resource.rb
CHANGED
|
@@ -23,12 +23,23 @@ module Seam
|
|
|
23
23
|
return nil if data.nil?
|
|
24
24
|
|
|
25
25
|
if data.is_a?(Array)
|
|
26
|
-
data.map { |
|
|
26
|
+
data.map { |item| load_from_response(item, client) }
|
|
27
27
|
else
|
|
28
|
-
|
|
28
|
+
resource_class = if data.is_a?(Hash) && @discriminator
|
|
29
|
+
value = data[@discriminator] || data[@discriminator.to_sym]
|
|
30
|
+
@discriminated_variants.fetch(value, self)
|
|
31
|
+
else
|
|
32
|
+
self
|
|
33
|
+
end
|
|
34
|
+
resource_class.new(data, client)
|
|
29
35
|
end
|
|
30
36
|
end
|
|
31
37
|
|
|
38
|
+
def self.discriminated_by(attribute, variants)
|
|
39
|
+
@discriminator = attribute.to_s
|
|
40
|
+
@discriminated_variants = variants
|
|
41
|
+
end
|
|
42
|
+
|
|
32
43
|
def inspect
|
|
33
44
|
"<#{self.class.name}:#{"0x00%x" % (object_id << 1)}\n" + # rubocop:disable Style/StringConcatenation, Style/FormatString
|
|
34
45
|
instance_variables
|
|
@@ -50,6 +61,11 @@ module Seam
|
|
|
50
61
|
attr_accessor attr
|
|
51
62
|
end
|
|
52
63
|
|
|
64
|
+
def self.aliased_accessor(attr, from:)
|
|
65
|
+
attribute_aliases[from.to_s] = attr
|
|
66
|
+
attr_accessor attr
|
|
67
|
+
end
|
|
68
|
+
|
|
53
69
|
def self.resource_list_accessor(attr, resource_class)
|
|
54
70
|
resource_list_accessors[attr.to_s] = resource_class
|
|
55
71
|
attr_writer attr
|
|
@@ -70,6 +86,10 @@ module Seam
|
|
|
70
86
|
@resource_list_accessors ||= {}
|
|
71
87
|
end
|
|
72
88
|
|
|
89
|
+
def self.attribute_aliases
|
|
90
|
+
@attribute_aliases ||= {}
|
|
91
|
+
end
|
|
92
|
+
|
|
73
93
|
def self.date_accessor(*attrs)
|
|
74
94
|
attrs.each do |attr|
|
|
75
95
|
define_method(attr) do
|
|
@@ -99,7 +119,8 @@ module Seam
|
|
|
99
119
|
else
|
|
100
120
|
process_hash_value(value)
|
|
101
121
|
end
|
|
102
|
-
|
|
122
|
+
attribute = self.class.attribute_aliases.fetch(key.to_s, key)
|
|
123
|
+
instance_variable_set(:"@#{attribute}", value)
|
|
103
124
|
end
|
|
104
125
|
end
|
|
105
126
|
|