seam 2.133.0 → 2.134.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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +24 -0
- data/Rakefile +1 -4
- data/lib/seam/deep_hash_accessor.rb +4 -0
- data/lib/seam/{default_endpoint.rb → defaults.rb} +2 -0
- data/lib/seam/helpers/action_attempt.rb +16 -7
- data/lib/seam/http.rb +5 -4
- data/lib/seam/http_multi_workspace.rb +5 -4
- data/lib/seam/http_single_workspace.rb +17 -11
- data/lib/seam/options.rb +1 -1
- data/lib/seam/request.rb +8 -2
- data/lib/seam/version.rb +1 -1
- data/lib/seam.rb +5 -4
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f3ffafcdfdbb5c40dc150484a2e283d55bf1cdd7685f0158a660c303c9719553
|
|
4
|
+
data.tar.gz: b9300c82c89d2c4b8056fdcb0b1cbb87c50c4df006de3fd8b06831b01d42930e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f0c5dc998b88e2b814f86a386bdfe02ef41e31d95f07963a54e7ccbb8bb245ae8911896580f507d785abfef25f14b9d504ac1c437857390047174a4a0f6fc715
|
|
7
|
+
data.tar.gz: 7b37c256db254e40232840de248352a00c84d9bda655e244708784a405d498446f4ae4b91d4544323419e6f535781ba965a65b712b434da978814a09476bc743
|
data/Gemfile.lock
CHANGED
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
|
data/Rakefile
CHANGED
|
@@ -6,14 +6,23 @@ module Seam
|
|
|
6
6
|
module Helpers
|
|
7
7
|
module ActionAttempt
|
|
8
8
|
def self.decide_and_wait(action_attempt, client, wait_for_action_attempt)
|
|
9
|
-
if wait_for_action_attempt == true
|
|
10
|
-
return wait_until_finished(action_attempt, client)
|
|
11
|
-
elsif wait_for_action_attempt.is_a?(Hash)
|
|
12
|
-
return wait_until_finished(action_attempt, client, timeout: wait_for_action_attempt[:timeout],
|
|
13
|
-
polling_interval: wait_for_action_attempt[:polling_interval])
|
|
14
|
-
end
|
|
9
|
+
return wait_until_finished(action_attempt, client) if wait_for_action_attempt == true
|
|
15
10
|
|
|
16
|
-
|
|
11
|
+
options = wait_options(wait_for_action_attempt)
|
|
12
|
+
return action_attempt if options.nil?
|
|
13
|
+
|
|
14
|
+
wait_until_finished(action_attempt, client, timeout: options[:timeout],
|
|
15
|
+
polling_interval: options[:polling_interval])
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# The client wraps its defaults in a DeepHashAccessor, so the hash form of
|
|
19
|
+
# this option reaches here as an accessor when it comes from the client
|
|
20
|
+
# and as a plain Hash when it comes from the method call.
|
|
21
|
+
def self.wait_options(wait_for_action_attempt)
|
|
22
|
+
case wait_for_action_attempt
|
|
23
|
+
when Hash then wait_for_action_attempt
|
|
24
|
+
when Seam::DeepHashAccessor then wait_for_action_attempt.to_h
|
|
25
|
+
end
|
|
17
26
|
end
|
|
18
27
|
|
|
19
28
|
def self.wait_until_finished(action_attempt, client, timeout: nil, polling_interval: nil)
|
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:
|
|
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:
|
|
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,
|
|
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,14 +17,20 @@ 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: {})
|
|
21
|
-
options = Http::Options.parse_options(api_key: api_key, personal_access_token: personal_access_token,
|
|
22
|
-
workspace_id: workspace_id, endpoint: endpoint)
|
|
23
|
-
@endpoint = options[:endpoint]
|
|
24
|
-
@auth_headers = options[:auth_headers]
|
|
20
|
+
wait_for_action_attempt: true, timeout: nil, faraday_options: {}, faraday_retry_options: {})
|
|
25
21
|
@defaults = Seam::DeepHashAccessor.new({"wait_for_action_attempt" => wait_for_action_attempt})
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
|
|
23
|
+
# A client carries its own endpoint and authorization, so the auth
|
|
24
|
+
# options are only parsed when one has to be built.
|
|
25
|
+
@client = client || begin
|
|
26
|
+
options = Http::Options.parse_options(api_key: api_key, personal_access_token: personal_access_token,
|
|
27
|
+
workspace_id: workspace_id, endpoint: endpoint)
|
|
28
|
+
@endpoint = options[:endpoint]
|
|
29
|
+
@auth_headers = options[:auth_headers]
|
|
30
|
+
|
|
31
|
+
Http::Request.create_faraday_client(@endpoint, @auth_headers, faraday_options, faraday_retry_options,
|
|
32
|
+
timeout: timeout)
|
|
33
|
+
end
|
|
28
34
|
|
|
29
35
|
initialize_routes(client: @client, defaults: @defaults)
|
|
30
36
|
end
|
|
@@ -37,14 +43,14 @@ module Seam
|
|
|
37
43
|
Paginator.new(request, params)
|
|
38
44
|
end
|
|
39
45
|
|
|
40
|
-
def self.from_api_key(api_key, endpoint: nil, wait_for_action_attempt:
|
|
46
|
+
def self.from_api_key(api_key, endpoint: nil, wait_for_action_attempt: true, timeout: nil, faraday_options: {}, faraday_retry_options: {})
|
|
41
47
|
new(api_key: api_key, endpoint: endpoint, wait_for_action_attempt: wait_for_action_attempt,
|
|
42
|
-
faraday_options: faraday_options, faraday_retry_options: faraday_retry_options)
|
|
48
|
+
timeout: timeout, faraday_options: faraday_options, faraday_retry_options: faraday_retry_options)
|
|
43
49
|
end
|
|
44
50
|
|
|
45
|
-
def self.from_personal_access_token(personal_access_token, workspace_id, endpoint: nil, wait_for_action_attempt:
|
|
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: {})
|
|
46
52
|
new(personal_access_token: personal_access_token, workspace_id: workspace_id, endpoint: endpoint,
|
|
47
|
-
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)
|
|
48
54
|
end
|
|
49
55
|
end
|
|
50
56
|
end
|
data/lib/seam/options.rb
CHANGED
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,15 @@ 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
|
+
# open_timeout bounds the connect phase, which timeout does not cover.
|
|
21
|
+
request: {timeout: timeout, open_timeout: timeout}
|
|
16
22
|
}
|
|
17
23
|
|
|
18
24
|
options = deep_merge(default_options, faraday_options)
|
data/lib/seam/version.rb
CHANGED
data/lib/seam.rb
CHANGED
|
@@ -11,12 +11,13 @@ module Seam
|
|
|
11
11
|
Seam::Http.new(**args)
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
-
def self.from_api_key(api_key, endpoint: nil, wait_for_action_attempt:
|
|
15
|
-
Seam::Http.from_api_key(api_key, endpoint: endpoint, wait_for_action_attempt: wait_for_action_attempt
|
|
14
|
+
def self.from_api_key(api_key, endpoint: nil, wait_for_action_attempt: true, timeout: nil)
|
|
15
|
+
Seam::Http.from_api_key(api_key, endpoint: endpoint, wait_for_action_attempt: wait_for_action_attempt,
|
|
16
|
+
timeout: timeout)
|
|
16
17
|
end
|
|
17
18
|
|
|
18
|
-
def self.from_personal_access_token(personal_access_token, workspace_id, endpoint: nil, wait_for_action_attempt:
|
|
19
|
-
Seam::Http.from_personal_access_token(personal_access_token, workspace_id, endpoint: endpoint, wait_for_action_attempt: wait_for_action_attempt)
|
|
19
|
+
def self.from_personal_access_token(personal_access_token, workspace_id, endpoint: nil, wait_for_action_attempt: true, timeout: nil)
|
|
20
|
+
Seam::Http.from_personal_access_token(personal_access_token, workspace_id, endpoint: endpoint, wait_for_action_attempt: wait_for_action_attempt, timeout: timeout)
|
|
20
21
|
end
|
|
21
22
|
|
|
22
23
|
def self.lts_version
|
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.
|
|
4
|
+
version: 2.134.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-
|
|
11
|
+
date: 2026-08-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|
|
@@ -193,7 +193,7 @@ files:
|
|
|
193
193
|
- lib/seam/auth.rb
|
|
194
194
|
- lib/seam/base_resource.rb
|
|
195
195
|
- lib/seam/deep_hash_accessor.rb
|
|
196
|
-
- lib/seam/
|
|
196
|
+
- lib/seam/defaults.rb
|
|
197
197
|
- lib/seam/helpers/action_attempt.rb
|
|
198
198
|
- lib/seam/http.rb
|
|
199
199
|
- lib/seam/http_multi_workspace.rb
|