seam 2.166.0 → 2.167.0

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 (83) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +4 -4
  3. data/README.md +55 -2
  4. data/lib/seam/action_attempt_resolver.rb +77 -7
  5. data/lib/seam/auth.rb +2 -1
  6. data/lib/seam/base_resource.rb +50 -3
  7. data/lib/seam/deep_hash_accessor.rb +11 -15
  8. data/lib/seam/errors.rb +6 -0
  9. data/lib/seam/http.rb +11 -7
  10. data/lib/seam/http_single_workspace.rb +15 -3
  11. data/lib/seam/http_without_workspace.rb +17 -7
  12. data/lib/seam/invalid_response_error.rb +17 -0
  13. data/lib/seam/options.rb +2 -1
  14. data/lib/seam/paginator.rb +34 -29
  15. data/lib/seam/request_parameters.rb +11 -0
  16. data/lib/seam/resources/access_code.rb +46 -3
  17. data/lib/seam/resources/access_grant.rb +38 -4
  18. data/lib/seam/resources/access_method.rb +18 -1
  19. data/lib/seam/resources/acs_access_group.rb +0 -17
  20. data/lib/seam/resources/acs_credential.rb +18 -1
  21. data/lib/seam/resources/acs_entrance.rb +1 -1
  22. data/lib/seam/resources/acs_system.rb +17 -31
  23. data/lib/seam/resources/acs_user.rb +0 -3
  24. data/lib/seam/resources/action_attempt.rb +4 -216
  25. data/lib/seam/resources/batch.rb +1 -1
  26. data/lib/seam/resources/client_session.rb +0 -4
  27. data/lib/seam/resources/connect_webview.rb +1 -0
  28. data/lib/seam/resources/connected_account.rb +1 -21
  29. data/lib/seam/resources/device.rb +354 -311
  30. data/lib/seam/resources/device_provider.rb +11 -13
  31. data/lib/seam/resources/event.rb +372 -151
  32. data/lib/seam/resources/instant_key.rb +1 -1
  33. data/lib/seam/resources/phone.rb +90 -2
  34. data/lib/seam/resources/space.rb +21 -1
  35. data/lib/seam/resources/unmanaged_access_code.rb +44 -4
  36. data/lib/seam/resources/unmanaged_access_grant.rb +38 -4
  37. data/lib/seam/resources/unmanaged_access_method.rb +18 -1
  38. data/lib/seam/resources/unmanaged_device.rb +108 -38
  39. data/lib/seam/resources/workspace.rb +0 -4
  40. data/lib/seam/routes/access_codes.rb +19 -23
  41. data/lib/seam/routes/access_codes_simulate.rb +1 -1
  42. data/lib/seam/routes/access_codes_unmanaged.rb +7 -5
  43. data/lib/seam/routes/access_grants.rb +24 -24
  44. data/lib/seam/routes/access_grants_unmanaged.rb +5 -4
  45. data/lib/seam/routes/access_methods.rb +20 -14
  46. data/lib/seam/routes/access_methods_unmanaged.rb +2 -2
  47. data/lib/seam/routes/acs_access_groups.rb +4 -4
  48. data/lib/seam/routes/acs_credentials.rb +4 -4
  49. data/lib/seam/routes/acs_encoders.rb +5 -5
  50. data/lib/seam/routes/acs_entrances.rb +6 -8
  51. data/lib/seam/routes/acs_systems.rb +3 -3
  52. data/lib/seam/routes/acs_users.rb +44 -34
  53. data/lib/seam/routes/action_attempts.rb +2 -2
  54. data/lib/seam/routes/cameras_live_views.rb +5 -5
  55. data/lib/seam/routes/client_sessions.rb +20 -21
  56. data/lib/seam/routes/connect_webviews.rb +3 -3
  57. data/lib/seam/routes/connected_accounts.rb +7 -5
  58. data/lib/seam/routes/customers.rb +4 -5
  59. data/lib/seam/routes/devices.rb +10 -10
  60. data/lib/seam/routes/devices_unmanaged.rb +7 -5
  61. data/lib/seam/routes/events.rb +16 -12
  62. data/lib/seam/routes/instant_keys.rb +7 -5
  63. data/lib/seam/routes/locks.rb +10 -8
  64. data/lib/seam/routes/locks_simulate.rb +2 -2
  65. data/lib/seam/routes/media.rb +1 -1
  66. data/lib/seam/routes/noise_sensors.rb +1 -1
  67. data/lib/seam/routes/noise_sensors_noise_thresholds.rb +9 -3
  68. data/lib/seam/routes/phones.rb +2 -2
  69. data/lib/seam/routes/phones_simulate.rb +1 -1
  70. data/lib/seam/routes/spaces.rb +18 -13
  71. data/lib/seam/routes/thermostats.rb +14 -18
  72. data/lib/seam/routes/thermostats_daily_programs.rb +2 -2
  73. data/lib/seam/routes/thermostats_schedules.rb +3 -3
  74. data/lib/seam/routes/user_identities.rb +24 -18
  75. data/lib/seam/routes/user_identities_unmanaged.rb +2 -2
  76. data/lib/seam/routes/webhooks.rb +3 -3
  77. data/lib/seam/routes/workspaces.rb +6 -16
  78. data/lib/seam/url_search_params_serializer.rb +2 -1
  79. data/lib/seam/version.rb +1 -1
  80. data/lib/seam/wait_for_action_attempt.rb +3 -1
  81. data/lib/seam/webhook.rb +25 -5
  82. data/lib/seam.rb +12 -6
  83. metadata +5 -2
@@ -23,7 +23,7 @@ module Seam
23
23
 
24
24
  wait_for_action_attempt = wait_for_action_attempt.nil? ? @defaults.wait_for_action_attempt : wait_for_action_attempt
25
25
 
26
- Seam::ActionAttemptResolver.resolve(Seam::Resources::ActionAttempt.load_from_response(res.body["action_attempt"]), @client, wait_for_action_attempt)
26
+ Seam::ActionAttemptResolver.resolve(Seam::Resources::ActionAttempt.from_http_response(res, "action_attempt", "/access_methods/assign_card"), @client, wait_for_action_attempt)
27
27
  end
28
28
 
29
29
  # Deletes an access method.
@@ -31,10 +31,13 @@ module Seam
31
31
  # @param access_method_id [String, nil] ID of access method to delete.
32
32
  # @param reservation_key [String, nil] Reservation key of the access grant whose access methods should be deleted.
33
33
  # @return [nil] OK
34
+ # @deprecated Access methods are managed by their access grant. Some workflows still need this endpoint today; access grant routes will replace it for them soon.
34
35
  def delete(access_grant_id: nil, access_method_id: nil, reservation_key: nil)
35
- if access_grant_id.nil? && access_method_id.nil? && reservation_key.nil?
36
- raise TypeError, "At least one parameter is required for /access_methods/delete"
37
- end
36
+ Seam::RequestParameters.require_at_least_one(
37
+ "/access_methods/delete",
38
+ {access_grant_id: access_grant_id, access_method_id: access_method_id, reservation_key: reservation_key},
39
+ [:access_grant_id, :access_method_id, :reservation_key]
40
+ )
38
41
 
39
42
  @client.delete("/access_methods/delete", {access_grant_id: access_grant_id, access_method_id: access_method_id, reservation_key: reservation_key}.compact)
40
43
 
@@ -50,7 +53,7 @@ module Seam
50
53
 
51
54
  wait_for_action_attempt = wait_for_action_attempt.nil? ? @defaults.wait_for_action_attempt : wait_for_action_attempt
52
55
 
53
- Seam::ActionAttemptResolver.resolve(Seam::Resources::ActionAttempt.load_from_response(res.body["action_attempt"]), @client, wait_for_action_attempt)
56
+ Seam::ActionAttemptResolver.resolve(Seam::Resources::ActionAttempt.from_http_response(res, "action_attempt", "/access_methods/encode"), @client, wait_for_action_attempt)
54
57
  end
55
58
 
56
59
  # Gets an access method.
@@ -59,7 +62,7 @@ module Seam
59
62
  def get(access_method_id:)
60
63
  res = @client.get("/access_methods/get", {access_method_id: access_method_id}.compact)
61
64
 
62
- Seam::Resources::AccessMethod.load_from_response(res.body["access_method"])
65
+ Seam::Resources::AccessMethod.from_http_response(res, "access_method", "/access_methods/get")
63
66
  end
64
67
 
65
68
  # Gets all related resources for one or more Access Methods.
@@ -70,7 +73,7 @@ module Seam
70
73
  def get_related(access_method_ids:, exclude: nil, include: nil)
71
74
  res = @client.get("/access_methods/get_related", {access_method_ids: access_method_ids, exclude: exclude, include: include}.compact)
72
75
 
73
- Seam::Resources::Batch.load_from_response(res.body["batch"])
76
+ Seam::Resources::Batch.from_http_response(res, "batch", "/access_methods/get_related")
74
77
  end
75
78
 
76
79
  # Lists all access methods, usually filtered by Access Grant.
@@ -78,19 +81,22 @@ module Seam
78
81
  # @param access_grant_id [String, nil] ID of Access Grant to list access methods for.
79
82
  # @param access_grant_key [String, nil] Key of Access Grant to list access methods for.
80
83
  # @param acs_entrance_id [String, nil] ID of the entrance for which you want to retrieve all access methods that grant access to it.
84
+ # @param customer_key [String, nil] Customer key for which you want to list access methods.
81
85
  # @param device_id [String, nil] ID of the device by which to filter the returned access methods. Must be combined with `access_grant_id`, `access_grant_key`, or `acs_entrance_id`.
82
86
  # @param limit [Integer, nil] Maximum number of records to return per page.
83
87
  # @param page_cursor [String, Seam::Null, nil] Identifies the specific page of results to return, obtained from the previous page's `next_page_cursor`.
84
88
  # @param space_id [String, nil] ID of the space by which to filter the returned access methods. Must be combined with `access_grant_id`, `access_grant_key`, or `acs_entrance_id`.
85
89
  # @return [Seam::Resources::AccessMethod] OK
86
- def list(access_code_id: nil, access_grant_id: nil, access_grant_key: nil, acs_entrance_id: nil, device_id: nil, limit: nil, page_cursor: nil, space_id: nil)
87
- if access_code_id.nil? && access_grant_id.nil? && access_grant_key.nil? && acs_entrance_id.nil? && device_id.nil? && limit.nil? && page_cursor.nil? && space_id.nil?
88
- raise TypeError, "At least one parameter is required for /access_methods/list"
89
- end
90
+ def list(access_code_id: nil, access_grant_id: nil, access_grant_key: nil, acs_entrance_id: nil, customer_key: nil, device_id: nil, limit: nil, page_cursor: nil, space_id: nil)
91
+ Seam::RequestParameters.require_at_least_one(
92
+ "/access_methods/list",
93
+ {access_code_id: access_code_id, access_grant_id: access_grant_id, access_grant_key: access_grant_key, acs_entrance_id: acs_entrance_id, customer_key: customer_key, device_id: device_id, limit: limit, page_cursor: page_cursor, space_id: space_id},
94
+ [:access_code_id, :access_grant_id, :access_grant_key, :acs_entrance_id, :customer_key, :device_id, :space_id]
95
+ )
90
96
 
91
- res = @client.get("/access_methods/list", {access_code_id: access_code_id, access_grant_id: access_grant_id, access_grant_key: access_grant_key, acs_entrance_id: acs_entrance_id, device_id: device_id, limit: limit, page_cursor: page_cursor, space_id: space_id}.compact)
97
+ res = @client.get("/access_methods/list", {access_code_id: access_code_id, access_grant_id: access_grant_id, access_grant_key: access_grant_key, acs_entrance_id: acs_entrance_id, customer_key: customer_key, device_id: device_id, limit: limit, page_cursor: page_cursor, space_id: space_id}.compact)
92
98
 
93
- Seam::Resources::AccessMethod.load_from_response(res.body["access_methods"])
99
+ Seam::Resources::AccessMethod.list_from_http_response(res, "access_methods", "/access_methods/list")
94
100
  end
95
101
 
96
102
  # Remotely unlocks a specified [entrance](https://www.seam.co/docs/low-level-apis/access-systems/retrieving-entrance-details) using the cloud key credential associated with an access method. Returns an action attempt that tracks the progress of the unlock operation.
@@ -102,7 +108,7 @@ module Seam
102
108
 
103
109
  wait_for_action_attempt = wait_for_action_attempt.nil? ? @defaults.wait_for_action_attempt : wait_for_action_attempt
104
110
 
105
- Seam::ActionAttemptResolver.resolve(Seam::Resources::ActionAttempt.load_from_response(res.body["action_attempt"]), @client, wait_for_action_attempt)
111
+ Seam::ActionAttemptResolver.resolve(Seam::Resources::ActionAttempt.from_http_response(res, "action_attempt", "/access_methods/unlock_door"), @client, wait_for_action_attempt)
106
112
  end
107
113
  end
108
114
  end
@@ -14,7 +14,7 @@ module Seam
14
14
  def get(access_method_id:)
15
15
  res = @client.get("/access_methods/unmanaged/get", {access_method_id: access_method_id}.compact)
16
16
 
17
- Seam::Resources::UnmanagedAccessMethod.load_from_response(res.body["access_method"])
17
+ Seam::Resources::UnmanagedAccessMethod.from_http_response(res, "access_method", "/access_methods/unmanaged/get")
18
18
  end
19
19
 
20
20
  # Lists all unmanaged access methods (where is_managed = false), usually filtered by Access Grant.
@@ -26,7 +26,7 @@ module Seam
26
26
  def list(access_grant_id:, acs_entrance_id: nil, device_id: nil, space_id: nil)
27
27
  res = @client.get("/access_methods/unmanaged/list", {access_grant_id: access_grant_id, acs_entrance_id: acs_entrance_id, device_id: device_id, space_id: space_id}.compact)
28
28
 
29
- Seam::Resources::UnmanagedAccessMethod.load_from_response(res.body["access_methods"])
29
+ Seam::Resources::UnmanagedAccessMethod.list_from_http_response(res, "access_methods", "/access_methods/unmanaged/list")
30
30
  end
31
31
  end
32
32
  end
@@ -34,7 +34,7 @@ module Seam
34
34
  def get(acs_access_group_id:)
35
35
  res = @client.get("/acs/access_groups/get", {acs_access_group_id: acs_access_group_id}.compact)
36
36
 
37
- Seam::Resources::AcsAccessGroup.load_from_response(res.body["acs_access_group"])
37
+ Seam::Resources::AcsAccessGroup.from_http_response(res, "acs_access_group", "/acs/access_groups/get")
38
38
  end
39
39
 
40
40
  # Returns a list of all [access groups](https://www.seam.co/docs/low-level-apis/access-systems/user-management/assigning-users-to-access-groups).
@@ -46,7 +46,7 @@ module Seam
46
46
  def list(acs_system_id: nil, acs_user_id: nil, search: nil, user_identity_id: nil)
47
47
  res = @client.get("/acs/access_groups/list", {acs_system_id: acs_system_id, acs_user_id: acs_user_id, search: search, user_identity_id: user_identity_id}.compact)
48
48
 
49
- Seam::Resources::AcsAccessGroup.load_from_response(res.body["acs_access_groups"])
49
+ Seam::Resources::AcsAccessGroup.list_from_http_response(res, "acs_access_groups", "/acs/access_groups/list")
50
50
  end
51
51
 
52
52
  # Returns a list of all accessible entrances for a specified [access group](https://www.seam.co/docs/low-level-apis/access-systems/user-management/assigning-users-to-access-groups).
@@ -55,7 +55,7 @@ module Seam
55
55
  def list_accessible_entrances(acs_access_group_id:)
56
56
  res = @client.get("/acs/access_groups/list_accessible_entrances", {acs_access_group_id: acs_access_group_id}.compact)
57
57
 
58
- Seam::Resources::AcsEntrance.load_from_response(res.body["acs_entrances"])
58
+ Seam::Resources::AcsEntrance.list_from_http_response(res, "acs_entrances", "/acs/access_groups/list_accessible_entrances")
59
59
  end
60
60
 
61
61
  # Returns a list of all [access system users](https://www.seam.co/docs/low-level-apis/access-systems/user-management) in an [access group](https://www.seam.co/docs/low-level-apis/access-systems/user-management/assigning-users-to-access-groups).
@@ -64,7 +64,7 @@ module Seam
64
64
  def list_users(acs_access_group_id:)
65
65
  res = @client.get("/acs/access_groups/list_users", {acs_access_group_id: acs_access_group_id}.compact)
66
66
 
67
- Seam::Resources::AcsUser.load_from_response(res.body["acs_users"])
67
+ Seam::Resources::AcsUser.list_from_http_response(res, "acs_users", "/acs/access_groups/list_users")
68
68
  end
69
69
 
70
70
  # Removes a specified [access system user](https://www.seam.co/docs/low-level-apis/access-systems/user-management) from a specified [access group](https://www.seam.co/docs/low-level-apis/access-systems/user-management/assigning-users-to-access-groups).
@@ -37,7 +37,7 @@ module Seam
37
37
  def create(access_method:, acs_system_id: nil, acs_user_id: nil, allowed_acs_entrance_ids: nil, assa_abloy_vostio_metadata: nil, code: nil, credential_manager_acs_system_id: nil, ends_at: nil, is_multi_phone_sync_credential: nil, salto_space_metadata: nil, starts_at: nil, user_identity_id: nil, visionline_metadata: nil)
38
38
  res = @client.post("/acs/credentials/create", {access_method: access_method, acs_system_id: acs_system_id, acs_user_id: acs_user_id, allowed_acs_entrance_ids: allowed_acs_entrance_ids, assa_abloy_vostio_metadata: assa_abloy_vostio_metadata, code: code, credential_manager_acs_system_id: credential_manager_acs_system_id, ends_at: ends_at, is_multi_phone_sync_credential: is_multi_phone_sync_credential, salto_space_metadata: salto_space_metadata, starts_at: starts_at, user_identity_id: user_identity_id, visionline_metadata: visionline_metadata}.compact)
39
39
 
40
- Seam::Resources::AcsCredential.load_from_response(res.body["acs_credential"])
40
+ Seam::Resources::AcsCredential.from_http_response(res, "acs_credential", "/acs/credentials/create")
41
41
  end
42
42
 
43
43
  # Deletes a specified [credential](https://www.seam.co/docs/low-level-apis/access-systems/managing-credentials).
@@ -55,7 +55,7 @@ module Seam
55
55
  def get(acs_credential_id:)
56
56
  res = @client.get("/acs/credentials/get", {acs_credential_id: acs_credential_id}.compact)
57
57
 
58
- Seam::Resources::AcsCredential.load_from_response(res.body["acs_credential"])
58
+ Seam::Resources::AcsCredential.from_http_response(res, "acs_credential", "/acs/credentials/get")
59
59
  end
60
60
 
61
61
  # Returns a list of all [credentials](https://www.seam.co/docs/low-level-apis/access-systems/managing-credentials).
@@ -71,7 +71,7 @@ module Seam
71
71
  def list(acs_system_id: nil, acs_user_id: nil, created_before: nil, is_multi_phone_sync_credential: nil, limit: nil, page_cursor: nil, search: nil, user_identity_id: nil)
72
72
  res = @client.get("/acs/credentials/list", {acs_system_id: acs_system_id, acs_user_id: acs_user_id, created_before: created_before, is_multi_phone_sync_credential: is_multi_phone_sync_credential, limit: limit, page_cursor: page_cursor, search: search, user_identity_id: user_identity_id}.compact)
73
73
 
74
- Seam::Resources::AcsCredential.load_from_response(res.body["acs_credentials"])
74
+ Seam::Resources::AcsCredential.list_from_http_response(res, "acs_credentials", "/acs/credentials/list")
75
75
  end
76
76
 
77
77
  # Returns a list of all [entrances](https://www.seam.co/docs/api/acs/entrances/object) to which a [credential](https://www.seam.co/docs/api/acs/credentials/object) grants access.
@@ -80,7 +80,7 @@ module Seam
80
80
  def list_accessible_entrances(acs_credential_id:)
81
81
  res = @client.get("/acs/credentials/list_accessible_entrances", {acs_credential_id: acs_credential_id}.compact)
82
82
 
83
- Seam::Resources::AcsEntrance.load_from_response(res.body["acs_entrances"])
83
+ Seam::Resources::AcsEntrance.list_from_http_response(res, "acs_entrances", "/acs/credentials/list_accessible_entrances")
84
84
  end
85
85
 
86
86
  # Unassigns a specified [credential](https://www.seam.co/docs/low-level-apis/access-systems/managing-credentials) from a specified [access system user](https://www.seam.co/docs/low-level-apis/access-systems/user-management).
@@ -24,7 +24,7 @@ module Seam
24
24
 
25
25
  wait_for_action_attempt = wait_for_action_attempt.nil? ? @defaults.wait_for_action_attempt : wait_for_action_attempt
26
26
 
27
- Seam::ActionAttemptResolver.resolve(Seam::Resources::ActionAttempt.load_from_response(res.body["action_attempt"]), @client, wait_for_action_attempt)
27
+ Seam::ActionAttemptResolver.resolve(Seam::Resources::ActionAttempt.from_http_response(res, "action_attempt", "/acs/encoders/encode_credential"), @client, wait_for_action_attempt)
28
28
  end
29
29
 
30
30
  # Returns a specified [encoder](https://www.seam.co/docs/low-level-apis/access-systems/working-with-card-encoders-and-scanners).
@@ -33,7 +33,7 @@ module Seam
33
33
  def get(acs_encoder_id:)
34
34
  res = @client.get("/acs/encoders/get", {acs_encoder_id: acs_encoder_id}.compact)
35
35
 
36
- Seam::Resources::AcsEncoder.load_from_response(res.body["acs_encoder"])
36
+ Seam::Resources::AcsEncoder.from_http_response(res, "acs_encoder", "/acs/encoders/get")
37
37
  end
38
38
 
39
39
  # Returns a list of all [encoders](https://www.seam.co/docs/low-level-apis/access-systems/working-with-card-encoders-and-scanners).
@@ -46,7 +46,7 @@ module Seam
46
46
  def list(acs_encoder_ids: nil, acs_system_id: nil, acs_system_ids: nil, limit: nil, page_cursor: nil)
47
47
  res = @client.get("/acs/encoders/list", {acs_encoder_ids: acs_encoder_ids, acs_system_id: acs_system_id, acs_system_ids: acs_system_ids, limit: limit, page_cursor: page_cursor}.compact)
48
48
 
49
- Seam::Resources::AcsEncoder.load_from_response(res.body["acs_encoders"])
49
+ Seam::Resources::AcsEncoder.list_from_http_response(res, "acs_encoders", "/acs/encoders/list")
50
50
  end
51
51
 
52
52
  # Scans an encoded [acs_credential](https://www.seam.co/docs/low-level-apis/access-systems/managing-credentials) from a plastic card placed on the specified [encoder](https://www.seam.co/docs/low-level-apis/access-systems/working-with-card-encoders-and-scanners).
@@ -58,7 +58,7 @@ module Seam
58
58
 
59
59
  wait_for_action_attempt = wait_for_action_attempt.nil? ? @defaults.wait_for_action_attempt : wait_for_action_attempt
60
60
 
61
- Seam::ActionAttemptResolver.resolve(Seam::Resources::ActionAttempt.load_from_response(res.body["action_attempt"]), @client, wait_for_action_attempt)
61
+ Seam::ActionAttemptResolver.resolve(Seam::Resources::ActionAttempt.from_http_response(res, "action_attempt", "/acs/encoders/scan_credential"), @client, wait_for_action_attempt)
62
62
  end
63
63
 
64
64
  # Scans a physical card placed on the specified [encoder](https://www.seam.co/docs/low-level-apis/access-systems/working-with-card-encoders-and-scanners) and assigns the scanned credential to an ACS user. Provide either an `acs_user_id` or a `user_identity_id`.
@@ -72,7 +72,7 @@ module Seam
72
72
 
73
73
  wait_for_action_attempt = wait_for_action_attempt.nil? ? @defaults.wait_for_action_attempt : wait_for_action_attempt
74
74
 
75
- Seam::ActionAttemptResolver.resolve(Seam::Resources::ActionAttempt.load_from_response(res.body["action_attempt"]), @client, wait_for_action_attempt)
75
+ Seam::ActionAttemptResolver.resolve(Seam::Resources::ActionAttempt.from_http_response(res, "action_attempt", "/acs/encoders/scan_to_assign_credential"), @client, wait_for_action_attempt)
76
76
  end
77
77
  end
78
78
  end
@@ -16,7 +16,7 @@ module Seam
16
16
  def get(acs_entrance_id:)
17
17
  res = @client.get("/acs/entrances/get", {acs_entrance_id: acs_entrance_id}.compact)
18
18
 
19
- Seam::Resources::AcsEntrance.load_from_response(res.body["acs_entrance"])
19
+ Seam::Resources::AcsEntrance.from_http_response(res, "acs_entrance", "/acs/entrances/get")
20
20
  end
21
21
 
22
22
  # Grants a specified [access system user](https://www.seam.co/docs/low-level-apis/access-systems/user-management) access to a specified [access system entrance](https://www.seam.co/docs/low-level-apis/access-systems/retrieving-entrance-details).
@@ -38,16 +38,14 @@ module Seam
38
38
  # @param connected_account_id [String, nil] ID of the connected account for which you want to retrieve all entrances.
39
39
  # @param customer_key [String, nil] Customer key for which you want to list entrances.
40
40
  # @param limit [Integer, nil] Maximum number of records to return per page.
41
- # @param location_id [String, Seam::Null, nil]
42
- # @deprecated location_id: Use `space_id`.
43
41
  # @param page_cursor [String, Seam::Null, nil] Identifies the specific page of results to return, obtained from the previous page's `next_page_cursor`.
44
42
  # @param search [String, nil] String for which to search. Filters returned entrances to include all records that satisfy a partial match using `display_name`.
45
43
  # @param space_id [String, nil] ID of the space for which you want to list entrances.
46
44
  # @return [Seam::Resources::AcsEntrance] OK
47
- def list(access_method_id: nil, acs_credential_id: nil, acs_entrance_ids: nil, acs_system_id: nil, connected_account_id: nil, customer_key: nil, limit: nil, location_id: nil, page_cursor: nil, search: nil, space_id: nil)
48
- res = @client.get("/acs/entrances/list", {access_method_id: access_method_id, acs_credential_id: acs_credential_id, acs_entrance_ids: acs_entrance_ids, acs_system_id: acs_system_id, connected_account_id: connected_account_id, customer_key: customer_key, limit: limit, location_id: location_id, page_cursor: page_cursor, search: search, space_id: space_id}.compact)
45
+ def list(access_method_id: nil, acs_credential_id: nil, acs_entrance_ids: nil, acs_system_id: nil, connected_account_id: nil, customer_key: nil, limit: nil, page_cursor: nil, search: nil, space_id: nil)
46
+ res = @client.get("/acs/entrances/list", {access_method_id: access_method_id, acs_credential_id: acs_credential_id, acs_entrance_ids: acs_entrance_ids, acs_system_id: acs_system_id, connected_account_id: connected_account_id, customer_key: customer_key, limit: limit, page_cursor: page_cursor, search: search, space_id: space_id}.compact)
49
47
 
50
- Seam::Resources::AcsEntrance.load_from_response(res.body["acs_entrances"])
48
+ Seam::Resources::AcsEntrance.list_from_http_response(res, "acs_entrances", "/acs/entrances/list")
51
49
  end
52
50
 
53
51
  # Returns a list of all [credentials](https://www.seam.co/docs/low-level-apis/access-systems/managing-credentials) with access to a specified [entrance](https://www.seam.co/docs/low-level-apis/access-systems/retrieving-entrance-details).
@@ -57,7 +55,7 @@ module Seam
57
55
  def list_credentials_with_access(acs_entrance_id:, include_if: nil)
58
56
  res = @client.get("/acs/entrances/list_credentials_with_access", {acs_entrance_id: acs_entrance_id, include_if: include_if}.compact)
59
57
 
60
- Seam::Resources::AcsCredential.load_from_response(res.body["acs_credentials"])
58
+ Seam::Resources::AcsCredential.list_from_http_response(res, "acs_credentials", "/acs/entrances/list_credentials_with_access")
61
59
  end
62
60
 
63
61
  # Remotely unlocks a specified [entrance](https://www.seam.co/docs/low-level-apis/access-systems/retrieving-entrance-details) using a cloud_key credential. Returns an action attempt that tracks the progress of the unlock operation.
@@ -69,7 +67,7 @@ module Seam
69
67
 
70
68
  wait_for_action_attempt = wait_for_action_attempt.nil? ? @defaults.wait_for_action_attempt : wait_for_action_attempt
71
69
 
72
- Seam::ActionAttemptResolver.resolve(Seam::Resources::ActionAttempt.load_from_response(res.body["action_attempt"]), @client, wait_for_action_attempt)
70
+ Seam::ActionAttemptResolver.resolve(Seam::Resources::ActionAttempt.from_http_response(res, "action_attempt", "/acs/entrances/unlock"), @client, wait_for_action_attempt)
73
71
  end
74
72
  end
75
73
  end
@@ -14,7 +14,7 @@ module Seam
14
14
  def get(acs_system_id:)
15
15
  res = @client.get("/acs/systems/get", {acs_system_id: acs_system_id}.compact)
16
16
 
17
- Seam::Resources::AcsSystem.load_from_response(res.body["acs_system"])
17
+ Seam::Resources::AcsSystem.from_http_response(res, "acs_system", "/acs/systems/get")
18
18
  end
19
19
 
20
20
  # Returns a list of all [access systems](https://www.seam.co/docs/low-level-apis/access-systems).
@@ -27,7 +27,7 @@ module Seam
27
27
  def list(connected_account_id: nil, customer_key: nil, search: nil)
28
28
  res = @client.get("/acs/systems/list", {connected_account_id: connected_account_id, customer_key: customer_key, search: search}.compact)
29
29
 
30
- Seam::Resources::AcsSystem.load_from_response(res.body["acs_systems"])
30
+ Seam::Resources::AcsSystem.list_from_http_response(res, "acs_systems", "/acs/systems/list")
31
31
  end
32
32
 
33
33
  # Returns a list of all credential manager systems that are compatible with a specified [access system](https://www.seam.co/docs/low-level-apis/access-systems).
@@ -38,7 +38,7 @@ module Seam
38
38
  def list_compatible_credential_manager_acs_systems(acs_system_id:)
39
39
  res = @client.get("/acs/systems/list_compatible_credential_manager_acs_systems", {acs_system_id: acs_system_id}.compact)
40
40
 
41
- Seam::Resources::AcsSystem.load_from_response(res.body["acs_systems"])
41
+ Seam::Resources::AcsSystem.list_from_http_response(res, "acs_systems", "/acs/systems/list_compatible_credential_manager_acs_systems")
42
42
  end
43
43
 
44
44
  # Reports ACS system device status including encoders and entrances.
@@ -23,16 +23,14 @@ module Seam
23
23
  # @param full_name [String] Full name of the new access system user.
24
24
  # @param access_schedule [Hash, nil] `starts_at` and `ends_at` timestamps for the new access system user's access. If you specify an `access_schedule`, you may include both `starts_at` and `ends_at`. If you omit `starts_at`, it defaults to the current time. `ends_at` is optional and must be a time in the future and after `starts_at`.
25
25
  # @param acs_access_group_ids [Array<String>, nil] Array of access group IDs to indicate the access groups to which you want to add the new access system user.
26
- # @param email [String, nil]
27
- # @deprecated email: use email_address.
28
26
  # @param email_address [String, nil] Email address of the [access system user](https://www.seam.co/docs/low-level-apis/access-systems/user-management).
29
27
  # @param phone_number [String, nil] Phone number of the [access system user](https://www.seam.co/docs/low-level-apis/access-systems/user-management) in E.164 format (for example, `+15555550100`).
30
28
  # @param user_identity_id [String, nil] ID of the user identity with which you want to associate the new access system user.
31
29
  # @return [Seam::Resources::AcsUser] OK
32
- def create(acs_system_id:, full_name:, access_schedule: nil, acs_access_group_ids: nil, email: nil, email_address: nil, phone_number: nil, user_identity_id: nil)
33
- res = @client.post("/acs/users/create", {acs_system_id: acs_system_id, full_name: full_name, access_schedule: access_schedule, acs_access_group_ids: acs_access_group_ids, email: email, email_address: email_address, phone_number: phone_number, user_identity_id: user_identity_id}.compact)
30
+ def create(acs_system_id:, full_name:, access_schedule: nil, acs_access_group_ids: nil, email_address: nil, phone_number: nil, user_identity_id: nil)
31
+ res = @client.post("/acs/users/create", {acs_system_id: acs_system_id, full_name: full_name, access_schedule: access_schedule, acs_access_group_ids: acs_access_group_ids, email_address: email_address, phone_number: phone_number, user_identity_id: user_identity_id}.compact)
34
32
 
35
- Seam::Resources::AcsUser.load_from_response(res.body["acs_user"])
33
+ Seam::Resources::AcsUser.from_http_response(res, "acs_user", "/acs/users/create")
36
34
  end
37
35
 
38
36
  # Deletes a specified [access system user](https://www.seam.co/docs/low-level-apis/access-systems/user-management) and invalidates the access system user's [credentials](https://www.seam.co/docs/low-level-apis/access-systems/managing-credentials).
@@ -41,9 +39,11 @@ module Seam
41
39
  # @param user_identity_id [String, nil] ID of the user identity that you want to delete. You must provide either acs_user_id or user_identity_id. If you provide user_identity_id, you must also provide acs_system_id.
42
40
  # @return [nil] OK
43
41
  def delete(acs_system_id: nil, acs_user_id: nil, user_identity_id: nil)
44
- if acs_system_id.nil? && acs_user_id.nil? && user_identity_id.nil?
45
- raise TypeError, "At least one parameter is required for /acs/users/delete"
46
- end
42
+ Seam::RequestParameters.require_at_least_one(
43
+ "/acs/users/delete",
44
+ {acs_system_id: acs_system_id, acs_user_id: acs_user_id, user_identity_id: user_identity_id},
45
+ [:acs_system_id, :acs_user_id, :user_identity_id]
46
+ )
47
47
 
48
48
  @client.delete("/acs/users/delete", {acs_system_id: acs_system_id, acs_user_id: acs_user_id, user_identity_id: user_identity_id}.compact)
49
49
 
@@ -56,13 +56,15 @@ module Seam
56
56
  # @param user_identity_id [String, nil] ID of the user identity that you want to get. You can only provide acs_user_id or user_identity_id.
57
57
  # @return [Seam::Resources::AcsUser] OK
58
58
  def get(acs_user_id: nil, acs_system_id: nil, user_identity_id: nil)
59
- if acs_user_id.nil? && acs_system_id.nil? && user_identity_id.nil?
60
- raise TypeError, "At least one parameter is required for /acs/users/get"
61
- end
59
+ Seam::RequestParameters.require_at_least_one(
60
+ "/acs/users/get",
61
+ {acs_user_id: acs_user_id, acs_system_id: acs_system_id, user_identity_id: user_identity_id},
62
+ [:acs_user_id, :acs_system_id, :user_identity_id]
63
+ )
62
64
 
63
65
  res = @client.get("/acs/users/get", {acs_user_id: acs_user_id, acs_system_id: acs_system_id, user_identity_id: user_identity_id}.compact)
64
66
 
65
- Seam::Resources::AcsUser.load_from_response(res.body["acs_user"])
67
+ Seam::Resources::AcsUser.from_http_response(res, "acs_user", "/acs/users/get")
66
68
  end
67
69
 
68
70
  # Returns a list of all [access system users](https://www.seam.co/docs/low-level-apis/access-systems/user-management).
@@ -78,7 +80,7 @@ module Seam
78
80
  def list(acs_system_id: nil, created_before: nil, limit: nil, page_cursor: nil, search: nil, user_identity_email_address: nil, user_identity_id: nil, user_identity_phone_number: nil)
79
81
  res = @client.get("/acs/users/list", {acs_system_id: acs_system_id, created_before: created_before, limit: limit, page_cursor: page_cursor, search: search, user_identity_email_address: user_identity_email_address, user_identity_id: user_identity_id, user_identity_phone_number: user_identity_phone_number}.compact)
80
82
 
81
- Seam::Resources::AcsUser.load_from_response(res.body["acs_users"])
83
+ Seam::Resources::AcsUser.list_from_http_response(res, "acs_users", "/acs/users/list")
82
84
  end
83
85
 
84
86
  # Lists the [entrances](https://www.seam.co/docs/api/acs/entrances/object) to which a specified [access system user](https://www.seam.co/docs/low-level-apis/access-systems/user-management) has access.
@@ -87,13 +89,15 @@ module Seam
87
89
  # @param user_identity_id [String, nil] ID of the user identity for whom you want to list accessible entrances. You can only provide acs_user_id or user_identity_id.
88
90
  # @return [Seam::Resources::AcsEntrance] OK
89
91
  def list_accessible_entrances(acs_system_id: nil, acs_user_id: nil, user_identity_id: nil)
90
- if acs_system_id.nil? && acs_user_id.nil? && user_identity_id.nil?
91
- raise TypeError, "At least one parameter is required for /acs/users/list_accessible_entrances"
92
- end
92
+ Seam::RequestParameters.require_at_least_one(
93
+ "/acs/users/list_accessible_entrances",
94
+ {acs_system_id: acs_system_id, acs_user_id: acs_user_id, user_identity_id: user_identity_id},
95
+ [:acs_system_id, :acs_user_id, :user_identity_id]
96
+ )
93
97
 
94
98
  res = @client.get("/acs/users/list_accessible_entrances", {acs_system_id: acs_system_id, acs_user_id: acs_user_id, user_identity_id: user_identity_id}.compact)
95
99
 
96
- Seam::Resources::AcsEntrance.load_from_response(res.body["acs_entrances"])
100
+ Seam::Resources::AcsEntrance.list_from_http_response(res, "acs_entrances", "/acs/users/list_accessible_entrances")
97
101
  end
98
102
 
99
103
  # Removes a specified [access system user](https://www.seam.co/docs/low-level-apis/access-systems/user-management) from a specified [access group](https://www.seam.co/docs/low-level-apis/access-systems/user-management/assigning-users-to-access-groups).
@@ -113,9 +117,11 @@ module Seam
113
117
  # @param user_identity_id [String, nil] ID of the user identity for whom you want to revoke access. You can only provide acs_user_id or user_identity_id.
114
118
  # @return [nil] OK
115
119
  def revoke_access_to_all_entrances(acs_system_id: nil, acs_user_id: nil, user_identity_id: nil)
116
- if acs_system_id.nil? && acs_user_id.nil? && user_identity_id.nil?
117
- raise TypeError, "At least one parameter is required for /acs/users/revoke_access_to_all_entrances"
118
- end
120
+ Seam::RequestParameters.require_at_least_one(
121
+ "/acs/users/revoke_access_to_all_entrances",
122
+ {acs_system_id: acs_system_id, acs_user_id: acs_user_id, user_identity_id: user_identity_id},
123
+ [:acs_system_id, :acs_user_id, :user_identity_id]
124
+ )
119
125
 
120
126
  @client.post("/acs/users/revoke_access_to_all_entrances", {acs_system_id: acs_system_id, acs_user_id: acs_user_id, user_identity_id: user_identity_id}.compact)
121
127
 
@@ -128,9 +134,11 @@ module Seam
128
134
  # @param user_identity_id [String, nil] ID of the user identity that you want to suspend. You can only provide acs_user_id or the combination of acs_system_id and user_identity_id.
129
135
  # @return [nil] OK
130
136
  def suspend(acs_system_id: nil, acs_user_id: nil, user_identity_id: nil)
131
- if acs_system_id.nil? && acs_user_id.nil? && user_identity_id.nil?
132
- raise TypeError, "At least one parameter is required for /acs/users/suspend"
133
- end
137
+ Seam::RequestParameters.require_at_least_one(
138
+ "/acs/users/suspend",
139
+ {acs_system_id: acs_system_id, acs_user_id: acs_user_id, user_identity_id: user_identity_id},
140
+ [:acs_system_id, :acs_user_id, :user_identity_id]
141
+ )
134
142
 
135
143
  @client.post("/acs/users/suspend", {acs_system_id: acs_system_id, acs_user_id: acs_user_id, user_identity_id: user_identity_id}.compact)
136
144
 
@@ -143,9 +151,11 @@ module Seam
143
151
  # @param user_identity_id [String, nil] ID of the user identity that you want to unsuspend. You can only provide acs_user_id or the combination of acs_system_id and user_identity_id.
144
152
  # @return [nil] OK
145
153
  def unsuspend(acs_system_id: nil, acs_user_id: nil, user_identity_id: nil)
146
- if acs_system_id.nil? && acs_user_id.nil? && user_identity_id.nil?
147
- raise TypeError, "At least one parameter is required for /acs/users/unsuspend"
148
- end
154
+ Seam::RequestParameters.require_at_least_one(
155
+ "/acs/users/unsuspend",
156
+ {acs_system_id: acs_system_id, acs_user_id: acs_user_id, user_identity_id: user_identity_id},
157
+ [:acs_system_id, :acs_user_id, :user_identity_id]
158
+ )
149
159
 
150
160
  @client.post("/acs/users/unsuspend", {acs_system_id: acs_system_id, acs_user_id: acs_user_id, user_identity_id: user_identity_id}.compact)
151
161
 
@@ -156,20 +166,20 @@ module Seam
156
166
  # @param access_schedule [Hash, Seam::Null, nil] `starts_at` and `ends_at` timestamps for the access system user's access. If you specify an `access_schedule`, you may include both `starts_at` and `ends_at`. If you omit `starts_at`, it defaults to the current time. `ends_at` is optional and must be a time in the future and after `starts_at`.
157
167
  # @param acs_system_id [String, nil] ID of the access system that you want to update. You can only provide acs_system_id with user_identity_id.
158
168
  # @param acs_user_id [String, nil] ID of the access system user that you want to update. You can only provide acs_user_id or user_identity_id.
159
- # @param email [String, nil]
160
- # @deprecated email: use email_address.
161
169
  # @param email_address [String, nil] Email address of the [access system user](https://www.seam.co/docs/low-level-apis/access-systems/user-management).
162
170
  # @param full_name [String, nil] Full name of the [access system user](https://www.seam.co/docs/low-level-apis/access-systems/user-management).
163
171
  # @param hid_acs_system_id [String, nil] ID of the HID access control system associated with the user.
164
172
  # @param phone_number [String, nil] Phone number of the [access system user](https://www.seam.co/docs/low-level-apis/access-systems/user-management) in E.164 format (for example, `+15555550100`).
165
173
  # @param user_identity_id [String, nil] ID of the user identity that you want to update. You can only provide acs_user_id or user_identity_id. If you provide user_identity_id, you must also provide acs_system_id.
166
174
  # @return [nil] OK
167
- def update(access_schedule: nil, acs_system_id: nil, acs_user_id: nil, email: nil, email_address: nil, full_name: nil, hid_acs_system_id: nil, phone_number: nil, user_identity_id: nil)
168
- if access_schedule.nil? && acs_system_id.nil? && acs_user_id.nil? && email.nil? && email_address.nil? && full_name.nil? && hid_acs_system_id.nil? && phone_number.nil? && user_identity_id.nil?
169
- raise TypeError, "At least one parameter is required for /acs/users/update"
170
- end
171
-
172
- @client.patch("/acs/users/update", {access_schedule: access_schedule, acs_system_id: acs_system_id, acs_user_id: acs_user_id, email: email, email_address: email_address, full_name: full_name, hid_acs_system_id: hid_acs_system_id, phone_number: phone_number, user_identity_id: user_identity_id}.compact)
175
+ def update(access_schedule: nil, acs_system_id: nil, acs_user_id: nil, email_address: nil, full_name: nil, hid_acs_system_id: nil, phone_number: nil, user_identity_id: nil)
176
+ Seam::RequestParameters.require_at_least_one(
177
+ "/acs/users/update",
178
+ {access_schedule: access_schedule, acs_system_id: acs_system_id, acs_user_id: acs_user_id, email_address: email_address, full_name: full_name, hid_acs_system_id: hid_acs_system_id, phone_number: phone_number, user_identity_id: user_identity_id},
179
+ [:access_schedule, :acs_system_id, :acs_user_id, :email_address, :full_name, :hid_acs_system_id, :phone_number, :user_identity_id]
180
+ )
181
+
182
+ @client.patch("/acs/users/update", {access_schedule: access_schedule, acs_system_id: acs_system_id, acs_user_id: acs_user_id, email_address: email_address, full_name: full_name, hid_acs_system_id: hid_acs_system_id, phone_number: phone_number, user_identity_id: user_identity_id}.compact)
173
183
 
174
184
  nil
175
185
  end
@@ -18,7 +18,7 @@ module Seam
18
18
 
19
19
  wait_for_action_attempt = wait_for_action_attempt.nil? ? @defaults.wait_for_action_attempt : wait_for_action_attempt
20
20
 
21
- Seam::ActionAttemptResolver.resolve(Seam::Resources::ActionAttempt.load_from_response(res.body["action_attempt"]), @client, wait_for_action_attempt)
21
+ Seam::ActionAttemptResolver.resolve(Seam::Resources::ActionAttempt.from_http_response(res, "action_attempt", "/action_attempts/get"), @client, wait_for_action_attempt)
22
22
  end
23
23
 
24
24
  # Returns a list of the [action attempts](https://www.seam.co/docs/core-concepts/action-attempts) that you specify as an array of `action_attempt_id`s.
@@ -30,7 +30,7 @@ module Seam
30
30
  def list(action_attempt_ids: nil, device_id: nil, limit: nil, page_cursor: nil)
31
31
  res = @client.get("/action_attempts/list", {action_attempt_ids: action_attempt_ids, device_id: device_id, limit: limit, page_cursor: page_cursor}.compact)
32
32
 
33
- Seam::Resources::ActionAttempt.load_from_response(res.body["action_attempts"])
33
+ Seam::Resources::ActionAttempt.list_from_http_response(res, "action_attempts", "/action_attempts/list")
34
34
  end
35
35
  end
36
36
  end
@@ -10,7 +10,7 @@ module Seam
10
10
 
11
11
  # Creates a short-lived live view session for a single camera. Pass the returned session ID and token to `/cameras/live_views/offer` to start a WebRTC stream, and to `/cameras/live_views/stop` to end the session.
12
12
  #
13
- # Camera live view is in beta. To enable it for your workspace, contact Seam support. To check whether a camera supports live view, use `device.can_stream_live_video`.
13
+ # Camera live view is in public beta and enabled by default in production and sandbox workspaces. Use your API key on your backend to create a client session with access to the camera's connected account, then authenticate live view requests with that client session's token. To check whether a camera supports live view, use `device.can_stream_live_video`.
14
14
  # @param device_id [String] ID of the camera to view.
15
15
  # @param duration_seconds [Integer, nil] Number of seconds for which the live view session is valid, up to 600.
16
16
  # @param include_audio [Boolean, nil] Indicates whether to include the camera's audio.
@@ -18,12 +18,12 @@ module Seam
18
18
  def create(device_id:, duration_seconds: nil, include_audio: nil)
19
19
  res = @client.post("/cameras/live_views/create", {device_id: device_id, duration_seconds: duration_seconds, include_audio: include_audio}.compact)
20
20
 
21
- Seam::Resources::CameraLiveViewSession.load_from_response(res.body["camera_live_view_session"])
21
+ Seam::Resources::CameraLiveViewSession.from_http_response(res, "camera_live_view_session", "/cameras/live_views/create")
22
22
  end
23
23
 
24
24
  # Exchanges a WebRTC SDP offer for an SDP answer that starts streaming video from the camera, for a live view session that you created using `/cameras/live_views/create`.
25
25
  #
26
- # Camera live view is in beta. To enable it for your workspace, contact Seam support.
26
+ # Camera live view is in public beta and enabled by default in production and sandbox workspaces. Authenticate with the client session token used to create the live view session.
27
27
  # @param camera_live_view_session_id [String] ID of the camera live view session.
28
28
  # @param sdp_offer [String] WebRTC SDP offer from the viewer, limited to 64 KiB of UTF-8 data.
29
29
  # @param token [String] Token returned when the camera live view session was created.
@@ -31,12 +31,12 @@ module Seam
31
31
  def offer(camera_live_view_session_id:, sdp_offer:, token:)
32
32
  res = @client.post("/cameras/live_views/offer", {camera_live_view_session_id: camera_live_view_session_id, sdp_offer: sdp_offer, token: token}.compact)
33
33
 
34
- Seam::Resources::CameraLiveViewAnswer.load_from_response(res.body["camera_live_view_answer"])
34
+ Seam::Resources::CameraLiveViewAnswer.from_http_response(res, "camera_live_view_answer", "/cameras/live_views/offer")
35
35
  end
36
36
 
37
37
  # Stops a camera live view session that the current client session owns.
38
38
  #
39
- # Camera live view is in beta. To enable it for your workspace, contact Seam support.
39
+ # Camera live view is in public beta and enabled by default in production and sandbox workspaces. Authenticate with the client session token used to create the live view session.
40
40
  # @param camera_live_view_session_id [String] ID of the camera live view session.
41
41
  # @param token [String] Token returned when the camera live view session was created.
42
42
  # @return [nil] OK