vwo-sdk 1.3.0 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/vwo.rb +610 -55
- data/lib/vwo/constants.rb +40 -12
- data/lib/vwo/core/bucketer.rb +7 -9
- data/lib/vwo/core/variation_decider.rb +68 -46
- data/lib/vwo/enums.rb +72 -9
- data/lib/vwo/logger.rb +9 -3
- data/lib/vwo/schemas/settings_file.rb +1 -3
- data/lib/vwo/services/event_dispatcher.rb +3 -5
- data/lib/vwo/services/operand_evaluator.rb +114 -0
- data/lib/vwo/services/segment_evaluator.rb +109 -0
- data/lib/vwo/services/settings_file_manager.rb +4 -6
- data/lib/vwo/services/settings_file_processor.rb +1 -3
- data/lib/vwo/user_storage.rb +1 -3
- data/lib/vwo/utils/campaign.rb +44 -22
- data/lib/vwo/utils/custom_dimensions.rb +49 -0
- data/lib/vwo/utils/feature.rb +56 -0
- data/lib/vwo/utils/function.rb +6 -3
- data/lib/vwo/utils/impression.rb +21 -3
- data/lib/vwo/utils/request.rb +1 -3
- data/lib/vwo/utils/segment.rb +116 -0
- data/lib/vwo/utils/uuid.rb +3 -5
- data/lib/vwo/utils/validations.rb +12 -4
- metadata +8 -4
data/lib/vwo/constants.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright 2019 Wingify Software Pvt. Ltd.
|
1
|
+
# Copyright 2019-2020 Wingify Software Pvt. Ltd.
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
@@ -12,8 +12,6 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
-
# frozen_string_literal: true
|
16
|
-
|
17
15
|
class VWO
|
18
16
|
module CONSTANTS
|
19
17
|
API_VERSION = 1
|
@@ -22,11 +20,13 @@ class VWO
|
|
22
20
|
MAX_TRAFFIC_PERCENT = 100
|
23
21
|
MAX_TRAFFIC_VALUE = 10_000
|
24
22
|
STATUS_RUNNING = 'RUNNING'
|
23
|
+
# rubocop:disable Style/ExpandPathArguments
|
25
24
|
LIBRARY_PATH = File.expand_path('../..', __FILE__)
|
25
|
+
# rubocop:enable Style/ExpandPathArguments
|
26
26
|
HTTP_PROTOCOL = 'http://'
|
27
27
|
HTTPS_PROTOCOL = 'https://'
|
28
28
|
URL_NAMESPACE = '6ba7b811-9dad-11d1-80b4-00c04fd430c8'
|
29
|
-
SDK_VERSION = '1.
|
29
|
+
SDK_VERSION = '1.5.0'
|
30
30
|
SDK_NAME = 'ruby'
|
31
31
|
|
32
32
|
module ENDPOINTS
|
@@ -34,6 +34,7 @@ class VWO
|
|
34
34
|
ACCOUNT_SETTINGS = '/server-side/settings'
|
35
35
|
TRACK_USER = '/server-side/track-user'
|
36
36
|
TRACK_GOAL = '/server-side/track-goal'
|
37
|
+
PUSH = '/server-side/push'
|
37
38
|
end
|
38
39
|
|
39
40
|
module EVENTS
|
@@ -48,16 +49,43 @@ class VWO
|
|
48
49
|
BOOLEAN = 'boolean'
|
49
50
|
end
|
50
51
|
|
51
|
-
module
|
52
|
-
CREATE_INSTANCE = 'CREATE_INSTANCE'
|
53
|
-
ACTIVATE = 'ACTIVATE'
|
54
|
-
GET_VARIATION = 'GET_VARIATION'
|
55
|
-
TRACK = 'TRACK'
|
56
|
-
end
|
57
|
-
|
58
|
-
module GOALTYPES
|
52
|
+
module GoalTypes
|
59
53
|
REVENUE = 'REVENUE_TRACKING'
|
60
54
|
CUSTOM = 'CUSTOM_GOAL'
|
61
55
|
end
|
56
|
+
|
57
|
+
module VariableTypes
|
58
|
+
STRING = 'string'
|
59
|
+
INTEGER = 'integer'
|
60
|
+
DOUBLE = 'double'
|
61
|
+
BOOLEAN = 'boolean'
|
62
|
+
end
|
63
|
+
|
64
|
+
RUBY_VARIABLE_TYPES = {
|
65
|
+
'string' => [String],
|
66
|
+
'integer' => [Integer],
|
67
|
+
'double' => [Float],
|
68
|
+
'boolean' => [TrueClass, FalseClass]
|
69
|
+
}
|
70
|
+
|
71
|
+
module ApiMethods
|
72
|
+
ACTIVATE = 'activate'
|
73
|
+
GET_VARIATION_NAME = 'get_variation_name'
|
74
|
+
TRACK = 'track'
|
75
|
+
IS_FEATURE_ENABLED = 'is_feature_enabled'
|
76
|
+
GET_FEATURE_VARIABLE_VALUE = 'get_feature_variable_value'
|
77
|
+
PUSH = 'push'
|
78
|
+
end
|
79
|
+
|
80
|
+
module PushApi
|
81
|
+
TAG_VALUE_LENGTH = 255
|
82
|
+
TAG_KEY_LENGTH = 255
|
83
|
+
end
|
84
|
+
|
85
|
+
module CampaignTypes
|
86
|
+
VISUAL_AB = 'VISUAL_AB'
|
87
|
+
FEATURE_TEST = 'FEATURE_TEST'
|
88
|
+
FEATURE_ROLLOUT = 'FEATURE_ROLLOUT'
|
89
|
+
end
|
62
90
|
end
|
63
91
|
end
|
data/lib/vwo/core/bucketer.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright 2019 Wingify Software Pvt. Ltd.
|
1
|
+
# Copyright 2019-2020 Wingify Software Pvt. Ltd.
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
@@ -12,8 +12,6 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
-
# frozen_string_literal: true
|
16
|
-
|
17
15
|
require 'murmurhash3'
|
18
16
|
require_relative '../logger'
|
19
17
|
require_relative '../enums'
|
@@ -43,7 +41,7 @@ class VWO
|
|
43
41
|
# @param[String] :user_id The unique ID assigned to a user
|
44
42
|
# @param[Dict] :campaign For getting traffic allotted to the campaign
|
45
43
|
# @return[Boolean] If User is a part of Campaign or not
|
46
|
-
|
44
|
+
|
47
45
|
def user_part_of_campaign?(user_id, campaign)
|
48
46
|
unless valid_value?(user_id)
|
49
47
|
@logger.log(
|
@@ -62,7 +60,6 @@ class VWO
|
|
62
60
|
end
|
63
61
|
|
64
62
|
traffic_allocation = campaign['percentTraffic']
|
65
|
-
|
66
63
|
value_assigned_to_user = get_bucket_value_for_user(user_id)
|
67
64
|
is_user_part = (value_assigned_to_user != 0) && value_assigned_to_user <= traffic_allocation
|
68
65
|
@logger.log(
|
@@ -98,9 +95,9 @@ class VWO
|
|
98
95
|
end
|
99
96
|
|
100
97
|
hash_value = MurmurHash3::V32.str_hash(user_id, SEED_VALUE) & U_MAX_32_BIT
|
101
|
-
normalize = MAX_TRAFFIC_VALUE / campaign['percentTraffic']
|
98
|
+
normalize = MAX_TRAFFIC_VALUE.to_f / campaign['percentTraffic']
|
102
99
|
multiplier = normalize / 100
|
103
|
-
bucket_value =
|
100
|
+
bucket_value = get_bucket_value(
|
104
101
|
hash_value,
|
105
102
|
MAX_TRAFFIC_VALUE,
|
106
103
|
multiplier
|
@@ -118,6 +115,7 @@ class VWO
|
|
118
115
|
hash_value: hash_value
|
119
116
|
)
|
120
117
|
)
|
118
|
+
|
121
119
|
get_variation(campaign, bucket_value)
|
122
120
|
end
|
123
121
|
|
@@ -144,7 +142,7 @@ class VWO
|
|
144
142
|
# (between 1 to $this->$MAX_TRAFFIC_PERCENT)
|
145
143
|
def get_bucket_value_for_user(user_id)
|
146
144
|
hash_value = MurmurHash3::V32.str_hash(user_id, SEED_VALUE) & U_MAX_32_BIT
|
147
|
-
bucket_value =
|
145
|
+
bucket_value = get_bucket_value(hash_value, MAX_TRAFFIC_PERCENT)
|
148
146
|
|
149
147
|
@logger.log(
|
150
148
|
LogLevelEnum::DEBUG,
|
@@ -167,7 +165,7 @@ class VWO
|
|
167
165
|
# @param[Integer] :multiplier
|
168
166
|
# @return[Integer] Bucket Value of the User
|
169
167
|
#
|
170
|
-
def
|
168
|
+
def get_bucket_value(hash_value, max_value, multiplier = 1)
|
171
169
|
ratio = hash_value.to_f / MAX_HASH_VALUE
|
172
170
|
multiplied_value = (max_value * ratio + 1) * multiplier
|
173
171
|
multiplied_value.to_i
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright 2019 Wingify Software Pvt. Ltd.
|
1
|
+
# Copyright 2019-2020 Wingify Software Pvt. Ltd.
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
@@ -12,11 +12,10 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
-
# frozen_string_literal: true
|
16
|
-
|
17
15
|
require_relative '../logger'
|
18
16
|
require_relative '../enums'
|
19
17
|
require_relative '../utils/campaign'
|
18
|
+
require_relative '../services/segment_evaluator'
|
20
19
|
require_relative '../utils/validations'
|
21
20
|
require_relative 'bucketer'
|
22
21
|
|
@@ -38,10 +37,9 @@ class VWO
|
|
38
37
|
def initialize(settings_file, user_storage_service = nil)
|
39
38
|
@logger = VWO::Logger.get_instance
|
40
39
|
@user_storage_service = user_storage_service
|
41
|
-
# Check if user_storage_service provided is valid or not
|
42
|
-
@user_storage_service = user_storage_service
|
43
40
|
@bucketer = VWO::Core::Bucketer.new
|
44
41
|
@settings_file = settings_file
|
42
|
+
@segment_evaluator = VWO::Services::SegmentEvaluator.new
|
45
43
|
end
|
46
44
|
|
47
45
|
# Returns variation for the user for the passed campaign-key
|
@@ -50,14 +48,13 @@ class VWO
|
|
50
48
|
#
|
51
49
|
#
|
52
50
|
# @param[String] :user_id The unique ID assigned to User
|
53
|
-
# @param[Hash] :campaign Campaign hash
|
51
|
+
# @param[Hash] :campaign Campaign hash itself
|
52
|
+
# @param[String] :campaign_key The unique ID of the campaign passed
|
54
53
|
# @return[String,String] ({variation_id, variation_name}|Nil): Tuple of
|
55
54
|
# variation_id and variation_name if variation allotted, else nil
|
56
55
|
|
57
|
-
def get_variation(user_id, campaign)
|
58
|
-
|
59
|
-
campaign_key = campaign['key']
|
60
|
-
end
|
56
|
+
def get_variation(user_id, campaign, campaign_key, custom_variables = {})
|
57
|
+
campaign_key ||= campaign['key']
|
61
58
|
|
62
59
|
user_campaign_map = get_user_storage(user_id, campaign_key)
|
63
60
|
variation = get_stored_variation(user_id, campaign_key, user_campaign_map) if valid_hash?(user_campaign_map)
|
@@ -73,13 +70,47 @@ class VWO
|
|
73
70
|
variation_name: variation['name']
|
74
71
|
)
|
75
72
|
)
|
76
|
-
return variation
|
73
|
+
return variation
|
74
|
+
end
|
75
|
+
|
76
|
+
# Pre-segmentation
|
77
|
+
return unless campaign
|
78
|
+
|
79
|
+
segments = get_segments(campaign)
|
80
|
+
is_valid_segments = valid_value?(segments)
|
81
|
+
|
82
|
+
if is_valid_segments
|
83
|
+
unless custom_variables
|
84
|
+
@logger.log(
|
85
|
+
LogLevelEnum::INFO,
|
86
|
+
format(
|
87
|
+
LogMessageEnum::InfoMessages::NO_CUSTOM_VARIABLES,
|
88
|
+
file: FILE,
|
89
|
+
campaign_key: campaign_key,
|
90
|
+
user_id: user_id,
|
91
|
+
api_name: ApiMethods::GET_FEATURE_VARIABLE_VALUE
|
92
|
+
)
|
93
|
+
)
|
94
|
+
custom_variables = {}
|
95
|
+
end
|
96
|
+
return unless @segment_evaluator.evaluate(campaign_key, user_id, segments, custom_variables)
|
97
|
+
else
|
98
|
+
@logger.log(
|
99
|
+
LogLevelEnum::INFO,
|
100
|
+
format(
|
101
|
+
LogMessageEnum::InfoMessages::SKIPPING_PRE_SEGMENTATION,
|
102
|
+
file: FILE,
|
103
|
+
campaign_key: campaign_key,
|
104
|
+
user_id: user_id,
|
105
|
+
api_name: ApiMethods::GET_FEATURE_VARIABLE_VALUE
|
106
|
+
)
|
107
|
+
)
|
77
108
|
end
|
78
109
|
|
79
|
-
|
110
|
+
variation = get_variation_allotted(user_id, campaign)
|
80
111
|
|
81
|
-
if
|
82
|
-
save_user_storage(user_id, campaign_key,
|
112
|
+
if variation && variation['name']
|
113
|
+
save_user_storage(user_id, campaign_key, variation['name']) if variation['name']
|
83
114
|
|
84
115
|
@logger.log(
|
85
116
|
LogLevelEnum::INFO,
|
@@ -88,7 +119,8 @@ class VWO
|
|
88
119
|
file: FILE,
|
89
120
|
campaign_key: campaign_key,
|
90
121
|
user_id: user_id,
|
91
|
-
variation_name:
|
122
|
+
variation_name: variation['name'],
|
123
|
+
campaign_type: campaign['type']
|
92
124
|
)
|
93
125
|
)
|
94
126
|
else
|
@@ -97,39 +129,39 @@ class VWO
|
|
97
129
|
format(LogMessageEnum::InfoMessages::NO_VARIATION_ALLOCATED, file: FILE, campaign_key: campaign_key, user_id: user_id)
|
98
130
|
)
|
99
131
|
end
|
100
|
-
|
132
|
+
variation
|
101
133
|
end
|
102
134
|
|
103
135
|
# Returns the Variation Alloted for required campaign
|
104
136
|
#
|
105
|
-
# @param[String] :user_id The unique
|
137
|
+
# @param[String] :user_id The unique key assigned to User
|
106
138
|
# @param[Hash] :campaign Campaign hash for Unique campaign key
|
107
139
|
#
|
108
140
|
# @return[Hash]
|
109
141
|
|
110
142
|
def get_variation_allotted(user_id, campaign)
|
111
|
-
variation_id, variation_name = nil
|
112
143
|
unless valid_value?(user_id)
|
113
144
|
@logger.log(
|
114
145
|
LogLevelEnum::ERROR,
|
115
146
|
format(LogMessageEnum::ErrorMessages::INVALID_USER_ID, file: FILE, user_id: user_id, method: 'get_variation_alloted')
|
116
147
|
)
|
117
|
-
return
|
148
|
+
return
|
118
149
|
end
|
119
150
|
|
120
151
|
if @bucketer.user_part_of_campaign?(user_id, campaign)
|
121
|
-
|
152
|
+
variation = get_variation_of_campaign_for_user(user_id, campaign)
|
122
153
|
@logger.log(
|
123
154
|
LogLevelEnum::DEBUG,
|
124
155
|
format(
|
125
156
|
LogMessageEnum::DebugMessages::GOT_VARIATION_FOR_USER,
|
126
157
|
file: FILE,
|
127
|
-
variation_name:
|
158
|
+
variation_name: variation['name'],
|
128
159
|
user_id: user_id,
|
129
160
|
campaign_key: campaign['key'],
|
130
161
|
method: 'get_variation_allotted'
|
131
162
|
)
|
132
163
|
)
|
164
|
+
variation
|
133
165
|
else
|
134
166
|
# not part of campaign
|
135
167
|
@logger.log(
|
@@ -142,8 +174,8 @@ class VWO
|
|
142
174
|
method: 'get_variation_allotted'
|
143
175
|
)
|
144
176
|
)
|
177
|
+
nil
|
145
178
|
end
|
146
|
-
[variation_id, variation_name]
|
147
179
|
end
|
148
180
|
|
149
181
|
# Assigns variation to a particular user depending on the campaign PercentTraffic.
|
@@ -161,7 +193,7 @@ class VWO
|
|
161
193
|
method: 'get_variation_of_campaign_for_user'
|
162
194
|
)
|
163
195
|
)
|
164
|
-
return nil
|
196
|
+
return nil
|
165
197
|
end
|
166
198
|
|
167
199
|
variation = @bucketer.bucket_user_to_variation(user_id, campaign)
|
@@ -177,7 +209,7 @@ class VWO
|
|
177
209
|
campaign_key: campaign['key']
|
178
210
|
)
|
179
211
|
)
|
180
|
-
return variation
|
212
|
+
return variation
|
181
213
|
end
|
182
214
|
|
183
215
|
@logger.log(
|
@@ -189,7 +221,7 @@ class VWO
|
|
189
221
|
campaign_key: campaign['key']
|
190
222
|
)
|
191
223
|
)
|
192
|
-
|
224
|
+
nil
|
193
225
|
end
|
194
226
|
|
195
227
|
private
|
@@ -238,35 +270,25 @@ class VWO
|
|
238
270
|
# @return[Object, nil] if found then variation settings object otherwise None
|
239
271
|
|
240
272
|
def get_stored_variation(user_id, campaign_key, user_campaign_map)
|
241
|
-
|
242
|
-
variation_name = user_campaign_map[:variationName]
|
243
|
-
@logger.log(
|
244
|
-
LogLevelEnum::DEBUG,
|
245
|
-
format(
|
246
|
-
LogMessageEnum::DebugMessages::GETTING_STORED_VARIATION,
|
247
|
-
file: FILE,
|
248
|
-
campaign_key: campaign_key,
|
249
|
-
user_id: user_id,
|
250
|
-
variation_name: variation_name
|
251
|
-
)
|
252
|
-
)
|
253
|
-
return get_campaign_variation(
|
254
|
-
@settings_file,
|
255
|
-
campaign_key,
|
256
|
-
variation_name
|
257
|
-
)
|
258
|
-
end
|
273
|
+
return unless user_campaign_map['campaign_key'] == campaign_key
|
259
274
|
|
275
|
+
variation_name = user_campaign_map['variation_name']
|
260
276
|
@logger.log(
|
261
277
|
LogLevelEnum::DEBUG,
|
262
278
|
format(
|
263
|
-
LogMessageEnum::DebugMessages::
|
279
|
+
LogMessageEnum::DebugMessages::GETTING_STORED_VARIATION,
|
264
280
|
file: FILE,
|
265
281
|
campaign_key: campaign_key,
|
266
|
-
user_id: user_id
|
282
|
+
user_id: user_id,
|
283
|
+
variation_name: variation_name
|
267
284
|
)
|
268
285
|
)
|
269
|
-
|
286
|
+
|
287
|
+
get_campaign_variation(
|
288
|
+
@settings_file,
|
289
|
+
campaign_key,
|
290
|
+
variation_name
|
291
|
+
)
|
270
292
|
end
|
271
293
|
|
272
294
|
# If UserStorageService is provided, save the assigned variation
|
data/lib/vwo/enums.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright 2019 Wingify Software Pvt. Ltd.
|
1
|
+
# Copyright 2019-2020 Wingify Software Pvt. Ltd.
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
@@ -12,14 +12,43 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
-
# frozen_string_literal: true
|
16
|
-
|
17
15
|
# rubocop:disable Metrics/LineLength
|
18
16
|
|
19
17
|
require 'logger'
|
20
18
|
|
21
19
|
class VWO
|
22
20
|
module Enums
|
21
|
+
module OperandValueTypesName
|
22
|
+
REGEX = 'regex'
|
23
|
+
WILDCARD = 'wildcard'
|
24
|
+
LOWER = 'lower'
|
25
|
+
EQUALS = 'equals'
|
26
|
+
end
|
27
|
+
|
28
|
+
module OperandValueTypes
|
29
|
+
LOWER = 'lower'
|
30
|
+
CONTAINS = 'contains'
|
31
|
+
STARTS_WITH = 'starts_with'
|
32
|
+
ENDS_WITH = 'ends_with'
|
33
|
+
REGEX = 'regex'
|
34
|
+
EQUALS = 'equals'
|
35
|
+
end
|
36
|
+
|
37
|
+
module OperatorTypes
|
38
|
+
AND = 'and'
|
39
|
+
OR = 'or'
|
40
|
+
NOT = 'not'
|
41
|
+
end
|
42
|
+
|
43
|
+
module OperandTypes
|
44
|
+
CUSTOM_VARIABLE = 'custom_variable'
|
45
|
+
end
|
46
|
+
|
47
|
+
module OperandValuesBooleanTypes
|
48
|
+
TRUE = 'true'
|
49
|
+
FALSE = 'false'
|
50
|
+
end
|
51
|
+
|
23
52
|
module FileNameEnum
|
24
53
|
VWO_PATH = 'vwo'
|
25
54
|
UTIL_PATH = 'vwo/utils'
|
@@ -28,14 +57,17 @@ class VWO
|
|
28
57
|
Bucketer = VWO_PATH + '/core/bucketer'
|
29
58
|
VariationDecider = VWO_PATH + '/core/variation_decider'
|
30
59
|
EventDispatcher = VWO_PATH + '/services/event_dispatcher'
|
60
|
+
SegmentEvaluator = VWO_PATH + '/services/segment_evaluator'
|
31
61
|
Logger = VWO_PATH + '/logger'
|
32
62
|
SettingsFileProcessor = VWO_PATH + '/services/settings_file_processor'
|
33
63
|
|
34
64
|
CampaignUtil = UTIL_PATH + '/campaign'
|
35
65
|
FunctionUtil = UTIL_PATH + '/function'
|
66
|
+
FeatureUtil = UTIL_PATH + '/feature'
|
36
67
|
ImpressionUtil = UTIL_PATH + '/impression'
|
37
68
|
UuidUtil = UTIL_PATH + '/uuid'
|
38
69
|
ValidateUtil = UTIL_PATH + '/validations'
|
70
|
+
CustomDimensionsUtil = UTIL_PATH + '/custom_dimensions_util'
|
39
71
|
end
|
40
72
|
|
41
73
|
# Logging Enums
|
@@ -61,12 +93,13 @@ class VWO
|
|
61
93
|
IMPRESSION_FOR_TRACK_USER = '(%<file>s): Impression built for track-user - %<properties>s'
|
62
94
|
IMPRESSION_FOR_TRACK_GOAL = '(%<file>s): Impression built for track-goal - %<properties>s'
|
63
95
|
GOT_VARIATION_FOR_USER = '(%<file>s): userId:%<user_id>s for campaign:%<campaign_key>s got variationName:%<variation_name>s'
|
96
|
+
PARAMS_FOR_PUSH_CALL = '(%<file>s): Params for push call - %<properties>s'
|
64
97
|
end
|
65
98
|
|
66
99
|
# Info Messages
|
67
100
|
module InfoMessages
|
68
101
|
VARIATION_RANGE_ALLOCATION = '(%<file>s): Campaign:%<campaign_key>s having variations:%<variation_name>s with weight:%<variation_weight>s got range as: ( %<start>s - %<end>s ))'
|
69
|
-
VARIATION_ALLOCATED = '(%<file>s): UserId:%<user_id>s of Campaign:%<campaign_key>s got variation: %<variation_name>s'
|
102
|
+
VARIATION_ALLOCATED = '(%<file>s): UserId:%<user_id>s of Campaign:%<campaign_key>s type: %<campaign_type>s got variation: %<variation_name>s'
|
70
103
|
LOOKING_UP_USER_STORAGE_SERVICE = '(%<file>s): Looked into UserStorageService for userId:%<user_id>s %<status>s'
|
71
104
|
SAVING_DATA_USER_STORAGE_SERVICE = '(%<file>s): Saving into UserStorageService for userId:%<user_id>s successful'
|
72
105
|
GOT_STORED_VARIATION = '(%<file>s): Got stored variation:%<variation_name>s of campaign:%<campaign_key>s for userId:%<user_id>s from UserStorageService'
|
@@ -76,7 +109,22 @@ class VWO
|
|
76
109
|
GOT_VARIATION_FOR_USER = '(%<file>s): userId:%<user_id>s for campaign:%<campaign_key>s got variationName:%<variation_name>s'
|
77
110
|
USER_GOT_NO_VARIATION = '(%<file>s): userId:%<user_id>s for campaign:%<campaign_key>s did not allot any variation'
|
78
111
|
IMPRESSION_SUCCESS = '(%<file>s): Impression event - %<end_point>s was successfully received by VWO having main keys: accountId:%<account_id>s userId:%<user_id>s campaignId:%<campaign_id>s and variationId:%<variation_id>s'
|
112
|
+
MAIN_KEYS_FOR_IMPRESSION = '(%<file>s): Having main keys: accountId:%<account_id>s} userId:%<user_id>s campaignId:%<campaign_id>s and variationId:%<variation_id>s'
|
113
|
+
MAIN_KEYS_FOR_PUSH_API = '(%<file>s): Having main keys: accountId:%<account_id>s} userId:%<user_id>s u:%<u>s and tags:%<tags>s}'
|
79
114
|
INVALID_VARIATION_KEY = '(%<file>s): Variation was not assigned to userId:%<user_id>s for campaign:%<campaign_key>s'
|
115
|
+
|
116
|
+
USER_IN_FEATURE_ROLLOUT = '(%<file>s): User ID:%<user_id>s is in feature rollout:%<campaign_key>s'
|
117
|
+
USER_NOT_IN_FEATURE_ROLLOUT = '(%<file>s): User ID:%<user_id>s is NOT in feature rollout:%<campaign_key>s'
|
118
|
+
FEATURE_ENABLED_FOR_USER = '(%<file>s): In API: %<api_name>s Feature having feature-key:%<feature_key>s for user ID:%<user_id>s is enabled'
|
119
|
+
FEATURE_NOT_ENABLED_FOR_USER = '(%<file>s): In API: %<api_name>s Feature having feature-key:%<feature_key>s for user ID:%<user_id>s is not enabled'
|
120
|
+
|
121
|
+
VARIABLE_FOUND = '(%<file>s): In API: %<api_name>s Value for variable:%<variable_key>s of campaign:%<campaign_key>s and campaign type: %<campaign_type>s is:%<variable_value>s for user:%<user_id>s'
|
122
|
+
|
123
|
+
USER_PASSED_PRE_SEGMENTATION = '(%<file>s): UserId:%<user_id>s of campaign:%<campaign_key>s with custom_variables:%<custom_variables>s passed pre segmentation'
|
124
|
+
USER_FAILED_PRE_SEGMENTATION = '(%<file>s): UserId:%<user_id>s of campaign:%<campaign_key>s with custom_variables:%<custom_variables>s failed pre segmentation'
|
125
|
+
|
126
|
+
NO_CUSTOM_VARIABLES = '(%<file>s): In API: %<api_name>s, for UserId:%<user_id>s preSegments/customVariables are not passed for campaign:%<campaign_key>s and campaign has pre-segmentation'
|
127
|
+
SKIPPING_PRE_SEGMENTATION = '(%<file>s): In API: %<api_name>s, Skipping pre-segmentation for UserId:%<user_id>s as no valid segments found in campaign:%<campaign_key>s'
|
80
128
|
end
|
81
129
|
|
82
130
|
# Warning Messages
|
@@ -85,22 +133,37 @@ class VWO
|
|
85
133
|
# Error Messages
|
86
134
|
module ErrorMessages
|
87
135
|
SETTINGS_FILE_CORRUPTED = '(%<file>s): Settings file is corrupted. Please contact VWO Support for help.'
|
88
|
-
ACTIVATE_API_MISSING_PARAMS = '(%<file>s):
|
89
|
-
|
90
|
-
|
136
|
+
ACTIVATE_API_MISSING_PARAMS = '(%<file>s): %<api_name>s API got bad parameters. It expects campaignTestKey(String) as first and userId(String) as second argument, customVariables(Hash) can be passed via options for pre-segmentation'
|
137
|
+
API_CONFIG_CORRUPTED = '(%<file>s): %<api_name>s API has corrupted configuration'
|
138
|
+
GET_VARIATION_NAME_API_INVALID_PARAMS = '(%<file>s): %<api_name>s API got bad parameters. It expects campaignTestKey(String) as first and userId(String) as second argument, customVariables(Hash) can be passed via options for pre-segmentation'
|
91
139
|
GET_VARIATION_API_CONFIG_CORRUPTED = '(%<file>s): "getVariation" API has corrupted configuration'
|
92
|
-
|
140
|
+
TRACK_API_INVALID_PARAMS = '(%<file>s): %<api_name>s API got bad parameters. It expects campaignTestKey(String) as first userId(String) as second and goalIdentifier(String/Number) as third argument. Fourth is revenueValue(Float/Number/String) and is required for revenue goal only. customVariables(Hash) can be passed via options for pre-segmentation'
|
93
141
|
TRACK_API_CONFIG_CORRUPTED = '(%<file>s): "track" API has corrupted configuration'
|
94
142
|
TRACK_API_GOAL_NOT_FOUND = '(%<file>s): Goal:%<goal_identifier>s not found for campaign:%<campaign_key>s and userId:%<user_id>s'
|
95
143
|
TRACK_API_REVENUE_NOT_PASSED_FOR_REVENUE_GOAL = '(%<file>s): Revenue value should be passed for revenue goal:%<goal_identifier>s for campaign:%<campaign_key>s and userId:%<user_id>s'
|
96
144
|
TRACK_API_VARIATION_NOT_FOUND = '(%<file>s): Variation not found for campaign:%<campaign_key>s and userId:%<user_id>s'
|
97
|
-
CAMPAIGN_NOT_RUNNING = '(%<file>s): API used:%<
|
145
|
+
CAMPAIGN_NOT_RUNNING = '(%<file>s): API used:%<api_name>s - Campaign:%<campaign_key>s is not RUNNING. Please verify from VWO App'
|
98
146
|
LOOK_UP_USER_STORAGE_SERVICE_FAILED = '(%<file>s): Looking data from UserStorageService failed for userId:%<user_id>s'
|
99
147
|
SAVE_USER_STORAGE_SERVICE_FAILED = '(%<file>s): Saving data into UserStorageService failed for userId:%<user_id>s'
|
100
148
|
INVALID_CAMPAIGN = '(%<file>s): Invalid campaign passed to %<method>s of this file'
|
101
149
|
INVALID_USER_ID = '(%<file>s): Invalid userId:%<user_id>s passed to %<method>s of this file'
|
102
150
|
IMPRESSION_FAILED = '(%<file>s): Impression event could not be sent to VWO - %<end_point>s'
|
103
151
|
CUSTOM_LOGGER_MISCONFIGURED = '(%<file>s): Custom logger is provided but seems to have mis-configured. %<extra_info>s Please check the API Docs. Using default logger.'
|
152
|
+
INVALID_API = '(%<file>s): %<api_name>s API is not valid for user ID: %<user_id>s in campaign ID: %<campaign_key>s having campaign type: %<campaign_type>s.'
|
153
|
+
IS_FEATURE_ENABLED_API_INVALID_PARAMS = '(%<file>s): %<api_name>s API got bad parameters. It expects campaign_key(String) as first and user_id(String) as second argument, customVariables(dict) can be passed via options for pre-segmentation'
|
154
|
+
GET_FEATURE_VARIABLE_VALUE_API_INVALID_PARAMS = '(%<file>s): "get_feature_variable" API got bad parameters. It expects campaign_key(String) as first, variable_key(string) as second and user_id(String) as third argument, customVariables(dict) can be passed via options for pre-segmentation'
|
155
|
+
|
156
|
+
VARIABLE_NOT_FOUND = '(%<file>s): In API: %<api_name>s Variable %<variable_key>s not found for campaign %<campaign_key>s and type %<campaign_type>s for user ID %<user_id>s'
|
157
|
+
UNABLE_TO_TYPE_CAST = '(%<file>s): Unable to typecast value: %<value>s of type: %<of_type>s to type: %<variable_type>s.'
|
158
|
+
|
159
|
+
USER_NOT_IN_CAMPAIGN = '(%<file>s): userId:%<user_id>s did not become part of campaign:%<campaign_key>s and campaign type:%<campaign_type>s'
|
160
|
+
API_NOT_WORKING = '(%<file>s): API: %<api_name>s not working, exception caught: %<exception>s. Please contact VWO Support for help.'
|
161
|
+
|
162
|
+
PRE_SEGMENTATION_ERROR = '(%<file>s): Error while segmenting the UserId:%<user_id>s of campaign:%<campaign_key>s with custom_variables:%<custom_variables>s. Error message: %<error_message>s'
|
163
|
+
|
164
|
+
PUSH_API_INVALID_PARAMS = '(%<file>s): %<api_name>s API got bad parameters. It expects tag_key(String) as first and tag_value(String) as second argument and user_id(String) as third argument'
|
165
|
+
TAG_VALUE_LENGTH_EXCEEDED = '(%<file>s): In API: %<api_name>s, the length of tag_value:%<tag_value>s and userID: %<user_id>s can not be greater than 255'
|
166
|
+
TAG_KEY_LENGTH_EXCEEDED = '(%<file>s): In API: %<api_name>s, the length of tag_key:%<tag_key>s and userID: %<user_id>s can not be greater than 255'
|
104
167
|
end
|
105
168
|
end
|
106
169
|
|