seam 2.135.0 → 2.137.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 63f28be81d1f91aac1e7e4a985619c5373c3c8f2cd5c9cb2c912353d5d11d784
4
- data.tar.gz: 4b7a897a7b5baee78d66aa0041b5acbedb8dcf58360ffba672ec4f3d2ef16d41
3
+ metadata.gz: 127b82c7a575d44523d96d4f7abeb7f6e2c08a0ef31f0578fe1e215a197cbbd5
4
+ data.tar.gz: b7f55dea5261cbb03284de35dd1a1905db3f7caeacf31d64a25082882b5a1349
5
5
  SHA512:
6
- metadata.gz: 64a11203850219014f1547cef7ddef4c6e5c0bd031e30f5bb5cd395307d9a62124adbf683adb85031e363289e12255c34b10afa68fb326bee673a614daf4f410
7
- data.tar.gz: '09abde1c8cdcbd5dc21c0b823e704d940de7a3ef2fc80c9bb2ecf7cc0c59ae8c4d4adec11557b82735533a6ce335f504b1267f26a403ad8680c5cca49e6bd7b6'
6
+ metadata.gz: 33585716bb7d6d70c7936e5abd084414574eb9204a0ad728b57e94790972b5cc4a552ba145cf95c43d718eaae3febafd6ca3c52ebae88eba889f516e8d2af489
7
+ data.tar.gz: 153856dcd1afc01426ca4a6f00951c3231ae265963c1978c6ec5017d7b9e3a61269e91621f3d46ff01a50257422a8ec95d73a85d9739c6a8c82a93af0d13c50f
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- seam (2.135.0)
4
+ seam (2.137.0)
5
5
  faraday (~> 2.7)
6
6
  faraday-retry (~> 2.2)
7
7
  svix (~> 1.30)
data/README.md CHANGED
@@ -32,7 +32,8 @@ accurate and fully typed.
32
32
  - [Resume pagination](#resume-pagination)
33
33
  - [Iterate over all resources](#iterate-over-all-resources)
34
34
  - [Return all resources across all pages as a list](#return-all-resources-across-all-pages-as-a-list)
35
- - [Interacting with Multiple Workspaces](#interacting-with-multiple-workspaces)
35
+ - [Requests without a Workspace in scope](#requests-without-a-workspace-in-scope)
36
+ - [Personal Access Token](#personal-access-token-1)
36
37
  - [Webhooks](#webhooks)
37
38
  - [Advanced Usage](#advanced-usage)
38
39
  - [Additional Options](#additional-options)
@@ -120,6 +121,9 @@ Obtain one from the Seam Console.
120
121
  A workspace ID must be provided when using this method and all requests will be scoped to that workspace.
121
122
 
122
123
  ```ruby
124
+ # Set the `SEAM_PERSONAL_ACCESS_TOKEN` and `SEAM_WORKSPACE_ID` environment variables
125
+ seam = Seam.new
126
+
123
127
  # Pass as an option to the constructor
124
128
  seam = Seam.new(
125
129
  personal_access_token: "your-personal-access-token",
@@ -314,18 +318,30 @@ paginator = seam.create_paginator(seam.devices.method(:list), {limit: 20})
314
318
  all_devices = paginator.flatten_to_list
315
319
  ```
316
320
 
317
- ### Interacting with Multiple Workspaces
321
+ ### Requests without a Workspace in scope
322
+
323
+ Some Seam API endpoints do not require a workspace in scope.
324
+ The `Seam::Http::WithoutWorkspace` client is not bound to a specific workspace
325
+ and may use those endpoints with a personal access token authentication method.
318
326
 
319
- Some Seam API endpoints interact with multiple workspaces. The `Seam::Http::SeamMultiWorkspace` client is not bound to a specific workspace and may use those endpoints with a personal access token authentication method.
327
+ #### Personal Access Token
320
328
 
321
- A Personal Access Token is scoped to a Seam Console user. Obtain one from the Seam Console.
329
+ A Personal Access Token is scoped to a Seam Console user.
330
+ Obtain one from the Seam Console.
322
331
 
323
332
  ```ruby
324
- # Pass as an option to the constructor
325
- seam = Seam::Http::SeamMultiWorkspace.new(personal_access_token: "your-personal-access-token")
333
+ # Set the `SEAM_PERSONAL_ACCESS_TOKEN` environment variable
334
+ seam = Seam::Http::WithoutWorkspace.new
335
+
336
+ # Pass as a keyword argument to the constructor
337
+ seam = Seam::Http::WithoutWorkspace.new(
338
+ personal_access_token: "your-personal-access-token"
339
+ )
326
340
 
327
341
  # Use the factory method
328
- seam = Seam::Http::SeamMultiWorkspace.from_personal_access_token("your-personal-access-token")
342
+ seam = Seam::Http::WithoutWorkspace.from_personal_access_token(
343
+ "your-personal-access-token"
344
+ )
329
345
 
330
346
  # List workspaces authorized for this Personal Access Token
331
347
  workspaces = seam.workspaces.list
data/lib/seam/auth.rb CHANGED
@@ -86,7 +86,7 @@ module Seam
86
86
  }
87
87
  end
88
88
 
89
- def self.get_auth_headers_for_multi_workspace_personal_access_token(personal_access_token)
89
+ def self.get_auth_headers_for_without_workspace_personal_access_token(personal_access_token)
90
90
  if Auth.jwt?(personal_access_token)
91
91
  raise SeamInvalidTokenError.new(
92
92
  "A JWT cannot be used as a personal_access_token"
@@ -11,15 +11,19 @@ require_relative "routes/routes"
11
11
 
12
12
  module Seam
13
13
  module Http
14
- class MultiWorkspace
14
+ class WithoutWorkspace
15
15
  attr_reader :client, :defaults
16
16
 
17
- def initialize(personal_access_token:, endpoint: nil, wait_for_action_attempt: true, timeout: nil,
17
+ def initialize(personal_access_token: nil, endpoint: nil, wait_for_action_attempt: true, timeout: nil,
18
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
- @endpoint = Http::Options.get_endpoint(endpoint)
22
- @auth_headers = Http::Auth.get_auth_headers_for_multi_workspace_personal_access_token(personal_access_token)
21
+
22
+ options = Http::Options.parse_without_workspace_options(personal_access_token: personal_access_token,
23
+ endpoint: endpoint)
24
+ @endpoint = options[:endpoint]
25
+ @auth_headers = options[:auth_headers]
26
+
23
27
  @client = Http::Request.create_faraday_client(@endpoint, @auth_headers, faraday_options,
24
28
  faraday_retry_options, timeout: timeout)
25
29
  end
@@ -36,7 +40,8 @@ module Seam
36
40
  @workspaces ||= WorkspacesProxy.new(Seam::Clients::Workspaces.new(client: @client, defaults: @defaults))
37
41
  end
38
42
 
39
- def self.from_personal_access_token(personal_access_token, endpoint: nil, wait_for_action_attempt: true, timeout: nil, faraday_options: {}, faraday_retry_options: {})
43
+ def self.from_personal_access_token(personal_access_token, endpoint: nil, wait_for_action_attempt: true,
44
+ timeout: nil, faraday_options: {}, faraday_retry_options: {})
40
45
  new(
41
46
  personal_access_token: personal_access_token,
42
47
  endpoint: endpoint,
@@ -7,7 +7,9 @@ module Seam
7
7
  module Http
8
8
  module Options
9
9
  def self.parse_options(api_key: nil, personal_access_token: nil, workspace_id: nil, endpoint: nil)
10
- api_key ||= ENV["SEAM_API_KEY"] if personal_access_token.nil?
10
+ api_key ||= get_api_key_from_env(personal_access_token)
11
+ personal_access_token ||= get_personal_access_token_from_env(api_key)
12
+ workspace_id ||= ENV["SEAM_WORKSPACE_ID"]
11
13
 
12
14
  auth_headers = Http::Auth.get_auth_headers(
13
15
  api_key: api_key,
@@ -18,6 +20,48 @@ module Seam
18
20
 
19
21
  {auth_headers: auth_headers, endpoint: endpoint}
20
22
  end
23
+
24
+ def self.parse_without_workspace_options(personal_access_token: nil, endpoint: nil)
25
+ personal_access_token ||= ENV["SEAM_PERSONAL_ACCESS_TOKEN"]
26
+
27
+ if personal_access_token.nil?
28
+ raise SeamInvalidOptionsError.new(
29
+ "Must specify a personal_access_token. " \
30
+ "Attempted reading configuration from the environment, " \
31
+ "but the environment variable SEAM_PERSONAL_ACCESS_TOKEN is not set."
32
+ )
33
+ end
34
+
35
+ auth_headers = Http::Auth.get_auth_headers_for_without_workspace_personal_access_token(personal_access_token)
36
+ endpoint = Http::Options.get_endpoint(endpoint)
37
+
38
+ {auth_headers: auth_headers, endpoint: endpoint}
39
+ end
40
+
41
+ # A personal access token passed as an option takes precedence over the
42
+ # environment, so the environment is not consulted when one is given.
43
+ def self.get_api_key_from_env(personal_access_token)
44
+ return nil unless personal_access_token.nil?
45
+
46
+ api_key = ENV["SEAM_API_KEY"]
47
+
48
+ if api_key && ENV["SEAM_PERSONAL_ACCESS_TOKEN"]
49
+ raise SeamInvalidOptionsError.new(
50
+ "Both SEAM_API_KEY and SEAM_PERSONAL_ACCESS_TOKEN environment variables are defined. " \
51
+ "Please use only one authentication method."
52
+ )
53
+ end
54
+
55
+ api_key
56
+ end
57
+
58
+ # An api_key, whether passed as an option or read from the environment,
59
+ # takes precedence, so the environment is not consulted when one is set.
60
+ def self.get_personal_access_token_from_env(api_key)
61
+ return nil unless api_key.nil?
62
+
63
+ ENV["SEAM_PERSONAL_ACCESS_TOKEN"]
64
+ end
21
65
  end
22
66
  end
23
67
  end
data/lib/seam/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Seam
4
- VERSION = "2.135.0"
4
+ VERSION = "2.137.0"
5
5
  end
data/lib/seam.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  require_relative "seam/lts_version"
4
4
  require_relative "seam/http"
5
- require_relative "seam/http_multi_workspace"
5
+ require_relative "seam/http_without_workspace"
6
6
  require_relative "seam/webhook"
7
7
  require_relative "seam/wait_for_action_attempt"
8
8
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: seam
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.135.0
4
+ version: 2.137.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seam Labs, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-08-12 00:00:00.000000000 Z
11
+ date: 2026-08-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -196,8 +196,8 @@ files:
196
196
  - lib/seam/defaults.rb
197
197
  - lib/seam/helpers/action_attempt.rb
198
198
  - lib/seam/http.rb
199
- - lib/seam/http_multi_workspace.rb
200
199
  - lib/seam/http_single_workspace.rb
200
+ - lib/seam/http_without_workspace.rb
201
201
  - lib/seam/lts_version.rb
202
202
  - lib/seam/options.rb
203
203
  - lib/seam/paginator.rb