eppo-server-sdk 3.6.0-arm64-darwin → 3.7.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/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 +148 -3
- data/lib/eppo_client/version.rb +1 -1
- data/lib/eppo_client.rb +8 -0
- 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: 5ace4b9f12eb28590bb8fdce1ee23c754be1cc5866049a69c9c7351bc5e6a1eb
|
4
|
+
data.tar.gz: '080b59b10af6bd3452f46c3bb0c5e09d25165c59ce4a3d93d1ebfd0f31e5cda9'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e3667f2f2d94f9a23b184fb1e12798c0641df2891337df90b862656073018d829a1bc8c622bfa427c0cc75d600aa779475568a2abd5a6ad7362e528c399586c
|
7
|
+
data.tar.gz: 163a53a725ad85973ec25924e6c73705df1652b19f9607b4f516d9ce81163405593b2734510a71aa7732fe0756667da1bbd8bf9f68c4f5caddc16e2e1d14bdbc
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/lib/eppo_client/client.rb
CHANGED
@@ -40,69 +40,201 @@ module EppoClient
|
|
40
40
|
#
|
41
41
|
# Note: this method returns immediately if configuration poller
|
42
42
|
# has been disabled.
|
43
|
+
#
|
44
|
+
# @param timeout [Numeric] Maximum time to wait in seconds
|
45
|
+
# @return [nil]
|
43
46
|
def wait_for_initialization(timeout=1)
|
44
47
|
return unless @core
|
45
48
|
@core.wait_for_initialization(timeout)
|
46
49
|
end
|
47
50
|
|
51
|
+
##
|
52
|
+
# Returns the currently active configuration.
|
48
53
|
def configuration
|
49
54
|
@core.configuration
|
50
55
|
end
|
51
56
|
|
57
|
+
##
|
58
|
+
# Sets the currently active configuration.
|
52
59
|
def configuration=(configuration)
|
53
60
|
@core.configuration = configuration
|
54
61
|
end
|
55
62
|
|
63
|
+
##
|
64
|
+
# Prepare the client for shutdown.
|
65
|
+
#
|
66
|
+
# This method stops the configuration poller and any other background threads.
|
67
|
+
#
|
68
|
+
# @return [nil]
|
56
69
|
def shutdown
|
57
70
|
@core.shutdown
|
58
71
|
end
|
59
72
|
|
60
|
-
|
61
|
-
#
|
73
|
+
##
|
74
|
+
# Tracks an arbitrary event. Events must have a type and a payload.
|
75
|
+
#
|
76
|
+
# @note This method is considered unstable and may change in future versions.
|
77
|
+
#
|
78
|
+
# @param event_type [String] The type of the event to track.
|
79
|
+
# @param payload [Hash] The payload of the event to track.
|
62
80
|
def unstable_track(event_type, payload)
|
63
81
|
@core.track(event_type, payload)
|
64
82
|
end
|
65
83
|
|
84
|
+
##
|
85
|
+
# Returns a string assignment for the given flag key and subject.
|
86
|
+
#
|
87
|
+
# @param flag_key [String] The key of the flag to get an assignment for.
|
88
|
+
# @param subject_key [String] The key of the subject to get an assignment for.
|
89
|
+
# @param subject_attributes [Hash] The attributes of the subject to get an assignment for.
|
90
|
+
# @param default_value [String] The default value to return if the flag is not found or no assignment can be made.
|
91
|
+
# @return [String] The assignment for the given flag key and subject.
|
66
92
|
def get_string_assignment(flag_key, subject_key, subject_attributes, default_value)
|
67
93
|
get_assignment_inner(flag_key, subject_key, subject_attributes, "STRING", default_value)
|
68
94
|
end
|
69
95
|
|
96
|
+
##
|
97
|
+
# Returns a numeric assignment for the given flag key and subject.
|
98
|
+
#
|
99
|
+
# @param flag_key [String] The key of the flag to get an assignment for.
|
100
|
+
# @param subject_key [String] The key of the subject to get an assignment for.
|
101
|
+
# @param subject_attributes [Hash] The attributes of the subject to get an assignment for.
|
102
|
+
# @param default_value [Numeric] The default value to return if the flag is not found or no assignment can be made.
|
103
|
+
# @return [Numeric] The assignment for the given flag key and subject.
|
70
104
|
def get_numeric_assignment(flag_key, subject_key, subject_attributes, default_value)
|
71
105
|
get_assignment_inner(flag_key, subject_key, subject_attributes, "NUMERIC", default_value)
|
72
106
|
end
|
73
107
|
|
108
|
+
##
|
109
|
+
# Returns an integer assignment for the given flag key and subject.
|
110
|
+
#
|
111
|
+
# @param flag_key [String] The key of the flag to get an assignment for.
|
112
|
+
# @param subject_key [String] The key of the subject to get an assignment for.
|
113
|
+
# @param subject_attributes [Hash] The attributes of the subject to get an assignment for.
|
114
|
+
# @param default_value [Integer] The default value to return if the flag is not found or no assignment can be made.
|
115
|
+
# @return [Integer] The assignment for the given flag key and subject.
|
74
116
|
def get_integer_assignment(flag_key, subject_key, subject_attributes, default_value)
|
75
117
|
get_assignment_inner(flag_key, subject_key, subject_attributes, "INTEGER", default_value)
|
76
118
|
end
|
77
119
|
|
120
|
+
##
|
121
|
+
# Returns a boolean assignment for the given flag key and subject.
|
122
|
+
#
|
123
|
+
# @param flag_key [String] The key of the flag to get an assignment for.
|
124
|
+
# @param subject_key [String] The key of the subject to get an assignment for.
|
125
|
+
# @param subject_attributes [Hash] The attributes of the subject to get an assignment for.
|
126
|
+
# @param default_value [Boolean] The default value to return if the flag is not found or no assignment can be made.
|
127
|
+
# @return [Boolean] The assignment for the given flag key and subject.
|
78
128
|
def get_boolean_assignment(flag_key, subject_key, subject_attributes, default_value)
|
79
129
|
get_assignment_inner(flag_key, subject_key, subject_attributes, "BOOLEAN", default_value)
|
80
130
|
end
|
81
131
|
|
132
|
+
##
|
133
|
+
# Returns a JSON assignment for the given flag key and subject.
|
134
|
+
#
|
135
|
+
# @param flag_key [String] The key of the flag to get an assignment for.
|
136
|
+
# @param subject_key [String] The key of the subject to get an assignment for.
|
137
|
+
# @param subject_attributes [Hash] The attributes of the subject to get an assignment for.
|
138
|
+
# @param default_value [Hash] The default value to return if the flag is not found or no assignment can be made.
|
139
|
+
# @return [Hash] The assignment for the given flag key and subject.
|
82
140
|
def get_json_assignment(flag_key, subject_key, subject_attributes, default_value)
|
83
141
|
get_assignment_inner(flag_key, subject_key, subject_attributes, "JSON", default_value)
|
84
142
|
end
|
85
143
|
|
144
|
+
##
|
145
|
+
# Returns detailed information about a string assignment for the given flag key and subject.
|
146
|
+
#
|
147
|
+
# @note This method is intended for debugging purposes and is discouraged from use in
|
148
|
+
# production. It is a couple of times slower than the non-detail methods. The evaluation
|
149
|
+
# details format is primarily designed for human consumption (debugging) and is therefore
|
150
|
+
# unstable and may change between SDK versions.
|
151
|
+
#
|
152
|
+
# @param flag_key [String] The key of the flag to get an assignment for.
|
153
|
+
# @param subject_key [String] The key of the subject to get an assignment for.
|
154
|
+
# @param subject_attributes [Hash] The attributes of the subject to get an assignment for.
|
155
|
+
# @param default_value [String] The default value to return if the flag is not found or no assignment can be made.
|
156
|
+
# @return [Hash] A hash containing {:variation => assigned_value, :action => nil, :evaluationDetails => {detailed_evaluation_info}}
|
86
157
|
def get_string_assignment_details(flag_key, subject_key, subject_attributes, default_value)
|
87
158
|
get_assignment_details_inner(flag_key, subject_key, subject_attributes, "STRING", default_value)
|
88
159
|
end
|
89
160
|
|
161
|
+
##
|
162
|
+
# Returns detailed information about a numeric assignment for the given flag key and subject.
|
163
|
+
#
|
164
|
+
# @note This method is intended for debugging purposes and is discouraged from use in
|
165
|
+
# production. It is a couple of times slower than the non-detail methods. The evaluation
|
166
|
+
# details format is primarily designed for human consumption (debugging) and is therefore
|
167
|
+
# unstable.
|
168
|
+
#
|
169
|
+
# @param flag_key [String] The key of the flag to get an assignment for.
|
170
|
+
# @param subject_key [String] The key of the subject to get an assignment for.
|
171
|
+
# @param subject_attributes [Hash] The attributes of the subject to get an assignment for.
|
172
|
+
# @param default_value [Numeric] The default value to return if the flag is not found or no assignment can be made.
|
173
|
+
# @return [Hash] A hash containing {:variation => assigned_value, :action => nil, :evaluationDetails => {detailed_evaluation_info}}
|
90
174
|
def get_numeric_assignment_details(flag_key, subject_key, subject_attributes, default_value)
|
91
175
|
get_assignment_details_inner(flag_key, subject_key, subject_attributes, "NUMERIC", default_value)
|
92
176
|
end
|
93
177
|
|
178
|
+
##
|
179
|
+
# Returns detailed information about an integer assignment for the given flag key and subject.
|
180
|
+
#
|
181
|
+
# @note This method is intended for debugging purposes and is discouraged from use in
|
182
|
+
# production. It is a couple of times slower than the non-detail methods. The evaluation
|
183
|
+
# details format is primarily designed for human consumption (debugging) and is therefore
|
184
|
+
# unstable and may change between SDK versions.
|
185
|
+
#
|
186
|
+
# @param flag_key [String] The key of the flag to get an assignment for.
|
187
|
+
# @param subject_key [String] The key of the subject to get an assignment for.
|
188
|
+
# @param subject_attributes [Hash] The attributes of the subject to get an assignment for.
|
189
|
+
# @param default_value [Integer] The default value to return if the flag is not found or no assignment can be made.
|
190
|
+
# @return [Hash] A hash containing {:variation => assigned_value, :action => nil, :evaluationDetails => {detailed_evaluation_info}}
|
94
191
|
def get_integer_assignment_details(flag_key, subject_key, subject_attributes, default_value)
|
95
192
|
get_assignment_details_inner(flag_key, subject_key, subject_attributes, "INTEGER", default_value)
|
96
193
|
end
|
97
194
|
|
195
|
+
##
|
196
|
+
# Returns detailed information about a boolean assignment for the given flag key and subject.
|
197
|
+
#
|
198
|
+
# @note This method is intended for debugging purposes and is discouraged from use in
|
199
|
+
# production. It is a couple of times slower than the non-detail methods. The evaluation
|
200
|
+
# details format is primarily designed for human consumption (debugging) and is therefore
|
201
|
+
# unstable and may change between SDK versions.
|
202
|
+
#
|
203
|
+
# @param flag_key [String] The key of the flag to get an assignment for.
|
204
|
+
# @param subject_key [String] The key of the subject to get an assignment for.
|
205
|
+
# @param subject_attributes [Hash] The attributes of the subject to get an assignment for.
|
206
|
+
# @param default_value [Boolean] The default value to return if the flag is not found or no assignment can be made.
|
207
|
+
# @return [Hash] A hash containing {:variation => assigned_value, :action => nil, :evaluationDetails => {detailed_evaluation_info}}
|
98
208
|
def get_boolean_assignment_details(flag_key, subject_key, subject_attributes, default_value)
|
99
209
|
get_assignment_details_inner(flag_key, subject_key, subject_attributes, "BOOLEAN", default_value)
|
100
210
|
end
|
101
211
|
|
212
|
+
##
|
213
|
+
# Returns detailed information about a JSON assignment for the given flag key and subject.
|
214
|
+
#
|
215
|
+
# @note This method is intended for debugging purposes and is discouraged from use in
|
216
|
+
# production. It is a couple of times slower than the non-detail methods. The evaluation
|
217
|
+
# details format is primarily designed for human consumption (debugging) and is therefore
|
218
|
+
# unstable and may change between SDK versions.
|
219
|
+
#
|
220
|
+
# @param flag_key [String] The key of the flag to get an assignment for.
|
221
|
+
# @param subject_key [String] The key of the subject to get an assignment for.
|
222
|
+
# @param subject_attributes [Hash] The attributes of the subject to get an assignment for.
|
223
|
+
# @param default_value [Hash] The default value to return if the flag is not found or no assignment can be made.
|
224
|
+
# @return [Hash] A hash containing {:variation => assigned_value, :action => nil, :evaluationDetails => {detailed_evaluation_info}}
|
102
225
|
def get_json_assignment_details(flag_key, subject_key, subject_attributes, default_value)
|
103
226
|
get_assignment_details_inner(flag_key, subject_key, subject_attributes, "JSON", default_value)
|
104
227
|
end
|
105
228
|
|
229
|
+
##
|
230
|
+
# Returns a bandit action based on the flag key, subject, and available actions.
|
231
|
+
#
|
232
|
+
# @param flag_key [String] The key of the flag to get an action for.
|
233
|
+
# @param subject_key [String] The key of the subject to get an action for.
|
234
|
+
# @param subject_attributes [Hash] The attributes of the subject.
|
235
|
+
# @param actions [Hash] A map of available actions and their attributes.
|
236
|
+
# @param default_variation [String] The default variation to return if no assignment can be made.
|
237
|
+
# @return [Hash] A hash containing the assigned variation and action.
|
106
238
|
def get_bandit_action(flag_key, subject_key, subject_attributes, actions, default_variation)
|
107
239
|
attributes = coerce_context_attributes(subject_attributes)
|
108
240
|
actions = actions.to_h { |action, attributes| [action, coerce_context_attributes(attributes)] }
|
@@ -117,6 +249,20 @@ module EppoClient
|
|
117
249
|
}
|
118
250
|
end
|
119
251
|
|
252
|
+
##
|
253
|
+
# Returns detailed information about a bandit action based on the flag key, subject, and available actions.
|
254
|
+
#
|
255
|
+
# @note This method is intended for debugging purposes and is discouraged from use in
|
256
|
+
# production. It is a couple of times slower than the non-detail methods. The evaluation
|
257
|
+
# details format is primarily designed for human consumption (debugging) and is therefore
|
258
|
+
# unstable and may change between SDK versions.
|
259
|
+
#
|
260
|
+
# @param flag_key [String] The key of the flag to get an action for.
|
261
|
+
# @param subject_key [String] The key of the subject to get an action for.
|
262
|
+
# @param subject_attributes [Hash] The attributes of the subject.
|
263
|
+
# @param actions [Hash] A map of available actions and their attributes.
|
264
|
+
# @param default_variation [String] The default variation to return if no assignment can be made.
|
265
|
+
# @return [Hash] A hash containing {:variation => assigned_variation, :action => assigned_action, :evaluationDetails => {detailed_evaluation_info}}
|
120
266
|
def get_bandit_action_details(flag_key, subject_key, subject_attributes, actions, default_variation)
|
121
267
|
attributes = coerce_context_attributes(subject_attributes)
|
122
268
|
actions = actions.to_h { |action, attributes| [action, coerce_context_attributes(attributes)] }
|
@@ -134,7 +280,6 @@ module EppoClient
|
|
134
280
|
|
135
281
|
private
|
136
282
|
|
137
|
-
# rubocop:disable Metrics/MethodLength
|
138
283
|
def get_assignment_inner(flag_key, subject_key, subject_attributes, expected_type, default_value)
|
139
284
|
logger = Logger.new($stdout)
|
140
285
|
begin
|
data/lib/eppo_client/version.rb
CHANGED
data/lib/eppo_client.rb
CHANGED
@@ -6,6 +6,14 @@ require_relative "eppo_client/version"
|
|
6
6
|
# EppoClient is the main module for initializing the Eppo client.
|
7
7
|
# It provides a method to initialize the client with a given configuration.
|
8
8
|
module EppoClient
|
9
|
+
##
|
10
|
+
# Initializes the Eppo client singleton.
|
11
|
+
#
|
12
|
+
# @note The client returned by this method may still be in the process of initializing.
|
13
|
+
# Use the `#wait_for_initialization` method to wait for the client to be ready.
|
14
|
+
#
|
15
|
+
# @param config [EppoClient::Config] The configuration for the client.
|
16
|
+
# @return [EppoClient::Client] The client.
|
9
17
|
def init(config)
|
10
18
|
client = EppoClient::Client.instance
|
11
19
|
client.init(config)
|
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.7.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: 2025-
|
11
|
+
date: 2025-04-15 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|