seam 2.140.0 → 2.141.1

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.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/README.md +86 -0
  4. data/lib/seam/action_attempt_resolver.rb +54 -0
  5. data/lib/seam/null.rb +23 -0
  6. data/lib/seam/request.rb +49 -1
  7. data/lib/seam/routes/access_codes.rb +1 -1
  8. data/lib/seam/routes/access_codes_unmanaged.rb +1 -1
  9. data/lib/seam/routes/access_grants.rb +6 -6
  10. data/lib/seam/routes/access_grants_unmanaged.rb +1 -1
  11. data/lib/seam/routes/access_methods.rb +5 -5
  12. data/lib/seam/routes/acs_credentials.rb +1 -1
  13. data/lib/seam/routes/acs_encoders.rb +5 -5
  14. data/lib/seam/routes/acs_entrances.rb +4 -4
  15. data/lib/seam/routes/acs_users.rb +2 -2
  16. data/lib/seam/routes/action_attempts.rb +3 -3
  17. data/lib/seam/routes/connect_webviews.rb +1 -1
  18. data/lib/seam/routes/connected_accounts.rb +1 -1
  19. data/lib/seam/routes/devices.rb +3 -3
  20. data/lib/seam/routes/devices_unmanaged.rb +1 -1
  21. data/lib/seam/routes/locks.rb +4 -4
  22. data/lib/seam/routes/locks_simulate.rb +3 -3
  23. data/lib/seam/routes/spaces.rb +1 -1
  24. data/lib/seam/routes/thermostats.rb +22 -22
  25. data/lib/seam/routes/thermostats_daily_programs.rb +2 -2
  26. data/lib/seam/routes/thermostats_schedules.rb +2 -2
  27. data/lib/seam/routes/user_identities.rb +9 -9
  28. data/lib/seam/routes/user_identities_unmanaged.rb +1 -1
  29. data/lib/seam/routes/workspaces.rb +3 -3
  30. data/lib/seam/strict_url_search_params_serializer.rb +17 -0
  31. data/lib/seam/url_search_params.rb +102 -0
  32. data/lib/seam/url_search_params_serializer.rb +217 -0
  33. data/lib/seam/version.rb +1 -1
  34. data/lib/seam.rb +3 -0
  35. metadata +6 -2
  36. data/lib/seam/helpers/action_attempt.rb +0 -56
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 564fdfd341da5fc43c859ba3a1bb7d013b40845ffbab7e0e05f917493b974821
4
- data.tar.gz: a9ce5bded784a3153d98b85d6fcaaa1625837f84e9078c94a6c372e9a4a2eb24
3
+ metadata.gz: e99e4c607a0b5f8714d0067e093f8ab93766a3af4cd069f26988e483da203943
4
+ data.tar.gz: db6cd5c445363a9bdc119946829dac7a44aaf0ff7a278063e818133680e1edea
5
5
  SHA512:
6
- metadata.gz: 1cbe2df337d9004d747493a81330ccceda4caa1476e38d0907670b9f47d16bd4e5036a2745c958ca203ff0154e773ef91339769881da525a30ef2839f4d93761
7
- data.tar.gz: 0d69f48f2499b5f2275e44ddce95be1ffa50a417e8430374197f6a976fef7691facf1fdf80f247a8dfe0f166f2a32a966b79e74c7c851252e3df5fb502e46332
6
+ metadata.gz: 418154fb53f041f8682566396ecfae077473c5d64993afb5208d2eee316b60e508362de340b6ce83d68058b2098bf76347f70042ea023215c15a5d921916cea9
7
+ data.tar.gz: b58f492190db82e6be16f4f65a968a40d8569278781aa1238dec0c70c88e4241394ffff34b2ce9e6c662b048d635581e57eadb32b54a589b3513e683bac1b802
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- seam (2.140.0)
4
+ seam (2.141.1)
5
5
  faraday (~> 2.7)
6
6
  faraday-retry (~> 2.2)
7
7
  svix (~> 1.30)
data/README.md CHANGED
@@ -27,6 +27,7 @@ accurate and fully typed.
27
27
  - [API Key](#api-key)
28
28
  - [Personal Access Token](#personal-access-token)
29
29
  - [Action Attempts](#action-attempts)
30
+ - [Setting a value to null](#setting-a-value-to-null)
30
31
  - [Pagination](#pagination)
31
32
  - [Manually fetch pages with the next_page_cursor](#manually-fetch-pages-with-the-next_page_cursor)
32
33
  - [Resume pagination](#resume-pagination)
@@ -43,6 +44,7 @@ accurate and fully typed.
43
44
  - [Configuring the Faraday Client](#configuring-the-faraday-client)
44
45
  - [Using the Faraday Client](#using-the-faraday-client)
45
46
  - [Overriding the Client](#overriding-the-client)
47
+ - [Serializing URL search params](#serializing-url-search-params)
46
48
  - [Development and Testing](#development-and-testing)
47
49
  - [Quickstart](#quickstart)
48
50
  - [Source code](#source-code)
@@ -226,6 +228,35 @@ rescue Seam::ActionAttemptTimeoutError
226
228
  end
227
229
  ```
228
230
 
231
+ ### Setting a value to null
232
+
233
+ The Seam API distinguishes three states for an updatable parameter:
234
+ omitted (leave the stored value unchanged), null (unset the stored value),
235
+ and a value (set it).
236
+
237
+ Ruby's `nil` means omitted.
238
+ The SDK removes `nil` parameters from the request entirely,
239
+ so passing `nil` never unsets a value.
240
+ To unset a value, pass the `Seam::NULL` sentinel,
241
+ which the SDK sends as JSON `null` in request bodies
242
+ and as an empty value in query strings:
243
+
244
+ ```ruby
245
+ require "seam"
246
+
247
+ seam = Seam.new
248
+
249
+ # Leaves ends_at unchanged.
250
+ seam.access_grants.update(access_grant_id: access_grant_id, ends_at: nil)
251
+
252
+ # Unsets ends_at so the grant no longer expires.
253
+ seam.access_grants.update(access_grant_id: access_grant_id, ends_at: Seam::NULL)
254
+ ```
255
+
256
+ Only pass `Seam::NULL` for parameters the API documents as nullable.
257
+ Generated methods document nullable parameters
258
+ with `Seam::Null` in their `@param` types, e.g. `[String, Seam::Null, nil]`.
259
+
229
260
  ### Pagination
230
261
 
231
262
  Some Seam API endpoints that return lists of resources support pagination.
@@ -489,6 +520,61 @@ devices = seam.client.get("/devices/list").body["devices"]
489
520
  A Faraday compatible client may be provided to create a `Seam` instance.
490
521
  This API is used internally and is not directly supported.
491
522
 
523
+ #### Serializing URL search params
524
+
525
+ The Seam API parses URL search params as complex types.
526
+ If you call it with your own HTTP client,
527
+ `Seam.serialize_url_search_params` is exported for that purpose.
528
+ The `_strict=true` parameter is added to any non-empty query
529
+ so the Seam API uses strict, schema-aware parsing.
530
+ A query with no serializable params remains empty.
531
+
532
+ ```ruby
533
+ require "net/http"
534
+ require "seam"
535
+
536
+ uri = URI("https://connect.getseam.com/devices/list")
537
+ uri.query = Seam.serialize_url_search_params({device_ids: ["device1", "device2"]})
538
+
539
+ Net::HTTP.get(uri, {"Authorization" => "Bearer your-api-key"})
540
+ ```
541
+
542
+ The serialization defines the name and value of each search param,
543
+ where every value is a string.
544
+ `Seam::UrlSearchParams` holds those pairs and renders the query string,
545
+ as [URLSearchParams] does for the [reference implementation]:
546
+
547
+ ```ruby
548
+ require "seam"
549
+
550
+ search_params = Seam::UrlSearchParams.new
551
+
552
+ Seam.update_url_search_params(search_params, {device_ids: ["device1", "device2"]})
553
+
554
+ search_params.to_a
555
+ # => [["device_ids", "device1"], ["device_ids", "device2"], ["_strict", "true"]]
556
+
557
+ search_params.to_s
558
+ # => "device_ids=device1&device_ids=device2&_strict=true"
559
+ ```
560
+
561
+ Pass either the query string or the pairs to your HTTP client.
562
+ A client may percent-encode a few characters differently
563
+ than `URLSearchParams` does,
564
+ which the Seam API reads as the same params either way.
565
+
566
+ A param set to `nil` is omitted,
567
+ while a param set to `Seam::NULL` is serialized to an empty value,
568
+ which the Seam API reads as null,
569
+ as described in [Setting a value to null](#setting-a-value-to-null).
570
+ A param that cannot be represented raises a `Seam::UnserializableParamError`.
571
+
572
+ The Seam API parses these params with the corresponding [parser].
573
+
574
+ [URLSearchParams]: https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams
575
+ [reference implementation]: https://github.com/seamapi/url-search-params-serializer
576
+ [parser]: https://github.com/seamapi/url-search-params-parser
577
+
492
578
  ## Development and Testing
493
579
 
494
580
  ### Quickstart
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "wait_for_action_attempt"
4
+
5
+ module Seam
6
+ class ActionAttemptResolver
7
+ def self.resolve(action_attempt, client, wait_for_action_attempt)
8
+ return wait_until_resolved(action_attempt, client) if wait_for_action_attempt == true
9
+
10
+ options = wait_options(wait_for_action_attempt)
11
+ return action_attempt if options.nil?
12
+
13
+ wait_until_resolved(action_attempt, client, timeout: options[:timeout],
14
+ polling_interval: options[:polling_interval])
15
+ end
16
+
17
+ # The client wraps its defaults in a DeepHashAccessor, so the hash form of
18
+ # this option reaches here as an accessor when it comes from the client
19
+ # and as a plain Hash when it comes from the method call.
20
+ def self.wait_options(wait_for_action_attempt)
21
+ case wait_for_action_attempt
22
+ when Hash then wait_for_action_attempt
23
+ when Seam::DeepHashAccessor then wait_for_action_attempt.to_h
24
+ end
25
+ end
26
+
27
+ def self.wait_until_resolved(action_attempt, client, timeout: nil, polling_interval: nil)
28
+ timeout = timeout.nil? ? 5.0 : timeout
29
+ polling_interval = polling_interval.nil? ? 0.5 : polling_interval
30
+
31
+ time_waiting = 0.0
32
+
33
+ while action_attempt.status == "pending"
34
+ sleep(polling_interval)
35
+ time_waiting += polling_interval
36
+
37
+ raise Seam::ActionAttemptTimeoutError.new(action_attempt, timeout) if time_waiting > timeout
38
+
39
+ action_attempt = update_action_attempt(action_attempt, client)
40
+ end
41
+
42
+ raise Seam::ActionAttemptFailedError.new(action_attempt) if action_attempt.status == "error"
43
+
44
+ action_attempt
45
+ end
46
+
47
+ def self.update_action_attempt(action_attempt, client)
48
+ response = client.get("/action_attempts/get", {action_attempt_id: action_attempt.action_attempt_id})
49
+
50
+ action_attempt.update_from_response(response.body["action_attempt"])
51
+ action_attempt
52
+ end
53
+ end
54
+ end
data/lib/seam/null.rb ADDED
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "singleton"
4
+
5
+ module Seam
6
+ # The type of the {Seam::NULL} sentinel.
7
+ class Null
8
+ include Singleton
9
+
10
+ def to_s
11
+ "NULL"
12
+ end
13
+
14
+ def inspect
15
+ "NULL"
16
+ end
17
+ end
18
+
19
+ # Sentinel for an explicit JSON null: +nil+ omits a parameter, +Seam::NULL+
20
+ # unsets its stored value. Only for parameters the API documents as
21
+ # nullable.
22
+ NULL = Null.instance
23
+ end
data/lib/seam/request.rb CHANGED
@@ -5,6 +5,7 @@ require "faraday/retry"
5
5
  require_relative "defaults"
6
6
  require_relative "version"
7
7
  require_relative "paginator"
8
+ require_relative "strict_url_search_params_serializer"
8
9
 
9
10
  module Seam
10
11
  module Http
@@ -16,7 +17,11 @@ module Seam
16
17
  default_options = {
17
18
  url: endpoint,
18
19
  headers: auth_headers.merge(default_headers),
19
- request: {timeout: timeout, open_timeout: timeout}
20
+ request: {
21
+ timeout: timeout,
22
+ open_timeout: timeout,
23
+ params_encoder: UrlSearchParamsEncoder
24
+ }
20
25
  }
21
26
 
22
27
  options = deep_merge(default_options, faraday_options)
@@ -33,6 +38,7 @@ module Seam
33
38
  faraday_retry_options = default_faraday_retry_options.merge(faraday_retry_options)
34
39
 
35
40
  Faraday.new(options) do |builder|
41
+ builder.use ReplaceNullMiddleware
36
42
  builder.request :json
37
43
  builder.use Seam::PaginationMiddleware
38
44
  builder.response :json
@@ -97,6 +103,14 @@ module Seam
97
103
  end
98
104
  end
99
105
 
106
+ class ReplaceNullMiddleware < Faraday::Middleware
107
+ def on_request(env)
108
+ return unless env.body.is_a?(Hash) || env.body.is_a?(Array)
109
+
110
+ env.body = Seam.replace_null(env.body)
111
+ end
112
+ end
113
+
100
114
  def self.deep_merge(hash1, hash2)
101
115
  result = hash1.dup
102
116
  hash2.each do |key, value|
@@ -111,5 +125,39 @@ module Seam
111
125
 
112
126
  private_class_method :deep_merge
113
127
  end
128
+
129
+ module UrlSearchParamsEncoder
130
+ # Pairs decoded from a query string already present in the request
131
+ # path, passed through {encode} verbatim rather than re-serialized.
132
+ Decoded = Struct.new(:values)
133
+
134
+ def self.encode(params)
135
+ search_params = Seam::UrlSearchParams.new
136
+ map_params = {}
137
+
138
+ params.each do |name, value|
139
+ if value.is_a?(Decoded)
140
+ value.values.each { |element| search_params.append(name, element) }
141
+ else
142
+ map_params[name] = value
143
+ end
144
+ end
145
+
146
+ return search_params.to_s if map_params.empty?
147
+
148
+ Seam.update_url_search_params(search_params, map_params)
149
+ search_params.to_s
150
+ end
151
+
152
+ # Called by Faraday when a request path carries its own query string.
153
+ def self.decode(query)
154
+ return {} if query.nil? || query.empty?
155
+
156
+ pairs = URI.decode_www_form(query.encode(Encoding::UTF_8))
157
+ pairs.each_with_object({}) do |(name, value), decoded|
158
+ (decoded[name] ||= Decoded.new([])).values << value
159
+ end
160
+ end
161
+ end
114
162
  end
115
163
  end
@@ -129,7 +129,7 @@ module Seam
129
129
  # @param customer_key [String, nil] Customer key for which you want to list access codes.
130
130
  # @param device_id [String, nil] ID of the device for which you want to list access codes. Specify `device_id`, `access_code_ids`, `access_method_id`, `access_grant_id`, or `access_grant_key`.
131
131
  # @param limit [Float, nil] Numerical limit on the number of access codes to return.
132
- # @param page_cursor [String, nil] Identifies the specific page of results to return, obtained from the previous page's `next_page_cursor`.
132
+ # @param page_cursor [String, Seam::Null, nil] Identifies the specific page of results to return, obtained from the previous page's `next_page_cursor`.
133
133
  # @param search [String, nil] String for which to search. Filters returned access codes to include all records that satisfy a partial match using `name`, `code` or `access_code_id`.
134
134
  # @param user_identifier_key [String, nil] Your user ID for the user by which to filter access codes.
135
135
  # @return [Seam::Resources::AccessCode] OK
@@ -53,7 +53,7 @@ module Seam
53
53
  # Returns a list of all [unmanaged access codes](https://docs.seam.co/low-level-apis/smart-locks/access-codes/migrating-existing-access-codes).
54
54
  # @param device_id [String] ID of the device for which you want to list unmanaged access codes.
55
55
  # @param limit [Float, nil] Numerical limit on the number of unmanaged access codes to return.
56
- # @param page_cursor [String, nil] Identifies the specific page of results to return, obtained from the previous page's `next_page_cursor`.
56
+ # @param page_cursor [String, Seam::Null, nil] Identifies the specific page of results to return, obtained from the previous page's `next_page_cursor`.
57
57
  # @param search [String, nil] String for which to search. Filters returned access codes to include all records that satisfy a partial match using `name`, `code` or `access_code_id`.
58
58
  # @param user_identifier_key [String, nil] Your user ID for the user by which to filter unmanaged access codes.
59
59
  # @return [Seam::Resources::UnmanagedAccessCode] OK
@@ -20,12 +20,12 @@ module Seam
20
20
  # @param acs_entrance_ids [Array<String>, nil] Set of IDs of the [entrances](https://docs.seam.co/api/acs/systems/list) to which access is being granted.
21
21
  # @param customization_profile_id [String, nil] ID of the customization profile to apply to the Access Grant and its access methods.
22
22
  # @param device_ids [Array<String>, nil] Set of IDs of the [devices](https://docs.seam.co/api/devices/list) to which access is being granted.
23
- # @param ends_at [String, nil] Date and time at which the validity of the new grant ends, in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Must be a time in the future and after `starts_at`.
23
+ # @param ends_at [String, Seam::Null, nil] Date and time at which the validity of the new grant ends, in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Must be a time in the future and after `starts_at`.
24
24
  # @param location [Hash, nil]
25
25
  # @deprecated location: Create a space first, then reference it using `space_ids`.
26
26
  # @param location_ids [Array<String>, nil]
27
27
  # @deprecated location_ids: Use `space_ids`.
28
- # @param name [String, nil] Name for the access grant.
28
+ # @param name [String, Seam::Null, nil] Name for the access grant.
29
29
  # @param reservation_key [String, nil] Reservation key for the access grant.
30
30
  # @param space_ids [Array<String>, nil] Set of IDs of existing spaces to which access is being granted.
31
31
  # @param space_keys [Array<String>, nil] Set of keys of existing spaces to which access is being granted.
@@ -79,7 +79,7 @@ module Seam
79
79
  # Gets an Access Grant.
80
80
  # @param access_code_id [String, nil] ID of the access code by which you want to filter the list of Access Grants.
81
81
  # @param access_grant_ids [Array<String>, nil] IDs of the access grants to retrieve.
82
- # @param access_grant_key [String, nil] Filter Access Grants by access_grant_key. Use null to filter for Access Grants without an access_grant_key.
82
+ # @param access_grant_key [String, Seam::Null, nil] Filter Access Grants by access_grant_key. Use null to filter for Access Grants without an access_grant_key.
83
83
  # @param acs_entrance_id [String, nil] ID of the entrance by which you want to filter the list of Access Grants.
84
84
  # @param acs_system_id [String, nil] ID of the access system by which you want to filter the list of Access Grants.
85
85
  # @param customer_key [String, nil] Customer key for which you want to list access grants.
@@ -87,7 +87,7 @@ module Seam
87
87
  # @param limit [Float, nil] Numerical limit on the number of access grants to return.
88
88
  # @param location_id [String, nil]
89
89
  # @deprecated location_id: Use `space_id`.
90
- # @param page_cursor [String, nil] Identifies the specific page of results to return, obtained from the previous page's `next_page_cursor`.
90
+ # @param page_cursor [String, Seam::Null, nil] Identifies the specific page of results to return, obtained from the previous page's `next_page_cursor`.
91
91
  # @param reservation_key [String, nil] Filter Access Grants by reservation_key.
92
92
  # @param space_id [String, nil] ID of the space by which you want to filter the list of Access Grants.
93
93
  # @param user_identity_id [String, nil] ID of user identity by which you want to filter the list of Access Grants.
@@ -111,8 +111,8 @@ module Seam
111
111
  # Updates an existing Access Grant's time window.
112
112
  # @param access_grant_id [String, nil] ID of the Access Grant to update. Provide either `access_grant_id` or `access_grant_key`.
113
113
  # @param access_grant_key [String, nil] Key of the Access Grant to update. Provide either `access_grant_id` or `access_grant_key`.
114
- # @param ends_at [Time, nil] Date and time at which the validity of the grant ends, in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Must be a time in the future and after `starts_at`.
115
- # @param name [String, nil] Display name for the access grant.
114
+ # @param ends_at [Time, Seam::Null, nil] Date and time at which the validity of the grant ends, in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Must be a time in the future and after `starts_at`.
115
+ # @param name [String, Seam::Null, nil] Display name for the access grant.
116
116
  # @param starts_at [Time, nil] Date and time at which the validity of the grant starts, in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.
117
117
  # @return [nil] OK
118
118
  def update(access_grant_id: nil, access_grant_key: nil, ends_at: nil, name: nil, starts_at: nil)
@@ -21,7 +21,7 @@ module Seam
21
21
  # @param acs_entrance_id [String, nil] ID of the entrance by which you want to filter the list of unmanaged Access Grants.
22
22
  # @param acs_system_id [String, nil] ID of the access system by which you want to filter the list of unmanaged Access Grants.
23
23
  # @param limit [Float, nil] Numerical limit on the number of unmanaged access grants to return.
24
- # @param page_cursor [String, nil] Identifies the specific page of results to return, obtained from the previous page's `next_page_cursor`.
24
+ # @param page_cursor [String, Seam::Null, nil] Identifies the specific page of results to return, obtained from the previous page's `next_page_cursor`.
25
25
  # @param reservation_key [String, nil] Filter unmanaged Access Grants by reservation_key.
26
26
  # @param user_identity_id [String, nil] ID of user identity by which you want to filter the list of unmanaged Access Grants.
27
27
  # @return [Seam::Resources::UnmanagedAccessGrant] OK
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "seam/helpers/action_attempt"
3
+ require "seam/action_attempt_resolver"
4
4
 
5
5
  module Seam
6
6
  module Clients
@@ -23,7 +23,7 @@ module Seam
23
23
 
24
24
  wait_for_action_attempt = wait_for_action_attempt.nil? ? @defaults.wait_for_action_attempt : wait_for_action_attempt
25
25
 
26
- Helpers::ActionAttempt.decide_and_wait(Seam::Resources::ActionAttempt.load_from_response(res.body["action_attempt"]), @client, wait_for_action_attempt)
26
+ Seam::ActionAttemptResolver.resolve(Seam::Resources::ActionAttempt.load_from_response(res.body["action_attempt"]), @client, wait_for_action_attempt)
27
27
  end
28
28
 
29
29
  # Deletes an access method.
@@ -50,7 +50,7 @@ module Seam
50
50
 
51
51
  wait_for_action_attempt = wait_for_action_attempt.nil? ? @defaults.wait_for_action_attempt : wait_for_action_attempt
52
52
 
53
- Helpers::ActionAttempt.decide_and_wait(Seam::Resources::ActionAttempt.load_from_response(res.body["action_attempt"]), @client, wait_for_action_attempt)
53
+ Seam::ActionAttemptResolver.resolve(Seam::Resources::ActionAttempt.load_from_response(res.body["action_attempt"]), @client, wait_for_action_attempt)
54
54
  end
55
55
 
56
56
  # Gets an access method.
@@ -80,7 +80,7 @@ module Seam
80
80
  # @param acs_entrance_id [String, nil] ID of the entrance for which you want to retrieve all access methods that grant access to it.
81
81
  # @param device_id [String, nil] ID of the device by which to filter the returned access methods. Must be combined with `access_grant_id`, `access_grant_key`, or `acs_entrance_id`.
82
82
  # @param limit [Integer, nil] Maximum number of records to return per page.
83
- # @param page_cursor [String, nil] Identifies the specific page of results to return, obtained from the previous page's `next_page_cursor`.
83
+ # @param page_cursor [String, Seam::Null, nil] Identifies the specific page of results to return, obtained from the previous page's `next_page_cursor`.
84
84
  # @param space_id [String, nil] ID of the space by which to filter the returned access methods. Must be combined with `access_grant_id`, `access_grant_key`, or `acs_entrance_id`.
85
85
  # @return [Seam::Resources::AccessMethod] OK
86
86
  def list(access_code_id: nil, access_grant_id: nil, access_grant_key: nil, acs_entrance_id: nil, device_id: nil, limit: nil, page_cursor: nil, space_id: nil)
@@ -102,7 +102,7 @@ module Seam
102
102
 
103
103
  wait_for_action_attempt = wait_for_action_attempt.nil? ? @defaults.wait_for_action_attempt : wait_for_action_attempt
104
104
 
105
- Helpers::ActionAttempt.decide_and_wait(Seam::Resources::ActionAttempt.load_from_response(res.body["action_attempt"]), @client, wait_for_action_attempt)
105
+ Seam::ActionAttemptResolver.resolve(Seam::Resources::ActionAttempt.load_from_response(res.body["action_attempt"]), @client, wait_for_action_attempt)
106
106
  end
107
107
  end
108
108
  end
@@ -65,7 +65,7 @@ module Seam
65
65
  # @param created_before [Time, nil] Date and time, in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format, before which events to return were created.
66
66
  # @param is_multi_phone_sync_credential [Boolean, nil] Indicates whether you want to retrieve only multi-phone sync credentials or non-multi-phone sync credentials.
67
67
  # @param limit [Float, nil] Number of credentials to return.
68
- # @param page_cursor [String, nil] Identifies the specific page of results to return, obtained from the previous page's `next_page_cursor`.
68
+ # @param page_cursor [String, Seam::Null, nil] Identifies the specific page of results to return, obtained from the previous page's `next_page_cursor`.
69
69
  # @param search [String, nil] String for which to search. Filters returned credentials to include all records that satisfy a partial match using `display_name`, `code`, `card_number`, `acs_user_id` or `acs_credential_id`.
70
70
  # @return [Seam::Resources::AcsCredential] OK
71
71
  def list(acs_user_id: nil, acs_system_id: nil, user_identity_id: nil, created_before: nil, is_multi_phone_sync_credential: nil, limit: nil, page_cursor: nil, search: nil)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "seam/helpers/action_attempt"
3
+ require "seam/action_attempt_resolver"
4
4
 
5
5
  module Seam
6
6
  module Clients
@@ -24,7 +24,7 @@ module Seam
24
24
 
25
25
  wait_for_action_attempt = wait_for_action_attempt.nil? ? @defaults.wait_for_action_attempt : wait_for_action_attempt
26
26
 
27
- Helpers::ActionAttempt.decide_and_wait(Seam::Resources::ActionAttempt.load_from_response(res.body["action_attempt"]), @client, wait_for_action_attempt)
27
+ Seam::ActionAttemptResolver.resolve(Seam::Resources::ActionAttempt.load_from_response(res.body["action_attempt"]), @client, wait_for_action_attempt)
28
28
  end
29
29
 
30
30
  # Returns a specified [encoder](https://docs.seam.co/low-level-apis/access-systems/working-with-card-encoders-and-scanners).
@@ -41,7 +41,7 @@ module Seam
41
41
  # @param acs_system_ids [Array<String>, nil] IDs of the access systems for which you want to retrieve all encoders.
42
42
  # @param acs_encoder_ids [Array<String>, nil] IDs of the encoders that you want to retrieve.
43
43
  # @param limit [Float, nil] Number of encoders to return.
44
- # @param page_cursor [String, nil] Identifies the specific page of results to return, obtained from the previous page's `next_page_cursor`.
44
+ # @param page_cursor [String, Seam::Null, nil] Identifies the specific page of results to return, obtained from the previous page's `next_page_cursor`.
45
45
  # @return [Seam::Resources::AcsEncoder] OK
46
46
  def list(acs_system_id: nil, acs_system_ids: nil, acs_encoder_ids: nil, limit: nil, page_cursor: nil)
47
47
  res = @client.post("/acs/encoders/list", {acs_system_id: acs_system_id, acs_system_ids: acs_system_ids, acs_encoder_ids: acs_encoder_ids, limit: limit, page_cursor: page_cursor}.compact)
@@ -58,7 +58,7 @@ module Seam
58
58
 
59
59
  wait_for_action_attempt = wait_for_action_attempt.nil? ? @defaults.wait_for_action_attempt : wait_for_action_attempt
60
60
 
61
- Helpers::ActionAttempt.decide_and_wait(Seam::Resources::ActionAttempt.load_from_response(res.body["action_attempt"]), @client, wait_for_action_attempt)
61
+ Seam::ActionAttemptResolver.resolve(Seam::Resources::ActionAttempt.load_from_response(res.body["action_attempt"]), @client, wait_for_action_attempt)
62
62
  end
63
63
 
64
64
  # Scans a physical card placed on the specified [encoder](https://docs.seam.co/low-level-apis/access-systems/working-with-card-encoders-and-scanners) and assigns the scanned credential to an ACS user. Provide either an `acs_user_id` or a `user_identity_id`.
@@ -72,7 +72,7 @@ module Seam
72
72
 
73
73
  wait_for_action_attempt = wait_for_action_attempt.nil? ? @defaults.wait_for_action_attempt : wait_for_action_attempt
74
74
 
75
- Helpers::ActionAttempt.decide_and_wait(Seam::Resources::ActionAttempt.load_from_response(res.body["action_attempt"]), @client, wait_for_action_attempt)
75
+ Seam::ActionAttemptResolver.resolve(Seam::Resources::ActionAttempt.load_from_response(res.body["action_attempt"]), @client, wait_for_action_attempt)
76
76
  end
77
77
  end
78
78
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "seam/helpers/action_attempt"
3
+ require "seam/action_attempt_resolver"
4
4
 
5
5
  module Seam
6
6
  module Clients
@@ -38,9 +38,9 @@ module Seam
38
38
  # @param connected_account_id [String, nil] ID of the connected account for which you want to retrieve all entrances.
39
39
  # @param customer_key [String, nil] Customer key for which you want to list entrances.
40
40
  # @param limit [Integer, nil] Maximum number of records to return per page.
41
- # @param location_id [String, nil]
41
+ # @param location_id [String, Seam::Null, nil]
42
42
  # @deprecated location_id: Use `space_id`.
43
- # @param page_cursor [String, nil] Identifies the specific page of results to return, obtained from the previous page's `next_page_cursor`.
43
+ # @param page_cursor [String, Seam::Null, nil] Identifies the specific page of results to return, obtained from the previous page's `next_page_cursor`.
44
44
  # @param search [String, nil] String for which to search. Filters returned entrances to include all records that satisfy a partial match using `display_name`.
45
45
  # @param space_id [String, nil] ID of the space for which you want to list entrances.
46
46
  # @return [Seam::Resources::AcsEntrance] OK
@@ -69,7 +69,7 @@ module Seam
69
69
 
70
70
  wait_for_action_attempt = wait_for_action_attempt.nil? ? @defaults.wait_for_action_attempt : wait_for_action_attempt
71
71
 
72
- Helpers::ActionAttempt.decide_and_wait(Seam::Resources::ActionAttempt.load_from_response(res.body["action_attempt"]), @client, wait_for_action_attempt)
72
+ Seam::ActionAttemptResolver.resolve(Seam::Resources::ActionAttempt.load_from_response(res.body["action_attempt"]), @client, wait_for_action_attempt)
73
73
  end
74
74
  end
75
75
  end
@@ -69,7 +69,7 @@ module Seam
69
69
  # @param acs_system_id [String, nil] ID of the `acs_system` for which you want to retrieve all access system users.
70
70
  # @param created_before [Time, nil] Timestamp by which to limit returned access system users. Returns users created before this timestamp.
71
71
  # @param limit [Integer, nil] Maximum number of records to return per page.
72
- # @param page_cursor [String, nil] Identifies the specific page of results to return, obtained from the previous page's `next_page_cursor`.
72
+ # @param page_cursor [String, Seam::Null, nil] Identifies the specific page of results to return, obtained from the previous page's `next_page_cursor`.
73
73
  # @param search [String, nil] String for which to search. Filters returned access system users to include all records that satisfy a partial match using `full_name`, `phone_number`, `email_address`, `acs_user_id`, `user_identity_id`, `user_identity_full_name` or `user_identity_phone_number`.
74
74
  # @param user_identity_email_address [String, nil] Email address of the user identity for which you want to retrieve all access system users.
75
75
  # @param user_identity_id [String, nil] ID of the user identity for which you want to retrieve all access system users.
@@ -153,7 +153,7 @@ module Seam
153
153
  end
154
154
 
155
155
  # Updates the properties of a specified [access system user](https://docs.seam.co/low-level-apis/access-systems/user-management).
156
- # @param access_schedule [Hash, nil] `starts_at` and `ends_at` timestamps for the access system user's access. If you specify an `access_schedule`, you may include both `starts_at` and `ends_at`. If you omit `starts_at`, it defaults to the current time. `ends_at` is optional and must be a time in the future and after `starts_at`.
156
+ # @param access_schedule [Hash, Seam::Null, nil] `starts_at` and `ends_at` timestamps for the access system user's access. If you specify an `access_schedule`, you may include both `starts_at` and `ends_at`. If you omit `starts_at`, it defaults to the current time. `ends_at` is optional and must be a time in the future and after `starts_at`.
157
157
  # @param acs_system_id [String, nil] ID of the access system that you want to update. You can only provide acs_system_id with user_identity_id.
158
158
  # @param acs_user_id [String, nil] ID of the access system user that you want to update. You can only provide acs_user_id or user_identity_id.
159
159
  # @param email [String, nil]
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "seam/helpers/action_attempt"
3
+ require "seam/action_attempt_resolver"
4
4
 
5
5
  module Seam
6
6
  module Clients
@@ -18,14 +18,14 @@ module Seam
18
18
 
19
19
  wait_for_action_attempt = wait_for_action_attempt.nil? ? @defaults.wait_for_action_attempt : wait_for_action_attempt
20
20
 
21
- Helpers::ActionAttempt.decide_and_wait(Seam::Resources::ActionAttempt.load_from_response(res.body["action_attempt"]), @client, wait_for_action_attempt)
21
+ Seam::ActionAttemptResolver.resolve(Seam::Resources::ActionAttempt.load_from_response(res.body["action_attempt"]), @client, wait_for_action_attempt)
22
22
  end
23
23
 
24
24
  # Returns a list of the [action attempts](https://docs.seam.co/core-concepts/action-attempts) that you specify as an array of `action_attempt_id`s.
25
25
  # @param action_attempt_ids [Array<String>, nil] IDs of the action attempts that you want to retrieve.
26
26
  # @param device_id [String, nil] ID of the device to filter action attempts by.
27
27
  # @param limit [Integer, nil] Maximum number of records to return per page.
28
- # @param page_cursor [String, nil] Identifies the specific page of results to return, obtained from the previous page's `next_page_cursor`.
28
+ # @param page_cursor [String, Seam::Null, nil] Identifies the specific page of results to return, obtained from the previous page's `next_page_cursor`.
29
29
  # @return [Seam::Resources::ActionAttempt] OK
30
30
  def list(action_attempt_ids: nil, device_id: nil, limit: nil, page_cursor: nil)
31
31
  res = @client.post("/action_attempts/list", {action_attempt_ids: action_attempt_ids, device_id: device_id, limit: limit, page_cursor: page_cursor}.compact)
@@ -58,7 +58,7 @@ module Seam
58
58
  # @param custom_metadata_has [Hash, nil] Custom metadata pairs by which you want to [filter Connect Webviews](https://docs.seam.co/core-concepts/connect-webviews/filtering-connect-webviews-by-custom-metadata). Returns Connect Webviews with `custom_metadata` that contains all of the provided key:value pairs.
59
59
  # @param customer_key [String, nil] Customer key for which you want to list connect webviews.
60
60
  # @param limit [Float, nil] Maximum number of records to return per page.
61
- # @param page_cursor [String, nil] Identifies the specific page of results to return, obtained from the previous page's `next_page_cursor`.
61
+ # @param page_cursor [String, Seam::Null, nil] Identifies the specific page of results to return, obtained from the previous page's `next_page_cursor`.
62
62
  # @param search [String, nil] String for which to search. Filters returned Connect Webviews to include all records that satisfy a partial match using `connect_webview_id`, `accepted_providers`, `custom_metadata`, or `customer_key`.
63
63
  # @param user_identifier_key [String, nil] Your user ID for the user by which you want to filter Connect Webviews.
64
64
  # @return [Seam::Resources::ConnectWebview] OK
@@ -43,7 +43,7 @@ module Seam
43
43
  # @param custom_metadata_has [Hash, nil] Custom metadata pairs by which you want to filter connected accounts. Returns connected accounts with `custom_metadata` that contains all of the provided key:value pairs.
44
44
  # @param customer_key [String, nil] Customer key by which you want to filter connected accounts.
45
45
  # @param limit [Integer, nil] Maximum number of records to return per page.
46
- # @param page_cursor [String, nil] Identifies the specific page of results to return, obtained from the previous page's `next_page_cursor`.
46
+ # @param page_cursor [String, Seam::Null, nil] Identifies the specific page of results to return, obtained from the previous page's `next_page_cursor`.
47
47
  # @param search [String, nil] String for which to search. Filters returned connected accounts to include all records that satisfy a partial match using `connected_account_id`, `account_type`, `customer_key`, `custom_metadata`, `user_identifier.username`, `user_identifier.email` or `user_identifier.phone`.
48
48
  # @param space_id [String, nil] ID of the space by which you want to filter connected accounts.
49
49
  # @param user_identifier_key [String, nil] Your user ID for the user by which you want to filter connected accounts.
@@ -44,10 +44,10 @@ module Seam
44
44
  # @param device_types [Array<String>, nil] Array of device types for which you want to list devices.
45
45
  # @param limit [Float, nil] Numerical limit on the number of devices to return.
46
46
  # @param manufacturer [String, nil] Manufacturer for which you want to list devices.
47
- # @param page_cursor [String, nil] Identifies the specific page of results to return, obtained from the previous page's `next_page_cursor`.
47
+ # @param page_cursor [String, Seam::Null, nil] Identifies the specific page of results to return, obtained from the previous page's `next_page_cursor`.
48
48
  # @param search [String, nil] String for which to search. Filters returned devices to include all records that satisfy a partial match using `device_id` (full or partial UUID prefix, minimum 4 characters), `connected_account_id`, `display_name`, `custom_metadata` or `location.location_name`.
49
49
  # @param space_id [String, nil] ID of the space for which you want to list devices.
50
- # @param unstable_location_id [String, nil]
50
+ # @param unstable_location_id [String, Seam::Null, nil]
51
51
  # @deprecated unstable_location_id: Use `space_id`.
52
52
  # @param user_identifier_key [String, nil] Your own internal user ID for the user for which you want to list devices.
53
53
  # @return [Seam::Resources::Device] OK
@@ -86,7 +86,7 @@ module Seam
86
86
  # @param backup_access_code_pool_enabled [Boolean, nil] Indicates whether the device's [backup access code pool](https://docs.seam.co/low-level-apis/smart-locks/access-codes/backup-access-codes) is enabled. Set to `false` to disable the pool: Seam stops refilling it and removes any backup codes that have not yet been pulled into active use.
87
87
  # @param custom_metadata [Hash, nil] Custom metadata that you want to associate with the device. Supports up to 50 JSON key:value pairs. [Adding custom metadata to a device](https://docs.seam.co/core-concepts/devices/adding-custom-metadata-to-a-device) enables you to store custom information, like customer details or internal IDs from your application. Then, you can [filter devices by the desired metadata](https://docs.seam.co/core-concepts/devices/filtering-devices-by-custom-metadata).
88
88
  # @param is_managed [Boolean, nil] Indicates whether the device is managed. To unmanage a device, set `is_managed` to `false`.
89
- # @param name [String, nil] Name for the device.
89
+ # @param name [String, Seam::Null, nil] Name for the device.
90
90
  # @param properties [Hash, nil]
91
91
  # @return [nil] OK
92
92
  def update(device_id:, backup_access_code_pool_enabled: nil, custom_metadata: nil, is_managed: nil, name: nil, properties: nil)
@@ -39,7 +39,7 @@ module Seam
39
39
  # @param device_types [Array<String>, nil] Array of device types for which you want to list devices.
40
40
  # @param limit [Float, nil] Numerical limit on the number of devices to return.
41
41
  # @param manufacturer [String, nil] Manufacturer for which you want to list devices.
42
- # @param page_cursor [String, nil] Identifies the specific page of results to return, obtained from the previous page's `next_page_cursor`.
42
+ # @param page_cursor [String, Seam::Null, nil] Identifies the specific page of results to return, obtained from the previous page's `next_page_cursor`.
43
43
  # @param search [String, nil] String for which to search. Filters returned devices to include all records that satisfy a partial match using `device_id` (full or partial UUID prefix, minimum 4 characters), `connected_account_id`, `display_name`, `custom_metadata` or `location.location_name`.
44
44
  # @return [Seam::Resources::UnmanagedDevice] OK
45
45
  def list(connect_webview_id: nil, connected_account_id: nil, connected_account_ids: nil, created_before: nil, customer_key: nil, device_ids: nil, device_type: nil, device_types: nil, limit: nil, manufacturer: nil, page_cursor: nil, search: nil)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "seam/helpers/action_attempt"
3
+ require "seam/action_attempt_resolver"
4
4
 
5
5
  module Seam
6
6
  module Clients
@@ -24,7 +24,7 @@ module Seam
24
24
 
25
25
  wait_for_action_attempt = wait_for_action_attempt.nil? ? @defaults.wait_for_action_attempt : wait_for_action_attempt
26
26
 
27
- Helpers::ActionAttempt.decide_and_wait(Seam::Resources::ActionAttempt.load_from_response(res.body["action_attempt"]), @client, wait_for_action_attempt)
27
+ Seam::ActionAttemptResolver.resolve(Seam::Resources::ActionAttempt.load_from_response(res.body["action_attempt"]), @client, wait_for_action_attempt)
28
28
  end
29
29
 
30
30
  # Returns a specified [lock](https://docs.seam.co/low-level-apis/smart-locks).
@@ -64,7 +64,7 @@ module Seam
64
64
 
65
65
  wait_for_action_attempt = wait_for_action_attempt.nil? ? @defaults.wait_for_action_attempt : wait_for_action_attempt
66
66
 
67
- Helpers::ActionAttempt.decide_and_wait(Seam::Resources::ActionAttempt.load_from_response(res.body["action_attempt"]), @client, wait_for_action_attempt)
67
+ Seam::ActionAttemptResolver.resolve(Seam::Resources::ActionAttempt.load_from_response(res.body["action_attempt"]), @client, wait_for_action_attempt)
68
68
  end
69
69
 
70
70
  # Unlocks a [lock](https://docs.seam.co/low-level-apis/smart-locks). See also [Locking and Unlocking Smart Locks](https://docs.seam.co/low-level-apis/smart-locks/lock-and-unlock).
@@ -75,7 +75,7 @@ module Seam
75
75
 
76
76
  wait_for_action_attempt = wait_for_action_attempt.nil? ? @defaults.wait_for_action_attempt : wait_for_action_attempt
77
77
 
78
- Helpers::ActionAttempt.decide_and_wait(Seam::Resources::ActionAttempt.load_from_response(res.body["action_attempt"]), @client, wait_for_action_attempt)
78
+ Seam::ActionAttemptResolver.resolve(Seam::Resources::ActionAttempt.load_from_response(res.body["action_attempt"]), @client, wait_for_action_attempt)
79
79
  end
80
80
  end
81
81
  end