eppo-server-sdk 3.3.0-arm64-darwin → 3.4.0-arm64-darwin
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/README.md +32 -0
- data/lib/eppo_client/3.0/eppo_client.bundle +0 -0
- data/lib/eppo_client/3.1/eppo_client.bundle +0 -0
- data/lib/eppo_client/3.2/eppo_client.bundle +0 -0
- data/lib/eppo_client/3.3/eppo_client.bundle +0 -0
- data/lib/eppo_client/client.rb +12 -14
- data/lib/eppo_client/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d26281ed1f0c756a09a52526309d9beb8e963ff1f69acdc89f87ac1f64d7bb78
|
4
|
+
data.tar.gz: 8ecd8d6ad9d6e59c659f7275db73b7075e9d0841659b41172eec2f7ee0313291
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19dfbc99026ced14fdc8ff301138398d2fe010c2a16b1b5cd909a8199c40ff6b3779d3c1cf2d6967c3450bd80f34ee8a160a9aeb3554a88638f745d4263e6b23
|
7
|
+
data.tar.gz: 9516f1854a143ed70c90b86ee4f33b539a9619e4675d4a7f47e8b45fb6ea55318312953a4db50e58f8b75ff76fb8014adef94d7eb1728cdc21b8a6cfce967b26
|
data/README.md
CHANGED
@@ -38,8 +38,40 @@ eppo_core = { path = '../eppo_core' }
|
|
38
38
|
|
39
39
|
Make sure you remove the override before updating `Cargo.lock`. Otherwise, the lock file will be missing `eppo_core` checksum and will be unsuitable for release. (CI will warn you if you do this accidentally.)
|
40
40
|
|
41
|
+
## Build locally
|
42
|
+
|
43
|
+
Install all dependencies:
|
44
|
+
```sh
|
45
|
+
bundle install
|
46
|
+
```
|
47
|
+
|
48
|
+
Build native extension:
|
49
|
+
```sh
|
50
|
+
bundle exec rake build
|
51
|
+
```
|
52
|
+
|
53
|
+
Run tests:
|
54
|
+
```sh
|
55
|
+
bundle exec rspec
|
56
|
+
```
|
57
|
+
|
41
58
|
## Releasing
|
42
59
|
|
43
60
|
* Bump versions in `ruby-sdk/lib/eppo_client/version.rb` and `ruby-sdk/ext/eppo_client/Cargo.toml`
|
44
61
|
* Run `cargo update --workspace --verbose` to update `Cargo.lock`
|
45
62
|
* Run `bundle` to update `Gemfile.lock`
|
63
|
+
|
64
|
+
|
65
|
+
## Building Ruby native lib
|
66
|
+
|
67
|
+
1. Clone this repository at the desired Ruby SDK tag, eg.: `git clone --depth 1 --branch ruby-sdk@x.y.z https://github.com/Eppo-exp/eppo-multiplatform.git`
|
68
|
+
2. Open `build.sh` and update `rb-sys-dock --platform <platform>` with the desired platform, eg.: `rb-sys-dock --platform x86_64-linux`
|
69
|
+
3. Run `docker build --build-arg WORKDIR=$(pwd) -f Dockerfile.ruby.build -t ruby-sdk-builder .` to build the builder docker image
|
70
|
+
4. Run the following command to build the gem with native lib:
|
71
|
+
```
|
72
|
+
mkdir -p rust/cargo/registry && docker run --rm -it \
|
73
|
+
-v /var/run/docker.sock:/var/run/docker.sock \
|
74
|
+
-v /tmp:/tmp -v \
|
75
|
+
$(pwd)/rust:$(pwd)/rust ruby-sdk-builder
|
76
|
+
```
|
77
|
+
5. The gem will be available at `ruby-sdk/pkg/eppo-server-sdk-x.y.z-arch.gem`
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/lib/eppo_client/client.rb
CHANGED
@@ -22,7 +22,7 @@ module EppoClient
|
|
22
22
|
def init(config)
|
23
23
|
config.validate
|
24
24
|
|
25
|
-
if
|
25
|
+
if @core
|
26
26
|
STDERR.puts "Eppo Warning: multiple initialization of the client"
|
27
27
|
@core.shutdown
|
28
28
|
end
|
@@ -91,7 +91,10 @@ module EppoClient
|
|
91
91
|
log_assignment(result[:assignment_event])
|
92
92
|
log_bandit_action(result[:bandit_event])
|
93
93
|
|
94
|
-
|
94
|
+
{
|
95
|
+
:variation => result[:variation],
|
96
|
+
:action => result[:action]
|
97
|
+
}
|
95
98
|
end
|
96
99
|
|
97
100
|
def get_bandit_action_details(flag_key, subject_key, subject_attributes, actions, default_variation)
|
@@ -102,7 +105,7 @@ module EppoClient
|
|
102
105
|
log_assignment(result[:assignment_event])
|
103
106
|
log_bandit_action(result[:bandit_event])
|
104
107
|
|
105
|
-
|
108
|
+
{
|
106
109
|
:variation => result[:variation],
|
107
110
|
:action => result[:action],
|
108
111
|
:evaluationDetails => details
|
@@ -116,13 +119,11 @@ module EppoClient
|
|
116
119
|
logger = Logger.new($stdout)
|
117
120
|
begin
|
118
121
|
assignment = @core.get_assignment(flag_key, subject_key, subject_attributes, expected_type)
|
119
|
-
|
120
|
-
return default_value
|
121
|
-
end
|
122
|
+
return default_value unless assignment
|
122
123
|
|
123
124
|
log_assignment(assignment[:event])
|
124
125
|
|
125
|
-
return assignment[:value]
|
126
|
+
return assignment[:value]
|
126
127
|
rescue StandardError => error
|
127
128
|
logger.debug("[Eppo SDK] Failed to get assignment: #{error}")
|
128
129
|
|
@@ -137,19 +138,16 @@ module EppoClient
|
|
137
138
|
result, event = @core.get_assignment_details(flag_key, subject_key, subject_attributes, expected_type)
|
138
139
|
log_assignment(event)
|
139
140
|
|
140
|
-
if
|
141
|
+
if !result[:variation]
|
141
142
|
result[:variation] = default_value
|
142
|
-
else
|
143
|
-
# unwrap from AssignmentValue to untyped value
|
144
|
-
result[:variation] = result[:variation][:value]
|
145
143
|
end
|
146
144
|
|
147
|
-
|
145
|
+
result
|
148
146
|
end
|
149
147
|
# rubocop:enable Metrics/MethodLength
|
150
148
|
|
151
149
|
def log_assignment(event)
|
152
|
-
|
150
|
+
return unless event
|
153
151
|
|
154
152
|
# Because rust's AssignmentEvent has a #[flatten] extra_logging
|
155
153
|
# field, serde_magnus serializes it as a normal HashMap with
|
@@ -170,7 +168,7 @@ module EppoClient
|
|
170
168
|
end
|
171
169
|
|
172
170
|
def log_bandit_action(event)
|
173
|
-
|
171
|
+
return unless event
|
174
172
|
|
175
173
|
begin
|
176
174
|
@assignment_logger.log_bandit_action(event)
|
data/lib/eppo_client/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eppo-server-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.4.0
|
5
5
|
platform: arm64-darwin
|
6
6
|
authors:
|
7
7
|
- Eppo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-01-10 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|