seam 2.0.0b5 → 2.0.0.prerelease.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (156) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +53 -49
  3. data/README.md +3 -323
  4. data/Rakefile +1 -4
  5. data/lib/seam/client.rb +129 -0
  6. data/lib/seam/clients/access_codes.rb +95 -0
  7. data/lib/seam/clients/access_codes_simulate.rb +17 -0
  8. data/lib/seam/clients/access_codes_unmanaged.rb +57 -0
  9. data/lib/seam/clients/acs.rb +35 -0
  10. data/lib/seam/clients/acs_access_groups.rb +57 -0
  11. data/lib/seam/clients/acs_credential_pools.rb +17 -0
  12. data/lib/seam/clients/acs_credential_provisioning_automations.rb +17 -0
  13. data/lib/seam/clients/acs_credentials.rb +77 -0
  14. data/lib/seam/clients/acs_entrances.rb +47 -0
  15. data/lib/seam/clients/acs_systems.rb +27 -0
  16. data/lib/seam/clients/acs_users.rb +117 -0
  17. data/lib/seam/clients/action_attempts.rb +30 -0
  18. data/lib/seam/clients/base_client.rb +21 -0
  19. data/lib/seam/clients/client_sessions.rb +77 -0
  20. data/lib/seam/clients/connect_webviews.rb +47 -0
  21. data/lib/seam/clients/connected_accounts.rb +47 -0
  22. data/lib/seam/clients/devices.rb +65 -0
  23. data/lib/seam/clients/devices_simulate.rb +17 -0
  24. data/lib/seam/clients/devices_unmanaged.rb +37 -0
  25. data/lib/seam/clients/events.rb +27 -0
  26. data/lib/seam/clients/locks.rb +53 -0
  27. data/lib/seam/clients/networks.rb +27 -0
  28. data/lib/seam/clients/noise_sensors.rb +15 -0
  29. data/lib/seam/clients/noise_sensors_noise_thresholds.rb +57 -0
  30. data/lib/seam/clients/noise_sensors_simulate.rb +17 -0
  31. data/lib/seam/clients/phones.rb +31 -0
  32. data/lib/seam/clients/phones_simulate.rb +17 -0
  33. data/lib/seam/clients/thermostats.rb +106 -0
  34. data/lib/seam/clients/thermostats_climate_setting_schedules.rb +57 -0
  35. data/lib/seam/clients/user_identities.rb +131 -0
  36. data/lib/seam/clients/user_identities_enrollment_automations.rb +47 -0
  37. data/lib/seam/clients/webhooks.rb +57 -0
  38. data/lib/seam/clients/workspaces.rb +50 -0
  39. data/lib/seam/logger.rb +12 -0
  40. data/lib/seam/request.rb +51 -84
  41. data/lib/seam/resources/access_code.rb +12 -0
  42. data/lib/seam/resources/acs_access_group.rb +9 -0
  43. data/lib/seam/resources/acs_credential.rb +12 -0
  44. data/lib/seam/resources/acs_credential_pool.rb +9 -0
  45. data/lib/seam/resources/acs_credential_provisioning_automation.rb +9 -0
  46. data/lib/seam/resources/acs_entrance.rb +9 -0
  47. data/lib/seam/resources/acs_system.rb +9 -0
  48. data/lib/seam/resources/acs_user.rb +9 -0
  49. data/lib/seam/resources/action_attempt.rb +46 -0
  50. data/lib/seam/resources/base_resource.rb +58 -0
  51. data/lib/seam/resources/client_session.rb +9 -0
  52. data/lib/seam/resources/climate_setting_schedule.rb +11 -0
  53. data/lib/seam/resources/connect_webview.rb +9 -0
  54. data/lib/seam/resources/connected_account.rb +12 -0
  55. data/lib/seam/resources/device.rb +12 -0
  56. data/lib/seam/resources/device_provider.rb +7 -0
  57. data/lib/seam/resources/enrollment_automation.rb +9 -0
  58. data/lib/seam/resources/event.rb +9 -0
  59. data/lib/seam/resources/network.rb +9 -0
  60. data/lib/seam/resources/noise_threshold.rb +7 -0
  61. data/lib/seam/resources/phone.rb +12 -0
  62. data/lib/seam/resources/resource_error.rb +9 -0
  63. data/lib/seam/resources/resource_errors_support.rb +9 -0
  64. data/lib/seam/resources/resource_warning.rb +9 -0
  65. data/lib/seam/resources/resource_warnings_support.rb +9 -0
  66. data/lib/seam/resources/service_health.rb +7 -0
  67. data/lib/seam/resources/unmanaged_access_code.rb +12 -0
  68. data/lib/seam/resources/unmanaged_device.rb +12 -0
  69. data/lib/seam/resources/user_identity.rb +9 -0
  70. data/lib/seam/resources/webhook.rb +7 -0
  71. data/lib/seam/resources/workspace.rb +7 -0
  72. data/lib/seam/version.rb +1 -1
  73. data/lib/seam.rb +68 -19
  74. metadata +71 -115
  75. data/lib/seam/auth.rb +0 -118
  76. data/lib/seam/base_resource.rb +0 -65
  77. data/lib/seam/deep_hash_accessor.rb +0 -37
  78. data/lib/seam/default_endpoint.rb +0 -5
  79. data/lib/seam/helpers/action_attempt.rb +0 -47
  80. data/lib/seam/http.rb +0 -52
  81. data/lib/seam/http_multi_workspace.rb +0 -66
  82. data/lib/seam/http_single_workspace.rb +0 -46
  83. data/lib/seam/options.rb +0 -64
  84. data/lib/seam/parse_options.rb +0 -23
  85. data/lib/seam/routes/clients/access_codes.rb +0 -74
  86. data/lib/seam/routes/clients/access_codes_simulate.rb +0 -18
  87. data/lib/seam/routes/clients/access_codes_unmanaged.rb +0 -42
  88. data/lib/seam/routes/clients/acs.rb +0 -44
  89. data/lib/seam/routes/clients/acs_access_groups.rb +0 -48
  90. data/lib/seam/routes/clients/acs_access_groups_unmanaged.rb +0 -24
  91. data/lib/seam/routes/clients/acs_credential_pools.rb +0 -18
  92. data/lib/seam/routes/clients/acs_credential_provisioning_automations.rb +0 -18
  93. data/lib/seam/routes/clients/acs_credentials.rb +0 -60
  94. data/lib/seam/routes/clients/acs_credentials_unmanaged.rb +0 -24
  95. data/lib/seam/routes/clients/acs_encoders.rb +0 -36
  96. data/lib/seam/routes/clients/acs_entrances.rb +0 -36
  97. data/lib/seam/routes/clients/acs_systems.rb +0 -30
  98. data/lib/seam/routes/clients/acs_users.rb +0 -78
  99. data/lib/seam/routes/clients/acs_users_unmanaged.rb +0 -24
  100. data/lib/seam/routes/clients/action_attempts.rb +0 -28
  101. data/lib/seam/routes/clients/client_sessions.rb +0 -54
  102. data/lib/seam/routes/clients/connect_webviews.rb +0 -36
  103. data/lib/seam/routes/clients/connected_accounts.rb +0 -36
  104. data/lib/seam/routes/clients/devices.rb +0 -50
  105. data/lib/seam/routes/clients/devices_simulate.rb +0 -30
  106. data/lib/seam/routes/clients/devices_unmanaged.rb +0 -30
  107. data/lib/seam/routes/clients/events.rb +0 -24
  108. data/lib/seam/routes/clients/index.rb +0 -38
  109. data/lib/seam/routes/clients/locks.rb +0 -42
  110. data/lib/seam/routes/clients/networks.rb +0 -24
  111. data/lib/seam/routes/clients/noise_sensors.rb +0 -26
  112. data/lib/seam/routes/clients/noise_sensors_noise_thresholds.rb +0 -42
  113. data/lib/seam/routes/clients/noise_sensors_simulate.rb +0 -18
  114. data/lib/seam/routes/clients/phones.rb +0 -28
  115. data/lib/seam/routes/clients/phones_simulate.rb +0 -18
  116. data/lib/seam/routes/clients/thermostats.rb +0 -108
  117. data/lib/seam/routes/clients/thermostats_schedules.rb +0 -42
  118. data/lib/seam/routes/clients/user_identities.rb +0 -88
  119. data/lib/seam/routes/clients/user_identities_enrollment_automations.rb +0 -36
  120. data/lib/seam/routes/clients/webhooks.rb +0 -42
  121. data/lib/seam/routes/clients/workspaces.rb +0 -40
  122. data/lib/seam/routes/resources/access_code.rb +0 -14
  123. data/lib/seam/routes/resources/acs_access_group.rb +0 -11
  124. data/lib/seam/routes/resources/acs_credential.rb +0 -14
  125. data/lib/seam/routes/resources/acs_credential_pool.rb +0 -11
  126. data/lib/seam/routes/resources/acs_credential_provisioning_automation.rb +0 -11
  127. data/lib/seam/routes/resources/acs_entrance.rb +0 -13
  128. data/lib/seam/routes/resources/acs_system.rb +0 -14
  129. data/lib/seam/routes/resources/acs_user.rb +0 -14
  130. data/lib/seam/routes/resources/action_attempt.rb +0 -9
  131. data/lib/seam/routes/resources/client_session.rb +0 -11
  132. data/lib/seam/routes/resources/connect_webview.rb +0 -11
  133. data/lib/seam/routes/resources/connected_account.rb +0 -14
  134. data/lib/seam/routes/resources/device.rb +0 -14
  135. data/lib/seam/routes/resources/device_provider.rb +0 -9
  136. data/lib/seam/routes/resources/enrollment_automation.rb +0 -11
  137. data/lib/seam/routes/resources/event.rb +0 -11
  138. data/lib/seam/routes/resources/index.rb +0 -33
  139. data/lib/seam/routes/resources/network.rb +0 -11
  140. data/lib/seam/routes/resources/noise_threshold.rb +0 -9
  141. data/lib/seam/routes/resources/phone.rb +0 -14
  142. data/lib/seam/routes/resources/resource_error.rb +0 -11
  143. data/lib/seam/routes/resources/resource_errors_support.rb +0 -11
  144. data/lib/seam/routes/resources/resource_warning.rb +0 -11
  145. data/lib/seam/routes/resources/resource_warnings_support.rb +0 -11
  146. data/lib/seam/routes/resources/service_health.rb +0 -9
  147. data/lib/seam/routes/resources/thermostat_schedule.rb +0 -13
  148. data/lib/seam/routes/resources/unmanaged_access_code.rb +0 -14
  149. data/lib/seam/routes/resources/unmanaged_device.rb +0 -14
  150. data/lib/seam/routes/resources/user_identity.rb +0 -11
  151. data/lib/seam/routes/resources/webhook.rb +0 -9
  152. data/lib/seam/routes/resources/workspace.rb +0 -9
  153. data/lib/seam/routes/routes.rb +0 -94
  154. data/lib/seam/token.rb +0 -53
  155. data/lib/seam/wait_for_action_attempt.rb +0 -32
  156. data/lib/seam/webhook.rb +0 -23
@@ -1,40 +0,0 @@
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
@@ -1,14 +0,0 @@
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
@@ -1,11 +0,0 @@
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
@@ -1,14 +0,0 @@
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
@@ -1,11 +0,0 @@
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
@@ -1,11 +0,0 @@
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
@@ -1,13 +0,0 @@
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
@@ -1,14 +0,0 @@
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
@@ -1,14 +0,0 @@
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
@@ -1,9 +0,0 @@
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
@@ -1,11 +0,0 @@
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
@@ -1,11 +0,0 @@
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
@@ -1,14 +0,0 @@
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
@@ -1,14 +0,0 @@
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
@@ -1,9 +0,0 @@
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
@@ -1,11 +0,0 @@
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
@@ -1,11 +0,0 @@
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
@@ -1,33 +0,0 @@
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"
@@ -1,11 +0,0 @@
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
@@ -1,9 +0,0 @@
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
@@ -1,14 +0,0 @@
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
@@ -1,11 +0,0 @@
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
@@ -1,11 +0,0 @@
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
@@ -1,11 +0,0 @@
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
@@ -1,11 +0,0 @@
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
@@ -1,9 +0,0 @@
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
@@ -1,13 +0,0 @@
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
@@ -1,14 +0,0 @@
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
@@ -1,14 +0,0 @@
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
@@ -1,11 +0,0 @@
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
@@ -1,9 +0,0 @@
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
@@ -1,9 +0,0 @@
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
@@ -1,94 +0,0 @@
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 DELETED
@@ -1,53 +0,0 @@
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
@@ -1,32 +0,0 @@
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