eppo-server-sdk 3.5.1-x86_64-linux → 3.7.0-x86_64-linux

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: bb132dd4964a2170d3df0950ffb3611cd8dd8815a6f75cbdf37400784c6e0f17
4
- data.tar.gz: 462ca2091414b3baad9b8cc6368d44284ecaa488ba134e8701e71dde07267635
3
+ metadata.gz: 8b7d687153203134ae5a693a16bc1d21d85e440958772705c3fdd07d168a9fc9
4
+ data.tar.gz: 3b24c1c17e0443f757d4d8c7dd3db1c0cecce154fef70819a7960f6329a0d7b0
5
5
  SHA512:
6
- metadata.gz: 870223d034afb153182ea555187a789180e98aa96f50ac7c94d2dc02ce825c2dbdcaf4a32f0dbe837174b3390a8eabf6595bbc1c4839fd5b95ff7cfcbd1c70b8
7
- data.tar.gz: c2f2c2d292f61ce6fc0d686074785127ac5c04dc168cd19a518892907227ec83773ddfc1072e4614beead4c412e2de618b57d7322d07828fee982ffd7b8e6b20
6
+ metadata.gz: a6d6abc0f1231872b1405738c63c650f780f84e6ed4f286d57aa60961ba0a5d5c1f40b18d3bcf2db24d2692367c8f447b3e23d2657ef9071268b977430882642
7
+ data.tar.gz: d4ef5a889090f64d5059462c48e31bbb7e06d4a7a610b9ba43b0d934dd662a54ae8b44d7e93c9dfb087efbc94d4455b372ed58f9ac0ca73db43981a5e8b5accc
Binary file
Binary file
Binary file
Binary file
@@ -31,64 +31,210 @@ module EppoClient
31
31
  @core = EppoClient::Core::Client.new(config)
32
32
  end
33
33
 
34
+ ##
35
+ # Waits for client to fetch configuration and get ready to serve
36
+ # assignments.
37
+ #
38
+ # This method blocks the current thread until configuration is
39
+ # successfully fetched or +timeout+ seconds passed.
40
+ #
41
+ # Note: this method returns immediately if configuration poller
42
+ # has been disabled.
43
+ #
44
+ # @param timeout [Numeric] Maximum time to wait in seconds
45
+ # @return [nil]
46
+ def wait_for_initialization(timeout=1)
47
+ return unless @core
48
+ @core.wait_for_initialization(timeout)
49
+ end
50
+
51
+ ##
52
+ # Returns the currently active configuration.
34
53
  def configuration
35
54
  @core.configuration
36
55
  end
37
56
 
57
+ ##
58
+ # Sets the currently active configuration.
38
59
  def configuration=(configuration)
39
60
  @core.configuration = configuration
40
61
  end
41
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]
42
69
  def shutdown
43
70
  @core.shutdown
44
71
  end
45
72
 
46
- # Unstable
47
- # Enqueues an arbitrary event. Events must have a type and a payload
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.
48
80
  def unstable_track(event_type, payload)
49
81
  @core.track(event_type, payload)
50
82
  end
51
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.
52
92
  def get_string_assignment(flag_key, subject_key, subject_attributes, default_value)
53
93
  get_assignment_inner(flag_key, subject_key, subject_attributes, "STRING", default_value)
54
94
  end
55
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.
56
104
  def get_numeric_assignment(flag_key, subject_key, subject_attributes, default_value)
57
105
  get_assignment_inner(flag_key, subject_key, subject_attributes, "NUMERIC", default_value)
58
106
  end
59
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.
60
116
  def get_integer_assignment(flag_key, subject_key, subject_attributes, default_value)
61
117
  get_assignment_inner(flag_key, subject_key, subject_attributes, "INTEGER", default_value)
62
118
  end
63
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.
64
128
  def get_boolean_assignment(flag_key, subject_key, subject_attributes, default_value)
65
129
  get_assignment_inner(flag_key, subject_key, subject_attributes, "BOOLEAN", default_value)
66
130
  end
67
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.
68
140
  def get_json_assignment(flag_key, subject_key, subject_attributes, default_value)
69
141
  get_assignment_inner(flag_key, subject_key, subject_attributes, "JSON", default_value)
70
142
  end
71
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}}
72
157
  def get_string_assignment_details(flag_key, subject_key, subject_attributes, default_value)
73
158
  get_assignment_details_inner(flag_key, subject_key, subject_attributes, "STRING", default_value)
74
159
  end
75
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}}
76
174
  def get_numeric_assignment_details(flag_key, subject_key, subject_attributes, default_value)
77
175
  get_assignment_details_inner(flag_key, subject_key, subject_attributes, "NUMERIC", default_value)
78
176
  end
79
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}}
80
191
  def get_integer_assignment_details(flag_key, subject_key, subject_attributes, default_value)
81
192
  get_assignment_details_inner(flag_key, subject_key, subject_attributes, "INTEGER", default_value)
82
193
  end
83
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}}
84
208
  def get_boolean_assignment_details(flag_key, subject_key, subject_attributes, default_value)
85
209
  get_assignment_details_inner(flag_key, subject_key, subject_attributes, "BOOLEAN", default_value)
86
210
  end
87
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}}
88
225
  def get_json_assignment_details(flag_key, subject_key, subject_attributes, default_value)
89
226
  get_assignment_details_inner(flag_key, subject_key, subject_attributes, "JSON", default_value)
90
227
  end
91
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.
92
238
  def get_bandit_action(flag_key, subject_key, subject_attributes, actions, default_variation)
93
239
  attributes = coerce_context_attributes(subject_attributes)
94
240
  actions = actions.to_h { |action, attributes| [action, coerce_context_attributes(attributes)] }
@@ -103,6 +249,20 @@ module EppoClient
103
249
  }
104
250
  end
105
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}}
106
266
  def get_bandit_action_details(flag_key, subject_key, subject_attributes, actions, default_variation)
107
267
  attributes = coerce_context_attributes(subject_attributes)
108
268
  actions = actions.to_h { |action, attributes| [action, coerce_context_attributes(attributes)] }
@@ -120,7 +280,6 @@ module EppoClient
120
280
 
121
281
  private
122
282
 
123
- # rubocop:disable Metrics/MethodLength
124
283
  def get_assignment_inner(flag_key, subject_key, subject_attributes, expected_type, default_value)
125
284
  logger = Logger.new($stdout)
126
285
  begin
@@ -2,5 +2,5 @@
2
2
 
3
3
  # TODO: this version and ext/eppo_client/Cargo.toml should be in sync
4
4
  module EppoClient
5
- VERSION = "3.5.1"
5
+ VERSION = "3.7.0"
6
6
  end
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.5.1
4
+ version: 3.7.0
5
5
  platform: x86_64-linux
6
6
  authors:
7
7
  - Eppo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-03-14 00:00:00.000000000 Z
11
+ date: 2025-04-15 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: