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
@@ -198,6 +198,24 @@ module Seam
198
198
  date_accessor :created_at
199
199
  end
200
200
 
201
+ # Indicates that the lock has about one week, two days, or a critically low amount of battery life remaining. Replace the lock's batteries promptly to avoid losing access.
202
+ class LowBattery < Errors
203
+ # Unique identifier of the type of error. Enables quick recognition and categorization of the issue.
204
+ # @return [String]
205
+ # Known values:
206
+ # - `low_battery`
207
+ attr_accessor :error_code
208
+ # Indicates that the error is a device error.
209
+ # @return [TrueClass]
210
+ attr_accessor :is_device_error
211
+ # Detailed description of the error. Provides insights into the issue and potentially how to rectify it.
212
+ # @return [String]
213
+ attr_accessor :message
214
+ # Date and time at which Seam created the error.
215
+ # @return [Time]
216
+ date_accessor :created_at
217
+ end
218
+
201
219
  # Indicates that device credentials are missing.
202
220
  class MissingDeviceCredentials < Errors
203
221
  # Unique identifier of the type of error. Enables quick recognition and categorization of the issue.
@@ -286,6 +304,7 @@ module Seam
286
304
  # - `device_disconnected`
287
305
  # - `empty_backup_access_code_pool`
288
306
  # - `august_lock_not_authorized`
307
+ # - `low_battery`
289
308
  # - `missing_device_credentials`
290
309
  # - `auxiliary_heat_running`
291
310
  # - `subscription_required`
@@ -309,6 +328,7 @@ module Seam
309
328
  "device_disconnected" => DeviceDisconnected,
310
329
  "empty_backup_access_code_pool" => EmptyBackupAccessCodePool,
311
330
  "august_lock_not_authorized" => AugustLockNotAuthorized,
331
+ "low_battery" => LowBattery,
312
332
  "missing_device_credentials" => MissingDeviceCredentials,
313
333
  "auxiliary_heat_running" => AuxiliaryHeatRunning,
314
334
  "subscription_required" => SubscriptionRequired,
@@ -326,10 +346,6 @@ module Seam
326
346
  # Time zone of the device location.
327
347
  # @return [String, nil]
328
348
  attr_accessor :time_zone
329
- # Time zone of the device location.
330
- # @return [String, nil]
331
- # @deprecated Use `time_zone` instead.
332
- attr_accessor :timezone
333
349
  end
334
350
 
335
351
  class Properties < BaseResource
@@ -362,9 +378,6 @@ module Seam
362
378
  end
363
379
 
364
380
  class Model < BaseResource
365
- # @return [Boolean, nil]
366
- # @deprecated use device.properties.model.can_connect_accessory_keypad
367
- attr_accessor :accessory_keypad_supported
368
381
  # Indicates whether the device can connect a accessory keypad.
369
382
  # @return [Boolean, nil]
370
383
  attr_accessor :can_connect_accessory_keypad
@@ -377,12 +390,6 @@ module Seam
377
390
  # Display name that corresponds to the manufacturer-specific terminology for the device.
378
391
  # @return [String]
379
392
  attr_accessor :manufacturer_display_name
380
- # @return [Boolean, nil]
381
- # @deprecated use device.can_program_offline_access_codes.
382
- attr_accessor :offline_access_codes_supported
383
- # @return [Boolean, nil]
384
- # @deprecated use device.can_program_online_access_codes.
385
- attr_accessor :online_access_codes_supported
386
393
  end
387
394
 
388
395
  # Accessory keypad properties and state.
@@ -410,17 +417,9 @@ module Seam
410
417
  # @return [String]
411
418
  # @deprecated use device.display_name instead
412
419
  attr_accessor :name
413
- # Indicates whether it is currently possible to use offline access codes for the device.
414
- # @return [Boolean, nil]
415
- # @deprecated use device.can_program_offline_access_codes
416
- attr_accessor :offline_access_codes_enabled
417
420
  # Indicates whether the device is online.
418
421
  # @return [Boolean]
419
422
  attr_accessor :online
420
- # Indicates whether it is currently possible to use online access codes for the device.
421
- # @return [Boolean, nil]
422
- # @deprecated use device.can_program_online_access_codes
423
- attr_accessor :online_access_codes_enabled
424
423
  end
425
424
 
426
425
  # Known `warning_code` values load as subclasses; unknown values remain Warnings instances for forward compatibility.
@@ -635,7 +634,7 @@ module Seam
635
634
  date_accessor :created_at
636
635
  end
637
636
 
638
- # Indicates that a change in the reported device model has been detected for this Salto KS lock, which may occur after an IQ hub reset. Access code support may be affected. See https://help.getseam.com/articles/5098842588-salto-ks-lock-loses-access-code-support for troubleshooting steps.
637
+ # Indicates that a change in the reported device model has been detected for this Salto KS lock, which may occur after an IQ hub reset. Access code support may be affected. See https://www.seam.co/help/salto-ks-lock-loses-access-code-support for troubleshooting steps.
639
638
  class SaltoKsLockAccessCodeSupportRemoved < Warnings
640
639
  # Detailed description of the warning. Provides insights into the issue and potentially how to rectify it.
641
640
  # @return [String]
@@ -755,6 +754,21 @@ module Seam
755
754
  date_accessor :created_at
756
755
  end
757
756
 
757
+ # Indicates that a technician has put the pool controller in service mode. Schedules and remote changes will not run until it is switched back.
758
+ class ServiceMode < Warnings
759
+ # Detailed description of the warning. Provides insights into the issue and potentially how to rectify it.
760
+ # @return [String]
761
+ attr_accessor :message
762
+ # Unique identifier of the type of warning. Enables quick recognition and categorization of the issue.
763
+ # @return [String]
764
+ # Known values:
765
+ # - `service_mode`
766
+ attr_accessor :warning_code
767
+ # Date and time at which Seam created the warning.
768
+ # @return [Time]
769
+ date_accessor :created_at
770
+ end
771
+
758
772
  # Indicates a provider-specific issue that may affect device functionality.
759
773
  class ProviderIssue < Warnings
760
774
  # Detailed description of the warning. Provides insights into the issue and potentially how to rectify it.
@@ -815,6 +829,21 @@ module Seam
815
829
  date_accessor :created_at
816
830
  end
817
831
 
832
+ # Indicates that the lock has about two weeks of battery life remaining or the provider otherwise recommends replacing the lock's batteries soon.
833
+ class BatteryReplacementRecommended < Warnings
834
+ # Detailed description of the warning. Provides insights into the issue and potentially how to rectify it.
835
+ # @return [String]
836
+ attr_accessor :message
837
+ # Unique identifier of the type of warning. Enables quick recognition and categorization of the issue.
838
+ # @return [String]
839
+ # Known values:
840
+ # - `battery_replacement_recommended`
841
+ attr_accessor :warning_code
842
+ # Date and time at which Seam created the warning.
843
+ # @return [Time]
844
+ date_accessor :created_at
845
+ end
846
+
818
847
  # Indicates that the device may optimistically be reported as online because the provider does not reliably report its online status.
819
848
  class UnreliableOnlineStatus < Warnings
820
849
  # Detailed description of the warning. Provides insights into the issue and potentially how to rectify it.
@@ -851,6 +880,36 @@ module Seam
851
880
  date_accessor :created_at
852
881
  end
853
882
 
883
+ # Indicates that a third-party subscription is required to enable additional device capabilities.
884
+ class SubscriptionRequiredForAdditionalCapabilities < Warnings
885
+ # Detailed description of the warning. Provides insights into the issue and potentially how to rectify it.
886
+ # @return [String]
887
+ attr_accessor :message
888
+ # Unique identifier of the type of warning. Enables quick recognition and categorization of the issue.
889
+ # @return [String]
890
+ # Known values:
891
+ # - `subscription_required_for_additional_capabilities`
892
+ attr_accessor :warning_code
893
+ # Date and time at which Seam created the warning.
894
+ # @return [Time]
895
+ date_accessor :created_at
896
+ end
897
+
898
+ # Indicates that the camera's account plan does not include cloud recording, so event media such as motion clips is unavailable.
899
+ class CloudRecordingNotEnabled < Warnings
900
+ # Detailed description of the warning. Provides insights into the issue and potentially how to rectify it.
901
+ # @return [String]
902
+ attr_accessor :message
903
+ # Unique identifier of the type of warning. Enables quick recognition and categorization of the issue.
904
+ # @return [String]
905
+ # Known values:
906
+ # - `cloud_recording_not_enabled`
907
+ attr_accessor :warning_code
908
+ # Date and time at which Seam created the warning.
909
+ # @return [Time]
910
+ date_accessor :created_at
911
+ end
912
+
854
913
  # Detailed description of the warning. Provides insights into the issue and potentially how to rectify it.
855
914
  # @return [String]
856
915
  attr_accessor :message
@@ -879,12 +938,16 @@ module Seam
879
938
  # - `time_zone_mismatch`
880
939
  # - `two_n_device_missing_timezone`
881
940
  # - `hub_required_for_additional_capabilities`
941
+ # - `service_mode`
882
942
  # - `provider_issue`
883
943
  # - `keynest_unsupported_locker`
884
944
  # - `accessory_keypad_setup_required`
885
945
  # - `accessory_keypad_low_battery`
946
+ # - `battery_replacement_recommended`
886
947
  # - `unreliable_online_status`
887
948
  # - `max_access_codes_reached`
949
+ # - `subscription_required_for_additional_capabilities`
950
+ # - `cloud_recording_not_enabled`
888
951
  attr_accessor :warning_code
889
952
  # Date and time at which Seam created the warning.
890
953
  # @return [Time]
@@ -913,12 +976,16 @@ module Seam
913
976
  "time_zone_mismatch" => TimeZoneMismatch,
914
977
  "two_n_device_missing_timezone" => TwoNDeviceMissingTimezone,
915
978
  "hub_required_for_additional_capabilities" => HubRequiredForAdditionalCapabilities,
979
+ "service_mode" => ServiceMode,
916
980
  "provider_issue" => ProviderIssue,
917
981
  "keynest_unsupported_locker" => KeynestUnsupportedLocker,
918
982
  "accessory_keypad_setup_required" => AccessoryKeypadSetupRequired,
919
983
  "accessory_keypad_low_battery" => AccessoryKeypadLowBattery,
984
+ "battery_replacement_recommended" => BatteryReplacementRecommended,
920
985
  "unreliable_online_status" => UnreliableOnlineStatus,
921
- "max_access_codes_reached" => MaxAccessCodesReached
986
+ "max_access_codes_reached" => MaxAccessCodesReached,
987
+ "subscription_required_for_additional_capabilities" => SubscriptionRequiredForAdditionalCapabilities,
988
+ "cloud_recording_not_enabled" => CloudRecordingNotEnabled
922
989
  }.freeze
923
990
  end
924
991
 
@@ -926,7 +993,7 @@ module Seam
926
993
  # @return [Location, nil]
927
994
  resource_accessor :location, Location
928
995
  # properties of the device.
929
- # @return [Properties]
996
+ # @return [Properties, nil]
930
997
  resource_accessor :properties, Properties
931
998
  # Array of errors associated with the device. Each error object within the array contains two fields: `error_code` and `message`. `error_code` is a string that uniquely identifies the type of error, enabling quick recognition and categorization of the issue. `message` provides a more detailed description of the error, offering insights into the issue and potentially how to rectify it.
932
999
  # @return [Array<Errors>]
@@ -949,15 +1016,6 @@ module Seam
949
1016
  # Indicates whether the thermostat supports simultaneous heating and cooling.
950
1017
  # @return [Boolean, nil]
951
1018
  attr_accessor :can_hvac_heat_cool
952
- # Indicates whether the speaker supports muting and unmuting.
953
- # @return [Boolean, nil]
954
- attr_accessor :can_mute_speaker
955
- # Indicates whether the speaker supports pausing and resuming playback.
956
- # @return [Boolean, nil]
957
- attr_accessor :can_pause_speaker_playback
958
- # Indicates whether the speaker supports playing a chime.
959
- # @return [Boolean, nil]
960
- attr_accessor :can_play_speaker_chime
961
1019
  # Indicates whether the device supports programming offline access codes.
962
1020
  # @return [Boolean, nil]
963
1021
  attr_accessor :can_program_offline_access_codes
@@ -982,9 +1040,6 @@ module Seam
982
1040
  # Indicates whether the thermostat supports running climate programs.
983
1041
  # @return [Boolean, nil]
984
1042
  attr_accessor :can_run_thermostat_programs
985
- # Indicates whether the speaker supports setting its volume.
986
- # @return [Boolean, nil]
987
- attr_accessor :can_set_speaker_volume
988
1043
  # Indicates whether the device supports simulating connection in a sandbox.
989
1044
  # @return [Boolean, nil]
990
1045
  attr_accessor :can_simulate_connection
@@ -1003,7 +1058,7 @@ module Seam
1003
1058
  # Indicates whether the device supports simulating removal in a sandbox.
1004
1059
  # @return [Boolean, nil]
1005
1060
  attr_accessor :can_simulate_removal
1006
- # Indicates whether the camera supports streaming live video through a camera live view session.
1061
+ # Indicates whether the camera can stream live video through a camera live view session. `false` while the camera is offline.
1007
1062
  # @return [Boolean, nil]
1008
1063
  attr_accessor :can_stream_live_video
1009
1064
  # Indicates whether the thermostat can be turned off.
@@ -1021,6 +1076,7 @@ module Seam
1021
1076
  # - `thermostat`
1022
1077
  # - `battery`
1023
1078
  # - `phone`
1079
+ # - `pool`
1024
1080
  attr_accessor :capabilities_supported
1025
1081
  # Unique identifier for the account associated with the device.
1026
1082
  # @return [String]
@@ -1031,7 +1087,7 @@ module Seam
1031
1087
  # ID of the device.
1032
1088
  # @return [String]
1033
1089
  attr_accessor :device_id
1034
- # Type of the device.
1090
+ # Type of the device. The `august_lock` and `yale_lock` values are deprecated. Use `yale_access_lock` in place of `august_lock`, and `yale_access_lock` or `yale_home_lock` in place of `yale_lock`.
1035
1091
  # @return [String]
1036
1092
  # Known values:
1037
1093
  # - `akuvox_lock`
@@ -1051,6 +1107,9 @@ module Seam
1051
1107
  # - `smartthings_lock`
1052
1108
  # - `wyze_lock`
1053
1109
  # - `yale_lock`
1110
+ # - `yale_access_lock`
1111
+ # - `yale_home_lock`
1112
+ # - `yale_connect_lock`
1054
1113
  # - `two_n_intercom`
1055
1114
  # - `controlbyweb_device`
1056
1115
  # - `ttlock_lock`
@@ -1065,6 +1124,8 @@ module Seam
1065
1124
  # - `omnitec_lock`
1066
1125
  # - `kisi_lock`
1067
1126
  # - `aqara_lock`
1127
+ # - `tuya_lock`
1128
+ # - `eufy_lock`
1068
1129
  # - `keynest_key`
1069
1130
  # - `noiseaware_activity_zone`
1070
1131
  # - `minut_sensor`
@@ -1073,6 +1134,8 @@ module Seam
1073
1134
  # - `honeywell_resideo_thermostat`
1074
1135
  # - `tado_thermostat`
1075
1136
  # - `sensi_thermostat`
1137
+ # - `sensibo_thermostat`
1138
+ # - `cielo_thermostat`
1076
1139
  # - `smartthings_thermostat`
1077
1140
  # - `ios_phone`
1078
1141
  # - `android_phone`
@@ -1080,7 +1143,11 @@ module Seam
1080
1143
  # - `tapo_camera`
1081
1144
  # - `arlo_camera`
1082
1145
  # - `reolink_camera`
1146
+ # - `unifi_protect_camera`
1083
1147
  # - `sonos_speaker`
1148
+ # - `alertify_sensor`
1149
+ # - `hayward_pool_controller`
1150
+ # - `hayward_pool`
1084
1151
  attr_accessor :device_type
1085
1152
  # Display name of the device, defaults to nickname (if it is set) or `properties.appearance.name`, otherwise. Enables administrators and users to identify the device easily, especially when there are numerous devices.
1086
1153
  # @return [String]
@@ -1088,6 +1155,9 @@ module Seam
1088
1155
  # Indicates that Seam does not manage the device.
1089
1156
  # @return [FalseClass]
1090
1157
  attr_accessor :is_managed
1158
+ # Indicates whether the device is online.
1159
+ # @return [Boolean]
1160
+ attr_accessor :is_online
1091
1161
  # Unique identifier for the Seam workspace associated with the device.
1092
1162
  # @return [String]
1093
1163
  attr_accessor :workspace_id
@@ -27,10 +27,6 @@ module Seam
27
27
 
28
28
  # @return [ConnectWebviewCustomization]
29
29
  resource_accessor :connect_webview_customization, ConnectWebviewCustomization
30
- # Company name associated with the [workspace](https://www.seam.co/docs/core-concepts/workspaces).
31
- # @return [String]
32
- # @deprecated Use `connect_partner_name` instead.
33
- attr_accessor :company_name
34
30
  # Seam Connect partner name associated with the [workspace](https://www.seam.co/docs/core-concepts/workspaces).
35
31
  # @return [String, nil]
36
32
  attr_accessor :connect_partner_name
@@ -38,13 +38,11 @@ module Seam
38
38
  # @param preferred_code_length [Float, nil] Preferred code length. Only applicable if you do not specify a `code`. If the affected device does not support the preferred code length, Seam reverts to using the shortest supported code length.
39
39
  # @param starts_at [String, nil] Date and time at which the validity of the new access code starts, in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.
40
40
  # @param use_backup_access_code_pool [Boolean, nil] Indicates whether to use a [backup access code pool](https://www.seam.co/docs/low-level-apis/smart-locks/access-codes/backup-access-codes) provided by Seam. If `true`, you can use [`/access_codes/pull_backup_access_code`](https://www.seam.co/docs/api/access_codes/pull_backup_access_code).
41
- # @param use_offline_access_code [Boolean, nil]
42
- # @deprecated use_offline_access_code: Use `is_offline_access_code` instead.
43
41
  # @return [Seam::Resources::AccessCode] OK
44
- def create(device_id:, allow_external_modification: nil, attempt_for_offline_device: nil, code: nil, common_code_key: nil, ends_at: nil, is_external_modification_allowed: nil, is_offline_access_code: nil, is_one_time_use: nil, max_time_rounding: nil, name: nil, prefer_native_scheduling: nil, preferred_code_length: nil, starts_at: nil, use_backup_access_code_pool: nil, use_offline_access_code: nil)
45
- res = @client.post("/access_codes/create", {device_id: device_id, allow_external_modification: allow_external_modification, attempt_for_offline_device: attempt_for_offline_device, code: code, common_code_key: common_code_key, ends_at: ends_at, is_external_modification_allowed: is_external_modification_allowed, is_offline_access_code: is_offline_access_code, is_one_time_use: is_one_time_use, max_time_rounding: max_time_rounding, name: name, prefer_native_scheduling: prefer_native_scheduling, preferred_code_length: preferred_code_length, starts_at: starts_at, use_backup_access_code_pool: use_backup_access_code_pool, use_offline_access_code: use_offline_access_code}.compact)
42
+ def create(device_id:, allow_external_modification: nil, attempt_for_offline_device: nil, code: nil, common_code_key: nil, ends_at: nil, is_external_modification_allowed: nil, is_offline_access_code: nil, is_one_time_use: nil, max_time_rounding: nil, name: nil, prefer_native_scheduling: nil, preferred_code_length: nil, starts_at: nil, use_backup_access_code_pool: nil)
43
+ res = @client.post("/access_codes/create", {device_id: device_id, allow_external_modification: allow_external_modification, attempt_for_offline_device: attempt_for_offline_device, code: code, common_code_key: common_code_key, ends_at: ends_at, is_external_modification_allowed: is_external_modification_allowed, is_offline_access_code: is_offline_access_code, is_one_time_use: is_one_time_use, max_time_rounding: max_time_rounding, name: name, prefer_native_scheduling: prefer_native_scheduling, preferred_code_length: preferred_code_length, starts_at: starts_at, use_backup_access_code_pool: use_backup_access_code_pool}.compact)
46
44
 
47
- Seam::Resources::AccessCode.load_from_response(res.body["access_code"])
45
+ Seam::Resources::AccessCode.from_http_response(res, "access_code", "/access_codes/create")
48
46
  end
49
47
 
50
48
  # Creates new [access codes](https://www.seam.co/docs/low-level-apis/smart-locks/access-codes) that share a common code across multiple devices.
@@ -80,7 +78,7 @@ module Seam
80
78
  def create_multiple(device_ids:, allow_external_modification: nil, attempt_for_offline_device: nil, behavior_when_code_cannot_be_shared: nil, code: nil, ends_at: nil, is_external_modification_allowed: nil, name: nil, prefer_native_scheduling: nil, preferred_code_length: nil, starts_at: nil, use_backup_access_code_pool: nil)
81
79
  res = @client.put("/access_codes/create_multiple", {device_ids: device_ids, allow_external_modification: allow_external_modification, attempt_for_offline_device: attempt_for_offline_device, behavior_when_code_cannot_be_shared: behavior_when_code_cannot_be_shared, code: code, ends_at: ends_at, is_external_modification_allowed: is_external_modification_allowed, name: name, prefer_native_scheduling: prefer_native_scheduling, preferred_code_length: preferred_code_length, starts_at: starts_at, use_backup_access_code_pool: use_backup_access_code_pool}.compact)
82
80
 
83
- Seam::Resources::AccessCode.load_from_response(res.body["access_codes"])
81
+ Seam::Resources::AccessCode.list_from_http_response(res, "access_codes", "/access_codes/create_multiple")
84
82
  end
85
83
 
86
84
  # Deletes an [access code](https://www.seam.co/docs/low-level-apis/smart-locks/access-codes).
@@ -99,7 +97,7 @@ module Seam
99
97
  def generate_code(device_id:)
100
98
  res = @client.get("/access_codes/generate_code", {device_id: device_id}.compact)
101
99
 
102
- Seam::Resources::AccessCode.load_from_response(res.body["generated_code"])
100
+ Seam::Resources::AccessCode.from_http_response(res, "generated_code", "/access_codes/generate_code")
103
101
  end
104
102
 
105
103
  # Returns a specified [access code](https://www.seam.co/docs/low-level-apis/smart-locks/access-codes).
@@ -110,37 +108,35 @@ module Seam
110
108
  # @param device_id [String, nil] ID of the device containing the access code that you want to get. You must specify either `access_code_id` or both `device_id` and `code`.
111
109
  # @return [Seam::Resources::AccessCode] OK
112
110
  def get(access_code_id: nil, code: nil, device_id: nil)
113
- if access_code_id.nil? && code.nil? && device_id.nil?
114
- raise TypeError, "At least one parameter is required for /access_codes/get"
115
- end
111
+ Seam::RequestParameters.require_at_least_one(
112
+ "/access_codes/get",
113
+ {access_code_id: access_code_id, code: code, device_id: device_id},
114
+ [:access_code_id, :code, :device_id]
115
+ )
116
116
 
117
117
  res = @client.get("/access_codes/get", {access_code_id: access_code_id, code: code, device_id: device_id}.compact)
118
118
 
119
- Seam::Resources::AccessCode.load_from_response(res.body["access_code"])
119
+ Seam::Resources::AccessCode.from_http_response(res, "access_code", "/access_codes/get")
120
120
  end
121
121
 
122
122
  # Returns a list of all [access codes](https://www.seam.co/docs/low-level-apis/smart-locks/access-codes).
123
123
  #
124
- # Specify `device_id`, `access_code_ids`, `access_method_id`, `access_grant_id`, or `access_grant_key`.
125
- # @param access_code_ids [Array<String>, nil] IDs of the access codes that you want to retrieve. Specify `device_id`, `access_code_ids`, `access_method_id`, `access_grant_id`, or `access_grant_key`.
126
- # @param access_grant_id [String, nil] ID of the access grant for which you want to list access codes. Specify `device_id`, `access_code_ids`, `access_method_id`, `access_grant_id`, or `access_grant_key`.
127
- # @param access_grant_key [String, nil] Key of the access grant for which you want to list access codes. Specify `device_id`, `access_code_ids`, `access_method_id`, `access_grant_id`, or `access_grant_key`.
128
- # @param access_method_id [String, nil] ID of the access method for which you want to list access codes. Specify `device_id`, `access_code_ids`, `access_method_id`, `access_grant_id`, or `access_grant_key`.
124
+ # Without `device_id`, `access_code_ids`, `access_method_id`, `access_grant_id`, or `access_grant_key`, returns access codes across the workspace, or across the customer when `customer_key` is set. Use `limit` and `page_cursor` to page through them.
125
+ # @param access_code_ids [Array<String>, nil] IDs of the access codes that you want to retrieve.
126
+ # @param access_grant_id [String, nil] ID of the access grant for which you want to list access codes.
127
+ # @param access_grant_key [String, nil] Key of the access grant for which you want to list access codes.
128
+ # @param access_method_id [String, nil] ID of the access method for which you want to list access codes.
129
129
  # @param customer_key [String, nil] Customer key for which you want to list access codes.
130
- # @param device_id [String, nil] ID of the device for which you want to list access codes. Specify `device_id`, `access_code_ids`, `access_method_id`, `access_grant_id`, or `access_grant_key`.
130
+ # @param device_id [String, nil] ID of the device for which you want to list access codes.
131
131
  # @param limit [Float, nil] Numerical limit on the number of access codes to return.
132
132
  # @param page_cursor [String, Seam::Null, nil] Identifies the specific page of results to return, obtained from the previous page's `next_page_cursor`.
133
133
  # @param search [String, nil] String for which to search. Filters returned access codes to include all records that satisfy a partial match using `name`, `code` or `access_code_id`.
134
134
  # @param user_identifier_key [String, nil] Your user ID for the user by which to filter access codes.
135
135
  # @return [Seam::Resources::AccessCode] OK
136
136
  def list(access_code_ids: nil, access_grant_id: nil, access_grant_key: nil, access_method_id: nil, customer_key: nil, device_id: nil, limit: nil, page_cursor: nil, search: nil, user_identifier_key: nil)
137
- if access_code_ids.nil? && access_grant_id.nil? && access_grant_key.nil? && access_method_id.nil? && customer_key.nil? && device_id.nil? && limit.nil? && page_cursor.nil? && search.nil? && user_identifier_key.nil?
138
- raise TypeError, "At least one parameter is required for /access_codes/list"
139
- end
140
-
141
137
  res = @client.get("/access_codes/list", {access_code_ids: access_code_ids, access_grant_id: access_grant_id, access_grant_key: access_grant_key, access_method_id: access_method_id, customer_key: customer_key, device_id: device_id, limit: limit, page_cursor: page_cursor, search: search, user_identifier_key: user_identifier_key}.compact)
142
138
 
143
- Seam::Resources::AccessCode.load_from_response(res.body["access_codes"])
139
+ Seam::Resources::AccessCode.list_from_http_response(res, "access_codes", "/access_codes/list")
144
140
  end
145
141
 
146
142
  # Retrieves a backup access code for an [access code](https://www.seam.co/docs/low-level-apis/smart-locks/access-codes). See also [Managing Backup Access Codes](https://www.seam.co/docs/low-level-apis/smart-locks/access-codes/backup-access-codes).
@@ -157,7 +153,7 @@ module Seam
157
153
  def pull_backup_access_code(access_code_id:)
158
154
  res = @client.post("/access_codes/pull_backup_access_code", {access_code_id: access_code_id}.compact)
159
155
 
160
- Seam::Resources::AccessCode.load_from_response(res.body["access_code"])
156
+ Seam::Resources::AccessCode.from_http_response(res, "access_code", "/access_codes/pull_backup_access_code")
161
157
  end
162
158
 
163
159
  # Enables you to report access code-related constraints for a device. Currently, supports reporting supported code length constraints for SmartThings devices.
@@ -16,7 +16,7 @@ module Seam
16
16
  def create_unmanaged_access_code(code:, device_id:, name:)
17
17
  res = @client.post("/access_codes/simulate/create_unmanaged_access_code", {code: code, device_id: device_id, name: name}.compact)
18
18
 
19
- Seam::Resources::UnmanagedAccessCode.load_from_response(res.body["access_code"])
19
+ Seam::Resources::UnmanagedAccessCode.from_http_response(res, "access_code", "/access_codes/simulate/create_unmanaged_access_code")
20
20
  end
21
21
  end
22
22
  end
@@ -41,13 +41,15 @@ module Seam
41
41
  # @param device_id [String, nil] ID of the device containing the unmanaged access code that you want to get. You must specify either `access_code_id` or both `device_id` and `code`.
42
42
  # @return [Seam::Resources::UnmanagedAccessCode] OK
43
43
  def get(access_code_id: nil, code: nil, device_id: nil)
44
- if access_code_id.nil? && code.nil? && device_id.nil?
45
- raise TypeError, "At least one parameter is required for /access_codes/unmanaged/get"
46
- end
44
+ Seam::RequestParameters.require_at_least_one(
45
+ "/access_codes/unmanaged/get",
46
+ {access_code_id: access_code_id, code: code, device_id: device_id},
47
+ [:access_code_id, :code, :device_id]
48
+ )
47
49
 
48
50
  res = @client.get("/access_codes/unmanaged/get", {access_code_id: access_code_id, code: code, device_id: device_id}.compact)
49
51
 
50
- Seam::Resources::UnmanagedAccessCode.load_from_response(res.body["access_code"])
52
+ Seam::Resources::UnmanagedAccessCode.from_http_response(res, "access_code", "/access_codes/unmanaged/get")
51
53
  end
52
54
 
53
55
  # Returns a list of all [unmanaged access codes](https://www.seam.co/docs/low-level-apis/smart-locks/access-codes/migrating-existing-access-codes).
@@ -60,7 +62,7 @@ module Seam
60
62
  def list(device_id:, limit: nil, page_cursor: nil, search: nil, user_identifier_key: nil)
61
63
  res = @client.get("/access_codes/unmanaged/list", {device_id: device_id, limit: limit, page_cursor: page_cursor, search: search, user_identifier_key: user_identifier_key}.compact)
62
64
 
63
- Seam::Resources::UnmanagedAccessCode.load_from_response(res.body["access_codes"])
65
+ Seam::Resources::UnmanagedAccessCode.list_from_http_response(res, "access_codes", "/access_codes/unmanaged/list")
64
66
  end
65
67
 
66
68
  # Updates a specified [unmanaged access code](https://www.seam.co/docs/low-level-apis/smart-locks/access-codes/migrating-existing-access-codes).
@@ -19,10 +19,6 @@ module Seam
19
19
  # @param customization_profile_id [String, nil] ID of the customization profile to apply to the Access Grant and its access methods.
20
20
  # @param device_ids [Array<String>, nil] Set of IDs of the [devices](https://www.seam.co/docs/api/devices/list) to which access is being granted.
21
21
  # @param ends_at [String, Seam::Null, nil] Date and time at which the validity of the new grant ends, in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Must be a time in the future and after `starts_at`.
22
- # @param location [Hash, nil]
23
- # @deprecated location: Create a space first, then reference it using `space_ids`.
24
- # @param location_ids [Array<String>, nil]
25
- # @deprecated location_ids: Use `space_ids`.
26
22
  # @param name [String, Seam::Null, nil] Name for the access grant.
27
23
  # @param reservation_key [String, nil] Reservation key for the access grant.
28
24
  # @param space_ids [Array<String>, nil] Set of IDs of existing spaces to which access is being granted.
@@ -31,10 +27,10 @@ module Seam
31
27
  # @param user_identity [Hash, nil] When used, creates a new user identity with the given details, and grants them access.
32
28
  # @param user_identity_id [String, nil] ID of user identity for whom access is being granted.
33
29
  # @return [Seam::Resources::AccessGrant] OK
34
- def create(requested_access_methods:, access_grant_key: nil, acs_entrance_ids: nil, customization_profile_id: nil, device_ids: nil, ends_at: nil, location: nil, location_ids: nil, name: nil, reservation_key: nil, space_ids: nil, space_keys: nil, starts_at: nil, user_identity: nil, user_identity_id: nil)
35
- res = @client.post("/access_grants/create", {requested_access_methods: requested_access_methods, access_grant_key: access_grant_key, acs_entrance_ids: acs_entrance_ids, customization_profile_id: customization_profile_id, device_ids: device_ids, ends_at: ends_at, location: location, location_ids: location_ids, name: name, reservation_key: reservation_key, space_ids: space_ids, space_keys: space_keys, starts_at: starts_at, user_identity: user_identity, user_identity_id: user_identity_id}.compact)
30
+ def create(requested_access_methods:, access_grant_key: nil, acs_entrance_ids: nil, customization_profile_id: nil, device_ids: nil, ends_at: nil, name: nil, reservation_key: nil, space_ids: nil, space_keys: nil, starts_at: nil, user_identity: nil, user_identity_id: nil)
31
+ res = @client.post("/access_grants/create", {requested_access_methods: requested_access_methods, access_grant_key: access_grant_key, acs_entrance_ids: acs_entrance_ids, customization_profile_id: customization_profile_id, device_ids: device_ids, ends_at: ends_at, name: name, reservation_key: reservation_key, space_ids: space_ids, space_keys: space_keys, starts_at: starts_at, user_identity: user_identity, user_identity_id: user_identity_id}.compact)
36
32
 
37
- Seam::Resources::AccessGrant.load_from_response(res.body["access_grant"])
33
+ Seam::Resources::AccessGrant.from_http_response(res, "access_grant", "/access_grants/create")
38
34
  end
39
35
 
40
36
  # Delete an Access Grant.
@@ -51,13 +47,15 @@ module Seam
51
47
  # @param access_grant_key [String, nil] Unique key of Access Grant to get.
52
48
  # @return [Seam::Resources::AccessGrant] OK
53
49
  def get(access_grant_id: nil, access_grant_key: nil)
54
- if access_grant_id.nil? && access_grant_key.nil?
55
- raise TypeError, "At least one parameter is required for /access_grants/get"
56
- end
50
+ Seam::RequestParameters.require_at_least_one(
51
+ "/access_grants/get",
52
+ {access_grant_id: access_grant_id, access_grant_key: access_grant_key},
53
+ [:access_grant_id, :access_grant_key]
54
+ )
57
55
 
58
56
  res = @client.get("/access_grants/get", {access_grant_id: access_grant_id, access_grant_key: access_grant_key}.compact)
59
57
 
60
- Seam::Resources::AccessGrant.load_from_response(res.body["access_grant"])
58
+ Seam::Resources::AccessGrant.from_http_response(res, "access_grant", "/access_grants/get")
61
59
  end
62
60
 
63
61
  # Gets all related resources for one or more Access Grants.
@@ -67,13 +65,15 @@ module Seam
67
65
  # @param include [Array<String>, nil]
68
66
  # @return [Seam::Resources::Batch] OK
69
67
  def get_related(access_grant_ids: nil, access_grant_keys: nil, exclude: nil, include: nil)
70
- if access_grant_ids.nil? && access_grant_keys.nil? && exclude.nil? && include.nil?
71
- raise TypeError, "At least one parameter is required for /access_grants/get_related"
72
- end
68
+ Seam::RequestParameters.require_at_least_one(
69
+ "/access_grants/get_related",
70
+ {access_grant_ids: access_grant_ids, access_grant_keys: access_grant_keys, exclude: exclude, include: include},
71
+ [:access_grant_ids, :access_grant_keys, :exclude, :include]
72
+ )
73
73
 
74
74
  res = @client.get("/access_grants/get_related", {access_grant_ids: access_grant_ids, access_grant_keys: access_grant_keys, exclude: exclude, include: include}.compact)
75
75
 
76
- Seam::Resources::Batch.load_from_response(res.body["batch"])
76
+ Seam::Resources::Batch.from_http_response(res, "batch", "/access_grants/get_related")
77
77
  end
78
78
 
79
79
  # Gets an Access Grant.
@@ -85,18 +85,16 @@ module Seam
85
85
  # @param customer_key [String, nil] Customer key for which you want to list access grants.
86
86
  # @param device_id [String, nil] ID of the device by which you want to filter the list of Access Grants.
87
87
  # @param limit [Float, nil] Numerical limit on the number of access grants to return.
88
- # @param location_id [String, nil]
89
- # @deprecated location_id: Use `space_id`.
90
88
  # @param page_cursor [String, Seam::Null, nil] Identifies the specific page of results to return, obtained from the previous page's `next_page_cursor`.
91
89
  # @param reservation_key [String, nil] Filter Access Grants by reservation_key.
92
90
  # @param search [String, nil] String for which to search. Filters returned Access Grants to include all records that satisfy a partial match using `name`, `access_grant_key`, `reservation_key`, `access_grant_id`, `user_identity_id`, `user_identity_full_name`, `user_identity_email_address` or `user_identity_phone_number`.
93
91
  # @param space_id [String, nil] ID of the space by which you want to filter the list of Access Grants.
94
92
  # @param user_identity_id [String, nil] ID of user identity by which you want to filter the list of Access Grants.
95
93
  # @return [Seam::Resources::AccessGrant] OK
96
- def list(access_code_id: nil, access_grant_ids: nil, access_grant_key: nil, acs_entrance_id: nil, acs_system_id: nil, customer_key: nil, device_id: nil, limit: nil, location_id: nil, page_cursor: nil, reservation_key: nil, search: nil, space_id: nil, user_identity_id: nil)
97
- res = @client.get("/access_grants/list", {access_code_id: access_code_id, access_grant_ids: access_grant_ids, access_grant_key: access_grant_key, acs_entrance_id: acs_entrance_id, acs_system_id: acs_system_id, customer_key: customer_key, device_id: device_id, limit: limit, location_id: location_id, page_cursor: page_cursor, reservation_key: reservation_key, search: search, space_id: space_id, user_identity_id: user_identity_id}.compact)
94
+ def list(access_code_id: nil, access_grant_ids: nil, access_grant_key: nil, acs_entrance_id: nil, acs_system_id: nil, customer_key: nil, device_id: nil, limit: nil, page_cursor: nil, reservation_key: nil, search: nil, space_id: nil, user_identity_id: nil)
95
+ res = @client.get("/access_grants/list", {access_code_id: access_code_id, access_grant_ids: access_grant_ids, access_grant_key: access_grant_key, acs_entrance_id: acs_entrance_id, acs_system_id: acs_system_id, customer_key: customer_key, device_id: device_id, limit: limit, page_cursor: page_cursor, reservation_key: reservation_key, search: search, space_id: space_id, user_identity_id: user_identity_id}.compact)
98
96
 
99
- Seam::Resources::AccessGrant.load_from_response(res.body["access_grants"])
97
+ Seam::Resources::AccessGrant.list_from_http_response(res, "access_grants", "/access_grants/list")
100
98
  end
101
99
 
102
100
  # Adds additional requested access methods to an existing Access Grant.
@@ -106,7 +104,7 @@ module Seam
106
104
  def request_access_methods(access_grant_id:, requested_access_methods:)
107
105
  res = @client.post("/access_grants/request_access_methods", {access_grant_id: access_grant_id, requested_access_methods: requested_access_methods}.compact)
108
106
 
109
- Seam::Resources::AccessGrant.load_from_response(res.body["access_grant"])
107
+ Seam::Resources::AccessGrant.from_http_response(res, "access_grant", "/access_grants/request_access_methods")
110
108
  end
111
109
 
112
110
  # Updates an existing Access Grant's time window.
@@ -117,9 +115,11 @@ module Seam
117
115
  # @param starts_at [Time, nil] Date and time at which the validity of the grant starts, in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.
118
116
  # @return [nil] OK
119
117
  def update(access_grant_id: nil, access_grant_key: nil, ends_at: nil, name: nil, starts_at: nil)
120
- if access_grant_id.nil? && access_grant_key.nil? && ends_at.nil? && name.nil? && starts_at.nil?
121
- raise TypeError, "At least one parameter is required for /access_grants/update"
122
- end
118
+ Seam::RequestParameters.require_at_least_one(
119
+ "/access_grants/update",
120
+ {access_grant_id: access_grant_id, access_grant_key: access_grant_key, ends_at: ends_at, name: name, starts_at: starts_at},
121
+ [:access_grant_id, :access_grant_key, :ends_at, :name, :starts_at]
122
+ )
123
123
 
124
124
  @client.patch("/access_grants/update", {access_grant_id: access_grant_id, access_grant_key: access_grant_key, ends_at: ends_at, name: name, starts_at: starts_at}.compact)
125
125
 
@@ -14,21 +14,22 @@ module Seam
14
14
  def get(access_grant_id:)
15
15
  res = @client.get("/access_grants/unmanaged/get", {access_grant_id: access_grant_id}.compact)
16
16
 
17
- Seam::Resources::UnmanagedAccessGrant.load_from_response(res.body["access_grant"])
17
+ Seam::Resources::UnmanagedAccessGrant.from_http_response(res, "access_grant", "/access_grants/unmanaged/get")
18
18
  end
19
19
 
20
20
  # Gets unmanaged Access Grants (where is_managed = false).
21
21
  # @param acs_entrance_id [String, nil] ID of the entrance by which you want to filter the list of unmanaged Access Grants.
22
22
  # @param acs_system_id [String, nil] ID of the access system by which you want to filter the list of unmanaged Access Grants.
23
+ # @param customer_key [String, nil] Customer key for which you want to list unmanaged Access Grants.
23
24
  # @param limit [Float, nil] Numerical limit on the number of unmanaged access grants to return.
24
25
  # @param page_cursor [String, Seam::Null, nil] Identifies the specific page of results to return, obtained from the previous page's `next_page_cursor`.
25
26
  # @param reservation_key [String, nil] Filter unmanaged Access Grants by reservation_key.
26
27
  # @param user_identity_id [String, nil] ID of user identity by which you want to filter the list of unmanaged Access Grants.
27
28
  # @return [Seam::Resources::UnmanagedAccessGrant] OK
28
- def list(acs_entrance_id: nil, acs_system_id: nil, limit: nil, page_cursor: nil, reservation_key: nil, user_identity_id: nil)
29
- res = @client.get("/access_grants/unmanaged/list", {acs_entrance_id: acs_entrance_id, acs_system_id: acs_system_id, limit: limit, page_cursor: page_cursor, reservation_key: reservation_key, user_identity_id: user_identity_id}.compact)
29
+ def list(acs_entrance_id: nil, acs_system_id: nil, customer_key: nil, limit: nil, page_cursor: nil, reservation_key: nil, user_identity_id: nil)
30
+ res = @client.get("/access_grants/unmanaged/list", {acs_entrance_id: acs_entrance_id, acs_system_id: acs_system_id, customer_key: customer_key, limit: limit, page_cursor: page_cursor, reservation_key: reservation_key, user_identity_id: user_identity_id}.compact)
30
31
 
31
- Seam::Resources::UnmanagedAccessGrant.load_from_response(res.body["access_grants"])
32
+ Seam::Resources::UnmanagedAccessGrant.list_from_http_response(res, "access_grants", "/access_grants/unmanaged/list")
32
33
  end
33
34
 
34
35
  # Updates an unmanaged Access Grant to make it managed.