seam 2.0.0a2 → 2.0.0b0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (155) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +54 -51
  3. data/README.md +323 -3
  4. data/Rakefile +4 -1
  5. data/lib/seam/auth.rb +118 -0
  6. data/lib/seam/base_resource.rb +63 -0
  7. data/lib/seam/deep_hash_accessor.rb +37 -0
  8. data/lib/seam/default_endpoint.rb +5 -0
  9. data/lib/seam/helpers/action_attempt.rb +45 -0
  10. data/lib/seam/http.rb +52 -0
  11. data/lib/seam/http_multi_workspace.rb +62 -0
  12. data/lib/seam/http_single_workspace.rb +42 -0
  13. data/lib/seam/options.rb +64 -0
  14. data/lib/seam/parse_options.rb +23 -0
  15. data/lib/seam/request.rb +82 -51
  16. data/lib/seam/routes/clients/access_codes.rb +74 -0
  17. data/lib/seam/routes/clients/access_codes_simulate.rb +18 -0
  18. data/lib/seam/routes/clients/access_codes_unmanaged.rb +42 -0
  19. data/lib/seam/routes/clients/acs.rb +44 -0
  20. data/lib/seam/routes/clients/acs_access_groups.rb +48 -0
  21. data/lib/seam/routes/clients/acs_access_groups_unmanaged.rb +24 -0
  22. data/lib/seam/routes/clients/acs_credential_pools.rb +18 -0
  23. data/lib/seam/routes/clients/acs_credential_provisioning_automations.rb +18 -0
  24. data/lib/seam/routes/clients/acs_credentials.rb +60 -0
  25. data/lib/seam/routes/clients/acs_credentials_unmanaged.rb +24 -0
  26. data/lib/seam/routes/clients/acs_encoders.rb +36 -0
  27. data/lib/seam/routes/clients/acs_entrances.rb +36 -0
  28. data/lib/seam/routes/clients/acs_systems.rb +30 -0
  29. data/lib/seam/routes/clients/acs_users.rb +78 -0
  30. data/lib/seam/routes/clients/acs_users_unmanaged.rb +24 -0
  31. data/lib/seam/routes/clients/action_attempts.rb +28 -0
  32. data/lib/seam/routes/clients/client_sessions.rb +54 -0
  33. data/lib/seam/routes/clients/connect_webviews.rb +36 -0
  34. data/lib/seam/routes/clients/connected_accounts.rb +36 -0
  35. data/lib/seam/routes/clients/devices.rb +50 -0
  36. data/lib/seam/routes/clients/devices_simulate.rb +30 -0
  37. data/lib/seam/routes/clients/devices_unmanaged.rb +30 -0
  38. data/lib/seam/routes/clients/events.rb +24 -0
  39. data/lib/seam/routes/clients/index.rb +38 -0
  40. data/lib/seam/routes/clients/locks.rb +42 -0
  41. data/lib/seam/routes/clients/networks.rb +24 -0
  42. data/lib/seam/routes/clients/noise_sensors.rb +26 -0
  43. data/lib/seam/routes/clients/noise_sensors_noise_thresholds.rb +42 -0
  44. data/lib/seam/routes/clients/noise_sensors_simulate.rb +18 -0
  45. data/lib/seam/routes/clients/phones.rb +28 -0
  46. data/lib/seam/routes/clients/phones_simulate.rb +18 -0
  47. data/lib/seam/routes/clients/thermostats.rb +108 -0
  48. data/lib/seam/routes/clients/thermostats_schedules.rb +42 -0
  49. data/lib/seam/routes/clients/user_identities.rb +88 -0
  50. data/lib/seam/routes/clients/user_identities_enrollment_automations.rb +36 -0
  51. data/lib/seam/routes/clients/webhooks.rb +42 -0
  52. data/lib/seam/routes/clients/workspaces.rb +40 -0
  53. data/lib/seam/routes/resources/access_code.rb +14 -0
  54. data/lib/seam/routes/resources/acs_access_group.rb +11 -0
  55. data/lib/seam/routes/resources/acs_credential.rb +14 -0
  56. data/lib/seam/routes/resources/acs_credential_pool.rb +11 -0
  57. data/lib/seam/routes/resources/acs_credential_provisioning_automation.rb +11 -0
  58. data/lib/seam/routes/resources/acs_entrance.rb +13 -0
  59. data/lib/seam/routes/resources/acs_system.rb +14 -0
  60. data/lib/seam/routes/resources/acs_user.rb +14 -0
  61. data/lib/seam/routes/resources/action_attempt.rb +9 -0
  62. data/lib/seam/routes/resources/client_session.rb +11 -0
  63. data/lib/seam/routes/resources/connect_webview.rb +11 -0
  64. data/lib/seam/routes/resources/connected_account.rb +14 -0
  65. data/lib/seam/routes/resources/device.rb +14 -0
  66. data/lib/seam/routes/resources/device_provider.rb +9 -0
  67. data/lib/seam/routes/resources/enrollment_automation.rb +11 -0
  68. data/lib/seam/routes/resources/event.rb +11 -0
  69. data/lib/seam/routes/resources/index.rb +33 -0
  70. data/lib/seam/routes/resources/network.rb +11 -0
  71. data/lib/seam/routes/resources/noise_threshold.rb +9 -0
  72. data/lib/seam/routes/resources/phone.rb +14 -0
  73. data/lib/seam/routes/resources/resource_error.rb +11 -0
  74. data/lib/seam/routes/resources/resource_errors_support.rb +11 -0
  75. data/lib/seam/routes/resources/resource_warning.rb +11 -0
  76. data/lib/seam/routes/resources/resource_warnings_support.rb +11 -0
  77. data/lib/seam/routes/resources/service_health.rb +9 -0
  78. data/lib/seam/routes/resources/thermostat_schedule.rb +13 -0
  79. data/lib/seam/routes/resources/unmanaged_access_code.rb +14 -0
  80. data/lib/seam/routes/resources/unmanaged_device.rb +14 -0
  81. data/lib/seam/routes/resources/user_identity.rb +11 -0
  82. data/lib/seam/routes/resources/webhook.rb +9 -0
  83. data/lib/seam/routes/resources/workspace.rb +9 -0
  84. data/lib/seam/routes/routes.rb +94 -0
  85. data/lib/seam/token.rb +53 -0
  86. data/lib/seam/version.rb +1 -1
  87. data/lib/seam/wait_for_action_attempt.rb +32 -0
  88. data/lib/seam/webhook.rb +22 -0
  89. data/lib/seam.rb +19 -68
  90. metadata +115 -70
  91. data/lib/seam/client.rb +0 -129
  92. data/lib/seam/clients/access_codes.rb +0 -95
  93. data/lib/seam/clients/access_codes_simulate.rb +0 -17
  94. data/lib/seam/clients/access_codes_unmanaged.rb +0 -57
  95. data/lib/seam/clients/acs.rb +0 -35
  96. data/lib/seam/clients/acs_access_groups.rb +0 -57
  97. data/lib/seam/clients/acs_credential_pools.rb +0 -17
  98. data/lib/seam/clients/acs_credential_provisioning_automations.rb +0 -17
  99. data/lib/seam/clients/acs_credentials.rb +0 -77
  100. data/lib/seam/clients/acs_entrances.rb +0 -47
  101. data/lib/seam/clients/acs_systems.rb +0 -27
  102. data/lib/seam/clients/acs_users.rb +0 -117
  103. data/lib/seam/clients/action_attempts.rb +0 -30
  104. data/lib/seam/clients/base_client.rb +0 -21
  105. data/lib/seam/clients/client_sessions.rb +0 -77
  106. data/lib/seam/clients/connect_webviews.rb +0 -47
  107. data/lib/seam/clients/connected_accounts.rb +0 -47
  108. data/lib/seam/clients/devices.rb +0 -65
  109. data/lib/seam/clients/devices_simulate.rb +0 -17
  110. data/lib/seam/clients/devices_unmanaged.rb +0 -37
  111. data/lib/seam/clients/events.rb +0 -27
  112. data/lib/seam/clients/locks.rb +0 -53
  113. data/lib/seam/clients/networks.rb +0 -27
  114. data/lib/seam/clients/noise_sensors.rb +0 -15
  115. data/lib/seam/clients/noise_sensors_noise_thresholds.rb +0 -57
  116. data/lib/seam/clients/noise_sensors_simulate.rb +0 -17
  117. data/lib/seam/clients/phones.rb +0 -31
  118. data/lib/seam/clients/phones_simulate.rb +0 -17
  119. data/lib/seam/clients/thermostats.rb +0 -106
  120. data/lib/seam/clients/thermostats_climate_setting_schedules.rb +0 -57
  121. data/lib/seam/clients/user_identities.rb +0 -131
  122. data/lib/seam/clients/user_identities_enrollment_automations.rb +0 -47
  123. data/lib/seam/clients/webhooks.rb +0 -57
  124. data/lib/seam/clients/workspaces.rb +0 -50
  125. data/lib/seam/resources/access_code.rb +0 -12
  126. data/lib/seam/resources/acs_access_group.rb +0 -9
  127. data/lib/seam/resources/acs_credential.rb +0 -12
  128. data/lib/seam/resources/acs_credential_pool.rb +0 -9
  129. data/lib/seam/resources/acs_credential_provisioning_automation.rb +0 -9
  130. data/lib/seam/resources/acs_entrance.rb +0 -9
  131. data/lib/seam/resources/acs_system.rb +0 -9
  132. data/lib/seam/resources/acs_user.rb +0 -9
  133. data/lib/seam/resources/action_attempt.rb +0 -46
  134. data/lib/seam/resources/base_resource.rb +0 -58
  135. data/lib/seam/resources/client_session.rb +0 -9
  136. data/lib/seam/resources/climate_setting_schedule.rb +0 -11
  137. data/lib/seam/resources/connect_webview.rb +0 -9
  138. data/lib/seam/resources/connected_account.rb +0 -12
  139. data/lib/seam/resources/device.rb +0 -12
  140. data/lib/seam/resources/device_provider.rb +0 -7
  141. data/lib/seam/resources/enrollment_automation.rb +0 -9
  142. data/lib/seam/resources/event.rb +0 -9
  143. data/lib/seam/resources/network.rb +0 -9
  144. data/lib/seam/resources/noise_threshold.rb +0 -7
  145. data/lib/seam/resources/phone.rb +0 -12
  146. data/lib/seam/resources/resource_error.rb +0 -9
  147. data/lib/seam/resources/resource_errors_support.rb +0 -9
  148. data/lib/seam/resources/resource_warning.rb +0 -9
  149. data/lib/seam/resources/resource_warnings_support.rb +0 -9
  150. data/lib/seam/resources/service_health.rb +0 -7
  151. data/lib/seam/resources/unmanaged_access_code.rb +0 -12
  152. data/lib/seam/resources/unmanaged_device.rb +0 -12
  153. data/lib/seam/resources/user_identity.rb +0 -9
  154. data/lib/seam/resources/webhook.rb +0 -7
  155. data/lib/seam/resources/workspace.rb +0 -7
data/lib/seam/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Seam
4
- VERSION = "2.0.0a2"
4
+ VERSION = "2.0.0b0"
5
5
  end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Seam
4
+ class ActionAttemptError < StandardError
5
+ attr_reader :action_attempt
6
+
7
+ def initialize(message, action_attempt)
8
+ super(message)
9
+ @action_attempt = action_attempt
10
+ end
11
+
12
+ def name
13
+ self.class.name
14
+ end
15
+ end
16
+
17
+ class ActionAttemptFailedError < ActionAttemptError
18
+ attr_reader :code
19
+
20
+ def initialize(action_attempt)
21
+ super(action_attempt.error.message, action_attempt)
22
+ @code = action_attempt.error.type
23
+ end
24
+ end
25
+
26
+ class ActionAttemptTimeoutError < ActionAttemptError
27
+ def initialize(action_attempt, timeout)
28
+ message = "Timed out waiting for action attempt after #{timeout}s"
29
+ super(message, action_attempt)
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "svix"
4
+ require_relative "base_resource"
5
+ require_relative "routes/resources/event"
6
+
7
+ module Seam
8
+ WebhookVerificationError = Svix::WebhookVerificationError
9
+
10
+ class Webhook
11
+ def initialize(secret)
12
+ @webhook = Svix::Webhook.new(secret)
13
+ end
14
+
15
+ def verify(payload, headers)
16
+ normalized_headers = headers.transform_keys(&:downcase)
17
+ res = @webhook.verify(payload, normalized_headers)
18
+
19
+ Seam::Resources::SeamEvent.load_from_response(res)
20
+ end
21
+ end
22
+ end
data/lib/seam.rb CHANGED
@@ -1,74 +1,25 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "seam/version"
4
- require_relative "seam/lts_version"
5
- require_relative "seam/request"
6
3
  require_relative "seam/logger"
7
- require_relative "seam/client"
8
- require_relative "seam/clients/base_client"
9
- require_relative "seam/resources/base_resource"
10
- require_relative "seam/resources/resource_error"
11
- require_relative "seam/resources/resource_warning"
12
- require_relative "seam/resources/resource_errors_support"
13
- require_relative "seam/resources/resource_warnings_support"
14
- require_relative "seam/resources/access_code"
15
- require_relative "seam/resources/acs_access_group"
16
- require_relative "seam/resources/acs_credential"
17
- require_relative "seam/resources/acs_credential_pool"
18
- require_relative "seam/resources/acs_credential_provisioning_automation"
19
- require_relative "seam/resources/acs_entrance"
20
- require_relative "seam/resources/acs_system"
21
- require_relative "seam/resources/acs_user"
22
- require_relative "seam/resources/action_attempt"
23
- require_relative "seam/resources/client_session"
24
- require_relative "seam/resources/climate_setting_schedule"
25
- require_relative "seam/resources/connect_webview"
26
- require_relative "seam/resources/connected_account"
27
- require_relative "seam/resources/device"
28
- require_relative "seam/resources/device_provider"
29
- require_relative "seam/resources/enrollment_automation"
30
- require_relative "seam/resources/event"
31
- require_relative "seam/resources/network"
32
- require_relative "seam/resources/noise_threshold"
33
- require_relative "seam/resources/phone"
34
- require_relative "seam/resources/service_health"
35
- require_relative "seam/resources/unmanaged_access_code"
36
- require_relative "seam/resources/unmanaged_device"
37
- require_relative "seam/resources/user_identity"
38
- require_relative "seam/resources/webhook"
39
- require_relative "seam/resources/workspace"
40
- require_relative "seam/clients/access_codes"
41
- require_relative "seam/clients/access_codes_simulate"
42
- require_relative "seam/clients/access_codes_unmanaged"
43
- require_relative "seam/clients/acs_access_groups"
44
- require_relative "seam/clients/acs"
45
- require_relative "seam/clients/acs_credential_pools"
46
- require_relative "seam/clients/acs_credential_provisioning_automations"
47
- require_relative "seam/clients/acs_credentials"
48
- require_relative "seam/clients/acs_entrances"
49
- require_relative "seam/clients/acs_systems"
50
- require_relative "seam/clients/acs_users"
51
- require_relative "seam/clients/action_attempts"
52
- require_relative "seam/clients/client_sessions"
53
- require_relative "seam/clients/connect_webviews"
54
- require_relative "seam/clients/connected_accounts"
55
- require_relative "seam/clients/devices"
56
- require_relative "seam/clients/devices_simulate"
57
- require_relative "seam/clients/devices_unmanaged"
58
- require_relative "seam/clients/events"
59
- require_relative "seam/clients/locks"
60
- require_relative "seam/clients/networks"
61
- require_relative "seam/clients/noise_sensors_noise_thresholds"
62
- require_relative "seam/clients/noise_sensors"
63
- require_relative "seam/clients/noise_sensors_simulate"
64
- require_relative "seam/clients/phones"
65
- require_relative "seam/clients/phones_simulate"
66
- require_relative "seam/clients/thermostats_climate_setting_schedules"
67
- require_relative "seam/clients/thermostats"
68
- require_relative "seam/clients/user_identities"
69
- require_relative "seam/clients/user_identities_enrollment_automations"
70
- require_relative "seam/clients/webhooks"
71
- require_relative "seam/clients/workspaces"
4
+ require_relative "seam/http"
5
+ require_relative "seam/http_multi_workspace"
6
+ require_relative "seam/wait_for_action_attempt"
7
+ require_relative "seam/webhook"
72
8
 
73
9
  module Seam
10
+ def self.new(**args)
11
+ Http.new(**args)
12
+ end
13
+
14
+ def self.from_api_key(api_key, endpoint: nil, wait_for_action_attempt: false)
15
+ Http.from_api_key(api_key, endpoint: endpoint, wait_for_action_attempt: wait_for_action_attempt)
16
+ end
17
+
18
+ def self.from_personal_access_token(personal_access_token, workspace_id, endpoint: nil, wait_for_action_attempt: false)
19
+ Http.from_personal_access_token(personal_access_token, workspace_id, endpoint: endpoint, wait_for_action_attempt: wait_for_action_attempt)
20
+ end
21
+
22
+ def self.lts_version
23
+ Seam::LTS_VERSION
24
+ end
74
25
  end
metadata CHANGED
@@ -1,29 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: seam
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0a2
4
+ version: 2.0.0b0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seam Labs, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-06 00:00:00.000000000 Z
11
+ date: 2024-11-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: http
14
+ name: faraday
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '5.2'
19
+ version: '2.7'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '5.2'
26
+ version: '2.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: faraday-retry
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.2'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2.2'
41
+ - !ruby/object:Gem::Dependency
42
+ name: svix
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.30'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.30'
27
55
  - !ruby/object:Gem::Dependency
28
56
  name: bundler
29
57
  requirement: !ruby/object:Gem::Requirement
@@ -162,75 +190,92 @@ files:
162
190
  - README.md
163
191
  - Rakefile
164
192
  - lib/seam.rb
165
- - lib/seam/client.rb
166
- - lib/seam/clients/access_codes.rb
167
- - lib/seam/clients/access_codes_simulate.rb
168
- - lib/seam/clients/access_codes_unmanaged.rb
169
- - lib/seam/clients/acs.rb
170
- - lib/seam/clients/acs_access_groups.rb
171
- - lib/seam/clients/acs_credential_pools.rb
172
- - lib/seam/clients/acs_credential_provisioning_automations.rb
173
- - lib/seam/clients/acs_credentials.rb
174
- - lib/seam/clients/acs_entrances.rb
175
- - lib/seam/clients/acs_systems.rb
176
- - lib/seam/clients/acs_users.rb
177
- - lib/seam/clients/action_attempts.rb
178
- - lib/seam/clients/base_client.rb
179
- - lib/seam/clients/client_sessions.rb
180
- - lib/seam/clients/connect_webviews.rb
181
- - lib/seam/clients/connected_accounts.rb
182
- - lib/seam/clients/devices.rb
183
- - lib/seam/clients/devices_simulate.rb
184
- - lib/seam/clients/devices_unmanaged.rb
185
- - lib/seam/clients/events.rb
186
- - lib/seam/clients/locks.rb
187
- - lib/seam/clients/networks.rb
188
- - lib/seam/clients/noise_sensors.rb
189
- - lib/seam/clients/noise_sensors_noise_thresholds.rb
190
- - lib/seam/clients/noise_sensors_simulate.rb
191
- - lib/seam/clients/phones.rb
192
- - lib/seam/clients/phones_simulate.rb
193
- - lib/seam/clients/thermostats.rb
194
- - lib/seam/clients/thermostats_climate_setting_schedules.rb
195
- - lib/seam/clients/user_identities.rb
196
- - lib/seam/clients/user_identities_enrollment_automations.rb
197
- - lib/seam/clients/webhooks.rb
198
- - lib/seam/clients/workspaces.rb
193
+ - lib/seam/auth.rb
194
+ - lib/seam/base_resource.rb
195
+ - lib/seam/deep_hash_accessor.rb
196
+ - lib/seam/default_endpoint.rb
197
+ - lib/seam/helpers/action_attempt.rb
198
+ - lib/seam/http.rb
199
+ - lib/seam/http_multi_workspace.rb
200
+ - lib/seam/http_single_workspace.rb
199
201
  - lib/seam/logger.rb
200
202
  - lib/seam/lts_version.rb
203
+ - lib/seam/options.rb
204
+ - lib/seam/parse_options.rb
201
205
  - lib/seam/request.rb
202
- - lib/seam/resources/access_code.rb
203
- - lib/seam/resources/acs_access_group.rb
204
- - lib/seam/resources/acs_credential.rb
205
- - lib/seam/resources/acs_credential_pool.rb
206
- - lib/seam/resources/acs_credential_provisioning_automation.rb
207
- - lib/seam/resources/acs_entrance.rb
208
- - lib/seam/resources/acs_system.rb
209
- - lib/seam/resources/acs_user.rb
210
- - lib/seam/resources/action_attempt.rb
211
- - lib/seam/resources/base_resource.rb
212
- - lib/seam/resources/client_session.rb
213
- - lib/seam/resources/climate_setting_schedule.rb
214
- - lib/seam/resources/connect_webview.rb
215
- - lib/seam/resources/connected_account.rb
216
- - lib/seam/resources/device.rb
217
- - lib/seam/resources/device_provider.rb
218
- - lib/seam/resources/enrollment_automation.rb
219
- - lib/seam/resources/event.rb
220
- - lib/seam/resources/network.rb
221
- - lib/seam/resources/noise_threshold.rb
222
- - lib/seam/resources/phone.rb
223
- - lib/seam/resources/resource_error.rb
224
- - lib/seam/resources/resource_errors_support.rb
225
- - lib/seam/resources/resource_warning.rb
226
- - lib/seam/resources/resource_warnings_support.rb
227
- - lib/seam/resources/service_health.rb
228
- - lib/seam/resources/unmanaged_access_code.rb
229
- - lib/seam/resources/unmanaged_device.rb
230
- - lib/seam/resources/user_identity.rb
231
- - lib/seam/resources/webhook.rb
232
- - lib/seam/resources/workspace.rb
206
+ - lib/seam/routes/clients/access_codes.rb
207
+ - lib/seam/routes/clients/access_codes_simulate.rb
208
+ - lib/seam/routes/clients/access_codes_unmanaged.rb
209
+ - lib/seam/routes/clients/acs.rb
210
+ - lib/seam/routes/clients/acs_access_groups.rb
211
+ - lib/seam/routes/clients/acs_access_groups_unmanaged.rb
212
+ - lib/seam/routes/clients/acs_credential_pools.rb
213
+ - lib/seam/routes/clients/acs_credential_provisioning_automations.rb
214
+ - lib/seam/routes/clients/acs_credentials.rb
215
+ - lib/seam/routes/clients/acs_credentials_unmanaged.rb
216
+ - lib/seam/routes/clients/acs_encoders.rb
217
+ - lib/seam/routes/clients/acs_entrances.rb
218
+ - lib/seam/routes/clients/acs_systems.rb
219
+ - lib/seam/routes/clients/acs_users.rb
220
+ - lib/seam/routes/clients/acs_users_unmanaged.rb
221
+ - lib/seam/routes/clients/action_attempts.rb
222
+ - lib/seam/routes/clients/client_sessions.rb
223
+ - lib/seam/routes/clients/connect_webviews.rb
224
+ - lib/seam/routes/clients/connected_accounts.rb
225
+ - lib/seam/routes/clients/devices.rb
226
+ - lib/seam/routes/clients/devices_simulate.rb
227
+ - lib/seam/routes/clients/devices_unmanaged.rb
228
+ - lib/seam/routes/clients/events.rb
229
+ - lib/seam/routes/clients/index.rb
230
+ - lib/seam/routes/clients/locks.rb
231
+ - lib/seam/routes/clients/networks.rb
232
+ - lib/seam/routes/clients/noise_sensors.rb
233
+ - lib/seam/routes/clients/noise_sensors_noise_thresholds.rb
234
+ - lib/seam/routes/clients/noise_sensors_simulate.rb
235
+ - lib/seam/routes/clients/phones.rb
236
+ - lib/seam/routes/clients/phones_simulate.rb
237
+ - lib/seam/routes/clients/thermostats.rb
238
+ - lib/seam/routes/clients/thermostats_schedules.rb
239
+ - lib/seam/routes/clients/user_identities.rb
240
+ - lib/seam/routes/clients/user_identities_enrollment_automations.rb
241
+ - lib/seam/routes/clients/webhooks.rb
242
+ - lib/seam/routes/clients/workspaces.rb
243
+ - lib/seam/routes/resources/access_code.rb
244
+ - lib/seam/routes/resources/acs_access_group.rb
245
+ - lib/seam/routes/resources/acs_credential.rb
246
+ - lib/seam/routes/resources/acs_credential_pool.rb
247
+ - lib/seam/routes/resources/acs_credential_provisioning_automation.rb
248
+ - lib/seam/routes/resources/acs_entrance.rb
249
+ - lib/seam/routes/resources/acs_system.rb
250
+ - lib/seam/routes/resources/acs_user.rb
251
+ - lib/seam/routes/resources/action_attempt.rb
252
+ - lib/seam/routes/resources/client_session.rb
253
+ - lib/seam/routes/resources/connect_webview.rb
254
+ - lib/seam/routes/resources/connected_account.rb
255
+ - lib/seam/routes/resources/device.rb
256
+ - lib/seam/routes/resources/device_provider.rb
257
+ - lib/seam/routes/resources/enrollment_automation.rb
258
+ - lib/seam/routes/resources/event.rb
259
+ - lib/seam/routes/resources/index.rb
260
+ - lib/seam/routes/resources/network.rb
261
+ - lib/seam/routes/resources/noise_threshold.rb
262
+ - lib/seam/routes/resources/phone.rb
263
+ - lib/seam/routes/resources/resource_error.rb
264
+ - lib/seam/routes/resources/resource_errors_support.rb
265
+ - lib/seam/routes/resources/resource_warning.rb
266
+ - lib/seam/routes/resources/resource_warnings_support.rb
267
+ - lib/seam/routes/resources/service_health.rb
268
+ - lib/seam/routes/resources/thermostat_schedule.rb
269
+ - lib/seam/routes/resources/unmanaged_access_code.rb
270
+ - lib/seam/routes/resources/unmanaged_device.rb
271
+ - lib/seam/routes/resources/user_identity.rb
272
+ - lib/seam/routes/resources/webhook.rb
273
+ - lib/seam/routes/resources/workspace.rb
274
+ - lib/seam/routes/routes.rb
275
+ - lib/seam/token.rb
233
276
  - lib/seam/version.rb
277
+ - lib/seam/wait_for_action_attempt.rb
278
+ - lib/seam/webhook.rb
234
279
  homepage: https://github.com/seamapi/ruby-next
235
280
  licenses:
236
281
  - MIT
data/lib/seam/client.rb DELETED
@@ -1,129 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Seam
4
- class Client
5
- attr_accessor :api_key, :base_uri, :debug, :wait_for_action_attempt
6
-
7
- def self.lts_version
8
- Seam::LTS_VERSION
9
- end
10
-
11
- def initialize(api_key: nil, base_uri: nil, wait_for_action_attempt: false, debug: false)
12
- @api_key = api_key || ENV["SEAM_API_KEY"]
13
- @base_uri = base_uri || ENV["SEAM_API_URL"] || ENV["SEAM_ENDPOINT"] || "https://connect.getseam.com"
14
- @debug = debug
15
- @wait_for_action_attempt = wait_for_action_attempt
16
-
17
- raise ArgumentError, "SEAM_API_KEY not found in environment, and api_key not provided" if @api_key.to_s.empty?
18
-
19
- if ENV["SEAM_API_URL"]
20
- warn "Using the SEAM_API_URL environment variable is deprecated. " \
21
- "Support will be removed in a later major version. Use SEAM_ENDPOINT instead."
22
- end
23
- end
24
-
25
- def lts_version
26
- Seam::LTS_VERSION
27
- end
28
-
29
- def access_codes
30
- @access_codes ||= Seam::Clients::AccessCodes.new(self)
31
- end
32
-
33
- def acs
34
- @acs ||= Seam::Clients::Acs.new(self)
35
- end
36
-
37
- def action_attempts
38
- @action_attempts ||= Seam::Clients::ActionAttempts.new(self)
39
- end
40
-
41
- def client_sessions
42
- @client_sessions ||= Seam::Clients::ClientSessions.new(self)
43
- end
44
-
45
- def connect_webviews
46
- @connect_webviews ||= Seam::Clients::ConnectWebviews.new(self)
47
- end
48
-
49
- def connected_accounts
50
- @connected_accounts ||= Seam::Clients::ConnectedAccounts.new(self)
51
- end
52
-
53
- def devices
54
- @devices ||= Seam::Clients::Devices.new(self)
55
- end
56
-
57
- def events
58
- @events ||= Seam::Clients::Events.new(self)
59
- end
60
-
61
- def locks
62
- @locks ||= Seam::Clients::Locks.new(self)
63
- end
64
-
65
- def networks
66
- @networks ||= Seam::Clients::Networks.new(self)
67
- end
68
-
69
- def noise_sensors
70
- @noise_sensors ||= Seam::Clients::NoiseSensors.new(self)
71
- end
72
-
73
- def phones
74
- @phones ||= Seam::Clients::Phones.new(self)
75
- end
76
-
77
- def thermostats
78
- @thermostats ||= Seam::Clients::Thermostats.new(self)
79
- end
80
-
81
- def user_identities
82
- @user_identities ||= Seam::Clients::UserIdentities.new(self)
83
- end
84
-
85
- def webhooks
86
- @webhooks ||= Seam::Clients::Webhooks.new(self)
87
- end
88
-
89
- def workspaces
90
- @workspaces ||= Seam::Clients::Workspaces.new(self)
91
- end
92
-
93
- def health
94
- request_seam(:get, "/health")
95
- end
96
-
97
- # @deprecated Please use {#devices.unmanaged} instead.
98
- def unmanaged_devices
99
- warn "[DEPRECATION] 'unmanaged_devices' is deprecated. Please use 'devices.unmanaged' instead."
100
-
101
- @unmanaged_devices ||= Seam::Clients::DevicesUnmanaged.new(self)
102
- end
103
-
104
- # @deprecated Please use {#access_codes.unmanaged} instead.
105
- def unmanaged_access_codes
106
- warn "[DEPRECATION] 'unmanaged_access_codes' is deprecated. Please use 'access_codes.unmanaged' instead."
107
-
108
- @unmanaged_access_codes ||= Seam::Clients::AccessCodesUnmanaged.new(self)
109
- end
110
-
111
- def request_seam_object(method, path, klass, inner_object, config = {})
112
- response = request_seam(method, path, config)
113
-
114
- data = response[inner_object]
115
-
116
- klass.load_from_response(data, self)
117
- end
118
-
119
- def request_seam(method, path, config = {})
120
- Seam::Request.new(
121
- api_key: api_key,
122
- base_uri: base_uri,
123
- debug: debug
124
- ).perform(
125
- method, path, config
126
- )
127
- end
128
- end
129
- end
@@ -1,95 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Seam
4
- module Clients
5
- class AccessCodes < BaseClient
6
- def simulate
7
- @simulate ||= Seam::Clients::AccessCodesSimulate.new(self)
8
- end
9
-
10
- def unmanaged
11
- @unmanaged ||= Seam::Clients::AccessCodesUnmanaged.new(self)
12
- end
13
-
14
- def create(device_id:, allow_external_modification: nil, attempt_for_offline_device: nil, code: nil, common_code_key: nil, ends_at: nil, is_external_modification_allowed: nil, is_offline_access_code: nil, is_one_time_use: nil, max_time_rounding: nil, name: nil, prefer_native_scheduling: nil, starts_at: nil, sync: nil, use_backup_access_code_pool: nil, use_offline_access_code: nil)
15
- request_seam_object(
16
- :post,
17
- "/access_codes/create",
18
- Seam::AccessCode,
19
- "access_code",
20
- body: {device_id: device_id, allow_external_modification: allow_external_modification, attempt_for_offline_device: attempt_for_offline_device, code: code, common_code_key: common_code_key, ends_at: ends_at, is_external_modification_allowed: is_external_modification_allowed, is_offline_access_code: is_offline_access_code, is_one_time_use: is_one_time_use, max_time_rounding: max_time_rounding, name: name, prefer_native_scheduling: prefer_native_scheduling, starts_at: starts_at, sync: sync, use_backup_access_code_pool: use_backup_access_code_pool, use_offline_access_code: use_offline_access_code}.compact
21
- )
22
- end
23
-
24
- def create_multiple(device_ids:, allow_external_modification: nil, attempt_for_offline_device: nil, behavior_when_code_cannot_be_shared: nil, code: nil, ends_at: nil, is_external_modification_allowed: nil, is_offline_access_code: nil, is_one_time_use: nil, max_time_rounding: nil, name: nil, prefer_native_scheduling: nil, preferred_code_length: nil, starts_at: nil, use_backup_access_code_pool: nil, use_offline_access_code: nil)
25
- request_seam_object(
26
- :post,
27
- "/access_codes/create_multiple",
28
- Seam::AccessCode,
29
- "access_codes",
30
- body: {device_ids: device_ids, allow_external_modification: allow_external_modification, attempt_for_offline_device: attempt_for_offline_device, behavior_when_code_cannot_be_shared: behavior_when_code_cannot_be_shared, code: code, ends_at: ends_at, is_external_modification_allowed: is_external_modification_allowed, is_offline_access_code: is_offline_access_code, is_one_time_use: is_one_time_use, max_time_rounding: max_time_rounding, name: name, prefer_native_scheduling: prefer_native_scheduling, preferred_code_length: preferred_code_length, starts_at: starts_at, use_backup_access_code_pool: use_backup_access_code_pool, use_offline_access_code: use_offline_access_code}.compact
31
- )
32
- end
33
-
34
- def delete(access_code_id:, device_id: nil, sync: nil)
35
- request_seam(
36
- :post,
37
- "/access_codes/delete",
38
- body: {access_code_id: access_code_id, device_id: device_id, sync: sync}.compact
39
- )
40
-
41
- nil
42
- end
43
-
44
- def generate_code(device_id:)
45
- request_seam_object(
46
- :post,
47
- "/access_codes/generate_code",
48
- Seam::AccessCode,
49
- "generated_code",
50
- body: {device_id: device_id}.compact
51
- )
52
- end
53
-
54
- def get(access_code_id: nil, code: nil, device_id: nil)
55
- request_seam_object(
56
- :post,
57
- "/access_codes/get",
58
- Seam::AccessCode,
59
- "access_code",
60
- body: {access_code_id: access_code_id, code: code, device_id: device_id}.compact
61
- )
62
- end
63
-
64
- def list(access_code_ids: nil, device_id: nil, user_identifier_key: nil)
65
- request_seam_object(
66
- :post,
67
- "/access_codes/list",
68
- Seam::AccessCode,
69
- "access_codes",
70
- body: {access_code_ids: access_code_ids, device_id: device_id, user_identifier_key: user_identifier_key}.compact
71
- )
72
- end
73
-
74
- def pull_backup_access_code(access_code_id:)
75
- request_seam_object(
76
- :post,
77
- "/access_codes/pull_backup_access_code",
78
- Seam::AccessCode,
79
- "backup_access_code",
80
- body: {access_code_id: access_code_id}.compact
81
- )
82
- end
83
-
84
- def update(access_code_id:, allow_external_modification: nil, attempt_for_offline_device: nil, code: nil, device_id: nil, ends_at: nil, is_external_modification_allowed: nil, is_managed: nil, is_offline_access_code: nil, is_one_time_use: nil, max_time_rounding: nil, name: nil, prefer_native_scheduling: nil, starts_at: nil, sync: nil, type: nil, use_backup_access_code_pool: nil, use_offline_access_code: nil)
85
- request_seam(
86
- :post,
87
- "/access_codes/update",
88
- body: {access_code_id: access_code_id, allow_external_modification: allow_external_modification, attempt_for_offline_device: attempt_for_offline_device, code: code, device_id: device_id, ends_at: ends_at, is_external_modification_allowed: is_external_modification_allowed, is_managed: is_managed, is_offline_access_code: is_offline_access_code, is_one_time_use: is_one_time_use, max_time_rounding: max_time_rounding, name: name, prefer_native_scheduling: prefer_native_scheduling, starts_at: starts_at, sync: sync, type: type, use_backup_access_code_pool: use_backup_access_code_pool, use_offline_access_code: use_offline_access_code}.compact
89
- )
90
-
91
- nil
92
- end
93
- end
94
- end
95
- end
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Seam
4
- module Clients
5
- class AccessCodesSimulate < BaseClient
6
- def create_unmanaged_access_code(code:, device_id:, name:)
7
- request_seam_object(
8
- :post,
9
- "/access_codes/simulate/create_unmanaged_access_code",
10
- Seam::UnmanagedAccessCode,
11
- "access_code",
12
- body: {code: code, device_id: device_id, name: name}.compact
13
- )
14
- end
15
- end
16
- end
17
- end