vwo-fme-ruby-sdk 1.6.1 → 1.7.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/lib/resources/error_messages.json +46 -18
- data/lib/resources/info_messages.json +3 -2
- data/lib/vwo/api/get_flag.rb +13 -8
- data/lib/vwo/api/track_event.rb +2 -2
- data/lib/vwo/constants/constants.rb +24 -1
- data/lib/vwo/decorators/storage_decorator.rb +1 -5
- data/lib/vwo/enums/api_enum.rb +7 -3
- data/lib/vwo/enums/debug_category_enum.rb +20 -0
- data/lib/vwo/enums/event_enum.rb +1 -0
- data/lib/vwo/models/user/context_model.rb +36 -2
- data/lib/vwo/models/vwo_options_model.rb +8 -1
- data/lib/vwo/packages/network_layer/client/network_client.rb +189 -34
- data/lib/vwo/packages/network_layer/manager/network_manager.rb +71 -6
- data/lib/vwo/packages/network_layer/models/request_model.rb +38 -4
- data/lib/vwo/packages/network_layer/models/response_model.rb +10 -1
- data/lib/vwo/packages/segmentation_evaluator/core/segmentation_manager.rb +2 -1
- data/lib/vwo/packages/segmentation_evaluator/evaluators/segment_evaluator.rb +5 -3
- data/lib/vwo/packages/segmentation_evaluator/evaluators/segment_operand_evaluator.rb +3 -2
- data/lib/vwo/services/logger_service.rb +21 -1
- data/lib/vwo/services/settings_service.rb +19 -7
- data/lib/vwo/services/storage_service.rb +5 -4
- data/lib/vwo/utils/{batch_event_dispatcher.rb → batch_event_dispatcher_util.rb} +68 -7
- data/lib/vwo/utils/campaign_util.rb +35 -0
- data/lib/vwo/utils/debugger_service_util.rb +40 -0
- data/lib/vwo/utils/function_util.rb +14 -0
- data/lib/vwo/utils/gateway_service_util.rb +3 -2
- data/lib/vwo/utils/impression_util.rb +16 -2
- data/lib/vwo/utils/meg_util.rb +29 -22
- data/lib/vwo/utils/network_util.rb +138 -24
- data/lib/vwo/utils/rule_evaluation_util.rb +1 -1
- data/lib/vwo/vwo_builder.rb +15 -11
- data/lib/vwo/vwo_client.rb +11 -23
- metadata +5 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8935c2c79e2fc5cd17d450d4a21fdf48fda27343455ad939bb2a7b66820ae2ec
|
|
4
|
+
data.tar.gz: 3e0297e44ac33c862aad76b8e04ba7b944acc4c38b476582e931a53c14ffd483
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d05fef9ef3277e071c8cbf3f7582dc7845e1e99c63247b6db440975c46bbb685f8b5723bc67850fd2666bfd1d69e7fe17fafbdf1f711aa562bff013d7c65f48d
|
|
7
|
+
data.tar.gz: e39b7eaf87dc0bb3540519649a96b85e4178775948d88f7a60aedf6e430aa977c7ff1f27b5f53860f86e37233544da21975a66e767683be3566fec3ec2f261ed
|
|
@@ -1,34 +1,62 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
2
|
+
"EXECUTION_FAILED": "API - {apiName} failed to execute. Error:{err}",
|
|
3
|
+
"INVALID_OPTIONS": "[ERROR]: VWO-SDK {date} Options should be of type object",
|
|
4
|
+
"INVALID_SDK_KEY_IN_OPTIONS": "[ERROR]: VWO-SDK {date} Please provide the sdkKey in the options and should be a of type string",
|
|
5
|
+
"INVALID_ACCOUNT_ID_IN_OPTIONS": "[ERROR]: VWO-SDK {date} Please provide VWO account ID in the options and should be a of type string|number",
|
|
6
|
+
|
|
7
|
+
"ERROR_ADDING_CAMPAIGNS_TO_RULES": "Error setting and adding campaigns to rules. Error: {err}",
|
|
6
8
|
|
|
7
|
-
"
|
|
9
|
+
"INVALID_POLLING_CONFIGURATION": "Invalid key:{key} passed in options. Should be of type:{correctType} and greater than or equal to 1000",
|
|
8
10
|
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
+
"ERROR_FETCHING_SETTINGS": "Settings could not be fetched. Error:{err}",
|
|
12
|
+
"INVALID_SETTINGS_SCHEMA": "Settings are not valid for account ID: {accountId} and SDK key: {sdkKey}. Got settings as {settings}",
|
|
11
13
|
|
|
12
|
-
"
|
|
14
|
+
"ERROR_UPDATING_SETTINGS": "Error while updating settings. Error: {err}",
|
|
15
|
+
"UPDATING_CLIENT_INSTANCE_FAILED_WHEN_WEBHOOK_TRIGGERED": "Failed to fetch settings and hence VWO client instance couldn't be updated when API: {apiName} got called having isViaWebhook param as {isViaWebhook}. Error: {err}",
|
|
13
16
|
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"API_CONTEXT_INVALID": "Context should be an object and must contain a mandatory key - id, which is User ID",
|
|
17
|
+
"INVALID_PARAM": "Key:{key} passed to API:{apiName} is not of valid type. Got type:{type}, should be:{correctType}",
|
|
18
|
+
"INVALID_CONTEXT": "Context should be an object and must contain a mandatory key - id, which is User ID",
|
|
17
19
|
|
|
18
20
|
"FEATURE_NOT_FOUND": "Feature not found for the key:{featureKey}",
|
|
19
21
|
"EVENT_NOT_FOUND": "Event:{eventName} not found in any of the features' metrics",
|
|
20
22
|
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
+
"ERROR_READING_DATA_FROM_STORAGE": "Error while reading data from storage. Error: {err}",
|
|
24
|
+
"ERROR_STORING_DATA_IN_STORAGE": "Error while storing data in storage. Error: {err}",
|
|
23
25
|
|
|
24
|
-
"
|
|
26
|
+
"INVALID_GATEWAY_URL": "Please provide a valid URL for VWO Gateway Service while initializing the SDK",
|
|
27
|
+
"INVALID_RETRY_CONFIG": "Retry config is invalid. Should be of type:object",
|
|
25
28
|
|
|
26
|
-
"NETWORK_CALL_FAILED": "Error occurred
|
|
27
|
-
"SETTINGS_FETCH_FAILED": "Failed to fetch settings and hence VWO client instance couldn't be updated when API: {apiName} got called having isViaWebhook param as {isViaWebhook}. Error: {err}",
|
|
29
|
+
"NETWORK_CALL_FAILED": "Error occurred for {method} request. Error:{err}",
|
|
28
30
|
"NETWORK_CALL_RETRY_ATTEMPT": "Request failed for {endPoint}, Error: {err}. Retrying in {delay} seconds, attempt {attempt} of {maxRetries}",
|
|
29
31
|
"NETWORK_CALL_RETRY_FAILED": "Max retries reached. Request failed for {endPoint}, Error: {err}",
|
|
32
|
+
"ATTEMPTING_RETRY_FOR_FAILED_NETWORK_CALL": "Request failed for {endPoint}, Error: {err}. Retrying in {delay} seconds, attempt {attempt} of {maxRetries}",
|
|
33
|
+
"NETWORK_CALL_FAILURE_AFTER_MAX_RETRIES": "Network request failed after {attempts} attempts for {extraData}. Error: {err}",
|
|
30
34
|
|
|
31
|
-
"CONFIG_PARAMETER_INVALID": "{parameter} paased in {api} API is not correct. It should be of type:{type}}",
|
|
32
35
|
"BATCH_QUEUE_EMPTY": "No batch queue present for account:{accountId} when calling flushEvents API. Check batchEvents config in init API",
|
|
33
|
-
"INVALID_BATCH_EVENTS_CONFIG": "Invalid batch events config, should be a hash, events_per_request should be a number greater than 0 and request_time_interval should be a number greater than 0"
|
|
36
|
+
"INVALID_BATCH_EVENTS_CONFIG": "Invalid batch events config, should be a hash, events_per_request should be a number greater than 0 and request_time_interval should be a number greater than 0",
|
|
37
|
+
"FAILED_TO_INITIALIZE_SERVICE": "Failed to initialize {service}: {err}",
|
|
38
|
+
|
|
39
|
+
"ERROR_SETTING_SEGMENTATION_CONTEXT": "Error in setting contextual data for segmentation. Got error: {err}",
|
|
40
|
+
"ERROR_VALIDATING_SEGMENTATION": "Error in validating segmentation. Got error: {err}",
|
|
41
|
+
"USER_AGENT_VALIDATION_ERROR": "Failed to validate user agent. Error: {err}",
|
|
42
|
+
"INVALID_IP_ADDRESS_IN_CONTEXT_FOR_PRE_SEGMENTATION": "ipAddress is required in context to evaluate location pre-segmentation",
|
|
43
|
+
"INVALID_USER_AGENT_IN_CONTEXT_FOR_PRE_SEGMENTATION": "userAgent is required in context to evaluate user-agent pre-segmentation",
|
|
44
|
+
"INVALID_ATTRIBUTE_LIST_FORMAT": "Invalid inList operand format",
|
|
45
|
+
"ERROR_FETCHING_DATA_FROM_GATEWAY": "Error while fetching data from gateway. Error: {err}",
|
|
46
|
+
|
|
47
|
+
"ATTRIBUTES_MAP_ERROR": "Attributes map must contain atleast 1 key-value pair",
|
|
48
|
+
"ATTRIBUTES_MAP_INVALID": "Attributes should be an object containing key-value pairs",
|
|
49
|
+
|
|
50
|
+
"VALUES_MISMATCH_BATCHING_NOT_ENABLED": "Values mismatch from the expectation of both parameters. Batching not initialized.",
|
|
51
|
+
"INVALID_EVENTS_PER_REQUEST_VALUE": "Events_per_request values is invalid (should be greater than 0 and less than 5000). Using default value of events_per_request parameter : 100",
|
|
52
|
+
"INVALID_REQUEST_TIME_INTERVAL_VALUE": "Request_time_interval values is invalid (should be greater than 0). Using default value of request_time_interval parameter : 600",
|
|
53
|
+
"BATCHING_NOT_ENABLED": "Batching is not enabled. Pass batchEventData in the SDK configuration while invoking init API.",
|
|
54
|
+
|
|
55
|
+
"ERROR_CHECKING_FEATURE_IN_USER_STORAGE": "Error while checking feature in user storage. Got error: {err}",
|
|
56
|
+
|
|
57
|
+
"ERROR_FINDING_WINNER_CAMPAIGN": "Error while finding winner campaign inside {method}. Error: {err}",
|
|
58
|
+
|
|
59
|
+
"ERROR_EVALUATING_RULE": "Error occurred while evaluating rule. Error: {err}",
|
|
60
|
+
"BATCH_FLUSH_FAILED": "Failed to send batch events. Re-enqueuing events for retry.",
|
|
61
|
+
"ERROR_PARSING_GATEWAY_URL": "Error occurred while parsing gateway service URL: {err}"
|
|
34
62
|
}
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"MEG_CAMPAIGN_ELIGIBLE": "Campaign {campaignKey} is eligible for user ID:{userId}",
|
|
30
30
|
"MEG_WINNER_CAMPAIGN": "MEG: Campaign {campaignKey} is the winner for group {groupId} for user ID:{userId} {algo}",
|
|
31
31
|
"SETTINGS_UPDATED": "Settings fetched and updated successfully on the current VWO client instance when API: {apiName} got called having isViaWebhook param as {isViaWebhook}",
|
|
32
|
-
"NETWORK_CALL_SUCCESS": "Impression for {event} - {endPoint} was successfully received by VWO having Account ID:{accountId},
|
|
32
|
+
"NETWORK_CALL_SUCCESS": "Impression for {event} - {endPoint} was successfully received by VWO having Account ID:{accountId}, UUID: {uuid}",
|
|
33
33
|
|
|
34
34
|
"EVENT_BATCH_DEFAULTS": "{parameter} in SDK configuration is missing or invalid (should be greater than {minLimit}). Using default value: {defaultValue}",
|
|
35
35
|
"EVENT_QUEUE": "Event with payload:{event} pushed to the {queueType} queue",
|
|
@@ -37,5 +37,6 @@
|
|
|
37
37
|
"IMPRESSION_BATCH_SUCCESS": "Impression event - {endPoint} was successfully received by VWO having Account ID:{accountId}",
|
|
38
38
|
"IMPRESSION_BATCH_FAILED": "Batch events couldn\"t be received by VWO. Calling Flush Callback with error and data",
|
|
39
39
|
"EVENT_BATCH_MAX_LIMIT": "{parameter} passed in SDK configuration is greater than the maximum limit of {maxLimit}. Setting it to the maximum limit",
|
|
40
|
-
"GATEWAY_AND_BATCH_EVENTS_CONFIG_MISMATCH": "Batch Events config passed in SDK configuration will not work as the gatewayService is already configured. Please check the documentation for more details"
|
|
40
|
+
"GATEWAY_AND_BATCH_EVENTS_CONFIG_MISMATCH": "Batch Events config passed in SDK configuration will not work as the gatewayService is already configured. Please check the documentation for more details",
|
|
41
|
+
"NETWORK_CALL_SUCCESS_WITH_RETRIES": "Network call for {extraData} succeeded after {attempts} retry attempt(s). Previous attempts failed with error: {err}"
|
|
41
42
|
}
|
data/lib/vwo/api/get_flag.rb
CHANGED
|
@@ -90,7 +90,7 @@ class FlagApi
|
|
|
90
90
|
end
|
|
91
91
|
|
|
92
92
|
if feature.nil?
|
|
93
|
-
LoggerService.log(LogLevelEnum::ERROR, "FEATURE_NOT_FOUND", {featureKey: feature_key})
|
|
93
|
+
LoggerService.log(LogLevelEnum::ERROR, "FEATURE_NOT_FOUND", {featureKey: feature_key, an: ApiEnum::GET_FLAG, sId: context.get_session_id, uuid: context.get_uuid})
|
|
94
94
|
return GetFlagResponse.new(false, [])
|
|
95
95
|
end
|
|
96
96
|
|
|
@@ -130,7 +130,7 @@ class FlagApi
|
|
|
130
130
|
rollout_variation_to_return = variation
|
|
131
131
|
update_integrations_decision_object(passed_rollout_campaign, variation, passed_rules_information, decision)
|
|
132
132
|
|
|
133
|
-
create_and_send_impression_for_variation_shown(settings, passed_rollout_campaign.get_id, variation.get_id, context)
|
|
133
|
+
create_and_send_impression_for_variation_shown(settings, passed_rollout_campaign.get_id, variation.get_id, context, feature_key)
|
|
134
134
|
end
|
|
135
135
|
end
|
|
136
136
|
elsif rollout_rules.empty?
|
|
@@ -175,17 +175,21 @@ class FlagApi
|
|
|
175
175
|
experiment_variation_to_return = variation
|
|
176
176
|
update_integrations_decision_object(campaign, variation, passed_rules_information, decision)
|
|
177
177
|
|
|
178
|
-
create_and_send_impression_for_variation_shown(settings, campaign.get_id, variation.get_id, context)
|
|
178
|
+
create_and_send_impression_for_variation_shown(settings, campaign.get_id, variation.get_id, context, feature_key)
|
|
179
179
|
end
|
|
180
180
|
end
|
|
181
181
|
end
|
|
182
182
|
|
|
183
183
|
# Store evaluated feature in storage
|
|
184
184
|
if is_enabled
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
185
|
+
begin
|
|
186
|
+
StorageDecorator.new.set_data_in_storage(
|
|
187
|
+
{ feature_key: feature_key, context: context }.merge(passed_rules_information),
|
|
188
|
+
storage_service
|
|
189
|
+
)
|
|
190
|
+
rescue StandardError => e
|
|
191
|
+
LoggerService.log(LogLevelEnum::ERROR, "ERROR_STORING_DATA_IN_STORAGE", { err: e.message, an: ApiEnum::GET_FLAG, sId: context.get_session_id, uuid: context.get_uuid})
|
|
192
|
+
end
|
|
189
193
|
end
|
|
190
194
|
|
|
191
195
|
# Execute hooks
|
|
@@ -209,7 +213,8 @@ class FlagApi
|
|
|
209
213
|
settings,
|
|
210
214
|
feature&.get_impact_campaign&.get_campaign_id,
|
|
211
215
|
variation_id,
|
|
212
|
-
context
|
|
216
|
+
context,
|
|
217
|
+
feature_key
|
|
213
218
|
)
|
|
214
219
|
end
|
|
215
220
|
|
data/lib/vwo/api/track_event.rb
CHANGED
|
@@ -35,14 +35,14 @@ class TrackApi
|
|
|
35
35
|
create_impression_for_track(event_name, context, event_properties)
|
|
36
36
|
|
|
37
37
|
# Set and execute integration callback for the track event
|
|
38
|
-
hooks_service.set({ event_name: event_name, api: ApiEnum::
|
|
38
|
+
hooks_service.set({ event_name: event_name, api: ApiEnum::TRACK_EVENT })
|
|
39
39
|
hooks_service.execute(hooks_service.get)
|
|
40
40
|
|
|
41
41
|
return { event_name: true }
|
|
42
42
|
end
|
|
43
43
|
|
|
44
44
|
# Log an error if the event does not exist
|
|
45
|
-
LoggerService.log(LogLevelEnum::ERROR, "EVENT_NOT_FOUND", { eventName: event_name })
|
|
45
|
+
LoggerService.log(LogLevelEnum::ERROR, "EVENT_NOT_FOUND", { eventName: event_name, an: ApiEnum::TRACK_EVENT, sId: context.get_session_id, uuid: context.get_uuid})
|
|
46
46
|
|
|
47
47
|
{ event_name: false }
|
|
48
48
|
end
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
# Define the Constants module
|
|
18
18
|
module Constants
|
|
19
19
|
SDK_NAME = 'vwo-fme-ruby-sdk'.freeze
|
|
20
|
-
SDK_VERSION = '1.
|
|
20
|
+
SDK_VERSION = '1.7.0'.freeze
|
|
21
21
|
|
|
22
22
|
MAX_TRAFFIC_PERCENT = 100
|
|
23
23
|
MAX_TRAFFIC_VALUE = 10_000
|
|
@@ -57,4 +57,27 @@ module Constants
|
|
|
57
57
|
MAX_QUEUE_SIZE = 10000
|
|
58
58
|
|
|
59
59
|
PRODUCT_NAME = 'fme'.freeze
|
|
60
|
+
|
|
61
|
+
REQUEST_TIMEOUT = 10 # 10 seconds
|
|
62
|
+
|
|
63
|
+
# Retry mechanism constants
|
|
64
|
+
MAX_RETRIES = 3
|
|
65
|
+
INITIAL_RETRY_DELAY = 2 # seconds
|
|
66
|
+
RETRY_BACKOFF_FACTOR = 2
|
|
67
|
+
|
|
68
|
+
# Default retry configuration
|
|
69
|
+
DEFAULT_RETRY_CONFIG = {
|
|
70
|
+
should_retry: true,
|
|
71
|
+
initial_delay: 2,
|
|
72
|
+
max_retries: 3,
|
|
73
|
+
backoff_multiplier: 2
|
|
74
|
+
}.freeze
|
|
75
|
+
|
|
76
|
+
# debugger event constants
|
|
77
|
+
V2_SETTINGS = 'v2-settings'.freeze
|
|
78
|
+
POLLING = 'polling'.freeze
|
|
79
|
+
BATCH_EVENTS = 'batch-events'.freeze
|
|
80
|
+
NETWORK_CALL_FAILURE_AFTER_MAX_RETRIES = 'NETWORK_CALL_FAILURE_AFTER_MAX_RETRIES'.freeze
|
|
81
|
+
NETWORK_CALL_SUCCESS_WITH_RETRIES = 'NETWORK_CALL_SUCCESS_WITH_RETRIES'.freeze
|
|
82
|
+
IMPACT_ANALYSIS = 'IMPACT_ANALYSIS'.freeze
|
|
60
83
|
end
|
|
@@ -53,22 +53,18 @@ class StorageDecorator
|
|
|
53
53
|
experiment_variation_id = data[:experiment_variation_id]
|
|
54
54
|
|
|
55
55
|
if feature_key.nil?
|
|
56
|
-
LoggerService.log(LogLevelEnum::ERROR, "STORING_DATA_ERROR", { key: 'featureKey' })
|
|
57
56
|
raise 'Feature key is missing'
|
|
58
57
|
end
|
|
59
58
|
|
|
60
59
|
if context.nil? || context.id.nil?
|
|
61
|
-
LoggerService.log(LogLevelEnum::ERROR, "STORING_DATA_ERROR", { key: 'Context or Context.id' })
|
|
62
60
|
raise 'Context ID is missing'
|
|
63
61
|
end
|
|
64
62
|
|
|
65
63
|
if rollout_key && !experiment_key && !rollout_variation_id
|
|
66
|
-
LoggerService.log(LogLevelEnum::ERROR, "STORING_DATA_ERROR", { key: 'Variation:(rolloutKey, experimentKey or rolloutVariationId)' })
|
|
67
64
|
raise 'Invalid rollout variation'
|
|
68
65
|
end
|
|
69
66
|
|
|
70
67
|
if experiment_key && !experiment_variation_id
|
|
71
|
-
LoggerService.log(LogLevelEnum::ERROR, "STORING_DATA_ERROR", { key: 'Variation:(experimentKey or rolloutVariationId)' })
|
|
72
68
|
raise 'Invalid experiment variation'
|
|
73
69
|
end
|
|
74
70
|
|
|
@@ -81,6 +77,6 @@ class StorageDecorator
|
|
|
81
77
|
experiment_id: experiment_id,
|
|
82
78
|
experiment_key: experiment_key,
|
|
83
79
|
experiment_variation_id: experiment_variation_id
|
|
84
|
-
})
|
|
80
|
+
}, context)
|
|
85
81
|
end
|
|
86
82
|
end
|
data/lib/vwo/enums/api_enum.rb
CHANGED
|
@@ -13,7 +13,11 @@
|
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
|
|
15
15
|
module ApiEnum
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
INIT = 'init'
|
|
17
|
+
GET_FLAG = 'getFlag'
|
|
18
|
+
TRACK_EVENT = 'trackEvent'
|
|
19
|
+
SET_ATTRIBUTE = 'setAttribute'
|
|
20
|
+
UPDATE_SETTINGS = 'updateSettings'
|
|
21
|
+
FLUSH_EVENTS = 'flushEvents'
|
|
22
|
+
end
|
|
19
23
|
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Copyright 2024-2025 Wingify Software Pvt. Ltd.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
module DebugCategoryEnum
|
|
16
|
+
DECISION = 'decision'
|
|
17
|
+
NETWORK = 'network'
|
|
18
|
+
RETRY = 'retry'
|
|
19
|
+
ERROR = 'error'
|
|
20
|
+
end
|
data/lib/vwo/enums/event_enum.rb
CHANGED
|
@@ -13,11 +13,13 @@
|
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
|
|
15
15
|
require_relative './context_vwo_model'
|
|
16
|
+
require_relative '../../utils/uuid_util'
|
|
17
|
+
require_relative '../../services/settings_service'
|
|
16
18
|
|
|
17
19
|
class ContextModel
|
|
18
|
-
attr_accessor :id, :user_agent, :ip_address, :custom_variables, :variation_targeting_variables, :post_segmentation_variables, :vwo
|
|
20
|
+
attr_accessor :id, :user_agent, :ip_address, :custom_variables, :variation_targeting_variables, :post_segmentation_variables, :vwo, :session_id, :uuid
|
|
19
21
|
|
|
20
|
-
def initialize(id = nil, user_agent = nil, ip_address = nil, custom_variables = {}, variation_targeting_variables = {}, post_segmentation_variables = {}, vwo = nil)
|
|
22
|
+
def initialize(id = nil, user_agent = nil, ip_address = nil, custom_variables = {}, variation_targeting_variables = {}, post_segmentation_variables = {}, vwo = nil, session_id = nil, uuid = nil)
|
|
21
23
|
@id = id
|
|
22
24
|
@user_agent = user_agent
|
|
23
25
|
@ip_address = ip_address
|
|
@@ -25,6 +27,8 @@ class ContextModel
|
|
|
25
27
|
@variation_targeting_variables = variation_targeting_variables || {}
|
|
26
28
|
@post_segmentation_variables = post_segmentation_variables || {}
|
|
27
29
|
@vwo = vwo
|
|
30
|
+
@session_id = session_id
|
|
31
|
+
@uuid = uuid
|
|
28
32
|
end
|
|
29
33
|
|
|
30
34
|
# Creates a model instance from a hash (dictionary)
|
|
@@ -48,6 +52,20 @@ class ContextModel
|
|
|
48
52
|
@variation_targeting_variables = context[:variationTargetingVariables] if context.key?(:variationTargetingVariables)
|
|
49
53
|
@post_segmentation_variables = context[:postSegmentationVariables] if context.key?(:postSegmentationVariables)
|
|
50
54
|
@vwo = ContextVWOModel.new.model_from_dictionary(context[:_vwo]) if context.key?(:_vwo)
|
|
55
|
+
|
|
56
|
+
# check if sessionId is present in context and should be non null and non empty string
|
|
57
|
+
if context.key?(:sessionId) && context[:sessionId].is_a?(String) && !context[:sessionId].empty?
|
|
58
|
+
@session_id = context[:sessionId]
|
|
59
|
+
else
|
|
60
|
+
@session_id = Time.now.to_i
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# check if uuid is present in context and should be non null and non empty string
|
|
64
|
+
if context.key?(:uuid) && context[:uuid].is_a?(String) && !context[:uuid].empty?
|
|
65
|
+
@uuid = context[:uuid]
|
|
66
|
+
else
|
|
67
|
+
@uuid = UUIDUtil.get_uuid(id.to_s, SettingsService.instance.account_id.to_s)
|
|
68
|
+
end
|
|
51
69
|
|
|
52
70
|
self
|
|
53
71
|
end
|
|
@@ -107,4 +125,20 @@ class ContextModel
|
|
|
107
125
|
def set_vwo(vwo)
|
|
108
126
|
@vwo = vwo
|
|
109
127
|
end
|
|
128
|
+
|
|
129
|
+
def get_session_id
|
|
130
|
+
@session_id
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
def set_session_id(session_id)
|
|
134
|
+
@session_id = session_id
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
def get_uuid
|
|
138
|
+
@uuid
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
def set_uuid(uuid)
|
|
142
|
+
@uuid = uuid
|
|
143
|
+
end
|
|
110
144
|
end
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
class VWOOptionsModel
|
|
16
16
|
attr_accessor :account_id, :sdk_key, :is_development_mode, :storage, :gateway_service,
|
|
17
17
|
:poll_interval, :logger, :segmentation, :integrations, :network,
|
|
18
|
-
:should_wait_for_tracking_calls, :settings, :vwo_builder, :is_usage_stats_disabled, :_vwo_meta
|
|
18
|
+
:should_wait_for_tracking_calls, :settings, :vwo_builder, :is_usage_stats_disabled, :_vwo_meta,
|
|
19
|
+
:retry_config
|
|
19
20
|
|
|
20
21
|
def initialize(options = {})
|
|
21
22
|
@account_id = options[:account_id]
|
|
@@ -33,6 +34,7 @@ class VWOOptionsModel
|
|
|
33
34
|
@vwo_builder = options[:vwo_builder]
|
|
34
35
|
@is_usage_stats_disabled = options[:is_usage_stats_disabled]
|
|
35
36
|
@_vwo_meta = options[:_vwo_meta]
|
|
37
|
+
@retry_config = options[:retry_config]
|
|
36
38
|
end
|
|
37
39
|
|
|
38
40
|
# Creates a model instance from a hash (dictionary)
|
|
@@ -51,6 +53,7 @@ class VWOOptionsModel
|
|
|
51
53
|
@integrations = options[:integrations] if options.key?(:integrations)
|
|
52
54
|
@network = options[:network] if options.key?(:network)
|
|
53
55
|
@settings = options[:settings] if options.key?(:settings)
|
|
56
|
+
@retry_config = options[:retry_config] if options.key?(:retry_config)
|
|
54
57
|
|
|
55
58
|
self
|
|
56
59
|
end
|
|
@@ -114,5 +117,9 @@ class VWOOptionsModel
|
|
|
114
117
|
def get_vwo_meta
|
|
115
118
|
@_vwo_meta
|
|
116
119
|
end
|
|
120
|
+
|
|
121
|
+
def get_retry_config
|
|
122
|
+
@retry_config
|
|
123
|
+
end
|
|
117
124
|
|
|
118
125
|
end
|