seam 2.0.0a2 → 2.0.0b0

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 (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
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Seam
4
+ module Clients
5
+ class Webhooks
6
+ def initialize(client:, defaults:)
7
+ @client = client
8
+ @defaults = defaults
9
+ end
10
+
11
+ def create(url:, event_types: nil)
12
+ res = @client.post("/webhooks/create", {url: url, event_types: event_types}.compact)
13
+
14
+ Seam::Resources::Webhook.load_from_response(res.body["webhook"])
15
+ end
16
+
17
+ def delete(webhook_id:)
18
+ @client.post("/webhooks/delete", {webhook_id: webhook_id}.compact)
19
+
20
+ nil
21
+ end
22
+
23
+ def get(webhook_id:)
24
+ res = @client.post("/webhooks/get", {webhook_id: webhook_id}.compact)
25
+
26
+ Seam::Resources::Webhook.load_from_response(res.body["webhook"])
27
+ end
28
+
29
+ def list
30
+ res = @client.post("/webhooks/list")
31
+
32
+ Seam::Resources::Webhook.load_from_response(res.body["webhooks"])
33
+ end
34
+
35
+ def update(event_types:, webhook_id:)
36
+ @client.post("/webhooks/update", {event_types: event_types, webhook_id: webhook_id}.compact)
37
+
38
+ nil
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "seam/helpers/action_attempt"
4
+
5
+ module Seam
6
+ module Clients
7
+ class Workspaces
8
+ def initialize(client:, defaults:)
9
+ @client = client
10
+ @defaults = defaults
11
+ end
12
+
13
+ def create(name:, company_name: nil, connect_partner_name: nil, is_sandbox: nil, webview_logo_shape: nil, webview_primary_button_color: nil, webview_primary_button_text_color: nil)
14
+ res = @client.post("/workspaces/create", {name: name, company_name: company_name, connect_partner_name: connect_partner_name, is_sandbox: is_sandbox, webview_logo_shape: webview_logo_shape, webview_primary_button_color: webview_primary_button_color, webview_primary_button_text_color: webview_primary_button_text_color}.compact)
15
+
16
+ Seam::Resources::Workspace.load_from_response(res.body["workspace"])
17
+ end
18
+
19
+ def get
20
+ res = @client.post("/workspaces/get")
21
+
22
+ Seam::Resources::Workspace.load_from_response(res.body["workspace"])
23
+ end
24
+
25
+ def list
26
+ res = @client.post("/workspaces/list")
27
+
28
+ Seam::Resources::Workspace.load_from_response(res.body["workspaces"])
29
+ end
30
+
31
+ def reset_sandbox(wait_for_action_attempt: nil)
32
+ res = @client.post("/workspaces/reset_sandbox")
33
+
34
+ wait_for_action_attempt = wait_for_action_attempt.nil? ? @defaults.wait_for_action_attempt : wait_for_action_attempt
35
+
36
+ Helpers::ActionAttempt.decide_and_wait(Seam::Resources::ActionAttempt.load_from_response(res.body["action_attempt"]), @client, wait_for_action_attempt)
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Seam
4
+ module Resources
5
+ class AccessCode < BaseResource
6
+ attr_accessor :access_code_id, :code, :common_code_key, :device_id, :is_backup, :is_backup_access_code_available, :is_external_modification_allowed, :is_managed, :is_offline_access_code, :is_one_time_use, :is_scheduled_on_device, :is_waiting_for_code_assignment, :name, :pulled_backup_access_code_id, :status, :type
7
+
8
+ date_accessor :created_at, :ends_at, :starts_at
9
+
10
+ include Seam::Resources::ResourceErrorsSupport
11
+ include Seam::Resources::ResourceWarningsSupport
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Seam
4
+ module Resources
5
+ class AcsAccessGroup < BaseResource
6
+ attr_accessor :access_group_type, :access_group_type_display_name, :acs_access_group_id, :acs_system_id, :display_name, :external_type, :external_type_display_name, :is_managed, :name, :workspace_id
7
+
8
+ date_accessor :created_at
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Seam
4
+ module Resources
5
+ class AcsCredential < BaseResource
6
+ attr_accessor :access_method, :acs_credential_id, :acs_credential_pool_id, :acs_system_id, :acs_user_id, :card_number, :code, :display_name, :ends_at, :external_type, :external_type_display_name, :is_issued, :is_latest_desired_state_synced_with_provider, :is_managed, :is_multi_phone_sync_credential, :parent_acs_credential_id, :starts_at, :visionline_metadata, :workspace_id
7
+
8
+ date_accessor :created_at, :issued_at, :latest_desired_state_synced_with_provider_at
9
+
10
+ include Seam::Resources::ResourceErrorsSupport
11
+ include Seam::Resources::ResourceWarningsSupport
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Seam
4
+ module Resources
5
+ class AcsCredentialPool < BaseResource
6
+ attr_accessor :acs_credential_pool_id, :acs_system_id, :display_name, :external_type, :external_type_display_name, :workspace_id
7
+
8
+ date_accessor :created_at
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Seam
4
+ module Resources
5
+ class AcsCredentialProvisioningAutomation < BaseResource
6
+ attr_accessor :acs_credential_provisioning_automation_id, :credential_manager_acs_system_id, :user_identity_id, :workspace_id
7
+
8
+ date_accessor :created_at
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Seam
4
+ module Resources
5
+ class AcsEntrance < BaseResource
6
+ attr_accessor :acs_entrance_id, :acs_system_id, :assa_abloy_vostio_metadata, :display_name, :dormakaba_community_metadata, :latch_metadata, :salto_ks_metadata, :visionline_metadata
7
+
8
+ date_accessor :created_at
9
+
10
+ include Seam::Resources::ResourceErrorsSupport
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Seam
4
+ module Resources
5
+ class AcsSystem < BaseResource
6
+ attr_accessor :acs_system_id, :can_add_acs_users_to_acs_access_groups, :can_automate_enrollment, :can_create_acs_access_groups, :can_remove_acs_users_from_acs_access_groups, :connected_account_ids, :default_credential_manager_acs_system_id, :external_type, :external_type_display_name, :image_alt_text, :image_url, :is_credential_manager, :name, :system_type, :system_type_display_name, :visionline_metadata, :workspace_id
7
+
8
+ date_accessor :created_at
9
+
10
+ include Seam::Resources::ResourceErrorsSupport
11
+ include Seam::Resources::ResourceWarningsSupport
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Seam
4
+ module Resources
5
+ class AcsUser < BaseResource
6
+ attr_accessor :access_schedule, :acs_system_id, :acs_user_id, :display_name, :email, :email_address, :external_type, :external_type_display_name, :full_name, :hid_acs_system_id, :is_latest_desired_state_synced_with_provider, :is_managed, :is_suspended, :phone_number, :user_identity_email_address, :user_identity_full_name, :user_identity_id, :user_identity_phone_number, :workspace_id
7
+
8
+ date_accessor :created_at, :latest_desired_state_synced_with_provider_at
9
+
10
+ include Seam::Resources::ResourceErrorsSupport
11
+ include Seam::Resources::ResourceWarningsSupport
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Seam
4
+ module Resources
5
+ class ActionAttempt < BaseResource
6
+ attr_accessor :action_attempt_id, :action_type, :error, :result, :status
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Seam
4
+ module Resources
5
+ class ClientSession < BaseResource
6
+ attr_accessor :client_session_id, :connect_webview_ids, :connected_account_ids, :device_count, :token, :user_identifier_key, :user_identity_ids, :workspace_id
7
+
8
+ date_accessor :created_at
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Seam
4
+ module Resources
5
+ class ConnectWebview < BaseResource
6
+ attr_accessor :accepted_devices, :accepted_providers, :any_device_allowed, :any_provider_allowed, :automatically_manage_new_devices, :connect_webview_id, :connected_account_id, :custom_metadata, :custom_redirect_failure_url, :custom_redirect_url, :device_selection_mode, :login_successful, :selected_provider, :status, :url, :wait_for_device_creation, :workspace_id
7
+
8
+ date_accessor :authorized_at, :created_at
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Seam
4
+ module Resources
5
+ class ConnectedAccount < BaseResource
6
+ attr_accessor :account_type, :account_type_display_name, :automatically_manage_new_devices, :connected_account_id, :custom_metadata, :user_identifier
7
+
8
+ date_accessor :created_at
9
+
10
+ include Seam::Resources::ResourceErrorsSupport
11
+ include Seam::Resources::ResourceWarningsSupport
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Seam
4
+ module Resources
5
+ class Device < BaseResource
6
+ attr_accessor :can_hvac_cool, :can_hvac_heat, :can_hvac_heat_cool, :can_program_offline_access_codes, :can_program_online_access_codes, :can_remotely_lock, :can_remotely_unlock, :can_simulate_connection, :can_simulate_disconnection, :can_simulate_removal, :can_turn_off_hvac, :capabilities_supported, :connected_account_id, :custom_metadata, :device_id, :device_type, :display_name, :is_managed, :location, :nickname, :properties, :workspace_id
7
+
8
+ date_accessor :created_at
9
+
10
+ include Seam::Resources::ResourceErrorsSupport
11
+ include Seam::Resources::ResourceWarningsSupport
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Seam
4
+ module Resources
5
+ class DeviceProvider < BaseResource
6
+ attr_accessor :can_hvac_cool, :can_hvac_heat, :can_hvac_heat_cool, :can_program_offline_access_codes, :can_program_online_access_codes, :can_remotely_lock, :can_remotely_unlock, :can_simulate_connection, :can_simulate_disconnection, :can_simulate_removal, :can_turn_off_hvac, :device_provider_name, :display_name, :image_url, :provider_categories
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Seam
4
+ module Resources
5
+ class EnrollmentAutomation < BaseResource
6
+ attr_accessor :credential_manager_acs_system_id, :enrollment_automation_id, :user_identity_id, :workspace_id
7
+
8
+ date_accessor :created_at
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Seam
4
+ module Resources
5
+ class SeamEvent < BaseResource
6
+ attr_accessor :acs_credential_id, :acs_system_id, :acs_user_id, :action_attempt_id, :client_session_id, :climate_preset_key, :cooling_set_point_celsius, :cooling_set_point_fahrenheit, :device_id, :enrollment_automation_id, :event_description, :event_id, :event_type, :fan_mode_setting, :heating_set_point_celsius, :heating_set_point_fahrenheit, :hvac_mode_setting, :is_fallback_climate_preset, :method, :thermostat_schedule_id, :workspace_id
7
+
8
+ date_accessor :created_at, :occurred_at
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "seam/base_resource"
4
+ require_relative "resource_error"
5
+ require_relative "resource_warning"
6
+ require_relative "resource_errors_support"
7
+ require_relative "resource_warnings_support"
8
+ require_relative "access_code"
9
+ require_relative "acs_access_group"
10
+ require_relative "acs_credential"
11
+ require_relative "acs_credential_pool"
12
+ require_relative "acs_credential_provisioning_automation"
13
+ require_relative "acs_entrance"
14
+ require_relative "acs_system"
15
+ require_relative "acs_user"
16
+ require_relative "action_attempt"
17
+ require_relative "client_session"
18
+ require_relative "connect_webview"
19
+ require_relative "connected_account"
20
+ require_relative "device"
21
+ require_relative "device_provider"
22
+ require_relative "enrollment_automation"
23
+ require_relative "event"
24
+ require_relative "network"
25
+ require_relative "noise_threshold"
26
+ require_relative "phone"
27
+ require_relative "service_health"
28
+ require_relative "thermostat_schedule"
29
+ require_relative "unmanaged_access_code"
30
+ require_relative "unmanaged_device"
31
+ require_relative "user_identity"
32
+ require_relative "webhook"
33
+ require_relative "workspace"
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Seam
4
+ module Resources
5
+ class Network < BaseResource
6
+ attr_accessor :display_name, :network_id, :workspace_id
7
+
8
+ date_accessor :created_at
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Seam
4
+ module Resources
5
+ class NoiseThreshold < BaseResource
6
+ attr_accessor :device_id, :ends_daily_at, :name, :noise_threshold_decibels, :noise_threshold_id, :noise_threshold_nrs, :starts_daily_at
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Seam
4
+ module Resources
5
+ class Phone < BaseResource
6
+ attr_accessor :can_hvac_cool, :can_hvac_heat, :can_hvac_heat_cool, :can_program_offline_access_codes, :can_program_online_access_codes, :can_remotely_lock, :can_remotely_unlock, :can_simulate_connection, :can_simulate_disconnection, :can_simulate_removal, :can_turn_off_hvac, :capabilities_supported, :custom_metadata, :device_id, :device_type, :display_name, :is_managed, :location, :nickname, :properties, :workspace_id
7
+
8
+ date_accessor :created_at
9
+
10
+ include Seam::Resources::ResourceErrorsSupport
11
+ include Seam::Resources::ResourceWarningsSupport
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Seam
4
+ module Resources
5
+ class ResourceError < BaseResource
6
+ attr_accessor :error_code, :message
7
+
8
+ date_accessor :created_at
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Seam
4
+ module Resources
5
+ module ResourceErrorsSupport
6
+ def errors
7
+ @errors_converted ||= @errors.is_a?(Array) ? Seam::Resources::ResourceError.load_from_response(@errors) : []
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Seam
4
+ module Resources
5
+ class ResourceWarning < BaseResource
6
+ attr_accessor :warning_code, :message
7
+
8
+ date_accessor :created_at
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Seam
4
+ module Resources
5
+ module ResourceWarningsSupport
6
+ def warnings
7
+ @warnings_converted ||= @warnings.is_a?(Array) ? Seam::Resources::ResourceWarning.load_from_response(@warnings) : []
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Seam
4
+ module Resources
5
+ class ServiceHealth < BaseResource
6
+ attr_accessor :description, :service, :status
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Seam
4
+ module Resources
5
+ class ThermostatSchedule < BaseResource
6
+ attr_accessor :climate_preset_key, :device_id, :max_override_period_minutes, :name, :thermostat_schedule_id
7
+
8
+ date_accessor :created_at, :ends_at, :starts_at
9
+
10
+ include Seam::Resources::ResourceErrorsSupport
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Seam
4
+ module Resources
5
+ class UnmanagedAccessCode < BaseResource
6
+ attr_accessor :access_code_id, :code, :device_id, :is_managed, :name, :status, :type
7
+
8
+ date_accessor :created_at, :ends_at, :starts_at
9
+
10
+ include Seam::Resources::ResourceErrorsSupport
11
+ include Seam::Resources::ResourceWarningsSupport
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Seam
4
+ module Resources
5
+ class UnmanagedDevice < BaseResource
6
+ attr_accessor :can_hvac_cool, :can_hvac_heat, :can_hvac_heat_cool, :can_program_offline_access_codes, :can_program_online_access_codes, :can_remotely_lock, :can_remotely_unlock, :can_simulate_connection, :can_simulate_disconnection, :can_simulate_removal, :can_turn_off_hvac, :capabilities_supported, :connected_account_id, :device_id, :device_type, :is_managed, :location, :properties, :workspace_id
7
+
8
+ date_accessor :created_at
9
+
10
+ include Seam::Resources::ResourceErrorsSupport
11
+ include Seam::Resources::ResourceWarningsSupport
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Seam
4
+ module Resources
5
+ class UserIdentity < BaseResource
6
+ attr_accessor :display_name, :email_address, :full_name, :phone_number, :user_identity_id, :user_identity_key, :workspace_id
7
+
8
+ date_accessor :created_at
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Seam
4
+ module Resources
5
+ class Webhook < BaseResource
6
+ attr_accessor :event_types, :secret, :url, :webhook_id
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Seam
4
+ module Resources
5
+ class Workspace < BaseResource
6
+ attr_accessor :company_name, :connect_partner_name, :is_sandbox, :name, :workspace_id
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,94 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Seam
4
+ module Routes
5
+ def access_codes
6
+ @access_codes ||= Seam::Clients::AccessCodes.new(client: @client, defaults: @defaults)
7
+ end
8
+
9
+ def acs
10
+ @acs ||= Seam::Clients::Acs.new(client: @client, defaults: @defaults)
11
+ end
12
+
13
+ def action_attempts
14
+ @action_attempts ||= Seam::Clients::ActionAttempts.new(client: @client, defaults: @defaults)
15
+ end
16
+
17
+ def client_sessions
18
+ @client_sessions ||= Seam::Clients::ClientSessions.new(client: @client, defaults: @defaults)
19
+ end
20
+
21
+ def connect_webviews
22
+ @connect_webviews ||= Seam::Clients::ConnectWebviews.new(client: @client, defaults: @defaults)
23
+ end
24
+
25
+ def connected_accounts
26
+ @connected_accounts ||= Seam::Clients::ConnectedAccounts.new(client: @client, defaults: @defaults)
27
+ end
28
+
29
+ def devices
30
+ @devices ||= Seam::Clients::Devices.new(client: @client, defaults: @defaults)
31
+ end
32
+
33
+ def events
34
+ @events ||= Seam::Clients::Events.new(client: @client, defaults: @defaults)
35
+ end
36
+
37
+ def locks
38
+ @locks ||= Seam::Clients::Locks.new(client: @client, defaults: @defaults)
39
+ end
40
+
41
+ def networks
42
+ @networks ||= Seam::Clients::Networks.new(client: @client, defaults: @defaults)
43
+ end
44
+
45
+ def noise_sensors
46
+ @noise_sensors ||= Seam::Clients::NoiseSensors.new(client: @client, defaults: @defaults)
47
+ end
48
+
49
+ def phones
50
+ @phones ||= Seam::Clients::Phones.new(client: @client, defaults: @defaults)
51
+ end
52
+
53
+ def thermostats
54
+ @thermostats ||= Seam::Clients::Thermostats.new(client: @client, defaults: @defaults)
55
+ end
56
+
57
+ def user_identities
58
+ @user_identities ||= Seam::Clients::UserIdentities.new(client: @client, defaults: @defaults)
59
+ end
60
+
61
+ def webhooks
62
+ @webhooks ||= Seam::Clients::Webhooks.new(client: @client, defaults: @defaults)
63
+ end
64
+
65
+ def workspaces
66
+ @workspaces ||= Seam::Clients::Workspaces.new(client: @client, defaults: @defaults)
67
+ end
68
+
69
+ def health
70
+ @client.get("/health")
71
+ end
72
+
73
+ # @deprecated Please use {#devices.unmanaged} instead.
74
+ def unmanaged_devices
75
+ warn "[DEPRECATION] 'unmanaged_devices' is deprecated. Please use 'devices.unmanaged' instead."
76
+
77
+ @unmanaged_devices ||= Seam::Clients::DevicesUnmanaged.new(client: @client, defaults: @defaults)
78
+ end
79
+
80
+ # @deprecated Please use {#access_codes.unmanaged} instead.
81
+ def unmanaged_access_codes
82
+ warn "[DEPRECATION] 'unmanaged_access_codes' is deprecated. Please use 'access_codes.unmanaged' instead."
83
+
84
+ @unmanaged_access_codes ||= Seam::Clients::AccessCodesUnmanaged.new(client: @client, defaults: @defaults)
85
+ end
86
+
87
+ private
88
+
89
+ def initialize_routes(client:, defaults:)
90
+ @client = client
91
+ @defaults = defaults
92
+ end
93
+ end
94
+ end
data/lib/seam/token.rb ADDED
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Seam
4
+ module Http
5
+ module Auth
6
+ TOKEN_PREFIX = "seam_"
7
+
8
+ ACCESS_TOKEN_PREFIX = "seam_at"
9
+
10
+ JWT_PREFIX = "ey"
11
+
12
+ CLIENT_SESSION_TOKEN_PREFIX = "seam_cst"
13
+
14
+ PUBLISHABLE_KEY_TOKEN_PREFIX = "seam_pk"
15
+
16
+ def self.access_token?(token)
17
+ token.start_with?(ACCESS_TOKEN_PREFIX)
18
+ end
19
+
20
+ def self.jwt?(token)
21
+ token.start_with?(JWT_PREFIX)
22
+ end
23
+
24
+ def self.seam_token?(token)
25
+ token.start_with?(TOKEN_PREFIX)
26
+ end
27
+
28
+ def self.api_key?(token)
29
+ !client_session_token?(token) &&
30
+ !jwt?(token) &&
31
+ !access_token?(token) &&
32
+ !publishable_key?(token) &&
33
+ seam_token?(token)
34
+ end
35
+
36
+ def self.client_session_token?(token)
37
+ token.start_with?(CLIENT_SESSION_TOKEN_PREFIX)
38
+ end
39
+
40
+ def self.publishable_key?(token)
41
+ token.start_with?(PUBLISHABLE_KEY_TOKEN_PREFIX)
42
+ end
43
+
44
+ def self.console_session_token?(token)
45
+ jwt?(token)
46
+ end
47
+
48
+ def self.personal_access_token?(token)
49
+ access_token?(token)
50
+ end
51
+ end
52
+ end
53
+ end