optimizely-sdk 3.10.1 → 4.0.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/LICENSE +202 -202
- data/lib/optimizely/audience.rb +127 -97
- data/lib/optimizely/bucketer.rb +156 -156
- data/lib/optimizely/condition_tree_evaluator.rb +123 -123
- data/lib/optimizely/config/datafile_project_config.rb +539 -552
- data/lib/optimizely/config/proxy_config.rb +34 -34
- data/lib/optimizely/config_manager/async_scheduler.rb +95 -95
- data/lib/optimizely/config_manager/http_project_config_manager.rb +330 -329
- data/lib/optimizely/config_manager/project_config_manager.rb +24 -24
- data/lib/optimizely/config_manager/static_project_config_manager.rb +53 -52
- data/lib/optimizely/decide/optimizely_decide_option.rb +28 -28
- data/lib/optimizely/decide/optimizely_decision.rb +60 -60
- data/lib/optimizely/decide/optimizely_decision_message.rb +26 -26
- data/lib/optimizely/decision_service.rb +563 -563
- data/lib/optimizely/error_handler.rb +39 -39
- data/lib/optimizely/event/batch_event_processor.rb +235 -234
- data/lib/optimizely/event/entity/conversion_event.rb +44 -43
- data/lib/optimizely/event/entity/decision.rb +38 -38
- data/lib/optimizely/event/entity/event_batch.rb +86 -86
- data/lib/optimizely/event/entity/event_context.rb +50 -50
- data/lib/optimizely/event/entity/impression_event.rb +48 -47
- data/lib/optimizely/event/entity/snapshot.rb +33 -33
- data/lib/optimizely/event/entity/snapshot_event.rb +48 -48
- data/lib/optimizely/event/entity/user_event.rb +22 -22
- data/lib/optimizely/event/entity/visitor.rb +36 -35
- data/lib/optimizely/event/entity/visitor_attribute.rb +38 -37
- data/lib/optimizely/event/event_factory.rb +156 -155
- data/lib/optimizely/event/event_processor.rb +25 -25
- data/lib/optimizely/event/forwarding_event_processor.rb +44 -43
- data/lib/optimizely/event/user_event_factory.rb +88 -88
- data/lib/optimizely/event_builder.rb +221 -228
- data/lib/optimizely/event_dispatcher.rb +71 -71
- data/lib/optimizely/exceptions.rb +135 -139
- data/lib/optimizely/helpers/constants.rb +415 -397
- data/lib/optimizely/helpers/date_time_utils.rb +30 -30
- data/lib/optimizely/helpers/event_tag_utils.rb +132 -132
- data/lib/optimizely/helpers/group.rb +31 -31
- data/lib/optimizely/helpers/http_utils.rb +65 -64
- data/lib/optimizely/helpers/validator.rb +183 -183
- data/lib/optimizely/helpers/variable_type.rb +67 -67
- data/lib/optimizely/logger.rb +46 -45
- data/lib/optimizely/notification_center.rb +174 -176
- data/lib/optimizely/optimizely_config.rb +271 -272
- data/lib/optimizely/optimizely_factory.rb +181 -181
- data/lib/optimizely/optimizely_user_context.rb +204 -179
- data/lib/optimizely/params.rb +31 -31
- data/lib/optimizely/project_config.rb +99 -91
- data/lib/optimizely/semantic_version.rb +166 -166
- data/lib/optimizely/{custom_attribute_condition_evaluator.rb → user_condition_evaluator.rb} +391 -369
- data/lib/optimizely/user_profile_service.rb +35 -35
- data/lib/optimizely/version.rb +21 -21
- data/lib/optimizely.rb +1130 -1145
- metadata +13 -13
@@ -1,397 +1,415 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
#
|
4
|
-
# Copyright 2016-2020, Optimizely and contributors
|
5
|
-
#
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
-
# you may not use this file except in compliance with the License.
|
8
|
-
# You may obtain a copy of the License at
|
9
|
-
#
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
-
# See the License for the specific language governing permissions and
|
16
|
-
# limitations under the License.
|
17
|
-
#
|
18
|
-
module Optimizely
|
19
|
-
module Helpers
|
20
|
-
module Constants
|
21
|
-
JSON_SCHEMA_V2 = {
|
22
|
-
'type' => 'object',
|
23
|
-
'properties' => {
|
24
|
-
'projectId' => {
|
25
|
-
'type' => 'string'
|
26
|
-
},
|
27
|
-
'accountId' => {
|
28
|
-
'type' => 'string'
|
29
|
-
},
|
30
|
-
'groups' => {
|
31
|
-
'type' => 'array',
|
32
|
-
'items' => {
|
33
|
-
'type' => 'object',
|
34
|
-
'properties' => {
|
35
|
-
'id' => {
|
36
|
-
'type' => 'string'
|
37
|
-
},
|
38
|
-
'policy' => {
|
39
|
-
'type' => 'string'
|
40
|
-
},
|
41
|
-
'trafficAllocation' => {
|
42
|
-
'type' => 'array',
|
43
|
-
'items' => {
|
44
|
-
'type' => 'object',
|
45
|
-
'properties' => {
|
46
|
-
'entityId' => {
|
47
|
-
'type' => 'string'
|
48
|
-
},
|
49
|
-
'endOfRange' => {
|
50
|
-
'type' => 'integer'
|
51
|
-
}
|
52
|
-
},
|
53
|
-
'required' => %w[
|
54
|
-
entityId
|
55
|
-
endOfRange
|
56
|
-
]
|
57
|
-
}
|
58
|
-
},
|
59
|
-
'experiments' => {
|
60
|
-
'type' => 'array',
|
61
|
-
'items' => {
|
62
|
-
'type' => 'object',
|
63
|
-
'properties' => {
|
64
|
-
'id' => {
|
65
|
-
'type' => 'string'
|
66
|
-
},
|
67
|
-
'layerId' => {
|
68
|
-
'type' => 'string'
|
69
|
-
},
|
70
|
-
'key' => {
|
71
|
-
'type' => 'string'
|
72
|
-
},
|
73
|
-
'status' => {
|
74
|
-
'type' => 'string'
|
75
|
-
},
|
76
|
-
'variations' => {
|
77
|
-
'type' => 'array',
|
78
|
-
'items' => {
|
79
|
-
'type' => 'object',
|
80
|
-
'properties' => {
|
81
|
-
'id' => {
|
82
|
-
'type' => 'string'
|
83
|
-
},
|
84
|
-
'key' => {
|
85
|
-
'type' => 'string'
|
86
|
-
}
|
87
|
-
},
|
88
|
-
'required' => %w[
|
89
|
-
id
|
90
|
-
key
|
91
|
-
]
|
92
|
-
}
|
93
|
-
},
|
94
|
-
'trafficAllocation' => {
|
95
|
-
'type' => 'array',
|
96
|
-
'items' => {
|
97
|
-
'type' => 'object',
|
98
|
-
'properties' => {
|
99
|
-
'entityId' => {
|
100
|
-
'type' => 'string'
|
101
|
-
},
|
102
|
-
'endOfRange' => {
|
103
|
-
'type' => 'integer'
|
104
|
-
}
|
105
|
-
},
|
106
|
-
'required' => %w[
|
107
|
-
entityId
|
108
|
-
endOfRange
|
109
|
-
]
|
110
|
-
}
|
111
|
-
},
|
112
|
-
'audienceIds' => {
|
113
|
-
'type' => 'array',
|
114
|
-
'items' => {
|
115
|
-
'type' => 'string'
|
116
|
-
}
|
117
|
-
},
|
118
|
-
'forcedVariations' => {
|
119
|
-
'type' => 'object'
|
120
|
-
}
|
121
|
-
},
|
122
|
-
'required' => %w[
|
123
|
-
id
|
124
|
-
layerId
|
125
|
-
key
|
126
|
-
status
|
127
|
-
variations
|
128
|
-
trafficAllocation
|
129
|
-
audienceIds
|
130
|
-
forcedVariations
|
131
|
-
]
|
132
|
-
}
|
133
|
-
}
|
134
|
-
},
|
135
|
-
'required' => %w[
|
136
|
-
id
|
137
|
-
policy
|
138
|
-
trafficAllocation
|
139
|
-
experiments
|
140
|
-
]
|
141
|
-
}
|
142
|
-
},
|
143
|
-
'experiments' => {
|
144
|
-
'type' => 'array',
|
145
|
-
'items' => {
|
146
|
-
'type' => 'object',
|
147
|
-
'properties' => {
|
148
|
-
'id' => {
|
149
|
-
'type' => 'string'
|
150
|
-
},
|
151
|
-
'key' => {
|
152
|
-
'type' => 'string'
|
153
|
-
},
|
154
|
-
'status' => {
|
155
|
-
'type' => 'string'
|
156
|
-
},
|
157
|
-
'layerId' => {
|
158
|
-
'type' => 'string'
|
159
|
-
},
|
160
|
-
'variations' => {
|
161
|
-
'type' => 'array',
|
162
|
-
'items' => {
|
163
|
-
'type' => 'object',
|
164
|
-
'properties' => {
|
165
|
-
'id' => {
|
166
|
-
'type' => 'string'
|
167
|
-
},
|
168
|
-
'key' => {
|
169
|
-
'type' => 'string'
|
170
|
-
}
|
171
|
-
},
|
172
|
-
'required' => %w[
|
173
|
-
id
|
174
|
-
key
|
175
|
-
]
|
176
|
-
}
|
177
|
-
},
|
178
|
-
'trafficAllocation' => {
|
179
|
-
'type' => 'array',
|
180
|
-
'items' => {
|
181
|
-
'type' => 'object',
|
182
|
-
'properties' => {
|
183
|
-
'entityId' => {
|
184
|
-
'type' => 'string'
|
185
|
-
},
|
186
|
-
'endOfRange' => {
|
187
|
-
'type' => 'integer'
|
188
|
-
}
|
189
|
-
},
|
190
|
-
'required' => %w[
|
191
|
-
entityId
|
192
|
-
endOfRange
|
193
|
-
]
|
194
|
-
}
|
195
|
-
},
|
196
|
-
'audienceIds' => {
|
197
|
-
'type' => 'array',
|
198
|
-
'items' => {
|
199
|
-
'type' => 'string'
|
200
|
-
}
|
201
|
-
},
|
202
|
-
'forcedVariations' => {
|
203
|
-
'type' => 'object'
|
204
|
-
}
|
205
|
-
},
|
206
|
-
'required' => %w[
|
207
|
-
id
|
208
|
-
key
|
209
|
-
variations
|
210
|
-
trafficAllocation
|
211
|
-
audienceIds
|
212
|
-
forcedVariations
|
213
|
-
status
|
214
|
-
layerId
|
215
|
-
]
|
216
|
-
}
|
217
|
-
},
|
218
|
-
'events' => {
|
219
|
-
'type' => 'array',
|
220
|
-
'items' => {
|
221
|
-
'type' => 'object',
|
222
|
-
'properties' => {
|
223
|
-
'key' => {
|
224
|
-
'type' => 'string'
|
225
|
-
},
|
226
|
-
'experimentIds' => {
|
227
|
-
'type' => 'array',
|
228
|
-
'items' => {
|
229
|
-
'type' => 'string'
|
230
|
-
}
|
231
|
-
},
|
232
|
-
'id' => {
|
233
|
-
'type' => 'string'
|
234
|
-
}
|
235
|
-
},
|
236
|
-
'required' => %w[
|
237
|
-
key
|
238
|
-
experimentIds
|
239
|
-
id
|
240
|
-
]
|
241
|
-
}
|
242
|
-
},
|
243
|
-
'audiences' => {
|
244
|
-
'type' => 'array',
|
245
|
-
'items' => {
|
246
|
-
'type' => 'object',
|
247
|
-
'properties' => {
|
248
|
-
'id' => {
|
249
|
-
'type' => 'string'
|
250
|
-
},
|
251
|
-
'name' => {
|
252
|
-
'type' => 'string'
|
253
|
-
},
|
254
|
-
'conditions' => {
|
255
|
-
'type' => 'string'
|
256
|
-
}
|
257
|
-
},
|
258
|
-
'required' => %w[
|
259
|
-
id
|
260
|
-
name
|
261
|
-
conditions
|
262
|
-
]
|
263
|
-
}
|
264
|
-
},
|
265
|
-
'attributes' => {
|
266
|
-
'type' => 'array',
|
267
|
-
'items' => {
|
268
|
-
'type' => 'object',
|
269
|
-
'properties' => {
|
270
|
-
'id' => {
|
271
|
-
'type' => 'string'
|
272
|
-
},
|
273
|
-
'key' => {
|
274
|
-
'type' => 'string'
|
275
|
-
}
|
276
|
-
},
|
277
|
-
'required' => %w[
|
278
|
-
id
|
279
|
-
key
|
280
|
-
]
|
281
|
-
}
|
282
|
-
},
|
283
|
-
'version' => {
|
284
|
-
'type' => 'string'
|
285
|
-
},
|
286
|
-
'revision' => {
|
287
|
-
'type' => 'string'
|
288
|
-
}
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
'
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
'
|
323
|
-
'
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
'
|
340
|
-
|
341
|
-
'
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
'
|
346
|
-
|
347
|
-
'
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
'
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
'
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
'
|
369
|
-
'
|
370
|
-
'
|
371
|
-
'
|
372
|
-
'
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
'
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
'
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
'
|
387
|
-
|
388
|
-
'
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
#
|
4
|
+
# Copyright 2016-2020, Optimizely and contributors
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
module Optimizely
|
19
|
+
module Helpers
|
20
|
+
module Constants
|
21
|
+
JSON_SCHEMA_V2 = {
|
22
|
+
'type' => 'object',
|
23
|
+
'properties' => {
|
24
|
+
'projectId' => {
|
25
|
+
'type' => 'string'
|
26
|
+
},
|
27
|
+
'accountId' => {
|
28
|
+
'type' => 'string'
|
29
|
+
},
|
30
|
+
'groups' => {
|
31
|
+
'type' => 'array',
|
32
|
+
'items' => {
|
33
|
+
'type' => 'object',
|
34
|
+
'properties' => {
|
35
|
+
'id' => {
|
36
|
+
'type' => 'string'
|
37
|
+
},
|
38
|
+
'policy' => {
|
39
|
+
'type' => 'string'
|
40
|
+
},
|
41
|
+
'trafficAllocation' => {
|
42
|
+
'type' => 'array',
|
43
|
+
'items' => {
|
44
|
+
'type' => 'object',
|
45
|
+
'properties' => {
|
46
|
+
'entityId' => {
|
47
|
+
'type' => 'string'
|
48
|
+
},
|
49
|
+
'endOfRange' => {
|
50
|
+
'type' => 'integer'
|
51
|
+
}
|
52
|
+
},
|
53
|
+
'required' => %w[
|
54
|
+
entityId
|
55
|
+
endOfRange
|
56
|
+
]
|
57
|
+
}
|
58
|
+
},
|
59
|
+
'experiments' => {
|
60
|
+
'type' => 'array',
|
61
|
+
'items' => {
|
62
|
+
'type' => 'object',
|
63
|
+
'properties' => {
|
64
|
+
'id' => {
|
65
|
+
'type' => 'string'
|
66
|
+
},
|
67
|
+
'layerId' => {
|
68
|
+
'type' => 'string'
|
69
|
+
},
|
70
|
+
'key' => {
|
71
|
+
'type' => 'string'
|
72
|
+
},
|
73
|
+
'status' => {
|
74
|
+
'type' => 'string'
|
75
|
+
},
|
76
|
+
'variations' => {
|
77
|
+
'type' => 'array',
|
78
|
+
'items' => {
|
79
|
+
'type' => 'object',
|
80
|
+
'properties' => {
|
81
|
+
'id' => {
|
82
|
+
'type' => 'string'
|
83
|
+
},
|
84
|
+
'key' => {
|
85
|
+
'type' => 'string'
|
86
|
+
}
|
87
|
+
},
|
88
|
+
'required' => %w[
|
89
|
+
id
|
90
|
+
key
|
91
|
+
]
|
92
|
+
}
|
93
|
+
},
|
94
|
+
'trafficAllocation' => {
|
95
|
+
'type' => 'array',
|
96
|
+
'items' => {
|
97
|
+
'type' => 'object',
|
98
|
+
'properties' => {
|
99
|
+
'entityId' => {
|
100
|
+
'type' => 'string'
|
101
|
+
},
|
102
|
+
'endOfRange' => {
|
103
|
+
'type' => 'integer'
|
104
|
+
}
|
105
|
+
},
|
106
|
+
'required' => %w[
|
107
|
+
entityId
|
108
|
+
endOfRange
|
109
|
+
]
|
110
|
+
}
|
111
|
+
},
|
112
|
+
'audienceIds' => {
|
113
|
+
'type' => 'array',
|
114
|
+
'items' => {
|
115
|
+
'type' => 'string'
|
116
|
+
}
|
117
|
+
},
|
118
|
+
'forcedVariations' => {
|
119
|
+
'type' => 'object'
|
120
|
+
}
|
121
|
+
},
|
122
|
+
'required' => %w[
|
123
|
+
id
|
124
|
+
layerId
|
125
|
+
key
|
126
|
+
status
|
127
|
+
variations
|
128
|
+
trafficAllocation
|
129
|
+
audienceIds
|
130
|
+
forcedVariations
|
131
|
+
]
|
132
|
+
}
|
133
|
+
}
|
134
|
+
},
|
135
|
+
'required' => %w[
|
136
|
+
id
|
137
|
+
policy
|
138
|
+
trafficAllocation
|
139
|
+
experiments
|
140
|
+
]
|
141
|
+
}
|
142
|
+
},
|
143
|
+
'experiments' => {
|
144
|
+
'type' => 'array',
|
145
|
+
'items' => {
|
146
|
+
'type' => 'object',
|
147
|
+
'properties' => {
|
148
|
+
'id' => {
|
149
|
+
'type' => 'string'
|
150
|
+
},
|
151
|
+
'key' => {
|
152
|
+
'type' => 'string'
|
153
|
+
},
|
154
|
+
'status' => {
|
155
|
+
'type' => 'string'
|
156
|
+
},
|
157
|
+
'layerId' => {
|
158
|
+
'type' => 'string'
|
159
|
+
},
|
160
|
+
'variations' => {
|
161
|
+
'type' => 'array',
|
162
|
+
'items' => {
|
163
|
+
'type' => 'object',
|
164
|
+
'properties' => {
|
165
|
+
'id' => {
|
166
|
+
'type' => 'string'
|
167
|
+
},
|
168
|
+
'key' => {
|
169
|
+
'type' => 'string'
|
170
|
+
}
|
171
|
+
},
|
172
|
+
'required' => %w[
|
173
|
+
id
|
174
|
+
key
|
175
|
+
]
|
176
|
+
}
|
177
|
+
},
|
178
|
+
'trafficAllocation' => {
|
179
|
+
'type' => 'array',
|
180
|
+
'items' => {
|
181
|
+
'type' => 'object',
|
182
|
+
'properties' => {
|
183
|
+
'entityId' => {
|
184
|
+
'type' => 'string'
|
185
|
+
},
|
186
|
+
'endOfRange' => {
|
187
|
+
'type' => 'integer'
|
188
|
+
}
|
189
|
+
},
|
190
|
+
'required' => %w[
|
191
|
+
entityId
|
192
|
+
endOfRange
|
193
|
+
]
|
194
|
+
}
|
195
|
+
},
|
196
|
+
'audienceIds' => {
|
197
|
+
'type' => 'array',
|
198
|
+
'items' => {
|
199
|
+
'type' => 'string'
|
200
|
+
}
|
201
|
+
},
|
202
|
+
'forcedVariations' => {
|
203
|
+
'type' => 'object'
|
204
|
+
}
|
205
|
+
},
|
206
|
+
'required' => %w[
|
207
|
+
id
|
208
|
+
key
|
209
|
+
variations
|
210
|
+
trafficAllocation
|
211
|
+
audienceIds
|
212
|
+
forcedVariations
|
213
|
+
status
|
214
|
+
layerId
|
215
|
+
]
|
216
|
+
}
|
217
|
+
},
|
218
|
+
'events' => {
|
219
|
+
'type' => 'array',
|
220
|
+
'items' => {
|
221
|
+
'type' => 'object',
|
222
|
+
'properties' => {
|
223
|
+
'key' => {
|
224
|
+
'type' => 'string'
|
225
|
+
},
|
226
|
+
'experimentIds' => {
|
227
|
+
'type' => 'array',
|
228
|
+
'items' => {
|
229
|
+
'type' => 'string'
|
230
|
+
}
|
231
|
+
},
|
232
|
+
'id' => {
|
233
|
+
'type' => 'string'
|
234
|
+
}
|
235
|
+
},
|
236
|
+
'required' => %w[
|
237
|
+
key
|
238
|
+
experimentIds
|
239
|
+
id
|
240
|
+
]
|
241
|
+
}
|
242
|
+
},
|
243
|
+
'audiences' => {
|
244
|
+
'type' => 'array',
|
245
|
+
'items' => {
|
246
|
+
'type' => 'object',
|
247
|
+
'properties' => {
|
248
|
+
'id' => {
|
249
|
+
'type' => 'string'
|
250
|
+
},
|
251
|
+
'name' => {
|
252
|
+
'type' => 'string'
|
253
|
+
},
|
254
|
+
'conditions' => {
|
255
|
+
'type' => 'string'
|
256
|
+
}
|
257
|
+
},
|
258
|
+
'required' => %w[
|
259
|
+
id
|
260
|
+
name
|
261
|
+
conditions
|
262
|
+
]
|
263
|
+
}
|
264
|
+
},
|
265
|
+
'attributes' => {
|
266
|
+
'type' => 'array',
|
267
|
+
'items' => {
|
268
|
+
'type' => 'object',
|
269
|
+
'properties' => {
|
270
|
+
'id' => {
|
271
|
+
'type' => 'string'
|
272
|
+
},
|
273
|
+
'key' => {
|
274
|
+
'type' => 'string'
|
275
|
+
}
|
276
|
+
},
|
277
|
+
'required' => %w[
|
278
|
+
id
|
279
|
+
key
|
280
|
+
]
|
281
|
+
}
|
282
|
+
},
|
283
|
+
'version' => {
|
284
|
+
'type' => 'string'
|
285
|
+
},
|
286
|
+
'revision' => {
|
287
|
+
'type' => 'string'
|
288
|
+
},
|
289
|
+
'integrations' => {
|
290
|
+
'type' => 'array',
|
291
|
+
'items' => {
|
292
|
+
'type' => 'object',
|
293
|
+
'properties' => {
|
294
|
+
'key' => {
|
295
|
+
'type' => 'string'
|
296
|
+
},
|
297
|
+
'host' => {
|
298
|
+
'type' => 'string'
|
299
|
+
},
|
300
|
+
'publicKey' => {
|
301
|
+
'type' => 'string'
|
302
|
+
}
|
303
|
+
},
|
304
|
+
'required' => %w[key]
|
305
|
+
}
|
306
|
+
}
|
307
|
+
},
|
308
|
+
'required' => %w[
|
309
|
+
projectId
|
310
|
+
accountId
|
311
|
+
experiments
|
312
|
+
events
|
313
|
+
groups
|
314
|
+
audiences
|
315
|
+
attributes
|
316
|
+
version
|
317
|
+
revision
|
318
|
+
]
|
319
|
+
}.freeze
|
320
|
+
|
321
|
+
VARIABLE_TYPES = {
|
322
|
+
'BOOLEAN' => 'boolean',
|
323
|
+
'DOUBLE' => 'double',
|
324
|
+
'INTEGER' => 'integer',
|
325
|
+
'STRING' => 'string',
|
326
|
+
'JSON' => 'json'
|
327
|
+
}.freeze
|
328
|
+
|
329
|
+
INPUT_VARIABLES = {
|
330
|
+
'FEATURE_FLAG_KEY' => 'Feature flag key',
|
331
|
+
'EXPERIMENT_KEY' => 'Experiment key',
|
332
|
+
'USER_ID' => 'User ID',
|
333
|
+
'VARIATION_KEY' => 'Variation key',
|
334
|
+
'VARIABLE_KEY' => 'Variable key',
|
335
|
+
'VARIABLE_TYPE' => 'Variable type'
|
336
|
+
}.freeze
|
337
|
+
|
338
|
+
CONTROL_ATTRIBUTES = {
|
339
|
+
'BOT_FILTERING' => '$opt_bot_filtering',
|
340
|
+
'BUCKETING_ID' => '$opt_bucketing_id',
|
341
|
+
'USER_AGENT' => '$opt_user_agent'
|
342
|
+
}.freeze
|
343
|
+
|
344
|
+
SUPPORTED_VERSIONS = {
|
345
|
+
'v2' => '2',
|
346
|
+
'v3' => '3',
|
347
|
+
'v4' => '4'
|
348
|
+
}.freeze
|
349
|
+
|
350
|
+
ATTRIBUTE_VALID_TYPES = [FalseClass, Float, Integer, String, TrueClass].freeze
|
351
|
+
|
352
|
+
FINITE_NUMBER_LIMIT = 2**53
|
353
|
+
|
354
|
+
AUDIENCE_EVALUATION_LOGS = {
|
355
|
+
'AUDIENCE_EVALUATION_RESULT' => "Audience '%s' evaluated to %s.",
|
356
|
+
'EVALUATING_AUDIENCE' => "Starting to evaluate audience '%s' with conditions: %s.",
|
357
|
+
'INFINITE_ATTRIBUTE_VALUE' => 'Audience condition %s evaluated to UNKNOWN because the number value ' \
|
358
|
+
"for user attribute '%s' is not in the range [-2^53, +2^53].",
|
359
|
+
'INVALID_SEMANTIC_VERSION' => 'Audience condition %s evaluated as UNKNOWN because an invalid semantic version ' \
|
360
|
+
"was passed for user attribute '%s'.",
|
361
|
+
'MISSING_ATTRIBUTE_VALUE' => 'Audience condition %s evaluated as UNKNOWN because no value ' \
|
362
|
+
"was passed for user attribute '%s'.",
|
363
|
+
'NULL_ATTRIBUTE_VALUE' => 'Audience condition %s evaluated to UNKNOWN because a nil value was passed ' \
|
364
|
+
"for user attribute '%s'.",
|
365
|
+
'UNEXPECTED_TYPE' => "Audience condition %s evaluated as UNKNOWN because a value of type '%s' " \
|
366
|
+
"was passed for user attribute '%s'.",
|
367
|
+
'UNKNOWN_CONDITION_TYPE' => 'Audience condition %s uses an unknown condition type. You may need ' \
|
368
|
+
'to upgrade to a newer release of the Optimizely SDK.',
|
369
|
+
'UNKNOWN_CONDITION_VALUE' => 'Audience condition %s has an unsupported condition value. You may need ' \
|
370
|
+
'to upgrade to a newer release of the Optimizely SDK.',
|
371
|
+
'UNKNOWN_MATCH_TYPE' => 'Audience condition %s uses an unknown match type. You may need ' \
|
372
|
+
'to upgrade to a newer release of the Optimizely SDK.'
|
373
|
+
}.freeze
|
374
|
+
|
375
|
+
EXPERIMENT_AUDIENCE_EVALUATION_LOGS = {
|
376
|
+
'AUDIENCE_EVALUATION_RESULT_COMBINED' => "Audiences for experiment '%s' collectively evaluated to %s.",
|
377
|
+
'EVALUATING_AUDIENCES_COMBINED' => "Evaluating audiences for experiment '%s': %s."
|
378
|
+
}.merge(AUDIENCE_EVALUATION_LOGS).freeze
|
379
|
+
|
380
|
+
ROLLOUT_AUDIENCE_EVALUATION_LOGS = {
|
381
|
+
'AUDIENCE_EVALUATION_RESULT_COMBINED' => "Audiences for rule '%s' collectively evaluated to %s.",
|
382
|
+
'EVALUATING_AUDIENCES_COMBINED' => "Evaluating audiences for rule '%s': %s."
|
383
|
+
}.merge(AUDIENCE_EVALUATION_LOGS).freeze
|
384
|
+
|
385
|
+
DECISION_NOTIFICATION_TYPES = {
|
386
|
+
'AB_TEST' => 'ab-test',
|
387
|
+
'FEATURE' => 'feature',
|
388
|
+
'FEATURE_TEST' => 'feature-test',
|
389
|
+
'FEATURE_VARIABLE' => 'feature-variable',
|
390
|
+
'FLAG' => 'flag',
|
391
|
+
'ALL_FEATURE_VARIABLES' => 'all-feature-variables'
|
392
|
+
}.freeze
|
393
|
+
|
394
|
+
CONFIG_MANAGER = {
|
395
|
+
'DATAFILE_URL_TEMPLATE' => 'https://cdn.optimizely.com/datafiles/%s.json',
|
396
|
+
'AUTHENTICATED_DATAFILE_URL_TEMPLATE' => 'https://config.optimizely.com/datafiles/auth/%s.json',
|
397
|
+
# Default time in seconds to block the 'config' method call until 'config' instance has been initialized.
|
398
|
+
'DEFAULT_BLOCKING_TIMEOUT' => 15,
|
399
|
+
# Default config update interval of 5 minutes
|
400
|
+
'DEFAULT_UPDATE_INTERVAL' => 5 * 60,
|
401
|
+
# Maximum update interval or blocking timeout: 30 days
|
402
|
+
'MAX_SECONDS_LIMIT' => 2_592_000,
|
403
|
+
# Minimum update interval or blocking timeout: 1 second
|
404
|
+
'MIN_SECONDS_LIMIT' => 1,
|
405
|
+
# Time in seconds before which request for datafile times out
|
406
|
+
'REQUEST_TIMEOUT' => 10
|
407
|
+
}.freeze
|
408
|
+
|
409
|
+
HTTP_HEADERS = {
|
410
|
+
'IF_MODIFIED_SINCE' => 'If-Modified-Since',
|
411
|
+
'LAST_MODIFIED' => 'Last-Modified'
|
412
|
+
}.freeze
|
413
|
+
end
|
414
|
+
end
|
415
|
+
end
|