altertable 1.1.2 → 1.2.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: 6578d35fc3a2278e59800c3e1856da5f5a569b8051d912d4dff7f0485fde74e9
4
- data.tar.gz: f29994d0c964d70e1f45b000e1fc19ef5ae8b7ce1464d46f3f423374e4d17c15
3
+ metadata.gz: 7472be3a607d8398965c62ed90f5531fe33b21d77fa4827bd73259d7a714eba5
4
+ data.tar.gz: 536319ad37e423c82ab298d5804aaf22de1563ece73226abaa42b5fd6bd93c39
5
5
  SHA512:
6
- metadata.gz: '029043ea4734d6ef374f7a426fc48c0b2a387c40d2cd6c5db332e0fef769da063a9ef884ecef6b6538a92d62830b92ddf6b9b76e3753552014332977cc56cc5d'
7
- data.tar.gz: 9d517e40f86b34ad5985df17c4ed1511d0c0e0bc8231e24f2fae2a3bf698fc34838ac4d7291a07f9ae1c18a4e520c481c5c9c84c6d605e982f226c6f7147fca2
6
+ metadata.gz: 231d0b578dd8fe4ed8856d07fe233b4e256ce3650ce9a11260a21c01d352fcb9bc291477ab526c2d8984078caa4b879f92da667483af5e475d6ea08089999283
7
+ data.tar.gz: 7ba2dd340e96f6d906c44456032b6a959e0cfa3f106bf5bf42d2982ac710da4856e4fb1e6d028a030afab62a3ed702e5a27e9fbd920725ff3b4926da40e64e35
@@ -37,7 +37,7 @@ body:
37
37
  - type: input
38
38
  id: runtime
39
39
  attributes:
40
- label: "{language} Version"
40
+ label: "Ruby Version"
41
41
  validations:
42
42
  required: true
43
43
  - type: dropdown
@@ -6,11 +6,11 @@ on:
6
6
  pull_request: {}
7
7
  jobs:
8
8
  lint:
9
- runs-on: ubuntu-latest
9
+ runs-on: ubuntu-24.04
10
10
  steps:
11
- - uses: actions/checkout@v4
11
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
12
12
  - name: Set up Ruby
13
- uses: ruby/setup-ruby@v1
13
+ uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1
14
14
  with:
15
15
  ruby-version: "3.4"
16
16
  bundler-cache: true
@@ -18,7 +18,7 @@ jobs:
18
18
  run: bundle exec rubocop
19
19
 
20
20
  test:
21
- runs-on: ubuntu-latest
21
+ runs-on: ubuntu-24.04
22
22
  strategy:
23
23
  matrix:
24
24
  ruby-version: ["3.2", "3.3", "3.4", "4.0"]
@@ -38,12 +38,12 @@ jobs:
38
38
  --health-start-period 10s
39
39
 
40
40
  steps:
41
- - uses: actions/checkout@v4
41
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
42
42
  with:
43
43
  submodules: recursive
44
44
 
45
45
  - name: Set up Ruby
46
- uses: ruby/setup-ruby@v1
46
+ uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1
47
47
  with:
48
48
  ruby-version: ${{ matrix.ruby-version }}
49
49
  bundler-cache: true
@@ -53,11 +53,11 @@ jobs:
53
53
 
54
54
  typing:
55
55
  name: "Typing"
56
- runs-on: ubuntu-latest
56
+ runs-on: ubuntu-24.04
57
57
  steps:
58
- - uses: actions/checkout@v4
58
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
59
59
  - name: Set up Ruby
60
- uses: ruby/setup-ruby@v1
60
+ uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1
61
61
  with:
62
62
  ruby-version: "3.4"
63
63
  bundler-cache: true
@@ -7,14 +7,14 @@ on:
7
7
 
8
8
  jobs:
9
9
  check:
10
- runs-on: ubuntu-latest
10
+ runs-on: ubuntu-24.04
11
11
 
12
12
  permissions:
13
13
  contents: write
14
14
  pull-requests: write
15
15
 
16
16
  steps:
17
- - uses: googleapis/release-please-action@v4
17
+ - uses: googleapis/release-please-action@8b8fd2cc23b2e18957157a9d923d75aa0c6f6ad5 # v4
18
18
  id: release
19
19
  with:
20
20
  token: ${{ secrets.GITHUB_TOKEN }}
@@ -29,7 +29,7 @@ jobs:
29
29
 
30
30
  if: ${{ needs.check.outputs.release_created }}
31
31
 
32
- runs-on: ubuntu-latest
32
+ runs-on: ubuntu-24.04
33
33
 
34
34
  permissions:
35
35
  contents: write
@@ -37,11 +37,11 @@ jobs:
37
37
  id-token: write
38
38
 
39
39
  steps:
40
- - uses: actions/checkout@v4
40
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
41
41
  with:
42
42
  persist-credentials: false
43
- - uses: ruby/setup-ruby@v1
43
+ - uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1
44
44
  with:
45
45
  ruby-version: 3.4
46
46
  bundler-cache: true
47
- - uses: rubygems/release-gem@v1
47
+ - uses: rubygems/release-gem@7f9650160c1a4e7989fdc9855807bdbd421d8b6b # v1
@@ -1,4 +1,5 @@
1
1
  name: Semantic Pull Request
2
+
2
3
  on:
3
4
  pull_request_target:
4
5
  types:
@@ -6,11 +7,33 @@ on:
6
7
  - edited
7
8
  - synchronize
8
9
 
10
+ permissions:
11
+ pull-requests: read
12
+
13
+ concurrency:
14
+ group: semantic-pr-${{ github.event.pull_request.number }}
15
+ cancel-in-progress: true
16
+
9
17
  jobs:
10
18
  main:
11
19
  name: Validate PR title
12
- runs-on: ubuntu-latest
20
+ runs-on: ubuntu-24.04
21
+ timeout-minutes: 5
13
22
  steps:
14
- - uses: amannn/action-semantic-pull-request@v5
23
+ - name: Validate pull request title
24
+ uses: amannn/action-semantic-pull-request@48f256284bd46cdaab1048c3721360e808335d50 # v6.1.1
15
25
  env:
16
26
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27
+ with:
28
+ types: |
29
+ feat
30
+ fix
31
+ perf
32
+ revert
33
+ docs
34
+ style
35
+ chore
36
+ refactor
37
+ test
38
+ build
39
+ ci
@@ -1,3 +1,3 @@
1
1
  {
2
- ".": "1.1.2"
2
+ ".": "1.2.0"
3
3
  }
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.2.0](https://github.com/altertable-ai/altertable-ruby/compare/altertable/v1.1.2...altertable/v1.2.0) (2026-08-27)
4
+
5
+
6
+ ### Features
7
+
8
+ * **adapters:** support explicit proxy configuration ([#51](https://github.com/altertable-ai/altertable-ruby/issues/51)) ([309aa8f](https://github.com/altertable-ai/altertable-ruby/commit/309aa8f43c43f57cf87cf23a6d1034298612b0be))
9
+
3
10
  ## [1.1.2](https://github.com/altertable-ai/altertable-ruby/compare/altertable/v1.1.1...altertable/v1.1.2) (2026-03-19)
4
11
 
5
12
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- altertable (1.1.2)
4
+ altertable (1.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -92,6 +92,7 @@ You can configure the client by passing options during initialization.
92
92
  | `debug` | Boolean | `false` | Enable debug logging. |
93
93
  | `on_error` | Proc | `nil` | Callback for handling errors. |
94
94
  | `adapter` | Symbol | auto-detect | HTTP adapter to use (`:faraday`, `:httpx`, `:net_http`). |
95
+ | `proxy` | String, Boolean | adapter default | Proxy to use for requests. Pass a URI string to force a specific proxy, or `false` to disable proxying (including any `HTTP_PROXY`/`HTTPS_PROXY` environment variables) for a fixed, trusted `base_url`. Unset by default: the `:faraday` and `:net_http` adapters auto-detect a proxy from the environment as they normally would; `:httpx` never does. |
95
96
 
96
97
  ## License
97
98
 
@@ -15,13 +15,17 @@ module Altertable
15
15
  end
16
16
 
17
17
  class FaradayAdapter < Base
18
- def initialize(base_url:, timeout:, headers: {})
19
- super
18
+ # proxy left unset (default) follows Faraday's own env-based auto-detection
19
+ # (HTTP_PROXY/HTTPS_PROXY/NO_PROXY). Pass `false` to disable proxying entirely for
20
+ # fixed, trusted destinations, or a URI string to force a specific proxy.
21
+ def initialize(base_url:, timeout:, headers: {}, proxy: nil)
22
+ super(base_url: base_url, timeout: timeout, headers: headers)
20
23
  require "faraday"
21
-
24
+
22
25
  @conn = Faraday.new(url: @base_url) do |f|
23
26
  @headers.each { |k, v| f.headers[k] = v }
24
27
  f.options.timeout = @timeout
28
+ f.proxy = proxy unless proxy.nil?
25
29
  f.adapter Faraday.default_adapter
26
30
  end
27
31
  end
@@ -46,10 +50,14 @@ module Altertable
46
50
  end
47
51
 
48
52
  class HttpxAdapter < Base
49
- def initialize(base_url:, timeout:, headers: {})
50
- super
53
+ # This adapter never auto-detects HTTP_PROXY/HTTPS_PROXY (httpx requires the :proxy
54
+ # plugin to be loaded explicitly). `proxy: false` and the default (unset) are
55
+ # therefore equivalent; pass a URI string to force a specific proxy.
56
+ def initialize(base_url:, timeout:, headers: {}, proxy: nil)
57
+ super(base_url: base_url, timeout: timeout, headers: headers)
51
58
  require "httpx"
52
- @client = HTTPX.plugin(:retries).with(
59
+ client = proxy ? HTTPX.plugin(:proxy).plugin(:retries).with(proxy: { uri: proxy }) : HTTPX.plugin(:retries)
60
+ @client = client.with(
53
61
  timeout: { operation_timeout: @timeout },
54
62
  headers: @headers,
55
63
  base_url: @base_url
@@ -74,11 +82,15 @@ module Altertable
74
82
  end
75
83
 
76
84
  class NetHttpAdapter < Base
77
- def initialize(base_url:, timeout:, headers: {})
78
- super
85
+ # proxy left unset (default) follows Net::HTTP's own env-based auto-detection
86
+ # (HTTP_PROXY/HTTPS_PROXY/NO_PROXY). Pass `false` to disable proxying entirely for
87
+ # fixed, trusted destinations, or a URI string to force a specific proxy.
88
+ def initialize(base_url:, timeout:, headers: {}, proxy: nil)
89
+ super(base_url: base_url, timeout: timeout, headers: headers)
79
90
  require "net/http"
80
91
  require "uri"
81
92
  @uri = URI.parse(@base_url)
93
+ @proxy = proxy
82
94
  end
83
95
 
84
96
  def post(path, body: nil, params: {})
@@ -89,7 +101,7 @@ module Altertable
89
101
  @headers.each { |k, v| req[k] = v }
90
102
  req.body = body if body
91
103
 
92
- Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https", open_timeout: @timeout, read_timeout: @timeout) do |http|
104
+ Net::HTTP.start(uri.host, uri.port, *proxy_start_args, use_ssl: uri.scheme == "https", open_timeout: @timeout, read_timeout: @timeout) do |http|
93
105
  resp = http.request(req)
94
106
  Response.new(resp.code.to_i, resp.body, resp.to_hash)
95
107
  end
@@ -98,6 +110,18 @@ module Altertable
98
110
  rescue StandardError => e
99
111
  raise Altertable::NetworkError.new(e.message, e)
100
112
  end
113
+
114
+ private
115
+
116
+ # Net::HTTP.start's p_addr defaults to :ENV; returning [] here preserves that.
117
+ # Passing an explicit nil p_addr (i.e. [nil]) is how Net::HTTP disables proxying.
118
+ def proxy_start_args
119
+ return [] if @proxy.nil?
120
+ return [nil] if @proxy == false
121
+
122
+ proxy_uri = URI.parse(@proxy)
123
+ [proxy_uri.host, proxy_uri.port, proxy_uri.user, proxy_uri.password]
124
+ end
101
125
  end
102
126
  end
103
127
  end
@@ -28,7 +28,7 @@ module Altertable
28
28
  "X-API-Key" => @api_key,
29
29
  "Content-Type" => "application/json"
30
30
  }
31
- @adapter = select_adapter(adapter_name, { base_url: @base_url, timeout: @timeout, headers: headers })
31
+ @adapter = select_adapter(adapter_name, { base_url: @base_url, timeout: @timeout, headers: headers, proxy: options[:proxy] })
32
32
  end
33
33
 
34
34
  def track(event, distinct_id, **options)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Altertable
4
- VERSION = "1.1.2"
4
+ VERSION = "1.2.0"
5
5
  end
data/rbi/altertable.rbi CHANGED
@@ -82,8 +82,8 @@ module Altertable
82
82
  end
83
83
 
84
84
  class FaradayAdapter < Base
85
- sig { params(base_url: String, timeout: T.any(Integer, Float), headers: T.nilable(T::Hash[String, String])).void }
86
- def initialize(base_url:, timeout:, headers: nil); end
85
+ sig { params(base_url: String, timeout: T.any(Integer, Float), headers: T.nilable(T::Hash[String, String]), proxy: T.nilable(T.any(String, T::Boolean))).void }
86
+ def initialize(base_url:, timeout:, headers: nil, proxy: nil); end
87
87
 
88
88
  sig { params(path: String, body: T.nilable(String), params: T.nilable(T::Hash[T.any(Symbol, String), T.untyped]), block: T.nilable(T.proc.params(arg0: T.untyped).void)).returns(Altertable::Adapters::Response) }
89
89
  def post(path, body: nil, params: nil, &block); end
@@ -95,8 +95,8 @@ module Altertable
95
95
  end
96
96
 
97
97
  class HttpxAdapter < Base
98
- sig { params(base_url: String, timeout: T.any(Integer, Float), headers: T.nilable(T::Hash[String, String])).void }
99
- def initialize(base_url:, timeout:, headers: nil); end
98
+ sig { params(base_url: String, timeout: T.any(Integer, Float), headers: T.nilable(T::Hash[String, String]), proxy: T.nilable(T.any(String, T::Boolean))).void }
99
+ def initialize(base_url:, timeout:, headers: nil, proxy: nil); end
100
100
 
101
101
  sig { params(path: String, body: T.nilable(String), params: T.nilable(T::Hash[T.any(Symbol, String), T.untyped]), block: T.nilable(T.proc.params(arg0: T.untyped).void)).returns(Altertable::Adapters::Response) }
102
102
  def post(path, body: nil, params: nil, &block); end
@@ -108,11 +108,16 @@ module Altertable
108
108
  end
109
109
 
110
110
  class NetHttpAdapter < Base
111
- sig { params(base_url: String, timeout: T.any(Integer, Float), headers: T.nilable(T::Hash[String, String])).void }
112
- def initialize(base_url:, timeout:, headers: nil); end
111
+ sig { params(base_url: String, timeout: T.any(Integer, Float), headers: T.nilable(T::Hash[String, String]), proxy: T.nilable(T.any(String, T::Boolean))).void }
112
+ def initialize(base_url:, timeout:, headers: nil, proxy: nil); end
113
113
 
114
114
  sig { params(path: String, body: T.nilable(String), params: T.nilable(T::Hash[T.any(Symbol, String), T.untyped]), block: T.nilable(T.proc.params(arg0: T.untyped).void)).returns(Altertable::Adapters::Response) }
115
115
  def post(path, body: nil, params: nil, &block); end
116
+
117
+ private
118
+
119
+ sig { returns(T::Array[T.untyped]) }
120
+ def proxy_start_args; end
116
121
  end
117
122
  end
118
123
 
@@ -19,7 +19,7 @@ module Altertable
19
19
  class FaradayAdapter < Base
20
20
  @conn: untyped
21
21
 
22
- def initialize: (base_url: String, timeout: Integer | Float, ?headers: ::Hash[String, String]) -> void
22
+ def initialize: (base_url: String, timeout: Integer | Float, ?headers: ::Hash[String, String], ?proxy: (String | bool)?) -> void
23
23
  def post: (String path, ?body: String?, ?params: ::Hash[Symbol | String, untyped]) -> Response
24
24
 
25
25
  private
@@ -30,7 +30,7 @@ module Altertable
30
30
  class HttpxAdapter < Base
31
31
  @client: untyped
32
32
 
33
- def initialize: (base_url: String, timeout: Integer | Float, ?headers: ::Hash[String, String]) -> void
33
+ def initialize: (base_url: String, timeout: Integer | Float, ?headers: ::Hash[String, String], ?proxy: (String | bool)?) -> void
34
34
  def post: (String path, ?body: String?, ?params: ::Hash[Symbol | String, untyped]) -> Response
35
35
 
36
36
  private
@@ -40,9 +40,14 @@ module Altertable
40
40
 
41
41
  class NetHttpAdapter < Base
42
42
  @uri: URI::HTTP | URI::HTTPS
43
+ @proxy: (String | bool)?
43
44
 
44
- def initialize: (base_url: String, timeout: Integer | Float, ?headers: ::Hash[String, String]) -> void
45
+ def initialize: (base_url: String, timeout: Integer | Float, ?headers: ::Hash[String, String], ?proxy: (String | bool)?) -> void
45
46
  def post: (String path, ?body: String?, ?params: ::Hash[Symbol | String, untyped]) -> Response
47
+
48
+ private
49
+
50
+ def proxy_start_args: () -> ::Array[untyped]
46
51
  end
47
52
  end
48
53
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: altertable
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Altertable