vwo-sdk 1.30.0 → 1.37.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/vwo/constants.rb +3 -2
- data/lib/vwo/core/bucketer.rb +50 -48
- data/lib/vwo/core/variation_decider.rb +427 -428
- data/lib/vwo/enums.rb +17 -154
- data/lib/vwo/logger.rb +8 -5
- data/lib/vwo/schemas/settings_file.rb +7 -6
- data/lib/vwo/services/batch_events_dispatcher.rb +45 -38
- data/lib/vwo/services/batch_events_queue.rb +52 -68
- data/lib/vwo/services/event_dispatcher.rb +46 -16
- data/lib/vwo/services/hooks_manager.rb +8 -12
- data/lib/vwo/services/segment_evaluator.rb +17 -15
- data/lib/vwo/services/settings_file_manager.rb +5 -5
- data/lib/vwo/services/settings_file_processor.rb +7 -4
- data/lib/vwo/services/usage_stats.rb +5 -4
- data/lib/vwo/utils/campaign.rb +61 -64
- data/lib/vwo/utils/custom_dimensions.rb +14 -14
- data/lib/vwo/utils/data_location_manager.rb +2 -9
- data/lib/vwo/utils/feature.rb +7 -10
- data/lib/vwo/utils/impression.rb +80 -79
- data/lib/vwo/utils/log_message.rb +69 -0
- data/lib/vwo/utils/request.rb +7 -9
- data/lib/vwo/utils/utility.rb +45 -28
- data/lib/vwo/utils/uuid.rb +12 -10
- data/lib/vwo/utils/validations.rb +124 -49
- data/lib/vwo.rb +472 -620
- metadata +11 -10
@@ -12,10 +12,10 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
-
require_relative '../logger'
|
16
15
|
require_relative '../enums'
|
17
16
|
require_relative '../utils/request'
|
18
17
|
require_relative '../utils/utility'
|
18
|
+
require_relative '../utils/log_message'
|
19
19
|
require_relative '../constants'
|
20
20
|
|
21
21
|
class VWO
|
@@ -33,7 +33,7 @@ class VWO
|
|
33
33
|
# to our server should be made or not.
|
34
34
|
#
|
35
35
|
def initialize(is_development_mode = false)
|
36
|
-
@logger = VWO::Logger
|
36
|
+
@logger = VWO::Utils::Logger
|
37
37
|
@is_development_mode = is_development_mode
|
38
38
|
end
|
39
39
|
|
@@ -43,7 +43,7 @@ class VWO
|
|
43
43
|
# the request to be dispatched to the VWO server
|
44
44
|
# @return[Boolean]
|
45
45
|
#
|
46
|
-
def dispatch(impression)
|
46
|
+
def dispatch(impression, main_keys, end_point)
|
47
47
|
return true if @is_development_mode
|
48
48
|
|
49
49
|
modified_event = impression.reject do |key, _value|
|
@@ -52,18 +52,38 @@ class VWO
|
|
52
52
|
|
53
53
|
resp = VWO::Utils::Request.get(impression['url'], modified_event)
|
54
54
|
if resp.code == '200'
|
55
|
+
@logger.log(
|
56
|
+
LogLevelEnum::INFO,
|
57
|
+
'IMPRESSION_SUCCESS',
|
58
|
+
{
|
59
|
+
'{file}' => FILE,
|
60
|
+
'{endPoint}' => end_point,
|
61
|
+
'{accountId}' => impression['account_id'] || impression[:account_id],
|
62
|
+
'{mainKeys}' => JSON.generate(main_keys)
|
63
|
+
}
|
64
|
+
)
|
55
65
|
true
|
56
66
|
else
|
57
67
|
@logger.log(
|
58
68
|
LogLevelEnum::ERROR,
|
59
|
-
|
69
|
+
'IMPRESSION_FAILED',
|
70
|
+
{
|
71
|
+
'{file}' => FileNameEnum::BATCH_EVENTS_DISPATCHER,
|
72
|
+
'{err}' => resp.message,
|
73
|
+
'{endPoint}' => impression['url']
|
74
|
+
}
|
60
75
|
)
|
61
76
|
false
|
62
77
|
end
|
63
|
-
rescue StandardError
|
78
|
+
rescue StandardError => e
|
64
79
|
@logger.log(
|
65
80
|
LogLevelEnum::ERROR,
|
66
|
-
|
81
|
+
'IMPRESSION_FAILED',
|
82
|
+
{
|
83
|
+
'{file}' => FileNameEnum::BATCH_EVENTS_DISPATCHER,
|
84
|
+
'{err}' => e.message,
|
85
|
+
'{endPoint}' => impression['url']
|
86
|
+
}
|
67
87
|
)
|
68
88
|
false
|
69
89
|
end
|
@@ -76,26 +96,36 @@ class VWO
|
|
76
96
|
if resp.code == '200'
|
77
97
|
@logger.log(
|
78
98
|
LogLevelEnum::INFO,
|
79
|
-
|
80
|
-
|
81
|
-
file
|
82
|
-
event
|
83
|
-
|
84
|
-
|
85
|
-
|
99
|
+
'IMPRESSION_SUCCESS_FOR_EVENT_ARCH',
|
100
|
+
{
|
101
|
+
'{file}' => FileNameEnum::BATCH_EVENTS_DISPATCHER,
|
102
|
+
'{event}' => "visitor property:#{JSON.generate(post_data[:d][:visitor][:props])}",
|
103
|
+
'{endPoint}' => url,
|
104
|
+
'{accountId}' => params[:a]
|
105
|
+
}
|
86
106
|
)
|
87
107
|
true
|
88
108
|
else
|
89
109
|
@logger.log(
|
90
110
|
LogLevelEnum::ERROR,
|
91
|
-
|
111
|
+
'IMPRESSION_FAILED',
|
112
|
+
{
|
113
|
+
'{file}' => FileNameEnum::EVENT_DISPATCHER,
|
114
|
+
'{err}' => resp.message,
|
115
|
+
'{endPoint}' => url
|
116
|
+
}
|
92
117
|
)
|
93
118
|
false
|
94
119
|
end
|
95
|
-
rescue StandardError
|
120
|
+
rescue StandardError => e
|
96
121
|
@logger.log(
|
97
122
|
LogLevelEnum::ERROR,
|
98
|
-
|
123
|
+
'IMPRESSION_FAILED',
|
124
|
+
{
|
125
|
+
'{file}' => FileNameEnum::EVENT_DISPATCHER,
|
126
|
+
'{err}' => e.message,
|
127
|
+
'{endPoint}' => url
|
128
|
+
}
|
99
129
|
)
|
100
130
|
false
|
101
131
|
end
|
@@ -15,22 +15,18 @@
|
|
15
15
|
class VWO
|
16
16
|
module Services
|
17
17
|
class HooksManager
|
18
|
-
|
19
|
-
|
18
|
+
# Hooks Manager is responsible for triggering callbacks useful to the end-user based on certain lifecycle events.
|
19
|
+
# Possible use with integrations when the user intends to send an event when a visitor is part of the experiment.
|
20
20
|
def initialize(config)
|
21
21
|
@logger = VWO::Logger.get_instance
|
22
|
-
if config.key?(:integrations) && config[:integrations].key?(:callback) && config[:integrations][:callback].is_a?(Method)
|
23
|
-
@callback = config[:integrations][:callback]
|
24
|
-
end
|
22
|
+
@callback = config[:integrations][:callback] if config.key?(:integrations) && config[:integrations].key?(:callback) && config[:integrations][:callback].is_a?(Method)
|
25
23
|
end
|
26
24
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
end
|
33
|
-
end
|
25
|
+
# Executes the callback
|
26
|
+
# @param[Hash] properties Properties from the callback
|
27
|
+
def execute(properties)
|
28
|
+
@callback&.call(properties)
|
29
|
+
end
|
34
30
|
end
|
35
31
|
end
|
36
32
|
end
|
@@ -12,12 +12,12 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
-
require_relative '../logger'
|
16
15
|
require_relative '../enums'
|
17
16
|
require_relative './operand_evaluator'
|
18
17
|
require_relative '../utils/function'
|
19
18
|
require_relative '../utils/segment'
|
20
19
|
require_relative '../utils/validations'
|
20
|
+
require_relative '../utils/log_message'
|
21
21
|
|
22
22
|
class VWO
|
23
23
|
module Services
|
@@ -29,7 +29,7 @@ class VWO
|
|
29
29
|
|
30
30
|
# Initializes this class with VWOLogger and OperandEvaluator
|
31
31
|
def initialize
|
32
|
-
@logger = VWO::Logger
|
32
|
+
@logger = VWO::Utils::Logger
|
33
33
|
@operand_evaluator = OperandEvaluator.new
|
34
34
|
end
|
35
35
|
|
@@ -43,15 +43,16 @@ class VWO
|
|
43
43
|
#
|
44
44
|
def evaluate_util(dsl, custom_variables)
|
45
45
|
operator, sub_dsl = get_key_value(dsl)
|
46
|
-
|
46
|
+
case operator
|
47
|
+
when OperatorTypes::NOT
|
47
48
|
!evaluate_util(sub_dsl, custom_variables)
|
48
|
-
|
49
|
+
when OperatorTypes::AND
|
49
50
|
sub_dsl.all? { |y| evaluate_util(y, custom_variables) }
|
50
|
-
|
51
|
+
when OperatorTypes::OR
|
51
52
|
sub_dsl.any? { |y| evaluate_util(y, custom_variables) }
|
52
|
-
|
53
|
+
when OperandTypes::CUSTOM_VARIABLE
|
53
54
|
@operand_evaluator.evaluate_custom_variable?(sub_dsl, custom_variables)
|
54
|
-
|
55
|
+
when OperandTypes::USER
|
55
56
|
@operand_evaluator.evaluate_user?(sub_dsl, custom_variables)
|
56
57
|
end
|
57
58
|
end
|
@@ -73,14 +74,15 @@ class VWO
|
|
73
74
|
rescue StandardError => e
|
74
75
|
@logger.log(
|
75
76
|
LogLevelEnum::ERROR,
|
76
|
-
|
77
|
-
|
78
|
-
file
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
77
|
+
'SEGMENTATION_ERROR',
|
78
|
+
{
|
79
|
+
'{file}' => FileNameEnum::SEGMENT_EVALUATOR,
|
80
|
+
'{userId}' => user_id,
|
81
|
+
'{campaignKey}' => campaign_key,
|
82
|
+
'{variation}' => '',
|
83
|
+
'{customVariables}' => custom_variables,
|
84
|
+
'{err}' => e.message
|
85
|
+
},
|
84
86
|
disable_logs
|
85
87
|
)
|
86
88
|
false
|
@@ -47,11 +47,11 @@ class VWO
|
|
47
47
|
return '{}'
|
48
48
|
end
|
49
49
|
|
50
|
-
if is_via_webhook
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
50
|
+
path = if is_via_webhook
|
51
|
+
::VWO::CONSTANTS::ENDPOINTS::WEBHOOK_SETTINGS_URL
|
52
|
+
else
|
53
|
+
::VWO::CONSTANTS::ENDPOINTS::SETTINGS_URL
|
54
|
+
end
|
55
55
|
vwo_server_url = "#{PROTOCOL}://#{HOSTNAME}#{path}"
|
56
56
|
|
57
57
|
settings_file_response = ::VWO::Utils::Request.get(vwo_server_url, params)
|
@@ -12,9 +12,9 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
-
require_relative '../logger'
|
16
15
|
require_relative '../enums'
|
17
16
|
require_relative '../utils/campaign'
|
17
|
+
require_relative '../utils/log_message'
|
18
18
|
|
19
19
|
class VWO
|
20
20
|
module Services
|
@@ -30,7 +30,6 @@ class VWO
|
|
30
30
|
|
31
31
|
def initialize(settings_file)
|
32
32
|
@settings_file = JSON.parse(settings_file)
|
33
|
-
@logger = VWO::Logger.get_instance
|
34
33
|
end
|
35
34
|
|
36
35
|
# Processes the settings_file, assigns variation allocation range
|
@@ -38,9 +37,13 @@ class VWO
|
|
38
37
|
(@settings_file['campaigns'] || []).each do |campaign|
|
39
38
|
set_variation_allocation(campaign)
|
40
39
|
end
|
41
|
-
|
40
|
+
Utils::Logger.log(
|
42
41
|
LogLevelEnum::DEBUG,
|
43
|
-
|
42
|
+
'SETTINGS_FILE_PROCESSED',
|
43
|
+
{
|
44
|
+
'{file}' => FileNameEnum::SETTINGS_FILE_PROCESSOR,
|
45
|
+
'{accountId}' => @settings_file['accountId']
|
46
|
+
}
|
44
47
|
)
|
45
48
|
end
|
46
49
|
|
@@ -16,13 +16,14 @@ class VWO
|
|
16
16
|
module Services
|
17
17
|
class UsageStats
|
18
18
|
attr_reader :usage_stats
|
19
|
+
|
19
20
|
# Initialize the UsageStats
|
20
21
|
def initialize(stats, is_development_mode = false)
|
21
22
|
@usage_stats = {}
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
return if is_development_mode
|
24
|
+
|
25
|
+
@usage_stats = stats
|
26
|
+
@usage_stats[:_l] = 1 if @usage_stats.length > 0
|
26
27
|
end
|
27
28
|
end
|
28
29
|
end
|
data/lib/vwo/utils/campaign.rb
CHANGED
@@ -12,9 +12,9 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
-
require_relative '../logger'
|
16
15
|
require_relative '../enums'
|
17
16
|
require_relative '../constants'
|
17
|
+
require_relative './log_message'
|
18
18
|
|
19
19
|
# Utility module for processing VWO campaigns
|
20
20
|
class VWO
|
@@ -41,18 +41,17 @@ class VWO
|
|
41
41
|
variation['start_variation_allocation'] = -1
|
42
42
|
variation['end_variation_allocation'] = -1
|
43
43
|
end
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
)
|
44
|
+
Logger.log(
|
45
|
+
LogLevelEnum::DEBUG,
|
46
|
+
'VARIATION_RANGE_ALLOCATION',
|
47
|
+
{
|
48
|
+
'{file}' => FileNameEnum::CAMPAIGN_UTIL,
|
49
|
+
'{campaignKey}' => campaign['key'],
|
50
|
+
'{variationName}' => variation['name'],
|
51
|
+
'{variationWeight}' => variation['weight'],
|
52
|
+
'{start}' => variation['start_variation_allocation'],
|
53
|
+
'{end}' => variation['end_variation_allocation']
|
54
|
+
}
|
56
55
|
)
|
57
56
|
end
|
58
57
|
end
|
@@ -178,21 +177,19 @@ class VWO
|
|
178
177
|
campaigns = get_campaigns_from_campaign_keys(campaign_key, settings_file, goal_identifier, goal_type_to_track)
|
179
178
|
elsif campaign_key.is_a?(String)
|
180
179
|
campaign = get_campaign_for_campaign_key_and_goal(campaign_key, settings_file, goal_identifier, goal_type_to_track)
|
181
|
-
if campaign
|
182
|
-
campaigns = [campaign]
|
183
|
-
end
|
180
|
+
campaigns = [campaign] if campaign
|
184
181
|
end
|
185
|
-
if campaigns.length
|
186
|
-
|
182
|
+
if campaigns.length == 0
|
183
|
+
Utils::Logger.log(
|
187
184
|
LogLevelEnum::ERROR,
|
188
|
-
|
189
|
-
|
190
|
-
file
|
191
|
-
|
192
|
-
|
185
|
+
'CAMPAIGN_NOT_FOUND_FOR_GOAL',
|
186
|
+
{
|
187
|
+
'{file}' => FileNameEnum::CAMPAIGN_UTIL,
|
188
|
+
'{goalIdentifier}' => goal_identifier
|
189
|
+
}
|
193
190
|
)
|
194
191
|
end
|
195
|
-
|
192
|
+
campaigns
|
196
193
|
end
|
197
194
|
|
198
195
|
# fetch all running campaigns (having goal identifier goal_type_to_track and goal type CUSTOM|REVENUE|ALL) from settings
|
@@ -205,38 +202,31 @@ class VWO
|
|
205
202
|
campaigns = []
|
206
203
|
if settings_file
|
207
204
|
settings_file['campaigns'].each do |campaign|
|
208
|
-
if campaign.key?(:status) && campaign[:status] != 'RUNNING'
|
209
|
-
|
210
|
-
end
|
205
|
+
next if campaign.key?(:status) && campaign[:status] != 'RUNNING'
|
206
|
+
|
211
207
|
goal = get_campaign_goal(campaign, goal_identifier)
|
212
|
-
if validate_goal(goal, goal_type_to_track)
|
213
|
-
campaigns.push(campaign)
|
214
|
-
end
|
208
|
+
campaigns.push(campaign) if validate_goal(goal, goal_type_to_track)
|
215
209
|
end
|
216
210
|
end
|
217
211
|
campaigns
|
218
212
|
end
|
219
213
|
|
220
214
|
def validate_goal(goal, goal_type_to_track)
|
221
|
-
|
215
|
+
goal && (
|
222
216
|
goal_type_to_track == 'ALL' ||
|
223
217
|
(
|
224
|
-
GOAL_TYPES.
|
218
|
+
GOAL_TYPES.value?(goal['type']) &&
|
225
219
|
(GOAL_TYPES.key? goal_type_to_track) &&
|
226
220
|
goal['type'] == GOAL_TYPES[goal_type_to_track]
|
227
221
|
)
|
228
222
|
)
|
229
|
-
return result
|
230
223
|
end
|
231
224
|
|
232
225
|
def get_campaigns_from_campaign_keys(campaign_keys, settings_file, goal_identifier, goal_type_to_track = 'ALL')
|
233
226
|
campaigns = []
|
234
227
|
campaign_keys.each do |campaign_key|
|
235
|
-
|
236
228
|
campaign = get_campaign_for_campaign_key_and_goal(campaign_key, settings_file, goal_identifier, goal_type_to_track)
|
237
|
-
if campaign
|
238
|
-
campaigns.push(campaign)
|
239
|
-
end
|
229
|
+
campaigns.push(campaign) if campaign
|
240
230
|
end
|
241
231
|
campaigns
|
242
232
|
end
|
@@ -245,9 +235,7 @@ class VWO
|
|
245
235
|
campaign = get_running_campaign(campaign_key, settings_file)
|
246
236
|
if campaign
|
247
237
|
goal = get_campaign_goal(campaign, goal_identifier)
|
248
|
-
if validate_goal(goal, goal_type_to_track)
|
249
|
-
return campaign
|
250
|
-
end
|
238
|
+
return campaign if validate_goal(goal, goal_type_to_track)
|
251
239
|
end
|
252
240
|
nil
|
253
241
|
end
|
@@ -255,18 +243,18 @@ class VWO
|
|
255
243
|
def get_running_campaign(campaign_key, settings_file)
|
256
244
|
campaign = get_campaign(settings_file, campaign_key)
|
257
245
|
if campaign.nil? || (campaign['status'] != 'RUNNING')
|
258
|
-
|
259
|
-
LogLevelEnum::
|
260
|
-
|
261
|
-
|
262
|
-
file
|
263
|
-
|
264
|
-
|
265
|
-
|
246
|
+
Utils::Logger.log(
|
247
|
+
LogLevelEnum::WARNING,
|
248
|
+
'CAMPAIGN_NOT_RUNNING',
|
249
|
+
{
|
250
|
+
'{file}' => FILE,
|
251
|
+
'{campaignKey}' => campaign_key,
|
252
|
+
'{api}' => ApiMethods::TRACK
|
253
|
+
}
|
266
254
|
)
|
267
255
|
nil
|
268
256
|
end
|
269
|
-
|
257
|
+
campaign
|
270
258
|
end
|
271
259
|
|
272
260
|
# Checks whether a campaign is part of a group.
|
@@ -274,10 +262,9 @@ class VWO
|
|
274
262
|
# @param[Hash] :settings_file Settings file for the project
|
275
263
|
# @param[Integer] :campaign_id Id of campaign which is to be checked
|
276
264
|
# @return[Boolean]
|
277
|
-
def
|
278
|
-
|
279
|
-
|
280
|
-
end
|
265
|
+
def part_of_group?(settings_file, campaign_id)
|
266
|
+
return true if settings_file['campaignGroups']&.key?(campaign_id.to_s)
|
267
|
+
|
281
268
|
false
|
282
269
|
end
|
283
270
|
|
@@ -289,24 +276,34 @@ class VWO
|
|
289
276
|
def get_group_campaigns(settings_file, group_id)
|
290
277
|
group_campaign_ids = []
|
291
278
|
group_campaigns = []
|
292
|
-
groups = settings_file[
|
279
|
+
groups = settings_file['groups']
|
293
280
|
|
294
|
-
|
295
|
-
group_campaign_ids = groups[group_id.to_s]["campaigns"]
|
296
|
-
end
|
281
|
+
group_campaign_ids = groups[group_id.to_s]['campaigns'] if groups&.key?(group_id.to_s)
|
297
282
|
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
if campaign["id"] == campaign_id && campaign["status"] == STATUS_RUNNING
|
302
|
-
group_campaigns.push(campaign)
|
303
|
-
end
|
304
|
-
end
|
283
|
+
group_campaign_ids&.each do |campaign_id|
|
284
|
+
settings_file['campaigns'].each do |campaign|
|
285
|
+
group_campaigns.push(campaign) if campaign['id'] == campaign_id && campaign['status'] == STATUS_RUNNING
|
305
286
|
end
|
306
287
|
end
|
307
288
|
group_campaigns
|
308
289
|
end
|
309
290
|
|
291
|
+
def campaign_goal_already_tracked?(user_id, campaign, identifiers, goal_identifier)
|
292
|
+
if identifiers.include? goal_identifier
|
293
|
+
@logger.log(
|
294
|
+
LogLevelEnum::INFO,
|
295
|
+
'CAMPAIGN_GOAL_ALREADY_TRACKED',
|
296
|
+
{
|
297
|
+
'{file}' => FILE,
|
298
|
+
'{userId}' => user_id,
|
299
|
+
'{campaignKey}' => campaign['key'],
|
300
|
+
'{goalIdentifier}' => goal_identifier
|
301
|
+
}
|
302
|
+
)
|
303
|
+
return true
|
304
|
+
end
|
305
|
+
false
|
306
|
+
end
|
310
307
|
end
|
311
308
|
end
|
312
309
|
end
|
@@ -13,11 +13,11 @@
|
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
15
|
require 'json'
|
16
|
-
require_relative '../logger'
|
17
16
|
require_relative '../enums'
|
18
17
|
require_relative '../constants'
|
19
18
|
require_relative './impression'
|
20
19
|
require_relative './utility'
|
20
|
+
require_relative './log_message'
|
21
21
|
|
22
22
|
# Utility module for helper math and random functions
|
23
23
|
class VWO
|
@@ -36,13 +36,13 @@ class VWO
|
|
36
36
|
params = get_common_properties(user_id, settings_file)
|
37
37
|
params.merge!('url' => url, 'tags' => JSON.generate(tag), 'env' => sdk_key)
|
38
38
|
|
39
|
-
|
39
|
+
Logger.log(
|
40
40
|
LogLevelEnum::DEBUG,
|
41
|
-
|
42
|
-
|
43
|
-
file
|
44
|
-
properties
|
45
|
-
|
41
|
+
'IMPRESSION_FOR_PUSH',
|
42
|
+
{
|
43
|
+
'{file}' => FileNameEnum::CUSTOM_DIMENSTIONS_UTIL,
|
44
|
+
'{properties}' => JSON.generate(params)
|
45
|
+
}
|
46
46
|
)
|
47
47
|
params
|
48
48
|
end
|
@@ -55,17 +55,17 @@ class VWO
|
|
55
55
|
params = {
|
56
56
|
'eT' => 3,
|
57
57
|
't' => JSON.generate(tag),
|
58
|
-
'u' => generator_for(user_id, account_id),
|
58
|
+
'u' => generator_for(user_id, account_id, true),
|
59
59
|
'sId' => get_current_unix_timestamp
|
60
60
|
}
|
61
61
|
|
62
|
-
|
62
|
+
Logger.log(
|
63
63
|
LogLevelEnum::DEBUG,
|
64
|
-
|
65
|
-
|
66
|
-
file
|
67
|
-
properties
|
68
|
-
|
64
|
+
'IMPRESSION_FOR_PUSH',
|
65
|
+
{
|
66
|
+
'{file}' => FileNameEnum::CUSTOM_DIMENSTIONS_UTIL,
|
67
|
+
'{properties}' => JSON.generate(params)
|
68
|
+
}
|
69
69
|
)
|
70
70
|
params
|
71
71
|
end
|
@@ -12,29 +12,22 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
-
|
16
15
|
require_relative '../constants'
|
17
16
|
|
18
17
|
# Utility module for generating uuid
|
19
18
|
class VWO
|
20
19
|
module Utils
|
21
20
|
class DataLocationManager
|
22
|
-
|
23
21
|
@@instance = nil
|
24
22
|
|
25
23
|
def self.get_instance
|
26
|
-
if @@instance.nil?
|
27
|
-
@@instance = self.new
|
28
|
-
end
|
24
|
+
@@instance = new if @@instance.nil?
|
29
25
|
@@instance
|
30
26
|
end
|
31
27
|
|
32
|
-
|
33
28
|
def get_data_location
|
34
29
|
url = VWO::CONSTANTS::ENDPOINTS::BASE_URL
|
35
|
-
if @settings.key?(
|
36
|
-
url = url + '/' + @settings["collectionPrefix"]
|
37
|
-
end
|
30
|
+
url = "#{url}/#{@settings['collectionPrefix']}" if @settings.key?('collectionPrefix')
|
38
31
|
url
|
39
32
|
end
|
40
33
|
|
data/lib/vwo/utils/feature.rb
CHANGED
@@ -12,9 +12,9 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
-
require_relative '../logger'
|
16
15
|
require_relative '../enums'
|
17
16
|
require_relative '../constants'
|
17
|
+
require_relative './log_message'
|
18
18
|
|
19
19
|
# Utility module for helper math and random functions
|
20
20
|
class VWO
|
@@ -40,16 +40,13 @@ class VWO
|
|
40
40
|
return !value || value == 0 ? false : true if variable_type == VariableTypes.BOOLEAN
|
41
41
|
|
42
42
|
return value if variable_type == VariableTypes::JSON
|
43
|
-
rescue StandardError =>
|
44
|
-
|
43
|
+
rescue StandardError => e
|
44
|
+
Logger.log(
|
45
45
|
LogLevelEnum::ERROR,
|
46
|
-
|
47
|
-
|
48
|
-
file
|
49
|
-
|
50
|
-
variable_type: variable_type,
|
51
|
-
of_type: value.class.name
|
52
|
-
)
|
46
|
+
"unable to type cast variable value: #{e.message}",
|
47
|
+
{
|
48
|
+
'{file}' => FILE
|
49
|
+
}
|
53
50
|
)
|
54
51
|
nil
|
55
52
|
end
|