eppo-server-sdk 3.6.0-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: a9f5298b4fa60a274ce3b55196f14be8b7e01ffb6a6696cd02221ade32ea741a
4
- data.tar.gz: 2803d92a70f01fe57ef5023a849affc662ffa54dce73418a9de88e1047a51f60
3
+ metadata.gz: 8b7d687153203134ae5a693a16bc1d21d85e440958772705c3fdd07d168a9fc9
4
+ data.tar.gz: 3b24c1c17e0443f757d4d8c7dd3db1c0cecce154fef70819a7960f6329a0d7b0
5
5
  SHA512:
6
- metadata.gz: 66ef7c37377ea31bccfab519489bb651f8af44d5e5867eaa7f68db2e1e52de56cdb7ffd3a4cdb89810b8a827bd17220291b8dd81d5b3bf4ed761d6382aa14c4e
7
- data.tar.gz: 13d2df1f0c2fda4152696ed16f844748375ab84c250289d3b737cd9e433986e066a5ac207f0806254e17c980ab8157bd45fe1b1e9aa973e0510a9c0d5a52d5d8
6
+ metadata.gz: a6d6abc0f1231872b1405738c63c650f780f84e6ed4f286d57aa60961ba0a5d5c1f40b18d3bcf2db24d2692367c8f447b3e23d2657ef9071268b977430882642
7
+ data.tar.gz: d4ef5a889090f64d5059462c48e31bbb7e06d4a7a610b9ba43b0d934dd662a54ae8b44d7e93c9dfb087efbc94d4455b372ed58f9ac0ca73db43981a5e8b5accc
Binary file
Binary file
Binary file
Binary file
@@ -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
- # Unstable
61
- # 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.
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
@@ -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.6.0"
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.6.0
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-19 00:00:00.000000000 Z
11
+ date: 2025-04-15 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: