seam 2.0.0a1 → 2.0.0b0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +63 -28
  3. data/README.md +327 -4
  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/logger.rb +12 -0
  14. data/lib/seam/lts_version.rb +5 -0
  15. data/lib/seam/options.rb +64 -0
  16. data/lib/seam/parse_options.rb +23 -0
  17. data/lib/seam/request.rb +104 -0
  18. data/lib/seam/routes/clients/access_codes.rb +74 -0
  19. data/lib/seam/routes/clients/access_codes_simulate.rb +18 -0
  20. data/lib/seam/routes/clients/access_codes_unmanaged.rb +42 -0
  21. data/lib/seam/routes/clients/acs.rb +44 -0
  22. data/lib/seam/routes/clients/acs_access_groups.rb +48 -0
  23. data/lib/seam/routes/clients/acs_access_groups_unmanaged.rb +24 -0
  24. data/lib/seam/routes/clients/acs_credential_pools.rb +18 -0
  25. data/lib/seam/routes/clients/acs_credential_provisioning_automations.rb +18 -0
  26. data/lib/seam/routes/clients/acs_credentials.rb +60 -0
  27. data/lib/seam/routes/clients/acs_credentials_unmanaged.rb +24 -0
  28. data/lib/seam/routes/clients/acs_encoders.rb +36 -0
  29. data/lib/seam/routes/clients/acs_entrances.rb +36 -0
  30. data/lib/seam/routes/clients/acs_systems.rb +30 -0
  31. data/lib/seam/routes/clients/acs_users.rb +78 -0
  32. data/lib/seam/routes/clients/acs_users_unmanaged.rb +24 -0
  33. data/lib/seam/routes/clients/action_attempts.rb +28 -0
  34. data/lib/seam/routes/clients/client_sessions.rb +54 -0
  35. data/lib/seam/routes/clients/connect_webviews.rb +36 -0
  36. data/lib/seam/routes/clients/connected_accounts.rb +36 -0
  37. data/lib/seam/routes/clients/devices.rb +50 -0
  38. data/lib/seam/routes/clients/devices_simulate.rb +30 -0
  39. data/lib/seam/routes/clients/devices_unmanaged.rb +30 -0
  40. data/lib/seam/routes/clients/events.rb +24 -0
  41. data/lib/seam/routes/clients/index.rb +38 -0
  42. data/lib/seam/routes/clients/locks.rb +42 -0
  43. data/lib/seam/routes/clients/networks.rb +24 -0
  44. data/lib/seam/routes/clients/noise_sensors.rb +26 -0
  45. data/lib/seam/routes/clients/noise_sensors_noise_thresholds.rb +42 -0
  46. data/lib/seam/routes/clients/noise_sensors_simulate.rb +18 -0
  47. data/lib/seam/routes/clients/phones.rb +28 -0
  48. data/lib/seam/routes/clients/phones_simulate.rb +18 -0
  49. data/lib/seam/routes/clients/thermostats.rb +108 -0
  50. data/lib/seam/routes/clients/thermostats_schedules.rb +42 -0
  51. data/lib/seam/routes/clients/user_identities.rb +88 -0
  52. data/lib/seam/routes/clients/user_identities_enrollment_automations.rb +36 -0
  53. data/lib/seam/routes/clients/webhooks.rb +42 -0
  54. data/lib/seam/routes/clients/workspaces.rb +40 -0
  55. data/lib/seam/routes/resources/access_code.rb +14 -0
  56. data/lib/seam/routes/resources/acs_access_group.rb +11 -0
  57. data/lib/seam/routes/resources/acs_credential.rb +14 -0
  58. data/lib/seam/routes/resources/acs_credential_pool.rb +11 -0
  59. data/lib/seam/routes/resources/acs_credential_provisioning_automation.rb +11 -0
  60. data/lib/seam/routes/resources/acs_entrance.rb +13 -0
  61. data/lib/seam/routes/resources/acs_system.rb +14 -0
  62. data/lib/seam/routes/resources/acs_user.rb +14 -0
  63. data/lib/seam/routes/resources/action_attempt.rb +9 -0
  64. data/lib/seam/routes/resources/client_session.rb +11 -0
  65. data/lib/seam/routes/resources/connect_webview.rb +11 -0
  66. data/lib/seam/routes/resources/connected_account.rb +14 -0
  67. data/lib/seam/routes/resources/device.rb +14 -0
  68. data/lib/seam/routes/resources/device_provider.rb +9 -0
  69. data/lib/seam/routes/resources/enrollment_automation.rb +11 -0
  70. data/lib/seam/routes/resources/event.rb +11 -0
  71. data/lib/seam/routes/resources/index.rb +33 -0
  72. data/lib/seam/routes/resources/network.rb +11 -0
  73. data/lib/seam/routes/resources/noise_threshold.rb +9 -0
  74. data/lib/seam/routes/resources/phone.rb +14 -0
  75. data/lib/seam/routes/resources/resource_error.rb +11 -0
  76. data/lib/seam/routes/resources/resource_errors_support.rb +11 -0
  77. data/lib/seam/routes/resources/resource_warning.rb +11 -0
  78. data/lib/seam/routes/resources/resource_warnings_support.rb +11 -0
  79. data/lib/seam/routes/resources/service_health.rb +9 -0
  80. data/lib/seam/routes/resources/thermostat_schedule.rb +13 -0
  81. data/lib/seam/routes/resources/unmanaged_access_code.rb +14 -0
  82. data/lib/seam/routes/resources/unmanaged_device.rb +14 -0
  83. data/lib/seam/routes/resources/user_identity.rb +11 -0
  84. data/lib/seam/routes/resources/webhook.rb +9 -0
  85. data/lib/seam/routes/resources/workspace.rb +9 -0
  86. data/lib/seam/routes/routes.rb +94 -0
  87. data/lib/seam/token.rb +53 -0
  88. data/lib/seam/version.rb +1 -1
  89. data/lib/seam/wait_for_action_attempt.rb +32 -0
  90. data/lib/seam/webhook.rb +22 -0
  91. data/lib/seam.rb +20 -3
  92. metadata +143 -3
  93. data/lib/seam/todo.rb +0 -9
@@ -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,8 +1,25 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "seam/version"
4
- require_relative "seam/todo"
3
+ require_relative "seam/logger"
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"
5
8
 
6
9
  module Seam
7
- # TODO
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
8
25
  end
metadata CHANGED
@@ -1,15 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: seam
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0a1
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-04-18 00:00:00.000000000 Z
11
+ date: 2024-11-12 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: faraday
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.7'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
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'
13
55
  - !ruby/object:Gem::Dependency
14
56
  name: bundler
15
57
  requirement: !ruby/object:Gem::Requirement
@@ -122,6 +164,20 @@ dependencies:
122
164
  - - "~>"
123
165
  - !ruby/object:Gem::Version
124
166
  version: '1.3'
167
+ - !ruby/object:Gem::Dependency
168
+ name: webmock
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: 3.0.0
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: 3.0.0
125
181
  description: SDK for the Seam API written in Ruby.
126
182
  email: engineering@getseam.com
127
183
  executables: []
@@ -134,8 +190,92 @@ files:
134
190
  - README.md
135
191
  - Rakefile
136
192
  - lib/seam.rb
137
- - lib/seam/todo.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
201
+ - lib/seam/logger.rb
202
+ - lib/seam/lts_version.rb
203
+ - lib/seam/options.rb
204
+ - lib/seam/parse_options.rb
205
+ - lib/seam/request.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
138
276
  - lib/seam/version.rb
277
+ - lib/seam/wait_for_action_attempt.rb
278
+ - lib/seam/webhook.rb
139
279
  homepage: https://github.com/seamapi/ruby-next
140
280
  licenses:
141
281
  - MIT
data/lib/seam/todo.rb DELETED
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Seam
4
- class Todo
5
- def todo
6
- "TODO"
7
- end
8
- end
9
- end