seam 2.133.1 → 2.135.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 (44) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/README.md +24 -0
  4. data/lib/seam/base_resource.rb +45 -1
  5. data/lib/seam/deep_hash_accessor.rb +8 -4
  6. data/lib/seam/{default_endpoint.rb → defaults.rb} +2 -0
  7. data/lib/seam/http.rb +5 -4
  8. data/lib/seam/http_multi_workspace.rb +5 -4
  9. data/lib/seam/http_single_workspace.rb +7 -6
  10. data/lib/seam/options.rb +1 -1
  11. data/lib/seam/request.rb +7 -2
  12. data/lib/seam/resources/access_code.rb +109 -7
  13. data/lib/seam/resources/access_grant.rb +90 -7
  14. data/lib/seam/resources/access_method.rb +49 -5
  15. data/lib/seam/resources/acs_access_group.rb +69 -7
  16. data/lib/seam/resources/acs_credential.rb +54 -7
  17. data/lib/seam/resources/acs_encoder.rb +10 -2
  18. data/lib/seam/resources/acs_entrance.rb +166 -25
  19. data/lib/seam/resources/acs_system.rb +40 -7
  20. data/lib/seam/resources/acs_user.rb +93 -11
  21. data/lib/seam/resources/action_attempt.rb +304 -5
  22. data/lib/seam/resources/connected_account.rb +70 -6
  23. data/lib/seam/resources/device.rb +1126 -11
  24. data/lib/seam/resources/event.rb +133 -49
  25. data/lib/seam/resources/index.rb +0 -4
  26. data/lib/seam/resources/instant_key.rb +10 -2
  27. data/lib/seam/resources/phone.rb +44 -5
  28. data/lib/seam/resources/space.rb +20 -4
  29. data/lib/seam/resources/thermostat_daily_program.rb +8 -2
  30. data/lib/seam/resources/thermostat_schedule.rb +10 -2
  31. data/lib/seam/resources/unmanaged_access_code.rb +74 -5
  32. data/lib/seam/resources/unmanaged_access_grant.rb +90 -7
  33. data/lib/seam/resources/unmanaged_access_method.rb +49 -5
  34. data/lib/seam/resources/unmanaged_device.rb +99 -7
  35. data/lib/seam/resources/unmanaged_user_identity.rb +24 -3
  36. data/lib/seam/resources/user_identity.rb +24 -3
  37. data/lib/seam/resources/workspace.rb +14 -1
  38. data/lib/seam/version.rb +1 -1
  39. data/lib/seam.rb +5 -4
  40. metadata +3 -7
  41. data/lib/seam/resources/resource_error.rb +0 -11
  42. data/lib/seam/resources/resource_errors_support.rb +0 -11
  43. data/lib/seam/resources/resource_warning.rb +0 -11
  44. data/lib/seam/resources/resource_warnings_support.rb +0 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9cd822a95811c14500048401893ba903d42e4a5431bcfe6a038955beca50e22e
4
- data.tar.gz: a4d7c7e7059b9cfb3a3a61395e9bb38d9f0768f3a8f389e3082d77ae3824e0ed
3
+ metadata.gz: 63f28be81d1f91aac1e7e4a985619c5373c3c8f2cd5c9cb2c912353d5d11d784
4
+ data.tar.gz: 4b7a897a7b5baee78d66aa0041b5acbedb8dcf58360ffba672ec4f3d2ef16d41
5
5
  SHA512:
6
- metadata.gz: 7b3078763143b252d99050c2397f6c71bd242d7971b95a514f104f3293a98a82b5369bde44e973051b4d36cd35491a542370bb8ba456813cbc418fe0a885981b
7
- data.tar.gz: e2137dc8e0fa70965c73b9c92249ad067e5dfb0395bb8a4c7ed8346e7d6f7848dfff3ccf90e4e41268c4e634e5a643dbef6735274f9daab310736f3ff13a72b7
6
+ metadata.gz: 64a11203850219014f1547cef7ddef4c6e5c0bd031e30f5bb5cd395307d9a62124adbf683adb85031e363289e12255c34b10afa68fb326bee673a614daf4f410
7
+ data.tar.gz: '09abde1c8cdcbd5dc21c0b823e704d940de7a3ef2fc80c9bb2ecf7cc0c59ae8c4d4adec11557b82735533a6ce335f504b1267f26a403ad8680c5cca49e6bd7b6'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- seam (2.133.1)
4
+ seam (2.135.0)
5
5
  faraday (~> 2.7)
6
6
  faraday-retry (~> 2.2)
7
7
  svix (~> 1.30)
data/README.md CHANGED
@@ -37,6 +37,7 @@ accurate and fully typed.
37
37
  - [Advanced Usage](#advanced-usage)
38
38
  - [Additional Options](#additional-options)
39
39
  - [Setting the endpoint](#setting-the-endpoint)
40
+ - [Setting the request timeout](#setting-the-request-timeout)
40
41
  - [Configuring the Faraday Client](#configuring-the-faraday-client)
41
42
  - [Using the Faraday Client](#using-the-faraday-client)
42
43
  - [Overriding the Client](#overriding-the-client)
@@ -381,6 +382,7 @@ the constructor takes some advanced options that affect behavior.
381
382
  seam = Seam.new(
382
383
  api_key: "your-api-key",
383
384
  endpoint: "https://example.com",
385
+ timeout: 30,
384
386
  faraday_options: {},
385
387
  faraday_retry_options: {}
386
388
  )
@@ -392,6 +394,7 @@ these options may be passed in as keyword arguments.
392
394
  ```ruby
393
395
  seam = Seam.from_api_key("some-api-key",
394
396
  endpoint: "https://example.com",
397
+ timeout: 30,
395
398
  faraday_options: {},
396
399
  faraday_retry_options: {})
397
400
  ```
@@ -403,6 +406,27 @@ e.g., testing or proxy setups. This option corresponds to the [Faraday](https://
403
406
 
404
407
  Either pass the `endpoint` option, or set the `SEAM_ENDPOINT` environment variable.
405
408
 
409
+ #### Setting the request timeout
410
+
411
+ Requests time out after 30 seconds by default.
412
+ Pass the `timeout` option, in seconds, to override this:
413
+
414
+ ```ruby
415
+ seam = Seam.new(api_key: "your-api-key", timeout: 60)
416
+ ```
417
+
418
+ The value sets both the Faraday `timeout` and `open_timeout`.
419
+ Either may be set independently via `faraday_options`, which takes precedence:
420
+
421
+ ```ruby
422
+ seam = Seam.new(
423
+ api_key: "your-api-key",
424
+ faraday_options: {request: {timeout: 60, open_timeout: 5}}
425
+ )
426
+ ```
427
+
428
+ A request that exceeds the timeout raises `Faraday::TimeoutError`.
429
+
406
430
  #### Configuring the Faraday Client
407
431
 
408
432
  The Faraday client and retry behavior may be configured with custom initiation options
@@ -20,6 +20,8 @@ module Seam
20
20
  end
21
21
 
22
22
  def self.load_from_response(data, client = nil)
23
+ return nil if data.nil?
24
+
23
25
  if data.is_a?(Array)
24
26
  data.map { |d| new(d, client) }
25
27
  else
@@ -36,6 +38,38 @@ module Seam
36
38
  .join("\n") + ">"
37
39
  end
38
40
 
41
+ def [](key)
42
+ name = key.to_s
43
+ return nil unless respond_to?(name)
44
+
45
+ public_send(name)
46
+ end
47
+
48
+ def self.resource_accessor(attr, resource_class)
49
+ resource_accessors[attr.to_s] = resource_class
50
+ attr_accessor attr
51
+ end
52
+
53
+ def self.resource_list_accessor(attr, resource_class)
54
+ resource_list_accessors[attr.to_s] = resource_class
55
+ attr_writer attr
56
+
57
+ # A list the response omits, sends as null, or sends as some other type
58
+ # reads as empty rather than nil, so callers can always iterate.
59
+ define_method(attr) do
60
+ value = instance_variable_get(:"@#{attr}")
61
+ value.is_a?(Array) ? value : []
62
+ end
63
+ end
64
+
65
+ def self.resource_accessors
66
+ @resource_accessors ||= {}
67
+ end
68
+
69
+ def self.resource_list_accessors
70
+ @resource_list_accessors ||= {}
71
+ end
72
+
39
73
  def self.date_accessor(*attrs)
40
74
  attrs.each do |attr|
41
75
  define_method(attr) do
@@ -54,7 +88,17 @@ module Seam
54
88
 
55
89
  def process_data_attributes(data)
56
90
  data.each do |key, value|
57
- value = process_hash_value(value)
91
+ next unless key.to_s.match?(/\A[a-zA-Z_][a-zA-Z0-9_]*\z/)
92
+
93
+ resource_class = self.class.resource_accessors[key.to_s]
94
+ resource_list_class = self.class.resource_list_accessors[key.to_s]
95
+ value = if resource_class && value.is_a?(Hash)
96
+ resource_class.load_from_response(value, client)
97
+ elsif resource_list_class && value.is_a?(Array)
98
+ resource_list_class.load_from_response(value, client)
99
+ else
100
+ process_hash_value(value)
101
+ end
58
102
  instance_variable_set(:"@#{key}", value)
59
103
  end
60
104
  end
@@ -10,7 +10,12 @@ module Seam
10
10
  end
11
11
 
12
12
  def [](key)
13
- instance_variable_get(:"@#{key}")
13
+ # Subscript access is Hash-like and returns nil for unknown keys, while
14
+ # method access continues to raise NoMethodError.
15
+ name = key.to_s
16
+ return nil unless respond_to?(name)
17
+
18
+ public_send(name)
14
19
  end
15
20
 
16
21
  def to_h
@@ -21,9 +26,8 @@ module Seam
21
26
 
22
27
  def create_accessor_methods
23
28
  @data.each do |key, value|
24
- define_singleton_method(key) do
25
- process_value(value)
26
- end
29
+ processed = process_value(value)
30
+ define_singleton_method(key) { processed }
27
31
  end
28
32
  end
29
33
 
@@ -2,4 +2,6 @@
2
2
 
3
3
  module Seam
4
4
  DEFAULT_ENDPOINT = "https://connect.getseam.com"
5
+
6
+ DEFAULT_TIMEOUT = 30
5
7
  end
data/lib/seam/http.rb CHANGED
@@ -8,13 +8,14 @@ module Seam
8
8
  Http::SingleWorkspace.new(**args)
9
9
  end
10
10
 
11
- def self.from_api_key(api_key, endpoint: nil, wait_for_action_attempt: true)
12
- Http::SingleWorkspace.from_api_key(api_key, endpoint: endpoint, wait_for_action_attempt: wait_for_action_attempt)
11
+ def self.from_api_key(api_key, endpoint: nil, wait_for_action_attempt: true, timeout: nil)
12
+ Http::SingleWorkspace.from_api_key(api_key, endpoint: endpoint, wait_for_action_attempt: wait_for_action_attempt,
13
+ timeout: timeout)
13
14
  end
14
15
 
15
- def self.from_personal_access_token(personal_access_token, workspace_id, endpoint: nil, wait_for_action_attempt: true)
16
+ def self.from_personal_access_token(personal_access_token, workspace_id, endpoint: nil, wait_for_action_attempt: true, timeout: nil)
16
17
  Http::SingleWorkspace.from_personal_access_token(personal_access_token, workspace_id, endpoint: endpoint,
17
- wait_for_action_attempt: wait_for_action_attempt)
18
+ wait_for_action_attempt: wait_for_action_attempt, timeout: timeout)
18
19
  end
19
20
 
20
21
  class ApiError < StandardError
@@ -14,14 +14,14 @@ module Seam
14
14
  class MultiWorkspace
15
15
  attr_reader :client, :defaults
16
16
 
17
- def initialize(personal_access_token:, endpoint: nil, wait_for_action_attempt: true, faraday_options: {},
18
- faraday_retry_options: {})
17
+ def initialize(personal_access_token:, endpoint: nil, wait_for_action_attempt: true, timeout: nil,
18
+ faraday_options: {}, faraday_retry_options: {})
19
19
  @wait_for_action_attempt = wait_for_action_attempt
20
20
  @defaults = {"wait_for_action_attempt" => wait_for_action_attempt}
21
21
  @endpoint = Http::Options.get_endpoint(endpoint)
22
22
  @auth_headers = Http::Auth.get_auth_headers_for_multi_workspace_personal_access_token(personal_access_token)
23
23
  @client = Http::Request.create_faraday_client(@endpoint, @auth_headers, faraday_options,
24
- faraday_retry_options)
24
+ faraday_retry_options, timeout: timeout)
25
25
  end
26
26
 
27
27
  def self.lts_version
@@ -36,11 +36,12 @@ module Seam
36
36
  @workspaces ||= WorkspacesProxy.new(Seam::Clients::Workspaces.new(client: @client, defaults: @defaults))
37
37
  end
38
38
 
39
- def self.from_personal_access_token(personal_access_token, endpoint: nil, wait_for_action_attempt: true, faraday_options: {}, faraday_retry_options: {})
39
+ def self.from_personal_access_token(personal_access_token, endpoint: nil, wait_for_action_attempt: true, timeout: nil, faraday_options: {}, faraday_retry_options: {})
40
40
  new(
41
41
  personal_access_token: personal_access_token,
42
42
  endpoint: endpoint,
43
43
  wait_for_action_attempt: wait_for_action_attempt,
44
+ timeout: timeout,
44
45
  faraday_options: faraday_options,
45
46
  faraday_retry_options: faraday_retry_options
46
47
  )
@@ -17,7 +17,7 @@ module Seam
17
17
  attr_reader :client, :defaults
18
18
 
19
19
  def initialize(client: nil, api_key: nil, personal_access_token: nil, workspace_id: nil, endpoint: nil,
20
- wait_for_action_attempt: true, faraday_options: {}, faraday_retry_options: {})
20
+ wait_for_action_attempt: true, timeout: nil, faraday_options: {}, faraday_retry_options: {})
21
21
  @defaults = Seam::DeepHashAccessor.new({"wait_for_action_attempt" => wait_for_action_attempt})
22
22
 
23
23
  # A client carries its own endpoint and authorization, so the auth
@@ -28,7 +28,8 @@ module Seam
28
28
  @endpoint = options[:endpoint]
29
29
  @auth_headers = options[:auth_headers]
30
30
 
31
- Http::Request.create_faraday_client(@endpoint, @auth_headers, faraday_options, faraday_retry_options)
31
+ Http::Request.create_faraday_client(@endpoint, @auth_headers, faraday_options, faraday_retry_options,
32
+ timeout: timeout)
32
33
  end
33
34
 
34
35
  initialize_routes(client: @client, defaults: @defaults)
@@ -42,14 +43,14 @@ module Seam
42
43
  Paginator.new(request, params)
43
44
  end
44
45
 
45
- def self.from_api_key(api_key, endpoint: nil, wait_for_action_attempt: true, faraday_options: {}, faraday_retry_options: {})
46
+ def self.from_api_key(api_key, endpoint: nil, wait_for_action_attempt: true, timeout: nil, faraday_options: {}, faraday_retry_options: {})
46
47
  new(api_key: api_key, endpoint: endpoint, wait_for_action_attempt: wait_for_action_attempt,
47
- faraday_options: faraday_options, faraday_retry_options: faraday_retry_options)
48
+ timeout: timeout, faraday_options: faraday_options, faraday_retry_options: faraday_retry_options)
48
49
  end
49
50
 
50
- def self.from_personal_access_token(personal_access_token, workspace_id, endpoint: nil, wait_for_action_attempt: true, faraday_options: {}, faraday_retry_options: {})
51
+ def self.from_personal_access_token(personal_access_token, workspace_id, endpoint: nil, wait_for_action_attempt: true, timeout: nil, faraday_options: {}, faraday_retry_options: {})
51
52
  new(personal_access_token: personal_access_token, workspace_id: workspace_id, endpoint: endpoint,
52
- wait_for_action_attempt: wait_for_action_attempt, faraday_options: faraday_options, faraday_retry_options: faraday_retry_options)
53
+ wait_for_action_attempt: wait_for_action_attempt, timeout: timeout, faraday_options: faraday_options, faraday_retry_options: faraday_retry_options)
53
54
  end
54
55
  end
55
56
  end
data/lib/seam/options.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "default_endpoint"
3
+ require_relative "defaults"
4
4
 
5
5
  module Seam
6
6
  module Http
data/lib/seam/request.rb CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  require "faraday"
4
4
  require "faraday/retry"
5
+ require_relative "defaults"
5
6
  require_relative "lts_version"
6
7
  require_relative "version"
7
8
  require_relative "paginator"
@@ -9,10 +10,14 @@ require_relative "paginator"
9
10
  module Seam
10
11
  module Http
11
12
  module Request
12
- def self.create_faraday_client(endpoint, auth_headers, faraday_options = {}, faraday_retry_options = {})
13
+ def self.create_faraday_client(endpoint, auth_headers, faraday_options = {}, faraday_retry_options = {},
14
+ timeout: nil)
15
+ timeout ||= Seam::DEFAULT_TIMEOUT
16
+
13
17
  default_options = {
14
18
  url: endpoint,
15
- headers: auth_headers.merge(default_headers)
19
+ headers: auth_headers.merge(default_headers),
20
+ request: {timeout: timeout, open_timeout: timeout}
16
21
  }
17
22
 
18
23
  options = deep_merge(default_options, faraday_options)
@@ -12,6 +12,115 @@ module Seam
12
12
  #
13
13
  # 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.
14
14
  class AccessCode < BaseResource
15
+ class DormakabaOracodeMetadata < BaseResource
16
+ # Indicates whether the stay can be cancelled via the Dormakaba Oracode API.
17
+ attr_accessor :is_cancellable
18
+ # Indicates whether early check-in is available for this stay.
19
+ attr_accessor :is_early_checkin_able
20
+ # Indicates whether the stay can be extended via the Dormakaba Oracode API.
21
+ attr_accessor :is_extendable
22
+ # Indicates whether the access code can be overridden. When false, the maximum number of overrides has been reached.
23
+ attr_accessor :is_overridable
24
+ # Dormakaba Oracode site name associated with this access code.
25
+ attr_accessor :site_name
26
+ # Dormakaba Oracode stay ID associated with this access code.
27
+ attr_accessor :stay_id
28
+ # Dormakaba Oracode user level ID associated with this access code.
29
+ attr_accessor :user_level_id
30
+ # Dormakaba Oracode user level name associated with this access code.
31
+ attr_accessor :user_level_name
32
+ end
33
+
34
+ class Errors < BaseResource
35
+ class ModifiedFields < BaseResource
36
+ # The name of the field that was changed (e.g. `code`, `starts_at`, `ends_at`).
37
+ attr_accessor :field
38
+ # The previous value of the field.
39
+ attr_accessor :from
40
+ # The new value of the field.
41
+ attr_accessor :to
42
+ end
43
+
44
+ resource_list_accessor :modified_fields, ModifiedFields
45
+ # Indicates the type of external modification. `modified` means the code's PIN or schedule was changed. `removed` means the code was deleted from the device.
46
+ attr_accessor :change_type
47
+ # Unique identifier of the type of error. Enables quick recognition and categorization of the issue.
48
+ attr_accessor :error_code
49
+ # Indicates that this is an access code error.
50
+ attr_accessor :is_access_code_error
51
+ # Indicates whether the error is related to [Seam Bridge](https://docs.seam.co/capability-guides/seam-bridge).
52
+ attr_accessor :is_bridge_error
53
+ attr_accessor :is_connected_account_error
54
+ attr_accessor :is_device_error
55
+ # ID of the managed access code that conflicts with this managed access code, when Seam can identify it.
56
+ attr_accessor :managed_access_code_id
57
+ # Detailed description of the error. Provides insights into the issue and potentially how to rectify it.
58
+ attr_accessor :message
59
+ # ID of the unmanaged access code that conflicts with this managed access code, when Seam can identify it.
60
+ attr_accessor :unmanaged_access_code_id
61
+ # Date and time at which Seam created the error.
62
+ date_accessor :created_at
63
+ end
64
+
65
+ class PendingMutations < BaseResource
66
+ class From < BaseResource
67
+ # Previous PIN code.
68
+ attr_accessor :code
69
+ # Previous access code name.
70
+ attr_accessor :name
71
+ # Previous end time for the access code.
72
+ date_accessor :ends_at
73
+ # Previous start time for the access code.
74
+ date_accessor :starts_at
75
+ end
76
+
77
+ class To < BaseResource
78
+ # New PIN code.
79
+ attr_accessor :code
80
+ # New access code name.
81
+ attr_accessor :name
82
+ # New end time for the access code.
83
+ date_accessor :ends_at
84
+ # New start time for the access code.
85
+ date_accessor :starts_at
86
+ end
87
+
88
+ resource_accessor :from, From
89
+ resource_accessor :to, To
90
+ # Detailed description of the mutation.
91
+ attr_accessor :message
92
+ attr_accessor :mutation_code
93
+ # Date and time at which the mutation was created.
94
+ date_accessor :created_at
95
+ # Date and time at which Seam will attempt to program this access code on the device.
96
+ date_accessor :scheduled_at
97
+ end
98
+
99
+ class Warnings < BaseResource
100
+ class ModifiedFields < BaseResource
101
+ # The name of the field that was changed (e.g. `code`, `starts_at`, `ends_at`).
102
+ attr_accessor :field
103
+ # The previous value of the field.
104
+ attr_accessor :from
105
+ # The new value of the field.
106
+ attr_accessor :to
107
+ end
108
+
109
+ resource_list_accessor :modified_fields, ModifiedFields
110
+ # Indicates the type of external modification. `modified` means the code's PIN or schedule was changed. `removed` means the code was deleted from the device.
111
+ attr_accessor :change_type
112
+ # Detailed description of the warning. Provides insights into the issue and potentially how to rectify it.
113
+ attr_accessor :message
114
+ # Unique identifier of the type of warning. Enables quick recognition and categorization of the issue.
115
+ attr_accessor :warning_code
116
+ # Date and time at which Seam created the warning.
117
+ date_accessor :created_at
118
+ end
119
+
120
+ resource_accessor :dormakaba_oracode_metadata, DormakabaOracodeMetadata
121
+ resource_list_accessor :errors, Errors
122
+ resource_list_accessor :pending_mutations, PendingMutations
123
+ resource_list_accessor :warnings, Warnings
15
124
  # Unique identifier for the access code.
16
125
  attr_accessor :access_code_id
17
126
  # Code used for access. Typically, a numeric or alphanumeric string.
@@ -20,8 +129,6 @@ module Seam
20
129
  attr_accessor :common_code_key
21
130
  # Unique identifier for the device associated with the access code.
22
131
  attr_accessor :device_id
23
- # Metadata for a dormakaba Oracode managed access code. Only present for access codes from dormakaba Oracode devices.
24
- attr_accessor :dormakaba_oracode_metadata
25
132
  # Indicates whether the access code is a backup code.
26
133
  attr_accessor :is_backup
27
134
  # Indicates whether a backup access code is available for use if the primary access code is lost or compromised.
@@ -40,8 +147,6 @@ module Seam
40
147
  attr_accessor :is_waiting_for_code_assignment
41
148
  # Name of the access code. Enables administrators and users to identify the access code easily, especially when there are numerous access codes. 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`. 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. 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).
42
149
  attr_accessor :name
43
- # Collection of pending mutations for the access code. Indicates changes that Seam is in the process of pushing to the device.
44
- attr_accessor :pending_mutations
45
150
  # Identifier of the pulled backup access code. Used to associate the pulled backup access code with the original access code.
46
151
  attr_accessor :pulled_backup_access_code_id
47
152
  # Current status of the access code within the operational lifecycle. Values are `setting`, a transitional phase that indicates that the code is being configured or activated; `set`, which indicates that the code is active and operational; `unset`, which indicates a deactivated or unused state, either before activation or after deliberate deactivation; `removing`, which indicates a transitional period in which the code is being deleted or made inactive; and `unknown`, which indicates an indeterminate state, due to reasons such as system errors or incomplete data, that highlights a potential need for system review or troubleshooting. See also [Lifecycle of Access Codes](https://docs.seam.co/low-level-apis/smart-locks/access-codes/lifecycle-of-access-codes).
@@ -59,9 +164,6 @@ module Seam
59
164
 
60
165
  # Date and time at which the time-bound access code becomes active.
61
166
  date_accessor :starts_at
62
-
63
- include Seam::Resources::ResourceErrorsSupport
64
- include Seam::Resources::ResourceWarningsSupport
65
167
  end
66
168
  end
67
169
  end
@@ -4,6 +4,96 @@ module Seam
4
4
  module Resources
5
5
  # Represents an Access Grant. Access Grants enable you to grant a user identity access to spaces, entrances, and devices through one or more access methods, such as mobile keys, plastic cards, and PIN codes. You can create an Access Grant for an existing user identity, or you can create a new user identity *while* creating the new Access Grant.
6
6
  class AccessGrant < BaseResource
7
+ class Errors < BaseResource
8
+ # Unique identifier of the type of error. Enables quick recognition and categorization of the issue.
9
+ attr_accessor :error_code
10
+ # Detailed description of the error. Provides insights into the issue and potentially how to rectify it.
11
+ attr_accessor :message
12
+ # IDs of the devices that did not receive an access code at grant creation. Use these to identify which specific devices failed when the message reports a partial failure.
13
+ attr_accessor :missing_device_ids
14
+ # Date and time at which Seam created the error.
15
+ date_accessor :created_at
16
+ end
17
+
18
+ class PendingMutations < BaseResource
19
+ class From < BaseResource
20
+ # Previous device IDs where access codes existed.
21
+ attr_accessor :device_ids
22
+ # Previous end time for access.
23
+ date_accessor :ends_at
24
+ # Previous start time for access.
25
+ date_accessor :starts_at
26
+ end
27
+
28
+ class To < BaseResource
29
+ # Common code key to ensure PIN code reuse across devices.
30
+ attr_accessor :common_code_key
31
+ # New device IDs where access codes should be created.
32
+ attr_accessor :device_ids
33
+ # New end time for access.
34
+ date_accessor :ends_at
35
+ # New start time for access.
36
+ date_accessor :starts_at
37
+ end
38
+
39
+ resource_accessor :from, From
40
+ resource_accessor :to, To
41
+ # IDs of the access methods being updated.
42
+ attr_accessor :access_method_ids
43
+ # Detailed description of the mutation.
44
+ attr_accessor :message
45
+ attr_accessor :mutation_code
46
+ # Date and time at which the mutation was created.
47
+ date_accessor :created_at
48
+ end
49
+
50
+ class RequestedAccessMethods < BaseResource
51
+ # Specific PIN code to use for this access method. Only applicable when mode is 'code'.
52
+ attr_accessor :code
53
+ # IDs of the access methods created for the requested access method.
54
+ attr_accessor :created_access_method_ids
55
+ # Display name of the access method.
56
+ attr_accessor :display_name
57
+ # Maximum number of times the instant key can be used. Only applicable when mode is 'mobile_key'. Defaults to 1 if not specified.
58
+ attr_accessor :instant_key_max_use_count
59
+ # Access method mode. Supported values: `code`, `card`, `mobile_key`, `cloud_key`.
60
+ attr_accessor :mode
61
+ # Date and time at which the requested access method was added to the Access Grant.
62
+ date_accessor :created_at
63
+ end
64
+
65
+ class Warnings < BaseResource
66
+ class FailedDevices < BaseResource
67
+ # Device whose access code could not be revoked.
68
+ attr_accessor :device_id
69
+ # Reason the access code could not be revoked (e.g. `offline_access_code_not_revocable`).
70
+ attr_accessor :error_code
71
+ # Human-readable description of why revocation failed.
72
+ attr_accessor :message
73
+ end
74
+
75
+ resource_list_accessor :failed_devices, FailedDevices
76
+ # IDs of the access methods being updated.
77
+ attr_accessor :access_method_ids
78
+ attr_accessor :device_id
79
+ # Detailed description of the warning. Provides insights into the issue and potentially how to rectify it.
80
+ attr_accessor :message
81
+ # The new PIN code that was assigned instead.
82
+ attr_accessor :new_code
83
+ # The originally requested PIN code that was unavailable.
84
+ attr_accessor :original_code
85
+ # Specific reason why the grant's times are not programmable on the device.
86
+ attr_accessor :reason
87
+ # Unique identifier of the type of warning. Enables quick recognition and categorization of the issue.
88
+ attr_accessor :warning_code
89
+ # Date and time at which Seam created the warning.
90
+ date_accessor :created_at
91
+ end
92
+
93
+ resource_list_accessor :errors, Errors
94
+ resource_list_accessor :pending_mutations, PendingMutations
95
+ resource_list_accessor :requested_access_methods, RequestedAccessMethods
96
+ resource_list_accessor :warnings, Warnings
7
97
  # ID of the Access Grant.
8
98
  attr_accessor :access_grant_id
9
99
  # Unique key for the access grant within the workspace.
@@ -22,10 +112,6 @@ module Seam
22
112
  attr_accessor :location_ids
23
113
  # Name of the Access Grant. If not provided, the display name will be computed.
24
114
  attr_accessor :name
25
- # List of pending mutations for the access grant. This shows updates that are in progress.
26
- attr_accessor :pending_mutations
27
- # Access methods that the user requested for the Access Grant.
28
- attr_accessor :requested_access_methods
29
115
  # Reservation key for the access grant.
30
116
  attr_accessor :reservation_key
31
117
  # IDs of the spaces to which the Access Grant gives access.
@@ -43,9 +129,6 @@ module Seam
43
129
 
44
130
  # Date and time at which the Access Grant starts.
45
131
  date_accessor :starts_at
46
-
47
- include Seam::Resources::ResourceErrorsSupport
48
- include Seam::Resources::ResourceWarningsSupport
49
132
  end
50
133
  end
51
134
  end
@@ -4,6 +4,55 @@ module Seam
4
4
  module Resources
5
5
  # Represents an access method for an Access Grant. Access methods describe the modes of access, such as PIN codes, plastic cards, and mobile keys. For a mobile key, the access method also stores the URL for the associated Instant Key.
6
6
  class AccessMethod < BaseResource
7
+ class Errors < BaseResource
8
+ # Unique identifier of the type of error. Enables quick recognition and categorization of the issue.
9
+ attr_accessor :error_code
10
+ # Detailed description of the error. Provides insights into the issue and potentially how to rectify it.
11
+ attr_accessor :message
12
+ # Date and time at which Seam created the error.
13
+ date_accessor :created_at
14
+ end
15
+
16
+ class PendingMutations < BaseResource
17
+ class From < BaseResource
18
+ attr_accessor :device_ids
19
+ # Previous end time for access.
20
+ date_accessor :ends_at
21
+ # Previous start time for access.
22
+ date_accessor :starts_at
23
+ end
24
+
25
+ class To < BaseResource
26
+ attr_accessor :device_ids
27
+ # New end time for access.
28
+ date_accessor :ends_at
29
+ # New start time for access.
30
+ date_accessor :starts_at
31
+ end
32
+
33
+ resource_accessor :from, From
34
+ resource_accessor :to, To
35
+ # Detailed description of the mutation.
36
+ attr_accessor :message
37
+ attr_accessor :mutation_code
38
+ # Date and time at which the mutation was created.
39
+ date_accessor :created_at
40
+ end
41
+
42
+ class Warnings < BaseResource
43
+ # Detailed description of the warning. Provides insights into the issue and potentially how to rectify it.
44
+ attr_accessor :message
45
+ # ID of the original access method from which this backup access method was split, if applicable.
46
+ attr_accessor :original_access_method_id
47
+ # Unique identifier of the type of warning. Enables quick recognition and categorization of the issue.
48
+ attr_accessor :warning_code
49
+ # Date and time at which Seam created the warning.
50
+ date_accessor :created_at
51
+ end
52
+
53
+ resource_list_accessor :errors, Errors
54
+ resource_list_accessor :pending_mutations, PendingMutations
55
+ resource_list_accessor :warnings, Warnings
7
56
  # ID of the access method.
8
57
  attr_accessor :access_method_id
9
58
  # Token of the client session associated with the access method.
@@ -28,8 +77,6 @@ module Seam
28
77
  attr_accessor :is_ready_for_encoding
29
78
  # Access method mode. Supported values: `code`, `card`, `mobile_key`, `cloud_key`.
30
79
  attr_accessor :mode
31
- # Pending mutations for the [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant). Indicates operations that are in progress.
32
- attr_accessor :pending_mutations
33
80
  # ID of the Seam workspace associated with the access method.
34
81
  attr_accessor :workspace_id
35
82
 
@@ -38,9 +85,6 @@ module Seam
38
85
 
39
86
  # Date and time at which the access method was issued.
40
87
  date_accessor :issued_at
41
-
42
- include Seam::Resources::ResourceErrorsSupport
43
- include Seam::Resources::ResourceWarningsSupport
44
88
  end
45
89
  end
46
90
  end