seam 2.137.0 → 2.139.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: 127b82c7a575d44523d96d4f7abeb7f6e2c08a0ef31f0578fe1e215a197cbbd5
4
- data.tar.gz: b7f55dea5261cbb03284de35dd1a1905db3f7caeacf31d64a25082882b5a1349
3
+ metadata.gz: 2b94008b86b31b1f480fc2c3276075bc61d83a74dd09ea0af2b7831f39e603c3
4
+ data.tar.gz: 1f4a039c2309d9b31c82cb9c295c09fb925161150f64eede25fcad60e35c89c0
5
5
  SHA512:
6
- metadata.gz: 33585716bb7d6d70c7936e5abd084414574eb9204a0ad728b57e94790972b5cc4a552ba145cf95c43d718eaae3febafd6ca3c52ebae88eba889f516e8d2af489
7
- data.tar.gz: 153856dcd1afc01426ca4a6f00951c3231ae265963c1978c6ec5017d7b9e3a61269e91621f3d46ff01a50257422a8ec95d73a85d9739c6a8c82a93af0d13c50f
6
+ metadata.gz: c23cbe8e1da6b13568c3cdb1676d7e19c68068aaa99b651ae1915ce4ec04eb776def06af72e3b592381e200e9dd85dbc20e7d568ebe60ea5092e17b27151b67c
7
+ data.tar.gz: 23f38b1e3c55349694570c17aa70a1d3e6696336d04ec0506ba4758360fdc2a651f9229263efb2c5168f95903f3525c85163ebb1b92de1856f18775e30d830df
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- seam (2.137.0)
4
+ seam (2.139.0)
5
5
  faraday (~> 2.7)
6
6
  faraday-retry (~> 2.2)
7
7
  svix (~> 1.30)
data/README.md CHANGED
@@ -39,6 +39,7 @@ accurate and fully typed.
39
39
  - [Additional Options](#additional-options)
40
40
  - [Setting the endpoint](#setting-the-endpoint)
41
41
  - [Setting the request timeout](#setting-the-request-timeout)
42
+ - [Retry behavior](#retry-behavior)
42
43
  - [Configuring the Faraday Client](#configuring-the-faraday-client)
43
44
  - [Using the Faraday Client](#using-the-faraday-client)
44
45
  - [Overriding the Client](#overriding-the-client)
@@ -443,6 +444,17 @@ seam = Seam.new(
443
444
 
444
445
  A request that exceeds the timeout raises `Faraday::TimeoutError`.
445
446
 
447
+ #### Retry behavior
448
+
449
+ By default, the SDK makes up to three attempts: the initial request and two
450
+ retries. Retries are limited to `GET`, `HEAD`, `OPTIONS`, `PUT`, and `DELETE`
451
+ requests that fail because of a transport error, timeout, HTTP 429 response, or
452
+ HTTP 5xx response. `POST` and `PATCH` requests are not retried.
453
+
454
+ Retries use exponential backoff with jitter: approximately 200–240 ms before
455
+ the first retry and 400–480 ms before the second. A longer `Retry-After` header
456
+ is honored. The request timeout is reset for each attempt.
457
+
446
458
  #### Configuring the Faraday Client
447
459
 
448
460
  The Faraday client and retry behavior may be configured with custom initiation options
@@ -16,13 +16,45 @@ module Seam
16
16
 
17
17
  attr_reader :client, :defaults
18
18
 
19
- def initialize(client: nil, api_key: nil, personal_access_token: nil, workspace_id: nil, endpoint: nil,
20
- wait_for_action_attempt: true, timeout: nil, faraday_options: {}, faraday_retry_options: {})
19
+ OPTION_NOT_PROVIDED = Object.new.freeze
20
+ private_constant :OPTION_NOT_PROVIDED
21
+
22
+ def initialize(client: nil, api_key: OPTION_NOT_PROVIDED, personal_access_token: OPTION_NOT_PROVIDED,
23
+ workspace_id: OPTION_NOT_PROVIDED, endpoint: OPTION_NOT_PROVIDED,
24
+ wait_for_action_attempt: OPTION_NOT_PROVIDED, timeout: OPTION_NOT_PROVIDED,
25
+ faraday_options: OPTION_NOT_PROVIDED, faraday_retry_options: OPTION_NOT_PROVIDED)
26
+ supplied_options = {
27
+ api_key: api_key,
28
+ personal_access_token: personal_access_token,
29
+ workspace_id: workspace_id,
30
+ endpoint: endpoint,
31
+ wait_for_action_attempt: wait_for_action_attempt,
32
+ timeout: timeout,
33
+ faraday_options: faraday_options,
34
+ faraday_retry_options: faraday_retry_options
35
+ }.reject { |_, value| value.equal?(OPTION_NOT_PROVIDED) }
36
+ invalid_options = supplied_options.keys - [:wait_for_action_attempt]
37
+
38
+ if client && invalid_options.any?
39
+ raise Http::Options::SeamInvalidOptionsError.new(
40
+ "The client option cannot be used with any other option, but received: #{supplied_options.keys.join(", ")}"
41
+ )
42
+ end
43
+
44
+ wait_for_action_attempt = true if wait_for_action_attempt.equal?(OPTION_NOT_PROVIDED)
21
45
  @defaults = Seam::DeepHashAccessor.new({"wait_for_action_attempt" => wait_for_action_attempt})
22
46
 
23
47
  # A client carries its own endpoint and authorization, so the auth
24
48
  # options are only parsed when one has to be built.
25
49
  @client = client || begin
50
+ api_key = nil if api_key.equal?(OPTION_NOT_PROVIDED)
51
+ personal_access_token = nil if personal_access_token.equal?(OPTION_NOT_PROVIDED)
52
+ workspace_id = nil if workspace_id.equal?(OPTION_NOT_PROVIDED)
53
+ endpoint = nil if endpoint.equal?(OPTION_NOT_PROVIDED)
54
+ timeout = nil if timeout.equal?(OPTION_NOT_PROVIDED)
55
+ faraday_options = {} if faraday_options.equal?(OPTION_NOT_PROVIDED)
56
+ faraday_retry_options = {} if faraday_retry_options.equal?(OPTION_NOT_PROVIDED)
57
+
26
58
  options = Http::Options.parse_options(api_key: api_key, personal_access_token: personal_access_token,
27
59
  workspace_id: workspace_id, endpoint: endpoint)
28
60
  @endpoint = options[:endpoint]
@@ -35,10 +67,6 @@ module Seam
35
67
  initialize_routes(client: @client, defaults: @defaults)
36
68
  end
37
69
 
38
- def lts_version
39
- Seam::LTS_VERSION
40
- end
41
-
42
70
  def create_paginator(request, params = {})
43
71
  Paginator.new(request, params)
44
72
  end
@@ -2,7 +2,6 @@
2
2
 
3
3
  require_relative "request"
4
4
  require_relative "parse_options"
5
- require_relative "lts_version"
6
5
  require_relative "version"
7
6
  require_relative "auth"
8
7
  require_relative "resources/index"
@@ -14,26 +13,47 @@ module Seam
14
13
  class WithoutWorkspace
15
14
  attr_reader :client, :defaults
16
15
 
17
- def initialize(personal_access_token: nil, endpoint: nil, wait_for_action_attempt: true, timeout: nil,
18
- faraday_options: {}, faraday_retry_options: {})
16
+ OPTION_NOT_PROVIDED = Object.new.freeze
17
+ private_constant :OPTION_NOT_PROVIDED
18
+
19
+ def initialize(client: nil, personal_access_token: OPTION_NOT_PROVIDED, endpoint: OPTION_NOT_PROVIDED,
20
+ wait_for_action_attempt: OPTION_NOT_PROVIDED, timeout: OPTION_NOT_PROVIDED,
21
+ faraday_options: OPTION_NOT_PROVIDED, faraday_retry_options: OPTION_NOT_PROVIDED)
22
+ supplied_options = {
23
+ personal_access_token: personal_access_token,
24
+ endpoint: endpoint,
25
+ wait_for_action_attempt: wait_for_action_attempt,
26
+ timeout: timeout,
27
+ faraday_options: faraday_options,
28
+ faraday_retry_options: faraday_retry_options
29
+ }.reject { |_, value| value.equal?(OPTION_NOT_PROVIDED) }
30
+ invalid_options = supplied_options.keys - [:wait_for_action_attempt]
31
+
32
+ if client && invalid_options.any?
33
+ raise Http::Options::SeamInvalidOptionsError.new(
34
+ "The client option cannot be used with any other option, but received: #{supplied_options.keys.join(", ")}"
35
+ )
36
+ end
37
+
38
+ wait_for_action_attempt = true if wait_for_action_attempt.equal?(OPTION_NOT_PROVIDED)
19
39
  @wait_for_action_attempt = wait_for_action_attempt
20
40
  @defaults = {"wait_for_action_attempt" => wait_for_action_attempt}
21
41
 
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]
42
+ @client = client || begin
43
+ personal_access_token = nil if personal_access_token.equal?(OPTION_NOT_PROVIDED)
44
+ endpoint = nil if endpoint.equal?(OPTION_NOT_PROVIDED)
45
+ timeout = nil if timeout.equal?(OPTION_NOT_PROVIDED)
46
+ faraday_options = {} if faraday_options.equal?(OPTION_NOT_PROVIDED)
47
+ faraday_retry_options = {} if faraday_retry_options.equal?(OPTION_NOT_PROVIDED)
26
48
 
27
- @client = Http::Request.create_faraday_client(@endpoint, @auth_headers, faraday_options,
28
- faraday_retry_options, timeout: timeout)
29
- end
30
-
31
- def self.lts_version
32
- Seam::LTS_VERSION
33
- end
49
+ options = Http::Options.parse_without_workspace_options(personal_access_token: personal_access_token,
50
+ endpoint: endpoint)
51
+ @endpoint = options[:endpoint]
52
+ @auth_headers = options[:auth_headers]
34
53
 
35
- def lts_version
36
- Seam::LTS_VERSION
54
+ Http::Request.create_faraday_client(@endpoint, @auth_headers, faraday_options,
55
+ faraday_retry_options, timeout: timeout)
56
+ end
37
57
  end
38
58
 
39
59
  def workspaces
data/lib/seam/request.rb CHANGED
@@ -3,7 +3,6 @@
3
3
  require "faraday"
4
4
  require "faraday/retry"
5
5
  require_relative "defaults"
6
- require_relative "lts_version"
7
6
  require_relative "version"
8
7
  require_relative "paginator"
9
8
 
@@ -24,7 +23,11 @@ module Seam
24
23
 
25
24
  default_faraday_retry_options = {
26
25
  max: 2,
27
- backoff_factor: 2
26
+ interval: 0.2,
27
+ interval_randomness: 0.2,
28
+ backoff_factor: 2,
29
+ exceptions: Faraday::Retry::Middleware::DEFAULT_EXCEPTIONS + [Faraday::ConnectionFailed],
30
+ retry_statuses: [429] + (500..599).to_a
28
31
  }
29
32
 
30
33
  faraday_retry_options = default_faraday_retry_options.merge(faraday_retry_options)
@@ -43,8 +46,7 @@ module Seam
43
46
  "User-Agent" => "seam-ruby/#{Seam::VERSION}",
44
47
  "Content-Type" => "application/json",
45
48
  :"seam-sdk-name" => "seamapi/ruby",
46
- :"seam-sdk-version" => Seam::VERSION,
47
- :"seam-lts-version" => Seam::LTS_VERSION
49
+ :"seam-sdk-version" => Seam::VERSION
48
50
  }
49
51
  end
50
52
 
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.137.0"
4
+ VERSION = "2.139.0"
5
5
  end
data/lib/seam.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "seam/lts_version"
4
3
  require_relative "seam/http"
5
4
  require_relative "seam/http_without_workspace"
6
5
  require_relative "seam/webhook"
@@ -19,8 +18,4 @@ module Seam
19
18
  def self.from_personal_access_token(personal_access_token, workspace_id, endpoint: nil, wait_for_action_attempt: true, timeout: nil)
20
19
  Seam::Http.from_personal_access_token(personal_access_token, workspace_id, endpoint: endpoint, wait_for_action_attempt: wait_for_action_attempt, timeout: timeout)
21
20
  end
22
-
23
- def self.lts_version
24
- Seam::LTS_VERSION
25
- end
26
21
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: seam
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.137.0
4
+ version: 2.139.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seam Labs, Inc.
@@ -198,7 +198,6 @@ files:
198
198
  - lib/seam/http.rb
199
199
  - lib/seam/http_single_workspace.rb
200
200
  - lib/seam/http_without_workspace.rb
201
- - lib/seam/lts_version.rb
202
201
  - lib/seam/options.rb
203
202
  - lib/seam/paginator.rb
204
203
  - lib/seam/parse_options.rb
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Seam
4
- LTS_VERSION = "1.0.0"
5
- end