altertable 0.4.0 → 1.1.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/.github/workflows/ci.yml +27 -0
- data/.release-please-manifest.json +1 -1
- data/.rubocop.yml +52 -7
- data/CHANGELOG.md +18 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +50 -16
- data/README.md +5 -5
- data/Rakefile +3 -1
- data/altertable.gemspec +5 -2
- data/lib/altertable/adapters.rb +3 -3
- data/lib/altertable/client.rb +30 -13
- data/lib/altertable/version.rb +1 -1
- data/lib/altertable.rb +6 -6
- data/mise.toml +2 -0
- data/rbi/altertable.rbi +20 -20
- data/rbi/todo.rbi +6 -0
- data/sig/altertable/client.rbs +3 -3
- data/sig/altertable.rbs +3 -3
- metadata +47 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b8e41db18f92cfe24f4683b754172ebb01eb38ba880184bdf03d1e66b8771153
|
|
4
|
+
data.tar.gz: 46ce07f124fedec9d6054b3e66e28605fb847816f787506d62b99eda97dd474b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 71d0cc5553baba7918630973a66413aeb6eda1f6332977695a8ba686852748a0e9c183a244f343800d81de6535762ce1c64e61d38465b7ca05965e2b89caa3e8
|
|
7
|
+
data.tar.gz: 8b9e20155315a28c9479b4701b89fba0ec5e2ffcecfff8a19890bb841d1569effd17e6e99fac40dfdf4db73e7e290c41437da83969f6fb48ab182b0c1fcca1a0
|
data/.github/workflows/ci.yml
CHANGED
|
@@ -7,6 +7,18 @@ on:
|
|
|
7
7
|
branches: [main]
|
|
8
8
|
|
|
9
9
|
jobs:
|
|
10
|
+
lint:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v4
|
|
14
|
+
- name: Set up Ruby
|
|
15
|
+
uses: ruby/setup-ruby@v1
|
|
16
|
+
with:
|
|
17
|
+
ruby-version: "3.4"
|
|
18
|
+
bundler-cache: true
|
|
19
|
+
- name: Run rubocop
|
|
20
|
+
run: bundle exec rubocop
|
|
21
|
+
|
|
10
22
|
test:
|
|
11
23
|
runs-on: ubuntu-latest
|
|
12
24
|
strategy:
|
|
@@ -40,3 +52,18 @@ jobs:
|
|
|
40
52
|
|
|
41
53
|
- name: Run tests
|
|
42
54
|
run: bundle exec rake spec
|
|
55
|
+
|
|
56
|
+
typing:
|
|
57
|
+
name: "Typing"
|
|
58
|
+
runs-on: ubuntu-latest
|
|
59
|
+
steps:
|
|
60
|
+
- uses: actions/checkout@v4
|
|
61
|
+
- name: Set up Ruby
|
|
62
|
+
uses: ruby/setup-ruby@v1
|
|
63
|
+
with:
|
|
64
|
+
ruby-version: "3.4"
|
|
65
|
+
bundler-cache: true
|
|
66
|
+
- name: Validate RBS
|
|
67
|
+
run: bundle exec rbs validate
|
|
68
|
+
- name: Typecheck with Sorbet
|
|
69
|
+
run: bundle exec srb tc
|
data/.rubocop.yml
CHANGED
|
@@ -1,18 +1,63 @@
|
|
|
1
|
-
|
|
1
|
+
plugins:
|
|
2
2
|
- rubocop-performance
|
|
3
3
|
- rubocop-rspec
|
|
4
4
|
|
|
5
5
|
AllCops:
|
|
6
6
|
NewCops: enable
|
|
7
|
+
TargetRubyVersion: 3.0
|
|
7
8
|
Exclude:
|
|
8
9
|
- 'vendor/**/*'
|
|
9
|
-
- 'spec
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
Max: 120
|
|
10
|
+
- 'spec/**/*'
|
|
11
|
+
- 'bin/**/*'
|
|
12
|
+
- 'gemfiles/**/*'
|
|
13
13
|
|
|
14
14
|
Style/Documentation:
|
|
15
15
|
Enabled: false
|
|
16
|
-
|
|
17
16
|
Style/FrozenStringLiteralComment:
|
|
18
|
-
Enabled:
|
|
17
|
+
Enabled: false
|
|
18
|
+
Style/StringLiterals:
|
|
19
|
+
Enabled: false
|
|
20
|
+
Layout/LineLength:
|
|
21
|
+
Enabled: false
|
|
22
|
+
Metrics/MethodLength:
|
|
23
|
+
Enabled: false
|
|
24
|
+
Metrics/ParameterLists:
|
|
25
|
+
Enabled: false
|
|
26
|
+
Metrics/AbcSize:
|
|
27
|
+
Enabled: false
|
|
28
|
+
Metrics/CyclomaticComplexity:
|
|
29
|
+
Enabled: false
|
|
30
|
+
Metrics/PerceivedComplexity:
|
|
31
|
+
Enabled: false
|
|
32
|
+
Layout/TrailingWhitespace:
|
|
33
|
+
Enabled: false
|
|
34
|
+
Metrics/ClassLength:
|
|
35
|
+
Enabled: false
|
|
36
|
+
Gemspec/RequireMFA:
|
|
37
|
+
Enabled: false
|
|
38
|
+
Gemspec/OrderedDependencies:
|
|
39
|
+
Enabled: false
|
|
40
|
+
Gemspec/DevelopmentDependencies:
|
|
41
|
+
Enabled: false
|
|
42
|
+
Gemspec/RequiredRubyVersion:
|
|
43
|
+
Enabled: false
|
|
44
|
+
Style/IfUnlessModifier:
|
|
45
|
+
Enabled: false
|
|
46
|
+
Layout/EmptyLineAfterGuardClause:
|
|
47
|
+
Enabled: false
|
|
48
|
+
Layout/EmptyLinesAroundModuleBody:
|
|
49
|
+
Enabled: false
|
|
50
|
+
Lint/MissingSuper:
|
|
51
|
+
Enabled: false
|
|
52
|
+
Naming/MethodParameterName:
|
|
53
|
+
Enabled: false
|
|
54
|
+
Layout/IndentationWidth:
|
|
55
|
+
Enabled: false
|
|
56
|
+
Style/Proc:
|
|
57
|
+
Enabled: false
|
|
58
|
+
Style/FetchEnvVar:
|
|
59
|
+
Enabled: false
|
|
60
|
+
Style/MutableConstant:
|
|
61
|
+
Enabled: false
|
|
62
|
+
Bundler/OrderedGems:
|
|
63
|
+
Enabled: false
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.1.0](https://github.com/altertable-ai/altertable-ruby/compare/altertable/v1.0.0...altertable/v1.1.0) (2026-03-09)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* plug rubocop ([#25](https://github.com/altertable-ai/altertable-ruby/issues/25)) ([1b375d5](https://github.com/altertable-ai/altertable-ruby/commit/1b375d5246d595972378e88bd61d56420a65ee39)), closes [#24](https://github.com/altertable-ai/altertable-ruby/issues/24)
|
|
9
|
+
|
|
10
|
+
## [1.0.0](https://github.com/altertable-ai/altertable-ruby/compare/altertable/v0.4.0...altertable/v1.0.0) (2026-03-09)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### ⚠ BREAKING CHANGES
|
|
14
|
+
|
|
15
|
+
* update method signatures to v0.9.0 specs ([#23](https://github.com/altertable-ai/altertable-ruby/issues/23))
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* update method signatures to v0.9.0 specs ([#23](https://github.com/altertable-ai/altertable-ruby/issues/23)) ([1c26f52](https://github.com/altertable-ai/altertable-ruby/commit/1c26f5229aa4bd3811ac83351df06d3275496d2f))
|
|
20
|
+
|
|
3
21
|
## [0.4.0](https://github.com/altertable-ai/altertable-ruby/compare/altertable/v0.3.0...altertable/v0.4.0) (2026-03-09)
|
|
4
22
|
|
|
5
23
|
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
altertable (
|
|
4
|
+
altertable (1.1.0)
|
|
5
5
|
|
|
6
6
|
GEM
|
|
7
7
|
remote: https://rubygems.org/
|
|
@@ -10,11 +10,13 @@ GEM
|
|
|
10
10
|
public_suffix (>= 2.0.2, < 8.0)
|
|
11
11
|
ast (2.4.3)
|
|
12
12
|
base64 (0.3.0)
|
|
13
|
+
benchmark (0.5.0)
|
|
13
14
|
bigdecimal (4.0.1)
|
|
14
15
|
diff-lcs (1.6.2)
|
|
15
16
|
docker-api (2.4.0)
|
|
16
17
|
excon (>= 0.64.0)
|
|
17
18
|
multi_json
|
|
19
|
+
erubi (1.13.1)
|
|
18
20
|
excon (1.4.0)
|
|
19
21
|
logger
|
|
20
22
|
faraday (2.14.1)
|
|
@@ -40,6 +42,7 @@ GEM
|
|
|
40
42
|
multi_json (1.19.1)
|
|
41
43
|
net-http (0.9.1)
|
|
42
44
|
uri (>= 0.11.1)
|
|
45
|
+
netrc (0.11.0)
|
|
43
46
|
parallel (1.27.0)
|
|
44
47
|
parser (3.3.10.2)
|
|
45
48
|
ast (~> 2.4.1)
|
|
@@ -49,7 +52,14 @@ GEM
|
|
|
49
52
|
racc (1.8.1)
|
|
50
53
|
rainbow (3.1.1)
|
|
51
54
|
rake (13.3.1)
|
|
55
|
+
rbi (0.3.9)
|
|
56
|
+
prism (~> 1.0)
|
|
57
|
+
rbs (>= 3.4.4)
|
|
58
|
+
rbs (3.10.3)
|
|
59
|
+
logger
|
|
60
|
+
tsort
|
|
52
61
|
regexp_parser (2.11.3)
|
|
62
|
+
rexml (3.4.4)
|
|
53
63
|
rspec (3.13.2)
|
|
54
64
|
rspec-core (~> 3.13.0)
|
|
55
65
|
rspec-expectations (~> 3.13.0)
|
|
@@ -78,36 +88,56 @@ GEM
|
|
|
78
88
|
rubocop-ast (1.49.0)
|
|
79
89
|
parser (>= 3.3.7.2)
|
|
80
90
|
prism (~> 1.7)
|
|
81
|
-
rubocop-capybara (2.22.1)
|
|
82
|
-
lint_roller (~> 1.1)
|
|
83
|
-
rubocop (~> 1.72, >= 1.72.1)
|
|
84
|
-
rubocop-factory_bot (2.28.0)
|
|
85
|
-
lint_roller (~> 1.1)
|
|
86
|
-
rubocop (~> 1.72, >= 1.72.1)
|
|
87
91
|
rubocop-performance (1.26.1)
|
|
88
92
|
lint_roller (~> 1.1)
|
|
89
93
|
rubocop (>= 1.75.0, < 2.0)
|
|
90
94
|
rubocop-ast (>= 1.47.1, < 2.0)
|
|
91
|
-
rubocop-rspec (
|
|
92
|
-
|
|
93
|
-
rubocop
|
|
94
|
-
rubocop-factory_bot (~> 2.22)
|
|
95
|
-
rubocop-rspec_rails (~> 2.28)
|
|
96
|
-
rubocop-rspec_rails (2.29.1)
|
|
97
|
-
rubocop (~> 1.61)
|
|
95
|
+
rubocop-rspec (3.9.0)
|
|
96
|
+
lint_roller (~> 1.1)
|
|
97
|
+
rubocop (~> 1.81)
|
|
98
98
|
ruby-progressbar (1.13.0)
|
|
99
|
+
sorbet (0.6.12997)
|
|
100
|
+
sorbet-static (= 0.6.12997)
|
|
101
|
+
sorbet-runtime (0.6.12997)
|
|
102
|
+
sorbet-static (0.6.12997-universal-darwin)
|
|
103
|
+
sorbet-static (0.6.12997-x86_64-linux)
|
|
104
|
+
sorbet-static-and-runtime (0.6.12997)
|
|
105
|
+
sorbet (= 0.6.12997)
|
|
106
|
+
sorbet-runtime (= 0.6.12997)
|
|
107
|
+
spoom (1.6.3)
|
|
108
|
+
erubi (>= 1.10.0)
|
|
109
|
+
prism (>= 0.28.0)
|
|
110
|
+
rbi (>= 0.3.3)
|
|
111
|
+
rexml (>= 3.2.6)
|
|
112
|
+
sorbet-static-and-runtime (>= 0.5.10187)
|
|
113
|
+
thor (>= 0.19.2)
|
|
114
|
+
tapioca (0.16.11)
|
|
115
|
+
benchmark
|
|
116
|
+
bundler (>= 2.2.25)
|
|
117
|
+
netrc (>= 0.11.0)
|
|
118
|
+
parallel (>= 1.21.0)
|
|
119
|
+
rbi (~> 0.2)
|
|
120
|
+
sorbet-static-and-runtime (>= 0.5.11087)
|
|
121
|
+
spoom (>= 1.2.0)
|
|
122
|
+
thor (>= 1.2.0)
|
|
123
|
+
yard-sorbet
|
|
99
124
|
testcontainers (0.2.0)
|
|
100
125
|
testcontainers-core (= 0.2.0)
|
|
101
126
|
testcontainers-core (0.2.0)
|
|
102
127
|
docker-api (~> 2.2)
|
|
128
|
+
thor (1.5.0)
|
|
129
|
+
tsort (0.2.0)
|
|
103
130
|
unicode-display_width (3.2.0)
|
|
104
131
|
unicode-emoji (~> 4.1)
|
|
105
132
|
unicode-emoji (4.2.0)
|
|
106
133
|
uri (1.1.1)
|
|
134
|
+
yard (0.9.38)
|
|
135
|
+
yard-sorbet (0.9.0)
|
|
136
|
+
sorbet-runtime
|
|
137
|
+
yard
|
|
107
138
|
|
|
108
139
|
PLATFORMS
|
|
109
140
|
arm64-darwin-25
|
|
110
|
-
ruby
|
|
111
141
|
x86_64-linux
|
|
112
142
|
|
|
113
143
|
DEPENDENCIES
|
|
@@ -118,10 +148,14 @@ DEPENDENCIES
|
|
|
118
148
|
faraday-retry
|
|
119
149
|
httpx
|
|
120
150
|
rake (~> 13.0)
|
|
151
|
+
rbs
|
|
121
152
|
rspec (~> 3.0, >= 0)
|
|
122
153
|
rubocop (~> 1.0)
|
|
123
154
|
rubocop-performance (~> 1.0)
|
|
124
|
-
rubocop-rspec (~>
|
|
155
|
+
rubocop-rspec (~> 3.0)
|
|
156
|
+
sorbet
|
|
157
|
+
sorbet-runtime
|
|
158
|
+
tapioca
|
|
125
159
|
testcontainers
|
|
126
160
|
|
|
127
161
|
BUNDLED WITH
|
data/README.md
CHANGED
|
@@ -29,25 +29,25 @@ Altertable.init('your_api_key', {
|
|
|
29
29
|
### Tracking Events
|
|
30
30
|
|
|
31
31
|
```ruby
|
|
32
|
-
Altertable.track('button_clicked', 'user_123', {
|
|
32
|
+
Altertable.track('button_clicked', 'user_123', properties: {
|
|
33
33
|
button_id: 'signup_btn',
|
|
34
34
|
page: 'home'
|
|
35
|
-
})
|
|
35
|
+
}, timestamp: Time.now.utc.iso8601)
|
|
36
36
|
```
|
|
37
37
|
|
|
38
38
|
### Identifying Users
|
|
39
39
|
|
|
40
40
|
```ruby
|
|
41
|
-
Altertable.identify('user_123', {
|
|
41
|
+
Altertable.identify('user_123', traits: {
|
|
42
42
|
email: 'user@example.com',
|
|
43
43
|
name: 'John Doe'
|
|
44
|
-
})
|
|
44
|
+
}, anonymous_id: 'previous_anon_id')
|
|
45
45
|
```
|
|
46
46
|
|
|
47
47
|
### Alias
|
|
48
48
|
|
|
49
49
|
```ruby
|
|
50
|
-
Altertable.alias('
|
|
50
|
+
Altertable.alias('previous_anonymous_id', 'new_user_id')
|
|
51
51
|
```
|
|
52
52
|
|
|
53
53
|
## License
|
data/Rakefile
CHANGED
data/altertable.gemspec
CHANGED
|
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
|
19
19
|
spec.metadata["changelog_uri"] = "https://github.com/altertable-ai/altertable-ruby/blob/main/CHANGELOG.md"
|
|
20
20
|
|
|
21
21
|
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
|
22
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
22
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|sorbet)/}) }
|
|
23
23
|
end
|
|
24
24
|
spec.bindir = "exe"
|
|
25
25
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
@@ -29,8 +29,11 @@ Gem::Specification.new do |spec|
|
|
|
29
29
|
spec.add_development_dependency "rspec", "~> 3.0"
|
|
30
30
|
spec.add_development_dependency "rubocop", "~> 1.0"
|
|
31
31
|
spec.add_development_dependency "rubocop-performance", "~> 1.0"
|
|
32
|
-
spec.add_development_dependency "rubocop-rspec", "~>
|
|
32
|
+
spec.add_development_dependency "rubocop-rspec", "~> 3.0"
|
|
33
33
|
spec.add_development_dependency "testcontainers"
|
|
34
|
+
spec.add_development_dependency "rbs"
|
|
35
|
+
spec.add_development_dependency "sorbet"
|
|
36
|
+
spec.add_development_dependency "sorbet-runtime"
|
|
34
37
|
|
|
35
38
|
# Optional adapter support (development only)
|
|
36
39
|
spec.add_development_dependency "faraday", "~> 2.0"
|
data/lib/altertable/adapters.rb
CHANGED
|
@@ -29,7 +29,7 @@ module Altertable
|
|
|
29
29
|
end
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
-
def post(path, body: nil, params: {}
|
|
32
|
+
def post(path, body: nil, params: {})
|
|
33
33
|
resp = @conn.post(path) do |req|
|
|
34
34
|
req.params = params
|
|
35
35
|
req.body = body
|
|
@@ -59,7 +59,7 @@ module Altertable
|
|
|
59
59
|
)
|
|
60
60
|
end
|
|
61
61
|
|
|
62
|
-
def post(path, body: nil, params: {}
|
|
62
|
+
def post(path, body: nil, params: {})
|
|
63
63
|
resp = @client.post(path, body: body, params: params)
|
|
64
64
|
wrap_response(resp)
|
|
65
65
|
rescue HTTPX::Error => e
|
|
@@ -84,7 +84,7 @@ module Altertable
|
|
|
84
84
|
@uri = URI.parse(@base_url)
|
|
85
85
|
end
|
|
86
86
|
|
|
87
|
-
def post(path, body: nil, params: {}
|
|
87
|
+
def post(path, body: nil, params: {})
|
|
88
88
|
uri = URI.join(@uri, path)
|
|
89
89
|
uri.query = URI.encode_www_form(params) unless params.empty?
|
|
90
90
|
|
data/lib/altertable/client.rb
CHANGED
|
@@ -31,38 +31,47 @@ module Altertable
|
|
|
31
31
|
@adapter = select_adapter(adapter_name, { base_url: @base_url, timeout: @timeout, headers: headers })
|
|
32
32
|
end
|
|
33
33
|
|
|
34
|
-
def track(event, distinct_id,
|
|
34
|
+
def track(event, distinct_id, **options)
|
|
35
|
+
properties = options[:properties] || {}
|
|
36
|
+
timestamp = options[:timestamp] || Time.now.utc.iso8601(3)
|
|
35
37
|
payload = {
|
|
36
|
-
timestamp:
|
|
38
|
+
timestamp: timestamp,
|
|
37
39
|
event: event,
|
|
38
40
|
environment: @environment,
|
|
39
41
|
distinct_id: distinct_id,
|
|
40
42
|
properties: {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
+
'$lib': "altertable-ruby",
|
|
44
|
+
'$lib_version': Altertable::VERSION
|
|
43
45
|
}.merge(properties)
|
|
44
46
|
}
|
|
45
47
|
payload[:properties]["$release"] = @release if @release
|
|
48
|
+
payload[:anonymous_id] = options[:anonymous_id] if options.key?(:anonymous_id)
|
|
49
|
+
payload[:device_id] = options[:device_id] if options.key?(:device_id)
|
|
46
50
|
|
|
47
51
|
post("/track", payload)
|
|
48
52
|
end
|
|
49
53
|
|
|
50
|
-
def identify(user_id,
|
|
54
|
+
def identify(user_id, **options)
|
|
55
|
+
traits = options[:traits] || {}
|
|
56
|
+
timestamp = options[:timestamp] || Time.now.utc.iso8601(3)
|
|
51
57
|
payload = {
|
|
52
|
-
timestamp:
|
|
58
|
+
timestamp: timestamp,
|
|
53
59
|
environment: @environment,
|
|
54
60
|
distinct_id: user_id,
|
|
55
61
|
traits: traits
|
|
56
62
|
}
|
|
63
|
+
payload[:anonymous_id] = options[:anonymous_id] if options.key?(:anonymous_id)
|
|
64
|
+
payload[:device_id] = options[:device_id] if options.key?(:device_id)
|
|
57
65
|
|
|
58
66
|
post("/identify", payload)
|
|
59
67
|
end
|
|
60
68
|
|
|
61
|
-
def alias(new_user_id,
|
|
69
|
+
def alias(distinct_id, new_user_id, **options)
|
|
70
|
+
timestamp = options[:timestamp] || Time.now.utc.iso8601(3)
|
|
62
71
|
payload = {
|
|
63
|
-
timestamp:
|
|
72
|
+
timestamp: timestamp,
|
|
64
73
|
environment: @environment,
|
|
65
|
-
distinct_id:
|
|
74
|
+
distinct_id: distinct_id,
|
|
66
75
|
new_user_id: new_user_id
|
|
67
76
|
}
|
|
68
77
|
|
|
@@ -108,10 +117,18 @@ module Altertable
|
|
|
108
117
|
def handle_response(res)
|
|
109
118
|
case res.status
|
|
110
119
|
when 200..299
|
|
111
|
-
|
|
120
|
+
begin
|
|
121
|
+
JSON.parse(res.body)
|
|
122
|
+
rescue StandardError
|
|
123
|
+
{}
|
|
124
|
+
end
|
|
112
125
|
when 422
|
|
113
|
-
error_data =
|
|
114
|
-
|
|
126
|
+
error_data = begin
|
|
127
|
+
JSON.parse(res.body)
|
|
128
|
+
rescue StandardError
|
|
129
|
+
{}
|
|
130
|
+
end
|
|
131
|
+
raise ApiError.new("Unprocessable Entity: #{error_data['message']}", res.status, error_data)
|
|
115
132
|
else
|
|
116
133
|
raise ApiError.new("HTTP Error: #{res.status}", res.status)
|
|
117
134
|
end
|
|
@@ -124,7 +141,7 @@ module Altertable
|
|
|
124
141
|
AltertableError.new(error.message, error)
|
|
125
142
|
end
|
|
126
143
|
|
|
127
|
-
@on_error&.call(wrapped_error)
|
|
144
|
+
@on_error&.call(wrapped_error)
|
|
128
145
|
raise wrapped_error
|
|
129
146
|
end
|
|
130
147
|
end
|
data/lib/altertable/version.rb
CHANGED
data/lib/altertable.rb
CHANGED
|
@@ -10,16 +10,16 @@ module Altertable
|
|
|
10
10
|
@client = Client.new(api_key, options)
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
-
def track(event,
|
|
14
|
-
client.track(event,
|
|
13
|
+
def track(event, distinct_id, **options)
|
|
14
|
+
client.track(event, distinct_id, **options)
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
-
def identify(user_id,
|
|
18
|
-
client.identify(user_id,
|
|
17
|
+
def identify(user_id, **options)
|
|
18
|
+
client.identify(user_id, **options)
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
-
def alias(new_user_id,
|
|
22
|
-
client.alias(new_user_id,
|
|
21
|
+
def alias(distinct_id, new_user_id, **options)
|
|
22
|
+
client.alias(distinct_id, new_user_id, **options)
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
def client
|
data/mise.toml
ADDED
data/rbi/altertable.rbi
CHANGED
|
@@ -34,14 +34,14 @@ module Altertable
|
|
|
34
34
|
sig { params(api_key: String, options: T::Hash[Symbol, T.untyped]).void }
|
|
35
35
|
def initialize(api_key, options = {}); end
|
|
36
36
|
|
|
37
|
-
sig { params(event: String, distinct_id: String,
|
|
38
|
-
def track(event, distinct_id,
|
|
37
|
+
sig { params(event: String, distinct_id: String, options: T.untyped).returns(T.untyped) }
|
|
38
|
+
def track(event, distinct_id, **options); end
|
|
39
39
|
|
|
40
|
-
sig { params(user_id: String,
|
|
41
|
-
def identify(user_id,
|
|
40
|
+
sig { params(user_id: String, options: T.untyped).returns(T.untyped) }
|
|
41
|
+
def identify(user_id, **options); end
|
|
42
42
|
|
|
43
|
-
sig { params(new_user_id: String,
|
|
44
|
-
def alias(new_user_id,
|
|
43
|
+
sig { params(distinct_id: String, new_user_id: String, options: T.untyped).returns(T.untyped) }
|
|
44
|
+
def alias(distinct_id, new_user_id, **options); end
|
|
45
45
|
|
|
46
46
|
private
|
|
47
47
|
|
|
@@ -77,16 +77,16 @@ 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])).returns(Response) }
|
|
81
|
-
def post(path, body: nil, params: nil); end
|
|
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) }
|
|
81
|
+
def post(path, body: nil, params: nil, &block); end
|
|
82
82
|
end
|
|
83
83
|
|
|
84
84
|
class FaradayAdapter < Base
|
|
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])).returns(Response) }
|
|
89
|
-
def post(path, body: nil, params: nil); end
|
|
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) }
|
|
89
|
+
def post(path, body: nil, params: nil, &block); end
|
|
90
90
|
|
|
91
91
|
private
|
|
92
92
|
|
|
@@ -98,8 +98,8 @@ 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])).returns(Response) }
|
|
102
|
-
def post(path, body: nil, params: nil); end
|
|
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) }
|
|
102
|
+
def post(path, body: nil, params: nil, &block); end
|
|
103
103
|
|
|
104
104
|
private
|
|
105
105
|
|
|
@@ -111,22 +111,22 @@ 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])).returns(Response) }
|
|
115
|
-
def post(path, body: nil, params: nil); end
|
|
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) }
|
|
115
|
+
def post(path, body: nil, params: nil, &block); end
|
|
116
116
|
end
|
|
117
117
|
end
|
|
118
118
|
|
|
119
119
|
sig { params(api_key: String, options: T::Hash[Symbol, T.untyped]).returns(Client) }
|
|
120
120
|
def self.init(api_key, options = {}); end
|
|
121
121
|
|
|
122
|
-
sig { params(event: String,
|
|
123
|
-
def self.track(event,
|
|
122
|
+
sig { params(event: String, distinct_id: String, options: T.untyped).returns(T.untyped) }
|
|
123
|
+
def self.track(event, distinct_id, **options); end
|
|
124
124
|
|
|
125
|
-
sig { params(user_id: String,
|
|
126
|
-
def self.identify(user_id,
|
|
125
|
+
sig { params(user_id: String, options: T.untyped).returns(T.untyped) }
|
|
126
|
+
def self.identify(user_id, **options); end
|
|
127
127
|
|
|
128
|
-
sig { params(new_user_id: String,
|
|
129
|
-
def self.alias(new_user_id,
|
|
128
|
+
sig { params(distinct_id: String, new_user_id: String, options: T.untyped).returns(T.untyped) }
|
|
129
|
+
def self.alias(distinct_id, new_user_id, **options); end
|
|
130
130
|
|
|
131
131
|
sig { returns(Client) }
|
|
132
132
|
def self.client; end
|
data/rbi/todo.rbi
ADDED
data/sig/altertable/client.rbs
CHANGED
|
@@ -15,11 +15,11 @@ module Altertable
|
|
|
15
15
|
|
|
16
16
|
def initialize: (String api_key, ?::Hash[Symbol, untyped] options) -> void
|
|
17
17
|
|
|
18
|
-
def track: (String event, String distinct_id,
|
|
18
|
+
def track: (String event, String distinct_id, **untyped options) -> untyped
|
|
19
19
|
|
|
20
|
-
def identify: (String user_id,
|
|
20
|
+
def identify: (String user_id, **untyped options) -> untyped
|
|
21
21
|
|
|
22
|
-
def alias: (String
|
|
22
|
+
def alias: (String distinct_id, String new_user_id, **untyped options) -> untyped
|
|
23
23
|
|
|
24
24
|
private
|
|
25
25
|
|
data/sig/altertable.rbs
CHANGED
|
@@ -3,11 +3,11 @@ module Altertable
|
|
|
3
3
|
|
|
4
4
|
def self.init: (String api_key, ?::Hash[Symbol, untyped] options) -> Client
|
|
5
5
|
|
|
6
|
-
def self.track: (String event, String
|
|
6
|
+
def self.track: (String event, String distinct_id, **untyped options) -> untyped
|
|
7
7
|
|
|
8
|
-
def self.identify: (String user_id,
|
|
8
|
+
def self.identify: (String user_id, **untyped options) -> untyped
|
|
9
9
|
|
|
10
|
-
def self.alias: (String
|
|
10
|
+
def self.alias: (String distinct_id, String new_user_id, **untyped options) -> untyped
|
|
11
11
|
|
|
12
12
|
def self.client: () -> Client
|
|
13
13
|
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:
|
|
4
|
+
version: 1.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Altertable
|
|
@@ -71,14 +71,14 @@ dependencies:
|
|
|
71
71
|
requirements:
|
|
72
72
|
- - "~>"
|
|
73
73
|
- !ruby/object:Gem::Version
|
|
74
|
-
version: '
|
|
74
|
+
version: '3.0'
|
|
75
75
|
type: :development
|
|
76
76
|
prerelease: false
|
|
77
77
|
version_requirements: !ruby/object:Gem::Requirement
|
|
78
78
|
requirements:
|
|
79
79
|
- - "~>"
|
|
80
80
|
- !ruby/object:Gem::Version
|
|
81
|
-
version: '
|
|
81
|
+
version: '3.0'
|
|
82
82
|
- !ruby/object:Gem::Dependency
|
|
83
83
|
name: testcontainers
|
|
84
84
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -93,6 +93,48 @@ dependencies:
|
|
|
93
93
|
- - ">="
|
|
94
94
|
- !ruby/object:Gem::Version
|
|
95
95
|
version: '0'
|
|
96
|
+
- !ruby/object:Gem::Dependency
|
|
97
|
+
name: rbs
|
|
98
|
+
requirement: !ruby/object:Gem::Requirement
|
|
99
|
+
requirements:
|
|
100
|
+
- - ">="
|
|
101
|
+
- !ruby/object:Gem::Version
|
|
102
|
+
version: '0'
|
|
103
|
+
type: :development
|
|
104
|
+
prerelease: false
|
|
105
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
106
|
+
requirements:
|
|
107
|
+
- - ">="
|
|
108
|
+
- !ruby/object:Gem::Version
|
|
109
|
+
version: '0'
|
|
110
|
+
- !ruby/object:Gem::Dependency
|
|
111
|
+
name: sorbet
|
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
|
113
|
+
requirements:
|
|
114
|
+
- - ">="
|
|
115
|
+
- !ruby/object:Gem::Version
|
|
116
|
+
version: '0'
|
|
117
|
+
type: :development
|
|
118
|
+
prerelease: false
|
|
119
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
120
|
+
requirements:
|
|
121
|
+
- - ">="
|
|
122
|
+
- !ruby/object:Gem::Version
|
|
123
|
+
version: '0'
|
|
124
|
+
- !ruby/object:Gem::Dependency
|
|
125
|
+
name: sorbet-runtime
|
|
126
|
+
requirement: !ruby/object:Gem::Requirement
|
|
127
|
+
requirements:
|
|
128
|
+
- - ">="
|
|
129
|
+
- !ruby/object:Gem::Version
|
|
130
|
+
version: '0'
|
|
131
|
+
type: :development
|
|
132
|
+
prerelease: false
|
|
133
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
134
|
+
requirements:
|
|
135
|
+
- - ">="
|
|
136
|
+
- !ruby/object:Gem::Version
|
|
137
|
+
version: '0'
|
|
96
138
|
- !ruby/object:Gem::Dependency
|
|
97
139
|
name: faraday
|
|
98
140
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -178,7 +220,9 @@ files:
|
|
|
178
220
|
- lib/altertable/client.rb
|
|
179
221
|
- lib/altertable/errors.rb
|
|
180
222
|
- lib/altertable/version.rb
|
|
223
|
+
- mise.toml
|
|
181
224
|
- rbi/altertable.rbi
|
|
225
|
+
- rbi/todo.rbi
|
|
182
226
|
- release-please-config.json
|
|
183
227
|
- sig/altertable.rbs
|
|
184
228
|
- sig/altertable/adapters.rbs
|