seam 2.138.0 → 2.140.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 +69 -66
- data/README.md +12 -0
- data/lib/seam/http_single_workspace.rb +34 -2
- data/lib/seam/http_without_workspace.rb +41 -12
- data/lib/seam/paginator.rb +4 -1
- data/lib/seam/request.rb +5 -1
- data/lib/seam/resources/access_code.rb +74 -0
- data/lib/seam/resources/access_grant.rb +60 -0
- data/lib/seam/resources/access_method.rb +39 -0
- data/lib/seam/resources/acs_access_group.rb +45 -0
- data/lib/seam/resources/acs_credential.rb +67 -0
- data/lib/seam/resources/acs_encoder.rb +11 -0
- data/lib/seam/resources/acs_entrance.rb +95 -0
- data/lib/seam/resources/acs_system.rb +36 -0
- data/lib/seam/resources/acs_user.rb +66 -0
- data/lib/seam/resources/action_attempt.rb +192 -0
- data/lib/seam/resources/batch.rb +24 -0
- data/lib/seam/resources/client_session.rb +12 -0
- data/lib/seam/resources/connect_webview.rb +19 -0
- data/lib/seam/resources/connected_account.rb +50 -0
- data/lib/seam/resources/customer_portal.rb +5 -0
- data/lib/seam/resources/device.rb +622 -4
- data/lib/seam/resources/device_provider.rb +24 -0
- data/lib/seam/resources/event.rb +142 -3
- data/lib/seam/resources/instant_key.rb +13 -0
- data/lib/seam/resources/noise_threshold.rb +7 -0
- data/lib/seam/resources/pagination.rb +3 -0
- data/lib/seam/resources/phone.rb +29 -0
- data/lib/seam/resources/space.rb +19 -0
- data/lib/seam/resources/thermostat_daily_program.rb +9 -0
- data/lib/seam/resources/thermostat_schedule.rb +15 -0
- data/lib/seam/resources/unmanaged_access_code.rb +51 -0
- data/lib/seam/resources/unmanaged_access_grant.rb +56 -0
- data/lib/seam/resources/unmanaged_access_method.rb +36 -0
- data/lib/seam/resources/unmanaged_device.rb +80 -0
- data/lib/seam/resources/unmanaged_user_identity.rb +20 -0
- data/lib/seam/resources/user_identity.rb +21 -0
- data/lib/seam/resources/webhook.rb +4 -0
- data/lib/seam/resources/workspace.rb +15 -0
- data/lib/seam/routes/access_codes.rb +79 -79
- data/lib/seam/routes/access_codes_simulate.rb +3 -3
- data/lib/seam/routes/access_codes_unmanaged.rb +27 -23
- data/lib/seam/routes/access_grants.rb +57 -45
- data/lib/seam/routes/access_grants_unmanaged.rb +13 -13
- data/lib/seam/routes/access_methods.rb +32 -24
- data/lib/seam/routes/access_methods_unmanaged.rb +7 -7
- data/lib/seam/routes/acs_access_groups.rb +21 -21
- data/lib/seam/routes/acs_credentials.rb +40 -40
- data/lib/seam/routes/acs_encoders.rb +16 -16
- data/lib/seam/routes/acs_encoders_simulate.rb +11 -11
- data/lib/seam/routes/acs_entrances.rb +20 -20
- data/lib/seam/routes/acs_systems.rb +11 -11
- data/lib/seam/routes/acs_users.rb +83 -55
- data/lib/seam/routes/action_attempts.rb +6 -6
- data/lib/seam/routes/client_sessions.rb +38 -34
- data/lib/seam/routes/connect_webviews.rb +20 -20
- data/lib/seam/routes/connected_accounts.rb +24 -20
- data/lib/seam/routes/connected_accounts_simulate.rb +1 -1
- data/lib/seam/routes/customers.rb +50 -50
- data/lib/seam/routes/devices.rb +33 -29
- data/lib/seam/routes/devices_simulate.rb +7 -7
- data/lib/seam/routes/devices_unmanaged.rb +25 -26
- data/lib/seam/routes/events.rb +40 -32
- data/lib/seam/routes/instant_keys.rb +11 -7
- data/lib/seam/routes/locks.rb +20 -27
- data/lib/seam/routes/locks_simulate.rb +3 -3
- data/lib/seam/routes/noise_sensors.rb +8 -19
- data/lib/seam/routes/noise_sensors_noise_thresholds.rb +21 -21
- data/lib/seam/routes/noise_sensors_simulate.rb +1 -1
- data/lib/seam/routes/phones.rb +7 -7
- data/lib/seam/routes/phones_simulate.rb +4 -4
- data/lib/seam/routes/spaces.rb +53 -45
- data/lib/seam/routes/thermostats.rb +75 -86
- data/lib/seam/routes/thermostats_daily_programs.rb +9 -9
- data/lib/seam/routes/thermostats_schedules.rb +22 -22
- data/lib/seam/routes/thermostats_simulate.rb +9 -9
- data/lib/seam/routes/user_identities.rb +50 -46
- data/lib/seam/routes/user_identities_unmanaged.rb +11 -11
- data/lib/seam/routes/webhooks.rb +10 -10
- data/lib/seam/routes/workspaces.rb +19 -19
- data/lib/seam/version.rb +1 -1
- metadata +8 -11
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 564fdfd341da5fc43c859ba3a1bb7d013b40845ffbab7e0e05f917493b974821
|
|
4
|
+
data.tar.gz: a9ce5bded784a3153d98b85d6fcaaa1625837f84e9078c94a6c372e9a4a2eb24
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1cbe2df337d9004d747493a81330ccceda4caa1476e38d0907670b9f47d16bd4e5036a2745c958ca203ff0154e773ef91339769881da525a30ef2839f4d93761
|
|
7
|
+
data.tar.gz: 0d69f48f2499b5f2275e44ddce95be1ffa50a417e8430374197f6a976fef7691facf1fdf80f247a8dfe0f166f2a32a966b79e74c7c851252e3df5fb502e46332
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
seam (2.
|
|
4
|
+
seam (2.140.0)
|
|
5
5
|
faraday (~> 2.7)
|
|
6
6
|
faraday-retry (~> 2.2)
|
|
7
7
|
svix (~> 1.30)
|
|
@@ -9,106 +9,109 @@ PATH
|
|
|
9
9
|
GEM
|
|
10
10
|
remote: https://rubygems.org/
|
|
11
11
|
specs:
|
|
12
|
-
addressable (2.
|
|
13
|
-
public_suffix (>= 2.0.2, <
|
|
14
|
-
ansi (1.
|
|
15
|
-
ast (2.4.
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
addressable (2.9.0)
|
|
13
|
+
public_suffix (>= 2.0.2, < 8.0)
|
|
14
|
+
ansi (1.6.0)
|
|
15
|
+
ast (2.4.3)
|
|
16
|
+
base64 (0.3.0)
|
|
17
|
+
bigdecimal (4.1.2)
|
|
18
|
+
crack (1.0.1)
|
|
18
19
|
bigdecimal
|
|
19
20
|
rexml
|
|
20
|
-
diff-lcs (1.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
faraday-net_http (>= 2.0, < 3.4)
|
|
21
|
+
diff-lcs (1.6.2)
|
|
22
|
+
faraday (2.14.3)
|
|
23
|
+
faraday-net_http (>= 2.0, < 3.5)
|
|
24
24
|
json
|
|
25
25
|
logger
|
|
26
|
-
faraday-net_http (3.
|
|
27
|
-
net-http
|
|
28
|
-
faraday-retry (2.
|
|
26
|
+
faraday-net_http (3.4.4)
|
|
27
|
+
net-http (~> 0.5)
|
|
28
|
+
faraday-retry (2.4.0)
|
|
29
29
|
faraday (~> 2.0)
|
|
30
|
-
gem-release (2.2.
|
|
31
|
-
hashdiff (1.1
|
|
32
|
-
json (2.
|
|
33
|
-
language_server-protocol (3.17.0.
|
|
30
|
+
gem-release (2.2.4)
|
|
31
|
+
hashdiff (1.2.1)
|
|
32
|
+
json (2.21.2)
|
|
33
|
+
language_server-protocol (3.17.0.6)
|
|
34
34
|
lint_roller (1.1.0)
|
|
35
|
-
logger (1.
|
|
36
|
-
multi_json (1.
|
|
37
|
-
net-http (0.
|
|
38
|
-
uri
|
|
39
|
-
parallel (1.
|
|
35
|
+
logger (1.7.0)
|
|
36
|
+
multi_json (1.21.1)
|
|
37
|
+
net-http (0.9.1)
|
|
38
|
+
uri (>= 0.11.1)
|
|
39
|
+
parallel (2.1.0)
|
|
40
40
|
parse_gemspec (1.0.0)
|
|
41
41
|
parse_gemspec-cli (1.0.0)
|
|
42
42
|
multi_json
|
|
43
43
|
parse_gemspec
|
|
44
44
|
thor
|
|
45
|
-
parser (3.3.
|
|
45
|
+
parser (3.3.12.0)
|
|
46
46
|
ast (~> 2.4.1)
|
|
47
47
|
racc
|
|
48
|
-
|
|
48
|
+
prism (1.9.0)
|
|
49
|
+
public_suffix (7.0.5)
|
|
49
50
|
racc (1.8.1)
|
|
50
51
|
rainbow (3.1.1)
|
|
51
|
-
rake (13.2
|
|
52
|
-
regexp_parser (2.
|
|
53
|
-
rexml (3.
|
|
54
|
-
rspec (3.13.
|
|
52
|
+
rake (13.4.2)
|
|
53
|
+
regexp_parser (2.12.0)
|
|
54
|
+
rexml (3.4.4)
|
|
55
|
+
rspec (3.13.2)
|
|
55
56
|
rspec-core (~> 3.13.0)
|
|
56
57
|
rspec-expectations (~> 3.13.0)
|
|
57
58
|
rspec-mocks (~> 3.13.0)
|
|
58
|
-
rspec-core (3.13.
|
|
59
|
+
rspec-core (3.13.6)
|
|
59
60
|
rspec-support (~> 3.13.0)
|
|
60
|
-
rspec-expectations (3.13.
|
|
61
|
+
rspec-expectations (3.13.5)
|
|
61
62
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
62
63
|
rspec-support (~> 3.13.0)
|
|
63
|
-
rspec-mocks (3.13.
|
|
64
|
+
rspec-mocks (3.13.8)
|
|
64
65
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
65
66
|
rspec-support (~> 3.13.0)
|
|
66
|
-
rspec-support (3.13.
|
|
67
|
-
rubocop (1.
|
|
67
|
+
rspec-support (3.13.7)
|
|
68
|
+
rubocop (1.88.2)
|
|
68
69
|
json (~> 2.3)
|
|
69
|
-
language_server-protocol (
|
|
70
|
-
|
|
70
|
+
language_server-protocol (~> 3.17.0.2)
|
|
71
|
+
lint_roller (~> 1.1.0)
|
|
72
|
+
parallel (>= 1.10)
|
|
71
73
|
parser (>= 3.3.0.2)
|
|
72
74
|
rainbow (>= 2.2.2, < 4.0)
|
|
73
|
-
regexp_parser (>= 2.
|
|
74
|
-
rubocop-ast (>= 1.
|
|
75
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
|
76
|
+
rubocop-ast (>= 1.49.0, < 2.0)
|
|
75
77
|
ruby-progressbar (~> 1.7)
|
|
76
|
-
unicode-display_width (>= 2.4.0, <
|
|
77
|
-
rubocop-ast (1.
|
|
78
|
-
parser (>= 3.3.
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
78
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
|
79
|
+
rubocop-ast (1.50.0)
|
|
80
|
+
parser (>= 3.3.7.2)
|
|
81
|
+
prism (~> 1.7)
|
|
82
|
+
rubocop-performance (1.26.1)
|
|
83
|
+
lint_roller (~> 1.1)
|
|
84
|
+
rubocop (>= 1.75.0, < 2.0)
|
|
85
|
+
rubocop-ast (>= 1.47.1, < 2.0)
|
|
82
86
|
ruby-progressbar (1.13.0)
|
|
83
|
-
simplecov (
|
|
84
|
-
|
|
85
|
-
simplecov-html (~> 0.11)
|
|
86
|
-
simplecov_json_formatter (~> 0.1)
|
|
87
|
-
simplecov-console (0.9.2)
|
|
87
|
+
simplecov (1.1.1)
|
|
88
|
+
simplecov-console (0.9.5)
|
|
88
89
|
ansi
|
|
89
90
|
simplecov
|
|
90
91
|
terminal-table
|
|
91
|
-
|
|
92
|
-
simplecov_json_formatter (0.1.4)
|
|
93
|
-
standard (1.41.1)
|
|
92
|
+
standard (1.56.0)
|
|
94
93
|
language_server-protocol (~> 3.17.0.2)
|
|
95
94
|
lint_roller (~> 1.0)
|
|
96
|
-
rubocop (~> 1.
|
|
95
|
+
rubocop (~> 1.88.0)
|
|
97
96
|
standard-custom (~> 1.0.0)
|
|
98
|
-
standard-performance (~> 1.
|
|
97
|
+
standard-performance (~> 1.8)
|
|
99
98
|
standard-custom (1.0.2)
|
|
100
99
|
lint_roller (~> 1.0)
|
|
101
100
|
rubocop (~> 1.50)
|
|
102
|
-
standard-performance (1.
|
|
101
|
+
standard-performance (1.9.0)
|
|
103
102
|
lint_roller (~> 1.1)
|
|
104
|
-
rubocop-performance (~> 1.
|
|
105
|
-
svix (1.
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
103
|
+
rubocop-performance (~> 1.26.0)
|
|
104
|
+
svix (1.99.1)
|
|
105
|
+
base64 (~> 0.3.0)
|
|
106
|
+
logger (~> 1.0)
|
|
107
|
+
terminal-table (4.0.0)
|
|
108
|
+
unicode-display_width (>= 1.1.1, < 4)
|
|
109
|
+
thor (1.5.0)
|
|
110
|
+
unicode-display_width (3.2.0)
|
|
111
|
+
unicode-emoji (~> 4.1)
|
|
112
|
+
unicode-emoji (4.2.0)
|
|
113
|
+
uri (1.1.1)
|
|
114
|
+
webmock (3.26.2)
|
|
112
115
|
addressable (>= 2.8.0)
|
|
113
116
|
crack (>= 0.3.2)
|
|
114
117
|
hashdiff (>= 0.4.0, < 2.0.0)
|
|
@@ -124,10 +127,10 @@ DEPENDENCIES
|
|
|
124
127
|
rake (~> 13.0)
|
|
125
128
|
rspec (~> 3.0)
|
|
126
129
|
seam!
|
|
127
|
-
simplecov (~>
|
|
130
|
+
simplecov (~> 1.1)
|
|
128
131
|
simplecov-console (~> 0.9)
|
|
129
132
|
standard (~> 1.3)
|
|
130
|
-
webmock (~> 3.
|
|
133
|
+
webmock (~> 3.26.2)
|
|
131
134
|
|
|
132
135
|
BUNDLED WITH
|
|
133
|
-
2.5.
|
|
136
|
+
2.5.22
|
data/README.md
CHANGED
|
@@ -39,6 +39,7 @@ accurate and fully typed.
|
|
|
39
39
|
- [Additional Options](#additional-options)
|
|
40
40
|
- [Setting the endpoint](#setting-the-endpoint)
|
|
41
41
|
- [Setting the request timeout](#setting-the-request-timeout)
|
|
42
|
+
- [Retry behavior](#retry-behavior)
|
|
42
43
|
- [Configuring the Faraday Client](#configuring-the-faraday-client)
|
|
43
44
|
- [Using the Faraday Client](#using-the-faraday-client)
|
|
44
45
|
- [Overriding the Client](#overriding-the-client)
|
|
@@ -443,6 +444,17 @@ seam = Seam.new(
|
|
|
443
444
|
|
|
444
445
|
A request that exceeds the timeout raises `Faraday::TimeoutError`.
|
|
445
446
|
|
|
447
|
+
#### Retry behavior
|
|
448
|
+
|
|
449
|
+
By default, the SDK makes up to three attempts: the initial request and two
|
|
450
|
+
retries. Retries are limited to `GET`, `HEAD`, `OPTIONS`, `PUT`, and `DELETE`
|
|
451
|
+
requests that fail because of a transport error, timeout, HTTP 429 response, or
|
|
452
|
+
HTTP 5xx response. `POST` and `PATCH` requests are not retried.
|
|
453
|
+
|
|
454
|
+
Retries use exponential backoff with jitter: approximately 200–240 ms before
|
|
455
|
+
the first retry and 400–480 ms before the second. A longer `Retry-After` header
|
|
456
|
+
is honored. The request timeout is reset for each attempt.
|
|
457
|
+
|
|
446
458
|
#### Configuring the Faraday Client
|
|
447
459
|
|
|
448
460
|
The Faraday client and retry behavior may be configured with custom initiation options
|
|
@@ -16,13 +16,45 @@ module Seam
|
|
|
16
16
|
|
|
17
17
|
attr_reader :client, :defaults
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
OPTION_NOT_PROVIDED = Object.new.freeze
|
|
20
|
+
private_constant :OPTION_NOT_PROVIDED
|
|
21
|
+
|
|
22
|
+
def initialize(client: nil, api_key: OPTION_NOT_PROVIDED, personal_access_token: OPTION_NOT_PROVIDED,
|
|
23
|
+
workspace_id: OPTION_NOT_PROVIDED, endpoint: OPTION_NOT_PROVIDED,
|
|
24
|
+
wait_for_action_attempt: OPTION_NOT_PROVIDED, timeout: OPTION_NOT_PROVIDED,
|
|
25
|
+
faraday_options: OPTION_NOT_PROVIDED, faraday_retry_options: OPTION_NOT_PROVIDED)
|
|
26
|
+
supplied_options = {
|
|
27
|
+
api_key: api_key,
|
|
28
|
+
personal_access_token: personal_access_token,
|
|
29
|
+
workspace_id: workspace_id,
|
|
30
|
+
endpoint: endpoint,
|
|
31
|
+
wait_for_action_attempt: wait_for_action_attempt,
|
|
32
|
+
timeout: timeout,
|
|
33
|
+
faraday_options: faraday_options,
|
|
34
|
+
faraday_retry_options: faraday_retry_options
|
|
35
|
+
}.reject { |_, value| value.equal?(OPTION_NOT_PROVIDED) }
|
|
36
|
+
invalid_options = supplied_options.keys - [:wait_for_action_attempt]
|
|
37
|
+
|
|
38
|
+
if client && invalid_options.any?
|
|
39
|
+
raise Http::Options::SeamInvalidOptionsError.new(
|
|
40
|
+
"The client option cannot be used with any other option, but received: #{supplied_options.keys.join(", ")}"
|
|
41
|
+
)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
wait_for_action_attempt = true if wait_for_action_attempt.equal?(OPTION_NOT_PROVIDED)
|
|
21
45
|
@defaults = Seam::DeepHashAccessor.new({"wait_for_action_attempt" => wait_for_action_attempt})
|
|
22
46
|
|
|
23
47
|
# A client carries its own endpoint and authorization, so the auth
|
|
24
48
|
# options are only parsed when one has to be built.
|
|
25
49
|
@client = client || begin
|
|
50
|
+
api_key = nil if api_key.equal?(OPTION_NOT_PROVIDED)
|
|
51
|
+
personal_access_token = nil if personal_access_token.equal?(OPTION_NOT_PROVIDED)
|
|
52
|
+
workspace_id = nil if workspace_id.equal?(OPTION_NOT_PROVIDED)
|
|
53
|
+
endpoint = nil if endpoint.equal?(OPTION_NOT_PROVIDED)
|
|
54
|
+
timeout = nil if timeout.equal?(OPTION_NOT_PROVIDED)
|
|
55
|
+
faraday_options = {} if faraday_options.equal?(OPTION_NOT_PROVIDED)
|
|
56
|
+
faraday_retry_options = {} if faraday_retry_options.equal?(OPTION_NOT_PROVIDED)
|
|
57
|
+
|
|
26
58
|
options = Http::Options.parse_options(api_key: api_key, personal_access_token: personal_access_token,
|
|
27
59
|
workspace_id: workspace_id, endpoint: endpoint)
|
|
28
60
|
@endpoint = options[:endpoint]
|
|
@@ -13,18 +13,47 @@ module Seam
|
|
|
13
13
|
class WithoutWorkspace
|
|
14
14
|
attr_reader :client, :defaults
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
OPTION_NOT_PROVIDED = Object.new.freeze
|
|
17
|
+
private_constant :OPTION_NOT_PROVIDED
|
|
18
|
+
|
|
19
|
+
def initialize(client: nil, personal_access_token: OPTION_NOT_PROVIDED, endpoint: OPTION_NOT_PROVIDED,
|
|
20
|
+
wait_for_action_attempt: OPTION_NOT_PROVIDED, timeout: OPTION_NOT_PROVIDED,
|
|
21
|
+
faraday_options: OPTION_NOT_PROVIDED, faraday_retry_options: OPTION_NOT_PROVIDED)
|
|
22
|
+
supplied_options = {
|
|
23
|
+
personal_access_token: personal_access_token,
|
|
24
|
+
endpoint: endpoint,
|
|
25
|
+
wait_for_action_attempt: wait_for_action_attempt,
|
|
26
|
+
timeout: timeout,
|
|
27
|
+
faraday_options: faraday_options,
|
|
28
|
+
faraday_retry_options: faraday_retry_options
|
|
29
|
+
}.reject { |_, value| value.equal?(OPTION_NOT_PROVIDED) }
|
|
30
|
+
invalid_options = supplied_options.keys - [:wait_for_action_attempt]
|
|
31
|
+
|
|
32
|
+
if client && invalid_options.any?
|
|
33
|
+
raise Http::Options::SeamInvalidOptionsError.new(
|
|
34
|
+
"The client option cannot be used with any other option, but received: #{supplied_options.keys.join(", ")}"
|
|
35
|
+
)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
wait_for_action_attempt = true if wait_for_action_attempt.equal?(OPTION_NOT_PROVIDED)
|
|
18
39
|
@wait_for_action_attempt = wait_for_action_attempt
|
|
19
40
|
@defaults = {"wait_for_action_attempt" => wait_for_action_attempt}
|
|
20
41
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
42
|
+
@client = client || begin
|
|
43
|
+
personal_access_token = nil if personal_access_token.equal?(OPTION_NOT_PROVIDED)
|
|
44
|
+
endpoint = nil if endpoint.equal?(OPTION_NOT_PROVIDED)
|
|
45
|
+
timeout = nil if timeout.equal?(OPTION_NOT_PROVIDED)
|
|
46
|
+
faraday_options = {} if faraday_options.equal?(OPTION_NOT_PROVIDED)
|
|
47
|
+
faraday_retry_options = {} if faraday_retry_options.equal?(OPTION_NOT_PROVIDED)
|
|
48
|
+
|
|
49
|
+
options = Http::Options.parse_without_workspace_options(personal_access_token: personal_access_token,
|
|
50
|
+
endpoint: endpoint)
|
|
51
|
+
@endpoint = options[:endpoint]
|
|
52
|
+
@auth_headers = options[:auth_headers]
|
|
25
53
|
|
|
26
|
-
|
|
27
|
-
|
|
54
|
+
Http::Request.create_faraday_client(@endpoint, @auth_headers, faraday_options,
|
|
55
|
+
faraday_retry_options, timeout: timeout)
|
|
56
|
+
end
|
|
28
57
|
end
|
|
29
58
|
|
|
30
59
|
def workspaces
|
|
@@ -49,12 +78,12 @@ module Seam
|
|
|
49
78
|
@workspaces = workspaces
|
|
50
79
|
end
|
|
51
80
|
|
|
52
|
-
def list(**
|
|
53
|
-
@workspaces.list(**
|
|
81
|
+
def list(**)
|
|
82
|
+
@workspaces.list(**)
|
|
54
83
|
end
|
|
55
84
|
|
|
56
|
-
def create(**
|
|
57
|
-
@workspaces.create(**
|
|
85
|
+
def create(**)
|
|
86
|
+
@workspaces.create(**)
|
|
58
87
|
end
|
|
59
88
|
end
|
|
60
89
|
|
data/lib/seam/paginator.rb
CHANGED
|
@@ -11,6 +11,9 @@ module Seam
|
|
|
11
11
|
def initialize(request, params = {})
|
|
12
12
|
raise ArgumentError, "request must be a Method" unless request.is_a?(Method)
|
|
13
13
|
raise ArgumentError, "params must be a Hash" unless params.is_a?(Hash)
|
|
14
|
+
unless request.parameters.any? { |_, name| name == :page_cursor }
|
|
15
|
+
raise ArgumentError, "request does not support pagination"
|
|
16
|
+
end
|
|
14
17
|
|
|
15
18
|
@request = request
|
|
16
19
|
@params = params.transform_keys(&:to_sym)
|
|
@@ -71,7 +74,7 @@ module Seam
|
|
|
71
74
|
end
|
|
72
75
|
end
|
|
73
76
|
|
|
74
|
-
Pagination = Struct.new(:has_next_page, :next_page_cursor, :next_page_url
|
|
77
|
+
Pagination = Struct.new(:has_next_page, :next_page_cursor, :next_page_url) do
|
|
75
78
|
def self.from_hash(hash)
|
|
76
79
|
return nil unless hash.is_a?(Hash) && !hash.empty?
|
|
77
80
|
|
data/lib/seam/request.rb
CHANGED
|
@@ -23,7 +23,11 @@ module Seam
|
|
|
23
23
|
|
|
24
24
|
default_faraday_retry_options = {
|
|
25
25
|
max: 2,
|
|
26
|
-
|
|
26
|
+
interval: 0.2,
|
|
27
|
+
interval_randomness: 0.2,
|
|
28
|
+
backoff_factor: 2,
|
|
29
|
+
exceptions: Faraday::Retry::Middleware::DEFAULT_EXCEPTIONS + [Faraday::ConnectionFailed],
|
|
30
|
+
retry_statuses: [429] + (500..599).to_a
|
|
27
31
|
}
|
|
28
32
|
|
|
29
33
|
faraday_retry_options = default_faraday_retry_options.merge(faraday_retry_options)
|
|
@@ -14,155 +14,229 @@ module Seam
|
|
|
14
14
|
class AccessCode < BaseResource
|
|
15
15
|
class DormakabaOracodeMetadata < BaseResource
|
|
16
16
|
# Indicates whether the stay can be cancelled via the Dormakaba Oracode API.
|
|
17
|
+
# @return [Boolean, nil]
|
|
17
18
|
attr_accessor :is_cancellable
|
|
18
19
|
# Indicates whether early check-in is available for this stay.
|
|
20
|
+
# @return [Boolean, nil]
|
|
19
21
|
attr_accessor :is_early_checkin_able
|
|
20
22
|
# Indicates whether the stay can be extended via the Dormakaba Oracode API.
|
|
23
|
+
# @return [Boolean, nil]
|
|
21
24
|
attr_accessor :is_extendable
|
|
22
25
|
# Indicates whether the access code can be overridden. When false, the maximum number of overrides has been reached.
|
|
26
|
+
# @return [Boolean, nil]
|
|
23
27
|
attr_accessor :is_overridable
|
|
24
28
|
# Dormakaba Oracode site name associated with this access code.
|
|
29
|
+
# @return [String, nil]
|
|
25
30
|
attr_accessor :site_name
|
|
26
31
|
# Dormakaba Oracode stay ID associated with this access code.
|
|
32
|
+
# @return [Float, nil]
|
|
27
33
|
attr_accessor :stay_id
|
|
28
34
|
# Dormakaba Oracode user level ID associated with this access code.
|
|
35
|
+
# @return [String, nil]
|
|
29
36
|
attr_accessor :user_level_id
|
|
30
37
|
# Dormakaba Oracode user level name associated with this access code.
|
|
38
|
+
# @return [String, nil]
|
|
31
39
|
attr_accessor :user_level_name
|
|
32
40
|
end
|
|
33
41
|
|
|
34
42
|
class Errors < BaseResource
|
|
35
43
|
class ModifiedFields < BaseResource
|
|
36
44
|
# The name of the field that was changed (e.g. `code`, `starts_at`, `ends_at`).
|
|
45
|
+
# @return [String]
|
|
37
46
|
attr_accessor :field
|
|
38
47
|
# The previous value of the field.
|
|
48
|
+
# @return [String, nil]
|
|
39
49
|
attr_accessor :from
|
|
40
50
|
# The new value of the field.
|
|
51
|
+
# @return [String, nil]
|
|
41
52
|
attr_accessor :to
|
|
42
53
|
end
|
|
43
54
|
|
|
55
|
+
# List of fields that were changed externally, with their previous and new values.
|
|
56
|
+
# @return [Array<ModifiedFields>]
|
|
44
57
|
resource_list_accessor :modified_fields, ModifiedFields
|
|
45
58
|
# Indicates the type of external modification. `modified` means the code's PIN or schedule was changed. `removed` means the code was deleted from the device.
|
|
59
|
+
# @return [String, nil]
|
|
46
60
|
attr_accessor :change_type
|
|
47
61
|
# Unique identifier of the type of error. Enables quick recognition and categorization of the issue.
|
|
62
|
+
# @return [String]
|
|
48
63
|
attr_accessor :error_code
|
|
49
64
|
# Indicates that this is an access code error.
|
|
65
|
+
# @return [Boolean]
|
|
50
66
|
attr_accessor :is_access_code_error
|
|
51
67
|
# Indicates whether the error is related to [Seam Bridge](https://docs.seam.co/capability-guides/seam-bridge).
|
|
68
|
+
# @return [Boolean, nil]
|
|
52
69
|
attr_accessor :is_bridge_error
|
|
70
|
+
# @return [Boolean, nil]
|
|
53
71
|
attr_accessor :is_connected_account_error
|
|
72
|
+
# @return [Boolean]
|
|
54
73
|
attr_accessor :is_device_error
|
|
55
74
|
# ID of the managed access code that conflicts with this managed access code, when Seam can identify it.
|
|
75
|
+
# @return [String, nil]
|
|
56
76
|
attr_accessor :managed_access_code_id
|
|
57
77
|
# Detailed description of the error. Provides insights into the issue and potentially how to rectify it.
|
|
78
|
+
# @return [String]
|
|
58
79
|
attr_accessor :message
|
|
59
80
|
# ID of the unmanaged access code that conflicts with this managed access code, when Seam can identify it.
|
|
81
|
+
# @return [String, nil]
|
|
60
82
|
attr_accessor :unmanaged_access_code_id
|
|
61
83
|
# Date and time at which Seam created the error.
|
|
84
|
+
# @return [Time, nil]
|
|
62
85
|
date_accessor :created_at
|
|
63
86
|
end
|
|
64
87
|
|
|
65
88
|
class PendingMutations < BaseResource
|
|
66
89
|
class From < BaseResource
|
|
67
90
|
# Previous PIN code.
|
|
91
|
+
# @return [String, nil]
|
|
68
92
|
attr_accessor :code
|
|
69
93
|
# Previous access code name.
|
|
94
|
+
# @return [String, nil]
|
|
70
95
|
attr_accessor :name
|
|
71
96
|
# Previous end time for the access code.
|
|
97
|
+
# @return [Time, nil]
|
|
72
98
|
date_accessor :ends_at
|
|
73
99
|
# Previous start time for the access code.
|
|
100
|
+
# @return [Time, nil]
|
|
74
101
|
date_accessor :starts_at
|
|
75
102
|
end
|
|
76
103
|
|
|
77
104
|
class To < BaseResource
|
|
78
105
|
# New PIN code.
|
|
106
|
+
# @return [String, nil]
|
|
79
107
|
attr_accessor :code
|
|
80
108
|
# New access code name.
|
|
109
|
+
# @return [String, nil]
|
|
81
110
|
attr_accessor :name
|
|
82
111
|
# New end time for the access code.
|
|
112
|
+
# @return [Time, nil]
|
|
83
113
|
date_accessor :ends_at
|
|
84
114
|
# New start time for the access code.
|
|
115
|
+
# @return [Time, nil]
|
|
85
116
|
date_accessor :starts_at
|
|
86
117
|
end
|
|
87
118
|
|
|
119
|
+
# @return [From]
|
|
88
120
|
resource_accessor :from, From
|
|
121
|
+
# @return [To]
|
|
89
122
|
resource_accessor :to, To
|
|
90
123
|
# Detailed description of the mutation.
|
|
124
|
+
# @return [String]
|
|
91
125
|
attr_accessor :message
|
|
126
|
+
# @return [String]
|
|
92
127
|
attr_accessor :mutation_code
|
|
93
128
|
# Date and time at which the mutation was created.
|
|
129
|
+
# @return [Time]
|
|
94
130
|
date_accessor :created_at
|
|
95
131
|
# Date and time at which Seam will attempt to program this access code on the device.
|
|
132
|
+
# @return [Time]
|
|
96
133
|
date_accessor :scheduled_at
|
|
97
134
|
end
|
|
98
135
|
|
|
99
136
|
class Warnings < BaseResource
|
|
100
137
|
class ModifiedFields < BaseResource
|
|
101
138
|
# The name of the field that was changed (e.g. `code`, `starts_at`, `ends_at`).
|
|
139
|
+
# @return [String]
|
|
102
140
|
attr_accessor :field
|
|
103
141
|
# The previous value of the field.
|
|
142
|
+
# @return [String, nil]
|
|
104
143
|
attr_accessor :from
|
|
105
144
|
# The new value of the field.
|
|
145
|
+
# @return [String, nil]
|
|
106
146
|
attr_accessor :to
|
|
107
147
|
end
|
|
108
148
|
|
|
149
|
+
# List of fields that were changed externally, with their previous and new values.
|
|
150
|
+
# @return [Array<ModifiedFields>]
|
|
109
151
|
resource_list_accessor :modified_fields, ModifiedFields
|
|
110
152
|
# Indicates the type of external modification. `modified` means the code's PIN or schedule was changed. `removed` means the code was deleted from the device.
|
|
153
|
+
# @return [String, nil]
|
|
111
154
|
attr_accessor :change_type
|
|
112
155
|
# Detailed description of the warning. Provides insights into the issue and potentially how to rectify it.
|
|
156
|
+
# @return [String]
|
|
113
157
|
attr_accessor :message
|
|
114
158
|
# Unique identifier of the type of warning. Enables quick recognition and categorization of the issue.
|
|
159
|
+
# @return [String]
|
|
115
160
|
attr_accessor :warning_code
|
|
116
161
|
# Date and time at which Seam created the warning.
|
|
162
|
+
# @return [Time, nil]
|
|
117
163
|
date_accessor :created_at
|
|
118
164
|
end
|
|
119
165
|
|
|
166
|
+
# Metadata for a dormakaba Oracode managed access code. Only present for access codes from dormakaba Oracode devices.
|
|
167
|
+
# @return [DormakabaOracodeMetadata, nil]
|
|
120
168
|
resource_accessor :dormakaba_oracode_metadata, DormakabaOracodeMetadata
|
|
169
|
+
# Errors associated with the [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes).
|
|
170
|
+
# @return [Array<Errors>]
|
|
121
171
|
resource_list_accessor :errors, Errors
|
|
172
|
+
# Collection of pending mutations for the access code. Indicates changes that Seam is in the process of pushing to the device.
|
|
173
|
+
# @return [Array<PendingMutations>]
|
|
122
174
|
resource_list_accessor :pending_mutations, PendingMutations
|
|
175
|
+
# Warnings associated with the [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes).
|
|
176
|
+
# @return [Array<Warnings>]
|
|
123
177
|
resource_list_accessor :warnings, Warnings
|
|
124
178
|
# Unique identifier for the access code.
|
|
179
|
+
# @return [String]
|
|
125
180
|
attr_accessor :access_code_id
|
|
126
181
|
# Code used for access. Typically, a numeric or alphanumeric string.
|
|
182
|
+
# @return [String, nil]
|
|
127
183
|
attr_accessor :code
|
|
128
184
|
# Unique identifier for a group of access codes that share the same code.
|
|
185
|
+
# @return [String, nil]
|
|
129
186
|
attr_accessor :common_code_key
|
|
130
187
|
# Unique identifier for the device associated with the access code.
|
|
188
|
+
# @return [String]
|
|
131
189
|
attr_accessor :device_id
|
|
132
190
|
# Indicates whether the access code is a backup code.
|
|
191
|
+
# @return [Boolean, nil]
|
|
133
192
|
attr_accessor :is_backup
|
|
134
193
|
# Indicates whether a backup access code is available for use if the primary access code is lost or compromised.
|
|
194
|
+
# @return [Boolean]
|
|
135
195
|
attr_accessor :is_backup_access_code_available
|
|
136
196
|
# Indicates whether changes to the access code from external sources are permitted.
|
|
197
|
+
# @return [Boolean]
|
|
137
198
|
attr_accessor :is_external_modification_allowed
|
|
138
199
|
# Indicates whether Seam manages the access code.
|
|
200
|
+
# @return [Boolean]
|
|
139
201
|
attr_accessor :is_managed
|
|
140
202
|
# Indicates whether the access code is intended for use in offline scenarios. If `true`, this code can be created on a device without a network connection.
|
|
203
|
+
# @return [Boolean]
|
|
141
204
|
attr_accessor :is_offline_access_code
|
|
142
205
|
# Indicates whether the access code can only be used once. If `true`, the code becomes invalid after the first use.
|
|
206
|
+
# @return [Boolean]
|
|
143
207
|
attr_accessor :is_one_time_use
|
|
144
208
|
# Indicates whether the code is set on the device according to a preconfigured schedule.
|
|
209
|
+
# @return [Boolean, nil]
|
|
145
210
|
attr_accessor :is_scheduled_on_device
|
|
146
211
|
# Indicates whether the access code is waiting for a code assignment.
|
|
212
|
+
# @return [Boolean, nil]
|
|
147
213
|
attr_accessor :is_waiting_for_code_assignment
|
|
148
214
|
# Name of the access code. Enables administrators and users to identify the access code easily, especially when there are numerous access codes. Note that the name provided on Seam is used to identify the code on Seam and is not necessarily the name that will appear in the lock provider's app or on the device. This is because lock providers may have constraints on names, such as length, uniqueness, or characters that can be used. In addition, some lock providers may break down names into components such as `first_name` and `last_name`. To provide a consistent experience, Seam identifies the code on Seam by its name but may modify the name that appears on the lock provider's app or on the device. For example, Seam may add additional characters or truncate the name to meet provider constraints. To help your users identify codes set by Seam, Seam provides the name exactly as it appears on the lock provider's app or on the device as a separate property called `appearance`. This is an object with a `name` property and, optionally, `first_name` and `last_name` properties (for providers that break down a name into components).
|
|
215
|
+
# @return [String, nil]
|
|
149
216
|
attr_accessor :name
|
|
150
217
|
# Identifier of the pulled backup access code. Used to associate the pulled backup access code with the original access code.
|
|
218
|
+
# @return [String, nil]
|
|
151
219
|
attr_accessor :pulled_backup_access_code_id
|
|
152
220
|
# Current status of the access code within the operational lifecycle. Values are `setting`, a transitional phase that indicates that the code is being configured or activated; `set`, which indicates that the code is active and operational; `unset`, which indicates a deactivated or unused state, either before activation or after deliberate deactivation; `removing`, which indicates a transitional period in which the code is being deleted or made inactive; and `unknown`, which indicates an indeterminate state, due to reasons such as system errors or incomplete data, that highlights a potential need for system review or troubleshooting. See also [Lifecycle of Access Codes](https://docs.seam.co/low-level-apis/smart-locks/access-codes/lifecycle-of-access-codes).
|
|
221
|
+
# @return [String]
|
|
153
222
|
attr_accessor :status
|
|
154
223
|
# Type of the access code. `ongoing` access codes are active continuously until deactivated manually. `time_bound` access codes have a specific duration.
|
|
224
|
+
# @return [String]
|
|
155
225
|
attr_accessor :type
|
|
156
226
|
# Unique identifier for the Seam workspace associated with the access code.
|
|
227
|
+
# @return [String]
|
|
157
228
|
attr_accessor :workspace_id
|
|
158
229
|
|
|
159
230
|
# Date and time at which the access code was created.
|
|
231
|
+
# @return [Time]
|
|
160
232
|
date_accessor :created_at
|
|
161
233
|
|
|
162
234
|
# Date and time after which the time-bound access code becomes inactive.
|
|
235
|
+
# @return [Time, nil]
|
|
163
236
|
date_accessor :ends_at
|
|
164
237
|
|
|
165
238
|
# Date and time at which the time-bound access code becomes active.
|
|
239
|
+
# @return [Time, nil]
|
|
166
240
|
date_accessor :starts_at
|
|
167
241
|
end
|
|
168
242
|
end
|