seam 2.138.0 → 2.140.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 +69 -66
  3. data/README.md +12 -0
  4. data/lib/seam/http_single_workspace.rb +34 -2
  5. data/lib/seam/http_without_workspace.rb +41 -12
  6. data/lib/seam/paginator.rb +4 -1
  7. data/lib/seam/request.rb +5 -1
  8. data/lib/seam/resources/access_code.rb +74 -0
  9. data/lib/seam/resources/access_grant.rb +60 -0
  10. data/lib/seam/resources/access_method.rb +39 -0
  11. data/lib/seam/resources/acs_access_group.rb +45 -0
  12. data/lib/seam/resources/acs_credential.rb +67 -0
  13. data/lib/seam/resources/acs_encoder.rb +11 -0
  14. data/lib/seam/resources/acs_entrance.rb +95 -0
  15. data/lib/seam/resources/acs_system.rb +36 -0
  16. data/lib/seam/resources/acs_user.rb +66 -0
  17. data/lib/seam/resources/action_attempt.rb +192 -0
  18. data/lib/seam/resources/batch.rb +24 -0
  19. data/lib/seam/resources/client_session.rb +12 -0
  20. data/lib/seam/resources/connect_webview.rb +19 -0
  21. data/lib/seam/resources/connected_account.rb +50 -0
  22. data/lib/seam/resources/customer_portal.rb +5 -0
  23. data/lib/seam/resources/device.rb +622 -4
  24. data/lib/seam/resources/device_provider.rb +24 -0
  25. data/lib/seam/resources/event.rb +142 -3
  26. data/lib/seam/resources/instant_key.rb +13 -0
  27. data/lib/seam/resources/noise_threshold.rb +7 -0
  28. data/lib/seam/resources/pagination.rb +3 -0
  29. data/lib/seam/resources/phone.rb +29 -0
  30. data/lib/seam/resources/space.rb +19 -0
  31. data/lib/seam/resources/thermostat_daily_program.rb +9 -0
  32. data/lib/seam/resources/thermostat_schedule.rb +15 -0
  33. data/lib/seam/resources/unmanaged_access_code.rb +51 -0
  34. data/lib/seam/resources/unmanaged_access_grant.rb +56 -0
  35. data/lib/seam/resources/unmanaged_access_method.rb +36 -0
  36. data/lib/seam/resources/unmanaged_device.rb +80 -0
  37. data/lib/seam/resources/unmanaged_user_identity.rb +20 -0
  38. data/lib/seam/resources/user_identity.rb +21 -0
  39. data/lib/seam/resources/webhook.rb +4 -0
  40. data/lib/seam/resources/workspace.rb +15 -0
  41. data/lib/seam/routes/access_codes.rb +79 -79
  42. data/lib/seam/routes/access_codes_simulate.rb +3 -3
  43. data/lib/seam/routes/access_codes_unmanaged.rb +27 -23
  44. data/lib/seam/routes/access_grants.rb +57 -45
  45. data/lib/seam/routes/access_grants_unmanaged.rb +13 -13
  46. data/lib/seam/routes/access_methods.rb +32 -24
  47. data/lib/seam/routes/access_methods_unmanaged.rb +7 -7
  48. data/lib/seam/routes/acs_access_groups.rb +21 -21
  49. data/lib/seam/routes/acs_credentials.rb +40 -40
  50. data/lib/seam/routes/acs_encoders.rb +16 -16
  51. data/lib/seam/routes/acs_encoders_simulate.rb +11 -11
  52. data/lib/seam/routes/acs_entrances.rb +20 -20
  53. data/lib/seam/routes/acs_systems.rb +11 -11
  54. data/lib/seam/routes/acs_users.rb +83 -55
  55. data/lib/seam/routes/action_attempts.rb +6 -6
  56. data/lib/seam/routes/client_sessions.rb +38 -34
  57. data/lib/seam/routes/connect_webviews.rb +20 -20
  58. data/lib/seam/routes/connected_accounts.rb +24 -20
  59. data/lib/seam/routes/connected_accounts_simulate.rb +1 -1
  60. data/lib/seam/routes/customers.rb +50 -50
  61. data/lib/seam/routes/devices.rb +33 -29
  62. data/lib/seam/routes/devices_simulate.rb +7 -7
  63. data/lib/seam/routes/devices_unmanaged.rb +25 -26
  64. data/lib/seam/routes/events.rb +40 -32
  65. data/lib/seam/routes/instant_keys.rb +11 -7
  66. data/lib/seam/routes/locks.rb +20 -27
  67. data/lib/seam/routes/locks_simulate.rb +3 -3
  68. data/lib/seam/routes/noise_sensors.rb +8 -19
  69. data/lib/seam/routes/noise_sensors_noise_thresholds.rb +21 -21
  70. data/lib/seam/routes/noise_sensors_simulate.rb +1 -1
  71. data/lib/seam/routes/phones.rb +7 -7
  72. data/lib/seam/routes/phones_simulate.rb +4 -4
  73. data/lib/seam/routes/spaces.rb +53 -45
  74. data/lib/seam/routes/thermostats.rb +75 -86
  75. data/lib/seam/routes/thermostats_daily_programs.rb +9 -9
  76. data/lib/seam/routes/thermostats_schedules.rb +22 -22
  77. data/lib/seam/routes/thermostats_simulate.rb +9 -9
  78. data/lib/seam/routes/user_identities.rb +50 -46
  79. data/lib/seam/routes/user_identities_unmanaged.rb +11 -11
  80. data/lib/seam/routes/webhooks.rb +10 -10
  81. data/lib/seam/routes/workspaces.rb +19 -19
  82. data/lib/seam/version.rb +1 -1
  83. metadata +8 -11
@@ -17,28 +17,28 @@ module Seam
17
17
  end
18
18
 
19
19
  # Creates a new [access code](https://docs.seam.co/low-level-apis/access-codes). For granting access, we recommend [Access Grants](https://docs.seam.co/use-cases/granting-access) instead: they work across both standalone smart locks and access control systems and manage the underlying codes for you. Use this low-level endpoint only when you need direct control over a code on a single device, such as setting a custom PIN value.
20
- # @param device_id ID of the device for which you want to create the new access code.
21
- # @param allow_external_modification Indicates whether [external modification](https://docs.seam.co/low-level-apis/smart-locks/access-codes#external-modification) of the code is allowed. Default: `false`.
22
- # @param attempt_for_offline_device
23
- # @param code Code to be used for access.
24
- # @param common_code_key Key to identify access codes that should have the same code. Any two access codes with the same `common_code_key` are guaranteed to have the same `code`. See also [Creating and Updating Multiple Linked Access Codes](https://docs.seam.co/low-level-apis/smart-locks/access-codes/creating-and-updating-multiple-linked-access-codes).
25
- # @param ends_at Date and time at which the validity of the new access code 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`.
26
- # @param is_external_modification_allowed Indicates whether [external modification](https://docs.seam.co/low-level-apis/smart-locks/access-codes#external-modification) of the code is allowed. Default: `false`.
27
- # @param is_offline_access_code Indicates whether the access code is an [offline access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes/offline-access-codes).
28
- # @param is_one_time_use Indicates whether the [offline access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes/offline-access-codes) is a single-use access code.
29
- # @param max_time_rounding Maximum rounding adjustment. To create a daily-bound [offline access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes/offline-access-codes) for devices that support this feature, set this parameter to `1d`.
30
- # @param name Name of the new access code. Enables administrators and users to identify the access code easily, especially when there are numerous access codes.
20
+ # @param device_id [String] ID of the device for which you want to create the new access code.
21
+ # @param allow_external_modification [Boolean, nil] Indicates whether [external modification](https://docs.seam.co/low-level-apis/smart-locks/access-codes#external-modification) of the code is allowed. Default: `false`.
22
+ # @param attempt_for_offline_device [Boolean, nil]
23
+ # @param code [String, nil] Code to be used for access.
24
+ # @param common_code_key [String, nil] Key to identify access codes that should have the same code. Any two access codes with the same `common_code_key` are guaranteed to have the same `code`. See also [Creating and Updating Multiple Linked Access Codes](https://docs.seam.co/low-level-apis/smart-locks/access-codes/creating-and-updating-multiple-linked-access-codes).
25
+ # @param ends_at [String, nil] Date and time at which the validity of the new access code 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`.
26
+ # @param is_external_modification_allowed [Boolean, nil] Indicates whether [external modification](https://docs.seam.co/low-level-apis/smart-locks/access-codes#external-modification) of the code is allowed. Default: `false`.
27
+ # @param is_offline_access_code [Boolean, nil] Indicates whether the access code is an [offline access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes/offline-access-codes).
28
+ # @param is_one_time_use [Boolean, nil] Indicates whether the [offline access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes/offline-access-codes) is a single-use access code.
29
+ # @param max_time_rounding [String, nil] Maximum rounding adjustment. To create a daily-bound [offline access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes/offline-access-codes) for devices that support this feature, set this parameter to `1d`.
30
+ # @param name [String, nil] Name of the new access code. Enables administrators and users to identify the access code easily, especially when there are numerous access codes.
31
31
  #
32
32
  # Note that the name provided on Seam is used to identify the code on Seam and is not necessarily the name that will appear in the lock provider's app or on the device. This is because lock providers may have constraints on names, such as length, uniqueness, or characters that can be used. In addition, some lock providers may break down names into components such as `first_name` and `last_name`.
33
33
  #
34
34
  # To provide a consistent experience, Seam identifies the code on Seam by its name but may modify the name that appears on the lock provider's app or on the device. For example, Seam may add additional characters or truncate the name to meet provider constraints.
35
35
  #
36
36
  # To help your users identify codes set by Seam, Seam provides the name exactly as it appears on the lock provider's app or on the device as a separate property called `appearance`. This is an object with a `name` property and, optionally, `first_name` and `last_name` properties (for providers that break down a name into components).
37
- # @param prefer_native_scheduling Indicates whether [native scheduling](https://docs.seam.co/low-level-apis/smart-locks/access-codes#native-scheduling) should be used for time-bound codes when supported by the provider. Default: `true`.
38
- # @param preferred_code_length 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
- # @param starts_at 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
- # @param use_backup_access_code_pool Indicates whether to use a [backup access code pool](https://docs.seam.co/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://docs.seam.co/api/access_codes/pull_backup_access_code).
41
- # @param use_offline_access_code
37
+ # @param prefer_native_scheduling [Boolean, nil] Indicates whether [native scheduling](https://docs.seam.co/low-level-apis/smart-locks/access-codes#native-scheduling) should be used for time-bound codes when supported by the provider. Default: `true`.
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
+ # @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
+ # @param use_backup_access_code_pool [Boolean, nil] Indicates whether to use a [backup access code pool](https://docs.seam.co/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://docs.seam.co/api/access_codes/pull_backup_access_code).
41
+ # @param use_offline_access_code [Boolean, nil]
42
42
  # @deprecated use_offline_access_code: Use `is_offline_access_code` instead.
43
43
  # @return [Seam::Resources::AccessCode] OK
44
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)
@@ -58,46 +58,46 @@ module Seam
58
58
  # See also [Creating and Updating Multiple Linked Access Codes](https://docs.seam.co/low-level-apis/smart-locks/access-codes/creating-and-updating-multiple-linked-access-codes).
59
59
  #
60
60
  # For granting a person access to a space, [Access Grants](https://docs.seam.co/use-cases/granting-access) are the default and recommended approach and work across both standalone smart locks and access systems. Use the lower-level Access Codes API directly only when you specifically need to manage individual PIN codes.
61
- # @param device_ids IDs of the devices for which you want to create the new access codes.
62
- # @param allow_external_modification Indicates whether [external modification](https://docs.seam.co/low-level-apis/smart-locks/access-codes#external-modification) of the code is allowed. Default: `false`.
63
- # @param attempt_for_offline_device
64
- # @param behavior_when_code_cannot_be_shared Desired behavior if any device cannot share a code. If `throw` (default), no access codes will be created if any device cannot share a code. If `create_random_code`, a random code will be created on devices that cannot share a code.
65
- # @param code Code to be used for access.
66
- # @param ends_at Date and time at which the validity of the new access code 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`.
67
- # @param is_external_modification_allowed Indicates whether [external modification](https://docs.seam.co/low-level-apis/smart-locks/access-codes#external-modification) of the code is allowed. Default: `false`.
68
- # @param name Name of the new access code. Enables administrators and users to identify the access code easily, especially when there are numerous access codes.
61
+ # @param device_ids [Array<String>] IDs of the devices for which you want to create the new access codes.
62
+ # @param allow_external_modification [Boolean, nil] Indicates whether [external modification](https://docs.seam.co/low-level-apis/smart-locks/access-codes#external-modification) of the code is allowed. Default: `false`.
63
+ # @param attempt_for_offline_device [Boolean, nil]
64
+ # @param behavior_when_code_cannot_be_shared [String, nil] Desired behavior if any device cannot share a code. If `throw` (default), no access codes will be created if any device cannot share a code. If `create_random_code`, a random code will be created on devices that cannot share a code.
65
+ # @param code [String, nil] Code to be used for access.
66
+ # @param ends_at [String, nil] Date and time at which the validity of the new access code 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`.
67
+ # @param is_external_modification_allowed [Boolean, nil] Indicates whether [external modification](https://docs.seam.co/low-level-apis/smart-locks/access-codes#external-modification) of the code is allowed. Default: `false`.
68
+ # @param name [String, nil] Name of the new access code. Enables administrators and users to identify the access code easily, especially when there are numerous access codes.
69
69
  #
70
70
  # Note that the name provided on Seam is used to identify the code on Seam and is not necessarily the name that will appear in the lock provider's app or on the device. This is because lock providers may have constraints on names, such as length, uniqueness, or characters that can be used. In addition, some lock providers may break down names into components such as `first_name` and `last_name`.
71
71
  #
72
72
  # To provide a consistent experience, Seam identifies the code on Seam by its name but may modify the name that appears on the lock provider's app or on the device. For example, Seam may add additional characters or truncate the name to meet provider constraints.
73
73
  #
74
74
  # To help your users identify codes set by Seam, Seam provides the name exactly as it appears on the lock provider's app or on the device as a separate property called `appearance`. This is an object with a `name` property and, optionally, `first_name` and `last_name` properties (for providers that break down a name into components).
75
- # @param prefer_native_scheduling Indicates whether [native scheduling](https://docs.seam.co/low-level-apis/smart-locks/access-codes#native-scheduling) should be used for time-bound codes when supported by the provider. Default: `true`.
76
- # @param preferred_code_length Preferred code length. If the affected devices do not support the preferred code length, Seam reverts to using the shortest supported code length.
77
- # @param starts_at 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.
78
- # @param use_backup_access_code_pool Indicates whether to use a [backup access code pool](https://docs.seam.co/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://docs.seam.co/api/access_codes/pull_backup_access_code).
75
+ # @param prefer_native_scheduling [Boolean, nil] Indicates whether [native scheduling](https://docs.seam.co/low-level-apis/smart-locks/access-codes#native-scheduling) should be used for time-bound codes when supported by the provider. Default: `true`.
76
+ # @param preferred_code_length [Float, nil] Preferred code length. If the affected devices do not support the preferred code length, Seam reverts to using the shortest supported code length.
77
+ # @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.
78
+ # @param use_backup_access_code_pool [Boolean, nil] Indicates whether to use a [backup access code pool](https://docs.seam.co/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://docs.seam.co/api/access_codes/pull_backup_access_code).
79
79
  # @return [Seam::Resources::AccessCode] OK
80
80
  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
- res = @client.post("/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)
81
+ 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
82
 
83
83
  Seam::Resources::AccessCode.load_from_response(res.body["access_codes"])
84
84
  end
85
85
 
86
86
  # Deletes an [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes).
87
- # @param access_code_id ID of the access code that you want to delete.
88
- # @param device_id ID of the device for which you want to delete the access code.
87
+ # @param access_code_id [String] ID of the access code that you want to delete.
88
+ # @param device_id [String, nil] ID of the device for which you want to delete the access code.
89
89
  # @return [nil] OK
90
90
  def delete(access_code_id:, device_id: nil)
91
- @client.post("/access_codes/delete", {access_code_id: access_code_id, device_id: device_id}.compact)
91
+ @client.delete("/access_codes/delete", {access_code_id: access_code_id, device_id: device_id}.compact)
92
92
 
93
93
  nil
94
94
  end
95
95
 
96
96
  # Generates a code for an [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes), given a device ID.
97
- # @param device_id ID of the device for which you want to generate a code.
97
+ # @param device_id [String] ID of the device for which you want to generate a code.
98
98
  # @return [Seam::Resources::AccessCode] OK
99
99
  def generate_code(device_id:)
100
- res = @client.post("/access_codes/generate_code", {device_id: device_id}.compact)
100
+ res = @client.get("/access_codes/generate_code", {device_id: device_id}.compact)
101
101
 
102
102
  Seam::Resources::AccessCode.load_from_response(res.body["generated_code"])
103
103
  end
@@ -105,12 +105,16 @@ module Seam
105
105
  # Returns a specified [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes).
106
106
  #
107
107
  # You must specify either `access_code_id` or both `device_id` and `code`.
108
- # @param access_code_id ID of the access code that you want to get. You must specify either `access_code_id` or both `device_id` and `code`.
109
- # @param code Code of the access code that you want to get. You must specify either `access_code_id` or both `device_id` and `code`.
110
- # @param device_id 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`.
108
+ # @param access_code_id [String, nil] ID of the access code that you want to get. You must specify either `access_code_id` or both `device_id` and `code`.
109
+ # @param code [String, nil] Code of the access code that you want to get. You must specify either `access_code_id` or both `device_id` and `code`.
110
+ # @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
111
  # @return [Seam::Resources::AccessCode] OK
112
112
  def get(access_code_id: nil, code: nil, device_id: nil)
113
- res = @client.post("/access_codes/get", {access_code_id: access_code_id, code: code, device_id: device_id}.compact)
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
116
+
117
+ res = @client.get("/access_codes/get", {access_code_id: access_code_id, code: code, device_id: device_id}.compact)
114
118
 
115
119
  Seam::Resources::AccessCode.load_from_response(res.body["access_code"])
116
120
  end
@@ -118,18 +122,22 @@ module Seam
118
122
  # Returns a list of all [access codes](https://docs.seam.co/low-level-apis/smart-locks/access-codes).
119
123
  #
120
124
  # Specify `device_id`, `access_code_ids`, `access_method_id`, `access_grant_id`, or `access_grant_key`.
121
- # @param access_code_ids 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`.
122
- # @param access_grant_id 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`.
123
- # @param access_grant_key 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`.
124
- # @param access_method_id 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`.
125
- # @param customer_key Customer key for which you want to list access codes.
126
- # @param device_id 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`.
127
- # @param limit Numerical limit on the number of access codes to return.
128
- # @param page_cursor Identifies the specific page of results to return, obtained from the previous page's `next_page_cursor`.
129
- # @param search 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`.
130
- # @param user_identifier_key Your user ID for the user by which to filter access codes.
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`.
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`.
131
+ # @param limit [Float, nil] Numerical limit on the number of access codes to return.
132
+ # @param page_cursor [String, nil] Identifies the specific page of results to return, obtained from the previous page's `next_page_cursor`.
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
+ # @param user_identifier_key [String, nil] Your user ID for the user by which to filter access codes.
131
135
  # @return [Seam::Resources::AccessCode] OK
132
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
+
133
141
  res = @client.post("/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)
134
142
 
135
143
  Seam::Resources::AccessCode.load_from_response(res.body["access_codes"])
@@ -144,7 +152,7 @@ module Seam
144
152
  # You can only pull backup access codes for time-bound access codes.
145
153
  #
146
154
  # Before pulling a backup access code, make sure that the device's `properties.supports_backup_access_code_pool` is `true`. Then, to activate the backup pool, set `use_backup_access_code_pool` to `true` when creating an access code.
147
- # @param access_code_id ID of the access code for which you want to pull a backup access code.
155
+ # @param access_code_id [String] ID of the access code for which you want to pull a backup access code.
148
156
  # @return [Seam::Resources::AccessCode] OK
149
157
  def pull_backup_access_code(access_code_id:)
150
158
  res = @client.post("/access_codes/pull_backup_access_code", {access_code_id: access_code_id}.compact)
@@ -155,10 +163,10 @@ module Seam
155
163
  # Enables you to report access code-related constraints for a device. Currently, supports reporting supported code length constraints for SmartThings devices.
156
164
  #
157
165
  # Specify either `supported_code_lengths` or `min_code_length`/`max_code_length`.
158
- # @param device_id ID of the device for which you want to report constraints.
159
- # @param max_code_length Maximum supported code length as an integer between 4 and 20, inclusive. You can specify either `min_code_length`/`max_code_length` or `supported_code_lengths`.
160
- # @param min_code_length Minimum supported code length as an integer between 4 and 20, inclusive. You can specify either `min_code_length`/`max_code_length` or `supported_code_lengths`.
161
- # @param supported_code_lengths Array of supported code lengths as integers between 4 and 20, inclusive. You can specify either `supported_code_lengths` or `min_code_length`/`max_code_length`.
166
+ # @param device_id [String] ID of the device for which you want to report constraints.
167
+ # @param max_code_length [Integer, nil] Maximum supported code length as an integer between 4 and 20, inclusive. You can specify either `min_code_length`/`max_code_length` or `supported_code_lengths`.
168
+ # @param min_code_length [Integer, nil] Minimum supported code length as an integer between 4 and 20, inclusive. You can specify either `min_code_length`/`max_code_length` or `supported_code_lengths`.
169
+ # @param supported_code_lengths [Array<Integer>, nil] Array of supported code lengths as integers between 4 and 20, inclusive. You can specify either `supported_code_lengths` or `min_code_length`/`max_code_length`.
162
170
  # @return [nil] OK
163
171
  def report_device_constraints(device_id:, max_code_length: nil, min_code_length: nil, supported_code_lengths: nil)
164
172
  @client.post("/access_codes/report_device_constraints", {device_id: device_id, max_code_length: max_code_length, min_code_length: min_code_length, supported_code_lengths: supported_code_lengths}.compact)
@@ -169,34 +177,26 @@ module Seam
169
177
  # Updates a specified active or upcoming [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes).
170
178
  #
171
179
  # See also [Modifying Access Codes](https://docs.seam.co/low-level-apis/smart-locks/access-codes/modifying-access-codes).
172
- # @param access_code_id ID of the access code that you want to update.
173
- # @param allow_external_modification Indicates whether [external modification](https://docs.seam.co/low-level-apis/smart-locks/access-codes#external-modification) of the code is allowed. Default: `false`.
174
- # @param attempt_for_offline_device
175
- # @param code Code to be used for access.
176
- # @param device_id ID of the device containing the access code that you want to update.
177
- # @param ends_at Date and time at which the validity of the new access code 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`.
178
- # @param is_external_modification_allowed Indicates whether [external modification](https://docs.seam.co/low-level-apis/smart-locks/access-codes#external-modification) of the code is allowed. Default: `false`.
179
- # @param is_managed Indicates whether the access code is managed through Seam. Note that to convert an unmanaged access code into a managed access code, use `/access_codes/unmanaged/convert_to_managed`.
180
- # @param is_offline_access_code Indicates whether the access code is an [offline access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes/offline-access-codes).
181
- # @param is_one_time_use Indicates whether the [offline access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes/offline-access-codes) is a single-use access code.
182
- # @param max_time_rounding Maximum rounding adjustment. To create a daily-bound [offline access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes/offline-access-codes) for devices that support this feature, set this parameter to `1d`.
183
- # @param name Name of the new access code. Enables administrators and users to identify the access code easily, especially when there are numerous access codes.
180
+ # @param access_code_id [String] ID of the access code that you want to update.
181
+ # @param allow_external_modification [Boolean, nil] Indicates whether [external modification](https://docs.seam.co/low-level-apis/smart-locks/access-codes#external-modification) of the code is allowed. Default: `false`.
182
+ # @param attempt_for_offline_device [Boolean, nil]
183
+ # @param code [String, nil] Code to be used for access.
184
+ # @param device_id [String, nil] ID of the device containing the access code that you want to update.
185
+ # @param ends_at [String, nil] Date and time at which the validity of the new access code 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`.
186
+ # @param is_external_modification_allowed [Boolean, nil] Indicates whether [external modification](https://docs.seam.co/low-level-apis/smart-locks/access-codes#external-modification) of the code is allowed. Default: `false`.
187
+ # @param is_managed [Boolean, nil] Indicates whether the access code is managed through Seam. Note that to convert an unmanaged access code into a managed access code, use `/access_codes/unmanaged/convert_to_managed`.
188
+ # @param name [String, nil] Name of the new access code. Enables administrators and users to identify the access code easily, especially when there are numerous access codes.
184
189
  #
185
190
  # Note that the name provided on Seam is used to identify the code on Seam and is not necessarily the name that will appear in the lock provider's app or on the device. This is because lock providers may have constraints on names, such as length, uniqueness, or characters that can be used. In addition, some lock providers may break down names into components such as `first_name` and `last_name`.
186
191
  #
187
192
  # To provide a consistent experience, Seam identifies the code on Seam by its name but may modify the name that appears on the lock provider's app or on the device. For example, Seam may add additional characters or truncate the name to meet provider constraints.
188
193
  #
189
194
  # To help your users identify codes set by Seam, Seam provides the name exactly as it appears on the lock provider's app or on the device as a separate property called `appearance`. This is an object with a `name` property and, optionally, `first_name` and `last_name` properties (for providers that break down a name into components).
190
- # @param prefer_native_scheduling Indicates whether [native scheduling](https://docs.seam.co/low-level-apis/smart-locks/access-codes#native-scheduling) should be used for time-bound codes when supported by the provider. Default: `true`.
191
- # @param preferred_code_length 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.
192
- # @param starts_at 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.
193
- # @param type Type to which you want to convert the access code. To convert a time-bound access code to an ongoing access code, set `type` to `ongoing`. See also [Changing a time-bound access code to permanent access](https://docs.seam.co/low-level-apis/smart-locks/access-codes/modifying-access-codes#special-case-2-changing-a-time-bound-access-code-to-permanent-access).
194
- # @param use_backup_access_code_pool Indicates whether to use a [backup access code pool](https://docs.seam.co/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://docs.seam.co/api/access_codes/pull_backup_access_code).
195
- # @param use_offline_access_code
196
- # @deprecated use_offline_access_code: Use `is_offline_access_code` instead.
195
+ # @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.
196
+ # @param type [String, nil] Type to which you want to convert the access code. To convert a time-bound access code to an ongoing access code, set `type` to `ongoing`. See also [Changing a time-bound access code to permanent access](https://docs.seam.co/low-level-apis/smart-locks/access-codes/modifying-access-codes#special-case-2-changing-a-time-bound-access-code-to-permanent-access).
197
197
  # @return [nil] OK
198
- def update(access_code_id:, allow_external_modification: nil, attempt_for_offline_device: nil, code: nil, device_id: nil, ends_at: nil, is_external_modification_allowed: nil, is_managed: 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, type: nil, use_backup_access_code_pool: nil, use_offline_access_code: nil)
199
- @client.post("/access_codes/update", {access_code_id: access_code_id, allow_external_modification: allow_external_modification, attempt_for_offline_device: attempt_for_offline_device, code: code, device_id: device_id, ends_at: ends_at, is_external_modification_allowed: is_external_modification_allowed, is_managed: is_managed, 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, type: type, use_backup_access_code_pool: use_backup_access_code_pool, use_offline_access_code: use_offline_access_code}.compact)
198
+ def update(access_code_id:, allow_external_modification: nil, attempt_for_offline_device: nil, code: nil, device_id: nil, ends_at: nil, is_external_modification_allowed: nil, is_managed: nil, name: nil, starts_at: nil, type: nil)
199
+ @client.put("/access_codes/update", {access_code_id: access_code_id, allow_external_modification: allow_external_modification, attempt_for_offline_device: attempt_for_offline_device, code: code, device_id: device_id, ends_at: ends_at, is_external_modification_allowed: is_external_modification_allowed, is_managed: is_managed, name: name, starts_at: starts_at, type: type}.compact)
200
200
 
201
201
  nil
202
202
  end
@@ -206,19 +206,19 @@ module Seam
206
206
  # Specify the `common_code_key` to identify the set of access codes that you want to update.
207
207
  #
208
208
  # See also [Update Linked Access Codes](https://docs.seam.co/low-level-apis/smart-locks/access-codes/creating-and-updating-multiple-linked-access-codes#update-linked-access-codes).
209
- # @param common_code_key Key that links the group of access codes, assigned on creation by `/access_codes/create_multiple`.
210
- # @param ends_at Date and time at which the validity of the new access code 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`.
211
- # @param name Name of the new access code. Enables administrators and users to identify the access code easily, especially when there are numerous access codes.
209
+ # @param common_code_key [String] Key that links the group of access codes, assigned on creation by `/access_codes/create_multiple`.
210
+ # @param ends_at [String, nil] Date and time at which the validity of the new access code 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`.
211
+ # @param name [String, nil] Name of the new access code. Enables administrators and users to identify the access code easily, especially when there are numerous access codes.
212
212
  #
213
213
  # Note that the name provided on Seam is used to identify the code on Seam and is not necessarily the name that will appear in the lock provider's app or on the device. This is because lock providers may have constraints on names, such as length, uniqueness, or characters that can be used. In addition, some lock providers may break down names into components such as `first_name` and `last_name`.
214
214
  #
215
215
  # To provide a consistent experience, Seam identifies the code on Seam by its name but may modify the name that appears on the lock provider's app or on the device. For example, Seam may add additional characters or truncate the name to meet provider constraints.
216
216
  #
217
217
  # To help your users identify codes set by Seam, Seam provides the name exactly as it appears on the lock provider's app or on the device as a separate property called `appearance`. This is an object with a `name` property and, optionally, `first_name` and `last_name` properties (for providers that break down a name into components).
218
- # @param starts_at 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.
218
+ # @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.
219
219
  # @return [nil] OK
220
220
  def update_multiple(common_code_key:, ends_at: nil, name: nil, starts_at: nil)
221
- @client.post("/access_codes/update_multiple", {common_code_key: common_code_key, ends_at: ends_at, name: name, starts_at: starts_at}.compact)
221
+ @client.patch("/access_codes/update_multiple", {common_code_key: common_code_key, ends_at: ends_at, name: name, starts_at: starts_at}.compact)
222
222
 
223
223
  nil
224
224
  end
@@ -9,9 +9,9 @@ module Seam
9
9
  end
10
10
 
11
11
  # Simulates the creation of an [unmanaged access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes/migrating-existing-access-codes) in a [sandbox workspace](https://docs.seam.co/core-concepts/workspaces#sandbox-workspaces).
12
- # @param code Code of the simulated unmanaged access code.
13
- # @param device_id ID of the device for which you want to simulate the creation of an unmanaged access code.
14
- # @param name Name of the simulated unmanaged access code.
12
+ # @param code [String] Code of the simulated unmanaged access code.
13
+ # @param device_id [String] ID of the device for which you want to simulate the creation of an unmanaged access code.
14
+ # @param name [String] Name of the simulated unmanaged access code.
15
15
  # @return [Seam::Resources::UnmanagedAccessCode] OK
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)
@@ -13,22 +13,22 @@ module Seam
13
13
  # An unmanaged access code has a limited set of operations that you can perform on it. Once you convert an unmanaged access code to a managed access code, the full set of access code operations and lifecycle events becomes available for it.
14
14
  #
15
15
  # Note that not all device providers support converting an unmanaged access code to a managed access code.
16
- # @param access_code_id ID of the unmanaged access code that you want to convert to a managed access code.
17
- # @param allow_external_modification Indicates whether [external modification](https://docs.seam.co/low-level-apis/smart-locks/access-codes#external-modification) of the access code is allowed.
18
- # @param force Indicates whether to force the access code conversion. To switch management of an access code from one Seam workspace to another, set `force` to `true`.
19
- # @param is_external_modification_allowed Indicates whether [external modification](https://docs.seam.co/low-level-apis/smart-locks/access-codes#external-modification) of the access code is allowed.
16
+ # @param access_code_id [String] ID of the unmanaged access code that you want to convert to a managed access code.
17
+ # @param allow_external_modification [Boolean, nil] Indicates whether [external modification](https://docs.seam.co/low-level-apis/smart-locks/access-codes#external-modification) of the access code is allowed.
18
+ # @param force [Boolean, nil] Indicates whether to force the access code conversion. To switch management of an access code from one Seam workspace to another, set `force` to `true`.
19
+ # @param is_external_modification_allowed [Boolean, nil] Indicates whether [external modification](https://docs.seam.co/low-level-apis/smart-locks/access-codes#external-modification) of the access code is allowed.
20
20
  # @return [nil] OK
21
21
  def convert_to_managed(access_code_id:, allow_external_modification: nil, force: nil, is_external_modification_allowed: nil)
22
- @client.post("/access_codes/unmanaged/convert_to_managed", {access_code_id: access_code_id, allow_external_modification: allow_external_modification, force: force, is_external_modification_allowed: is_external_modification_allowed}.compact)
22
+ @client.patch("/access_codes/unmanaged/convert_to_managed", {access_code_id: access_code_id, allow_external_modification: allow_external_modification, force: force, is_external_modification_allowed: is_external_modification_allowed}.compact)
23
23
 
24
24
  nil
25
25
  end
26
26
 
27
27
  # Deletes an [unmanaged access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes/migrating-existing-access-codes).
28
- # @param access_code_id ID of the unmanaged access code that you want to delete.
28
+ # @param access_code_id [String] ID of the unmanaged access code that you want to delete.
29
29
  # @return [nil] OK
30
30
  def delete(access_code_id:)
31
- @client.post("/access_codes/unmanaged/delete", {access_code_id: access_code_id}.compact)
31
+ @client.delete("/access_codes/unmanaged/delete", {access_code_id: access_code_id}.compact)
32
32
 
33
33
  nil
34
34
  end
@@ -36,38 +36,42 @@ module Seam
36
36
  # Returns a specified [unmanaged access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes/migrating-existing-access-codes).
37
37
  #
38
38
  # You must specify either `access_code_id` or both `device_id` and `code`.
39
- # @param access_code_id ID of the unmanaged access code that you want to get. You must specify either `access_code_id` or both `device_id` and `code`.
40
- # @param code Code of the unmanaged access code that you want to get. You must specify either `access_code_id` or both `device_id` and `code`.
41
- # @param device_id 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`.
39
+ # @param access_code_id [String, nil] ID of the unmanaged access code that you want to get. You must specify either `access_code_id` or both `device_id` and `code`.
40
+ # @param code [String, nil] Code of the unmanaged access code that you want to get. You must specify either `access_code_id` or both `device_id` and `code`.
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
- res = @client.post("/access_codes/unmanaged/get", {access_code_id: access_code_id, code: code, device_id: device_id}.compact)
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
47
+
48
+ res = @client.get("/access_codes/unmanaged/get", {access_code_id: access_code_id, code: code, device_id: device_id}.compact)
45
49
 
46
50
  Seam::Resources::UnmanagedAccessCode.load_from_response(res.body["access_code"])
47
51
  end
48
52
 
49
53
  # Returns a list of all [unmanaged access codes](https://docs.seam.co/low-level-apis/smart-locks/access-codes/migrating-existing-access-codes).
50
- # @param device_id ID of the device for which you want to list unmanaged access codes.
51
- # @param limit Numerical limit on the number of unmanaged access codes to return.
52
- # @param page_cursor Identifies the specific page of results to return, obtained from the previous page's `next_page_cursor`.
53
- # @param search 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`.
54
- # @param user_identifier_key Your user ID for the user by which to filter unmanaged access codes.
54
+ # @param device_id [String] ID of the device for which you want to list unmanaged access codes.
55
+ # @param limit [Float, nil] Numerical limit on the number of unmanaged access codes to return.
56
+ # @param page_cursor [String, nil] Identifies the specific page of results to return, obtained from the previous page's `next_page_cursor`.
57
+ # @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`.
58
+ # @param user_identifier_key [String, nil] Your user ID for the user by which to filter unmanaged access codes.
55
59
  # @return [Seam::Resources::UnmanagedAccessCode] OK
56
60
  def list(device_id:, limit: nil, page_cursor: nil, search: nil, user_identifier_key: nil)
57
- res = @client.post("/access_codes/unmanaged/list", {device_id: device_id, limit: limit, page_cursor: page_cursor, search: search, user_identifier_key: user_identifier_key}.compact)
61
+ 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)
58
62
 
59
63
  Seam::Resources::UnmanagedAccessCode.load_from_response(res.body["access_codes"])
60
64
  end
61
65
 
62
66
  # Updates a specified [unmanaged access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes/migrating-existing-access-codes).
63
- # @param access_code_id ID of the unmanaged access code that you want to update.
64
- # @param is_managed
65
- # @param allow_external_modification Indicates whether [external modification](https://docs.seam.co/low-level-apis/smart-locks/access-codes#external-modification) of the code is allowed.
66
- # @param force Indicates whether to force the unmanaged access code update.
67
- # @param is_external_modification_allowed Indicates whether [external modification](https://docs.seam.co/low-level-apis/smart-locks/access-codes#external-modification) of the code is allowed.
67
+ # @param access_code_id [String] ID of the unmanaged access code that you want to update.
68
+ # @param is_managed [Boolean]
69
+ # @param allow_external_modification [Boolean, nil] Indicates whether [external modification](https://docs.seam.co/low-level-apis/smart-locks/access-codes#external-modification) of the code is allowed.
70
+ # @param force [Boolean, nil] Indicates whether to force the unmanaged access code update.
71
+ # @param is_external_modification_allowed [Boolean, nil] Indicates whether [external modification](https://docs.seam.co/low-level-apis/smart-locks/access-codes#external-modification) of the code is allowed.
68
72
  # @return [nil] OK
69
73
  def update(access_code_id:, is_managed:, allow_external_modification: nil, force: nil, is_external_modification_allowed: nil)
70
- @client.post("/access_codes/unmanaged/update", {access_code_id: access_code_id, is_managed: is_managed, allow_external_modification: allow_external_modification, force: force, is_external_modification_allowed: is_external_modification_allowed}.compact)
74
+ @client.patch("/access_codes/unmanaged/update", {access_code_id: access_code_id, is_managed: is_managed, allow_external_modification: allow_external_modification, force: force, is_external_modification_allowed: is_external_modification_allowed}.compact)
71
75
 
72
76
  nil
73
77
  end
@@ -13,23 +13,23 @@ module Seam
13
13
  end
14
14
 
15
15
  # Creates a new [Access Grant](https://docs.seam.co/use-cases/granting-access/access-grants). Access Grants are the default and recommended way to grant a user access to any physical space, irrespective of the locking hardware. They work with both standalone smart locks (using `device_ids`) and access control systems (using `acs_entrance_ids` or `space_ids`), and can issue PIN codes, key cards, and mobile keys through a single request.
16
- # @param requested_access_methods
17
- # @param user_identity_id ID of user identity for whom access is being granted.
18
- # @param user_identity When used, creates a new user identity with the given details, and grants them access.
19
- # @param access_grant_key Unique key for the access grant within the workspace.
20
- # @param acs_entrance_ids Set of IDs of the [entrances](https://docs.seam.co/api/acs/systems/list) to which access is being granted.
21
- # @param customization_profile_id ID of the customization profile to apply to the Access Grant and its access methods.
22
- # @param device_ids Set of IDs of the [devices](https://docs.seam.co/api/devices/list) to which access is being granted.
23
- # @param ends_at 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`.
24
- # @param location
16
+ # @param requested_access_methods [Array<Hash>]
17
+ # @param user_identity_id [String, nil] ID of user identity for whom access is being granted.
18
+ # @param user_identity [Hash, nil] When used, creates a new user identity with the given details, and grants them access.
19
+ # @param access_grant_key [String, nil] Unique key for the access grant within the workspace.
20
+ # @param acs_entrance_ids [Array<String>, nil] Set of IDs of the [entrances](https://docs.seam.co/api/acs/systems/list) to which access is being granted.
21
+ # @param customization_profile_id [String, nil] ID of the customization profile to apply to the Access Grant and its access methods.
22
+ # @param device_ids [Array<String>, nil] Set of IDs of the [devices](https://docs.seam.co/api/devices/list) to which access is being granted.
23
+ # @param ends_at [String, 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`.
24
+ # @param location [Hash, nil]
25
25
  # @deprecated location: Create a space first, then reference it using `space_ids`.
26
- # @param location_ids
26
+ # @param location_ids [Array<String>, nil]
27
27
  # @deprecated location_ids: Use `space_ids`.
28
- # @param name Name for the access grant.
29
- # @param reservation_key Reservation key for the access grant.
30
- # @param space_ids Set of IDs of existing spaces to which access is being granted.
31
- # @param space_keys Set of keys of existing spaces to which access is being granted.
32
- # @param starts_at Date and time at which the validity of the new grant starts, in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.
28
+ # @param name [String, nil] Name for the access grant.
29
+ # @param reservation_key [String, nil] Reservation key for the access grant.
30
+ # @param space_ids [Array<String>, nil] Set of IDs of existing spaces to which access is being granted.
31
+ # @param space_keys [Array<String>, nil] Set of keys of existing spaces to which access is being granted.
32
+ # @param starts_at [String, nil] Date and time at which the validity of the new grant starts, in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.
33
33
  # @return [Seam::Resources::AccessGrant] OK
34
34
  def create(requested_access_methods:, user_identity_id: nil, user_identity: nil, 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)
35
35
  res = @client.post("/access_grants/create", {requested_access_methods: requested_access_methods, user_identity_id: user_identity_id, user_identity: user_identity, 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}.compact)
@@ -38,51 +38,59 @@ module Seam
38
38
  end
39
39
 
40
40
  # Delete an Access Grant.
41
- # @param access_grant_id ID of Access Grant to delete.
41
+ # @param access_grant_id [String] ID of Access Grant to delete.
42
42
  # @return [nil] OK
43
43
  def delete(access_grant_id:)
44
- @client.post("/access_grants/delete", {access_grant_id: access_grant_id}.compact)
44
+ @client.delete("/access_grants/delete", {access_grant_id: access_grant_id}.compact)
45
45
 
46
46
  nil
47
47
  end
48
48
 
49
49
  # Get an Access Grant.
50
- # @param access_grant_id ID of Access Grant to get.
51
- # @param access_grant_key Unique key of Access Grant to get.
50
+ # @param access_grant_id [String, nil] ID of Access Grant to get.
51
+ # @param access_grant_key [String, nil] Unique key of Access Grant to get.
52
52
  # @return [Seam::Resources::AccessGrant] OK
53
53
  def get(access_grant_id: nil, access_grant_key: nil)
54
- res = @client.post("/access_grants/get", {access_grant_id: access_grant_id, access_grant_key: access_grant_key}.compact)
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
57
+
58
+ res = @client.get("/access_grants/get", {access_grant_id: access_grant_id, access_grant_key: access_grant_key}.compact)
55
59
 
56
60
  Seam::Resources::AccessGrant.load_from_response(res.body["access_grant"])
57
61
  end
58
62
 
59
63
  # Gets all related resources for one or more Access Grants.
60
- # @param access_grant_ids IDs of the access grants that you want to get along with their related resources.
61
- # @param access_grant_keys Keys of the access grants that you want to get along with their related resources.
62
- # @param exclude
63
- # @param include
64
+ # @param access_grant_ids [Array<String>, nil] IDs of the access grants that you want to get along with their related resources.
65
+ # @param access_grant_keys [Array<String>, nil] Keys of the access grants that you want to get along with their related resources.
66
+ # @param exclude [Array<String>, nil]
67
+ # @param include [Array<String>, nil]
64
68
  # @return [Seam::Resources::Batch] OK
65
69
  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
73
+
66
74
  res = @client.post("/access_grants/get_related", {access_grant_ids: access_grant_ids, access_grant_keys: access_grant_keys, exclude: exclude, include: include}.compact)
67
75
 
68
76
  Seam::Resources::Batch.load_from_response(res.body["batch"])
69
77
  end
70
78
 
71
79
  # Gets an Access Grant.
72
- # @param access_code_id ID of the access code by which you want to filter the list of Access Grants.
73
- # @param access_grant_ids IDs of the access grants to retrieve.
74
- # @param access_grant_key Filter Access Grants by access_grant_key. Use null to filter for Access Grants without an access_grant_key.
75
- # @param acs_entrance_id ID of the entrance by which you want to filter the list of Access Grants.
76
- # @param acs_system_id ID of the access system by which you want to filter the list of Access Grants.
77
- # @param customer_key Customer key for which you want to list access grants.
78
- # @param device_id ID of the device by which you want to filter the list of Access Grants.
79
- # @param limit Numerical limit on the number of access grants to return.
80
- # @param location_id
80
+ # @param access_code_id [String, nil] ID of the access code by which you want to filter the list of Access Grants.
81
+ # @param access_grant_ids [Array<String>, nil] IDs of the access grants to retrieve.
82
+ # @param access_grant_key [String, nil] Filter Access Grants by access_grant_key. Use null to filter for Access Grants without an access_grant_key.
83
+ # @param acs_entrance_id [String, nil] ID of the entrance by which you want to filter the list of Access Grants.
84
+ # @param acs_system_id [String, nil] ID of the access system by which you want to filter the list of Access Grants.
85
+ # @param customer_key [String, nil] Customer key for which you want to list access grants.
86
+ # @param device_id [String, nil] ID of the device by which you want to filter the list of Access Grants.
87
+ # @param limit [Float, nil] Numerical limit on the number of access grants to return.
88
+ # @param location_id [String, nil]
81
89
  # @deprecated location_id: Use `space_id`.
82
- # @param page_cursor Identifies the specific page of results to return, obtained from the previous page's `next_page_cursor`.
83
- # @param reservation_key Filter Access Grants by reservation_key.
84
- # @param space_id ID of the space by which you want to filter the list of Access Grants.
85
- # @param user_identity_id ID of user identity by which you want to filter the list of Access Grants.
90
+ # @param page_cursor [String, nil] Identifies the specific page of results to return, obtained from the previous page's `next_page_cursor`.
91
+ # @param reservation_key [String, nil] Filter Access Grants by reservation_key.
92
+ # @param space_id [String, nil] ID of the space by which you want to filter the list of Access Grants.
93
+ # @param user_identity_id [String, nil] ID of user identity by which you want to filter the list of Access Grants.
86
94
  # @return [Seam::Resources::AccessGrant] OK
87
95
  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, space_id: nil, user_identity_id: nil)
88
96
  res = @client.post("/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, space_id: space_id, user_identity_id: user_identity_id}.compact)
@@ -91,8 +99,8 @@ module Seam
91
99
  end
92
100
 
93
101
  # Adds additional requested access methods to an existing Access Grant.
94
- # @param access_grant_id ID of the Access Grant to add access methods to.
95
- # @param requested_access_methods Array of requested access methods to add to the access grant.
102
+ # @param access_grant_id [String] ID of the Access Grant to add access methods to.
103
+ # @param requested_access_methods [Array<Hash>] Array of requested access methods to add to the access grant.
96
104
  # @return [Seam::Resources::AccessGrant] OK
97
105
  def request_access_methods(access_grant_id:, requested_access_methods:)
98
106
  res = @client.post("/access_grants/request_access_methods", {access_grant_id: access_grant_id, requested_access_methods: requested_access_methods}.compact)
@@ -101,14 +109,18 @@ module Seam
101
109
  end
102
110
 
103
111
  # Updates an existing Access Grant's time window.
104
- # @param access_grant_id ID of the Access Grant to update. Provide either `access_grant_id` or `access_grant_key`.
105
- # @param access_grant_key Key of the Access Grant to update. Provide either `access_grant_id` or `access_grant_key`.
106
- # @param ends_at Date and time at which the validity of the 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`.
107
- # @param name Display name for the access grant.
108
- # @param starts_at 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.
112
+ # @param access_grant_id [String, nil] ID of the Access Grant to update. Provide either `access_grant_id` or `access_grant_key`.
113
+ # @param access_grant_key [String, nil] Key of the Access Grant to update. Provide either `access_grant_id` or `access_grant_key`.
114
+ # @param ends_at [Time, nil] Date and time at which the validity of the 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`.
115
+ # @param name [String, nil] Display name for the access grant.
116
+ # @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.
109
117
  # @return [nil] OK
110
118
  def update(access_grant_id: nil, access_grant_key: nil, ends_at: nil, name: nil, starts_at: nil)
111
- @client.post("/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)
119
+ if access_grant_id.nil? && access_grant_key.nil? && ends_at.nil? && name.nil? && starts_at.nil?
120
+ raise TypeError, "At least one parameter is required for /access_grants/update"
121
+ end
122
+
123
+ @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)
112
124
 
113
125
  nil
114
126
  end