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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: seam
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.140.0
4
+ version: 2.141.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seam Labs, Inc.
@@ -189,14 +189,15 @@ files:
189
189
  - README.md
190
190
  - Rakefile
191
191
  - lib/seam.rb
192
+ - lib/seam/action_attempt_resolver.rb
192
193
  - lib/seam/auth.rb
193
194
  - lib/seam/base_resource.rb
194
195
  - lib/seam/deep_hash_accessor.rb
195
196
  - lib/seam/defaults.rb
196
- - lib/seam/helpers/action_attempt.rb
197
197
  - lib/seam/http.rb
198
198
  - lib/seam/http_single_workspace.rb
199
199
  - lib/seam/http_without_workspace.rb
200
+ - lib/seam/null.rb
200
201
  - lib/seam/options.rb
201
202
  - lib/seam/paginator.rb
202
203
  - lib/seam/parse_options.rb
@@ -279,7 +280,10 @@ files:
279
280
  - lib/seam/routes/user_identities_unmanaged.rb
280
281
  - lib/seam/routes/webhooks.rb
281
282
  - lib/seam/routes/workspaces.rb
283
+ - lib/seam/strict_url_search_params_serializer.rb
282
284
  - lib/seam/token.rb
285
+ - lib/seam/url_search_params.rb
286
+ - lib/seam/url_search_params_serializer.rb
283
287
  - lib/seam/version.rb
284
288
  - lib/seam/wait_for_action_attempt.rb
285
289
  - lib/seam/webhook.rb
@@ -1,56 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "../wait_for_action_attempt"
4
-
5
- module Seam
6
- module Helpers
7
- module ActionAttempt
8
- def self.decide_and_wait(action_attempt, client, wait_for_action_attempt)
9
- return wait_until_finished(action_attempt, client) if wait_for_action_attempt == true
10
-
11
- options = wait_options(wait_for_action_attempt)
12
- return action_attempt if options.nil?
13
-
14
- wait_until_finished(action_attempt, client, timeout: options[:timeout],
15
- polling_interval: options[:polling_interval])
16
- end
17
-
18
- # The client wraps its defaults in a DeepHashAccessor, so the hash form of
19
- # this option reaches here as an accessor when it comes from the client
20
- # and as a plain Hash when it comes from the method call.
21
- def self.wait_options(wait_for_action_attempt)
22
- case wait_for_action_attempt
23
- when Hash then wait_for_action_attempt
24
- when Seam::DeepHashAccessor then wait_for_action_attempt.to_h
25
- end
26
- end
27
-
28
- def self.wait_until_finished(action_attempt, client, timeout: nil, polling_interval: nil)
29
- timeout = timeout.nil? ? 5.0 : timeout
30
- polling_interval = polling_interval.nil? ? 0.5 : polling_interval
31
-
32
- time_waiting = 0.0
33
-
34
- while action_attempt.status == "pending"
35
- sleep(polling_interval)
36
- time_waiting += polling_interval
37
-
38
- raise Seam::ActionAttemptTimeoutError.new(action_attempt, timeout) if time_waiting > timeout
39
-
40
- action_attempt = update_action_attempt(action_attempt, client)
41
- end
42
-
43
- raise Seam::ActionAttemptFailedError.new(action_attempt) if action_attempt.status == "error"
44
-
45
- action_attempt
46
- end
47
-
48
- def self.update_action_attempt(action_attempt, client)
49
- response = client.get("/action_attempts/get", {action_attempt_id: action_attempt.action_attempt_id})
50
-
51
- action_attempt.update_from_response(response.body["action_attempt"])
52
- action_attempt
53
- end
54
- end
55
- end
56
- end