altertable 1.1.0 → 1.1.2
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/.github/workflows/ci.yml +1 -3
- data/.github/workflows/semantic-pull-request.yml +16 -0
- data/.release-please-manifest.json +1 -1
- data/CHANGELOG.md +15 -0
- data/Gemfile.lock +1 -5
- data/README.md +61 -18
- data/altertable.gemspec +0 -2
- data/lib/altertable/adapters.rb +0 -3
- data/lib/altertable/version.rb +1 -1
- data/rbi/altertable.rbi +6 -6
- data/rbi/todo.rbi +5 -2
- metadata +2 -29
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6578d35fc3a2278e59800c3e1856da5f5a569b8051d912d4dff7f0485fde74e9
|
|
4
|
+
data.tar.gz: f29994d0c964d70e1f45b000e1fc19ef5ae8b7ce1464d46f3f423374e4d17c15
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '029043ea4734d6ef374f7a426fc48c0b2a387c40d2cd6c5db332e0fef769da063a9ef884ecef6b6538a92d62830b92ddf6b9b76e3753552014332977cc56cc5d'
|
|
7
|
+
data.tar.gz: 9d517e40f86b34ad5985df17c4ed1511d0c0e0bc8231e24f2fae2a3bf698fc34838ac4d7291a07f9ae1c18a4e520c481c5c9c84c6d605e982f226c6f7147fca2
|
data/.github/workflows/ci.yml
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
name: Semantic Pull Request
|
|
2
|
+
on:
|
|
3
|
+
pull_request_target:
|
|
4
|
+
types:
|
|
5
|
+
- opened
|
|
6
|
+
- edited
|
|
7
|
+
- synchronize
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
main:
|
|
11
|
+
name: Validate PR title
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: amannn/action-semantic-pull-request@v5
|
|
15
|
+
env:
|
|
16
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.1.2](https://github.com/altertable-ai/altertable-ruby/compare/altertable/v1.1.1...altertable/v1.1.2) (2026-03-19)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **readme:** correct package name ([#33](https://github.com/altertable-ai/altertable-ruby/issues/33)) ([5838578](https://github.com/altertable-ai/altertable-ruby/commit/58385785e8849cda3627bdd04e563eadab933ba3))
|
|
9
|
+
* **transport:** remove the hard dep on `faraday-retry` ([#42](https://github.com/altertable-ai/altertable-ruby/issues/42)) ([f758d02](https://github.com/altertable-ai/altertable-ruby/commit/f758d0254d86de2ea3d6105a429d885c6a8aadbf))
|
|
10
|
+
|
|
11
|
+
## [1.1.1](https://github.com/altertable-ai/altertable-ruby/compare/altertable/v1.1.0...altertable/v1.1.1) (2026-03-09)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* **sorbet:** trigger build ([#31](https://github.com/altertable-ai/altertable-ruby/issues/31)) ([e30cbbf](https://github.com/altertable-ai/altertable-ruby/commit/e30cbbf6aa8c9264423101f69d572d25776ebff2))
|
|
17
|
+
|
|
3
18
|
## [1.1.0](https://github.com/altertable-ai/altertable-ruby/compare/altertable/v1.0.0...altertable/v1.1.0) (2026-03-09)
|
|
4
19
|
|
|
5
20
|
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
altertable (1.1.
|
|
4
|
+
altertable (1.1.2)
|
|
5
5
|
|
|
6
6
|
GEM
|
|
7
7
|
remote: https://rubygems.org/
|
|
@@ -25,8 +25,6 @@ GEM
|
|
|
25
25
|
logger
|
|
26
26
|
faraday-net_http (3.4.2)
|
|
27
27
|
net-http (~> 0.5)
|
|
28
|
-
faraday-retry (2.4.0)
|
|
29
|
-
faraday (~> 2.0)
|
|
30
28
|
http-2 (1.1.3)
|
|
31
29
|
httpx (1.7.3)
|
|
32
30
|
http-2 (>= 1.1.3)
|
|
@@ -144,8 +142,6 @@ DEPENDENCIES
|
|
|
144
142
|
altertable!
|
|
145
143
|
base64
|
|
146
144
|
faraday (~> 2.0)
|
|
147
|
-
faraday-net_http
|
|
148
|
-
faraday-retry
|
|
149
145
|
httpx
|
|
150
146
|
rake (~> 13.0)
|
|
151
147
|
rbs
|
data/README.md
CHANGED
|
@@ -1,55 +1,98 @@
|
|
|
1
1
|
# Altertable Ruby SDK
|
|
2
2
|
|
|
3
|
+
[](https://github.com/altertable-ai/altertable-ruby/actions)
|
|
4
|
+
[](https://rubygems.org/gems/altertable)
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
|
|
3
7
|
Official Ruby SDK for Altertable Product Analytics.
|
|
4
8
|
|
|
5
|
-
##
|
|
9
|
+
## Install
|
|
6
10
|
|
|
7
|
-
|
|
11
|
+
Install the gem with a single command:
|
|
8
12
|
|
|
9
|
-
```
|
|
10
|
-
gem
|
|
13
|
+
```bash
|
|
14
|
+
gem install altertable
|
|
11
15
|
```
|
|
12
16
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
$ bundle install
|
|
16
|
-
|
|
17
|
-
## Usage
|
|
17
|
+
## Quick Start
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
Initialize the client and track your first event. Call `track()` to record an action a user performed.
|
|
20
20
|
|
|
21
21
|
```ruby
|
|
22
22
|
require 'altertable'
|
|
23
23
|
|
|
24
|
-
Altertable
|
|
25
|
-
|
|
24
|
+
# Initialize the Altertable client
|
|
25
|
+
Altertable.init('pk_live_abc123', environment: 'production')
|
|
26
|
+
|
|
27
|
+
# Track an event
|
|
28
|
+
Altertable.track('button_clicked', 'user_123', properties: {
|
|
29
|
+
button_id: 'signup_btn',
|
|
30
|
+
page: 'home'
|
|
26
31
|
})
|
|
27
32
|
```
|
|
28
33
|
|
|
34
|
+
## API Reference
|
|
35
|
+
|
|
36
|
+
### Initialization
|
|
37
|
+
|
|
38
|
+
Initialize the global Altertable client instance.
|
|
39
|
+
|
|
40
|
+
`Altertable.init(api_key, options = {})`
|
|
41
|
+
|
|
42
|
+
```ruby
|
|
43
|
+
Altertable.init('pk_live_abc123', environment: 'production', debug: true)
|
|
44
|
+
```
|
|
45
|
+
|
|
29
46
|
### Tracking Events
|
|
30
47
|
|
|
48
|
+
Record an action performed by a user.
|
|
49
|
+
|
|
50
|
+
`Altertable.track(event, distinct_id, **options)`
|
|
51
|
+
|
|
31
52
|
```ruby
|
|
32
|
-
Altertable.track('
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
53
|
+
Altertable.track('item_purchased', 'user_123', properties: {
|
|
54
|
+
item_id: 'item_999',
|
|
55
|
+
price: 19.99
|
|
56
|
+
})
|
|
36
57
|
```
|
|
37
58
|
|
|
38
59
|
### Identifying Users
|
|
39
60
|
|
|
61
|
+
Link a user ID to their traits (like email or name).
|
|
62
|
+
|
|
63
|
+
`Altertable.identify(user_id, **options)`
|
|
64
|
+
|
|
40
65
|
```ruby
|
|
41
66
|
Altertable.identify('user_123', traits: {
|
|
42
67
|
email: 'user@example.com',
|
|
43
68
|
name: 'John Doe'
|
|
44
|
-
}
|
|
69
|
+
})
|
|
45
70
|
```
|
|
46
71
|
|
|
47
72
|
### Alias
|
|
48
73
|
|
|
74
|
+
Merge a previous anonymous ID with a newly identified user ID.
|
|
75
|
+
|
|
76
|
+
`Altertable.alias(distinct_id, new_user_id, **options)`
|
|
77
|
+
|
|
49
78
|
```ruby
|
|
50
|
-
Altertable.alias('
|
|
79
|
+
Altertable.alias('anon_session_456', 'user_123')
|
|
51
80
|
```
|
|
52
81
|
|
|
82
|
+
## Configuration
|
|
83
|
+
|
|
84
|
+
You can configure the client by passing options during initialization.
|
|
85
|
+
|
|
86
|
+
| Option | Type | Default | Description |
|
|
87
|
+
|---|---|---|---|
|
|
88
|
+
| `environment` | String | `"production"` | Environment name (e.g., `production`, `development`). |
|
|
89
|
+
| `base_url` | String | `"https://api.altertable.ai"` | Base URL for API requests. |
|
|
90
|
+
| `request_timeout` | Integer | `5` | Request timeout in seconds. |
|
|
91
|
+
| `release` | String | `nil` | Application release version (e.g., commit hash). |
|
|
92
|
+
| `debug` | Boolean | `false` | Enable debug logging. |
|
|
93
|
+
| `on_error` | Proc | `nil` | Callback for handling errors. |
|
|
94
|
+
| `adapter` | Symbol | auto-detect | HTTP adapter to use (`:faraday`, `:httpx`, `:net_http`). |
|
|
95
|
+
|
|
53
96
|
## License
|
|
54
97
|
|
|
55
98
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/altertable.gemspec
CHANGED
|
@@ -37,7 +37,5 @@ Gem::Specification.new do |spec|
|
|
|
37
37
|
|
|
38
38
|
# Optional adapter support (development only)
|
|
39
39
|
spec.add_development_dependency "faraday", "~> 2.0"
|
|
40
|
-
spec.add_development_dependency "faraday-retry"
|
|
41
|
-
spec.add_development_dependency "faraday-net_http"
|
|
42
40
|
spec.add_development_dependency "httpx"
|
|
43
41
|
end
|
data/lib/altertable/adapters.rb
CHANGED
|
@@ -18,13 +18,10 @@ module Altertable
|
|
|
18
18
|
def initialize(base_url:, timeout:, headers: {})
|
|
19
19
|
super
|
|
20
20
|
require "faraday"
|
|
21
|
-
require "faraday/retry"
|
|
22
|
-
require "faraday/net_http"
|
|
23
21
|
|
|
24
22
|
@conn = Faraday.new(url: @base_url) do |f|
|
|
25
23
|
@headers.each { |k, v| f.headers[k] = v }
|
|
26
24
|
f.options.timeout = @timeout
|
|
27
|
-
f.request :retry, max: 3, interval: 0.05, backoff_factor: 2
|
|
28
25
|
f.adapter Faraday.default_adapter
|
|
29
26
|
end
|
|
30
27
|
end
|
data/lib/altertable/version.rb
CHANGED
data/rbi/altertable.rbi
CHANGED
|
@@ -77,7 +77,7 @@ module Altertable
|
|
|
77
77
|
sig { params(base_url: String, timeout: T.any(Integer, Float), headers: T.nilable(T::Hash[String, String])).void }
|
|
78
78
|
def initialize(base_url:, timeout:, headers: nil); end
|
|
79
79
|
|
|
80
|
-
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(Response) }
|
|
80
|
+
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) }
|
|
81
81
|
def post(path, body: nil, params: nil, &block); end
|
|
82
82
|
end
|
|
83
83
|
|
|
@@ -85,12 +85,12 @@ module Altertable
|
|
|
85
85
|
sig { params(base_url: String, timeout: T.any(Integer, Float), headers: T.nilable(T::Hash[String, String])).void }
|
|
86
86
|
def initialize(base_url:, timeout:, headers: nil); end
|
|
87
87
|
|
|
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(Response) }
|
|
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
|
|
90
90
|
|
|
91
91
|
private
|
|
92
92
|
|
|
93
|
-
sig { params(resp: T.untyped).returns(Response) }
|
|
93
|
+
sig { params(resp: T.untyped).returns(Altertable::Adapters::Response) }
|
|
94
94
|
def wrap_response(resp); end
|
|
95
95
|
end
|
|
96
96
|
|
|
@@ -98,12 +98,12 @@ module Altertable
|
|
|
98
98
|
sig { params(base_url: String, timeout: T.any(Integer, Float), headers: T.nilable(T::Hash[String, String])).void }
|
|
99
99
|
def initialize(base_url:, timeout:, headers: nil); end
|
|
100
100
|
|
|
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(Response) }
|
|
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
|
|
103
103
|
|
|
104
104
|
private
|
|
105
105
|
|
|
106
|
-
sig { params(resp: T.untyped).returns(Response) }
|
|
106
|
+
sig { params(resp: T.untyped).returns(Altertable::Adapters::Response) }
|
|
107
107
|
def wrap_response(resp); end
|
|
108
108
|
end
|
|
109
109
|
|
|
@@ -111,7 +111,7 @@ module Altertable
|
|
|
111
111
|
sig { params(base_url: String, timeout: T.any(Integer, Float), headers: T.nilable(T::Hash[String, String])).void }
|
|
112
112
|
def initialize(base_url:, timeout:, headers: nil); end
|
|
113
113
|
|
|
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(Response) }
|
|
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
116
|
end
|
|
117
117
|
end
|
data/rbi/todo.rbi
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
module Faraday; end
|
|
2
|
-
class Faraday::
|
|
3
|
-
class Faraday::
|
|
2
|
+
class Faraday::Error < StandardError; end
|
|
3
|
+
class Faraday::ServerError < Faraday::Error; end
|
|
4
|
+
class Faraday::ConnectionFailed < Faraday::Error; end
|
|
5
|
+
class Faraday::TimeoutError < Faraday::ServerError; end
|
|
6
|
+
|
|
4
7
|
module HTTPX; end
|
|
5
8
|
class HTTPX::Error < StandardError; end
|
|
6
9
|
class HTTPX::ErrorResponse; 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.
|
|
4
|
+
version: 1.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Altertable
|
|
@@ -149,34 +149,6 @@ dependencies:
|
|
|
149
149
|
- - "~>"
|
|
150
150
|
- !ruby/object:Gem::Version
|
|
151
151
|
version: '2.0'
|
|
152
|
-
- !ruby/object:Gem::Dependency
|
|
153
|
-
name: faraday-retry
|
|
154
|
-
requirement: !ruby/object:Gem::Requirement
|
|
155
|
-
requirements:
|
|
156
|
-
- - ">="
|
|
157
|
-
- !ruby/object:Gem::Version
|
|
158
|
-
version: '0'
|
|
159
|
-
type: :development
|
|
160
|
-
prerelease: false
|
|
161
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
162
|
-
requirements:
|
|
163
|
-
- - ">="
|
|
164
|
-
- !ruby/object:Gem::Version
|
|
165
|
-
version: '0'
|
|
166
|
-
- !ruby/object:Gem::Dependency
|
|
167
|
-
name: faraday-net_http
|
|
168
|
-
requirement: !ruby/object:Gem::Requirement
|
|
169
|
-
requirements:
|
|
170
|
-
- - ">="
|
|
171
|
-
- !ruby/object:Gem::Version
|
|
172
|
-
version: '0'
|
|
173
|
-
type: :development
|
|
174
|
-
prerelease: false
|
|
175
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
176
|
-
requirements:
|
|
177
|
-
- - ">="
|
|
178
|
-
- !ruby/object:Gem::Version
|
|
179
|
-
version: '0'
|
|
180
152
|
- !ruby/object:Gem::Dependency
|
|
181
153
|
name: httpx
|
|
182
154
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -202,6 +174,7 @@ files:
|
|
|
202
174
|
- ".github/ISSUE_TEMPLATE/feature_request.yml"
|
|
203
175
|
- ".github/workflows/ci.yml"
|
|
204
176
|
- ".github/workflows/release-please.yml"
|
|
177
|
+
- ".github/workflows/semantic-pull-request.yml"
|
|
205
178
|
- ".gitmodules"
|
|
206
179
|
- ".release-please-manifest.json"
|
|
207
180
|
- ".rubocop.yml"
|