wingify-fme-ruby-sdk 1.50.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 +7 -0
- data/lib/resources/debug_messages.json +21 -0
- data/lib/resources/error_messages.json +63 -0
- data/lib/resources/info_messages.json +43 -0
- data/lib/resources/warn_messages.json +1 -0
- data/lib/vwo.rb +40 -0
- data/lib/wingify/api/get_flag.rb +244 -0
- data/lib/wingify/api/set_attribute.rb +57 -0
- data/lib/wingify/api/track_event.rb +80 -0
- data/lib/wingify/constants/constants.rb +106 -0
- data/lib/wingify/decorators/storage_decorator.rb +82 -0
- data/lib/wingify/enums/api_enum.rb +23 -0
- data/lib/wingify/enums/campaign_type_enum.rb +19 -0
- data/lib/wingify/enums/debug_category_enum.rb +20 -0
- data/lib/wingify/enums/decision_types_enum.rb +18 -0
- data/lib/wingify/enums/event_enum.rb +22 -0
- data/lib/wingify/enums/headers_enum.rb +20 -0
- data/lib/wingify/enums/hooks_enum.rb +17 -0
- data/lib/wingify/enums/http_method_enum.rb +18 -0
- data/lib/wingify/enums/log_level_enum.rb +21 -0
- data/lib/wingify/enums/log_level_to_number.rb +27 -0
- data/lib/wingify/enums/status_enum.rb +19 -0
- data/lib/wingify/enums/storage_enum.rb +22 -0
- data/lib/wingify/enums/url_enum.rb +22 -0
- data/lib/wingify/models/campaign/campaign_model.rb +192 -0
- data/lib/wingify/models/campaign/feature_model.rb +111 -0
- data/lib/wingify/models/campaign/impact_campaign_model.rb +38 -0
- data/lib/wingify/models/campaign/metric_model.rb +44 -0
- data/lib/wingify/models/campaign/rule_model.rb +56 -0
- data/lib/wingify/models/campaign/variable_model.rb +51 -0
- data/lib/wingify/models/campaign/variation_model.rb +137 -0
- data/lib/wingify/models/gateway_service_model.rb +39 -0
- data/lib/wingify/models/schemas/settings_schema_validation.rb +104 -0
- data/lib/wingify/models/settings/settings_model.rb +101 -0
- data/lib/wingify/models/storage/storage_data_model.rb +44 -0
- data/lib/wingify/models/user/context_model.rb +154 -0
- data/lib/wingify/models/user/context_vwo_model.rb +38 -0
- data/lib/wingify/models/user/get_flag_response.rb +50 -0
- data/lib/wingify/models/vwo_options_model.rb +129 -0
- data/lib/wingify/packages/decision_maker/decision_maker.rb +60 -0
- data/lib/wingify/packages/logger/core/log_manager.rb +92 -0
- data/lib/wingify/packages/logger/core/transport_manager.rb +76 -0
- data/lib/wingify/packages/logger/log_message_builder.rb +70 -0
- data/lib/wingify/packages/logger/logger.rb +38 -0
- data/lib/wingify/packages/logger/transports/console_transport.rb +49 -0
- data/lib/wingify/packages/network_layer/client/network_client.rb +276 -0
- data/lib/wingify/packages/network_layer/handlers/request_handler.rb +37 -0
- data/lib/wingify/packages/network_layer/manager/network_manager.rb +145 -0
- data/lib/wingify/packages/network_layer/models/global_request_model.rb +105 -0
- data/lib/wingify/packages/network_layer/models/request_model.rb +179 -0
- data/lib/wingify/packages/network_layer/models/response_model.rb +62 -0
- data/lib/wingify/packages/segmentation_evaluator/core/segmentation_manager.rb +77 -0
- data/lib/wingify/packages/segmentation_evaluator/enums/segment_operand_regex_enum.rb +29 -0
- data/lib/wingify/packages/segmentation_evaluator/enums/segment_operand_value_enum.rb +26 -0
- data/lib/wingify/packages/segmentation_evaluator/enums/segment_operator_value_enum.rb +33 -0
- data/lib/wingify/packages/segmentation_evaluator/evaluators/segment_evaluator.rb +218 -0
- data/lib/wingify/packages/segmentation_evaluator/evaluators/segment_operand_evaluator.rb +415 -0
- data/lib/wingify/packages/segmentation_evaluator/utils/segment_util.rb +44 -0
- data/lib/wingify/packages/storage/connector.rb +26 -0
- data/lib/wingify/packages/storage/storage.rb +47 -0
- data/lib/wingify/services/batch_event_queue.rb +179 -0
- data/lib/wingify/services/campaign_decision_service.rb +161 -0
- data/lib/wingify/services/hooks_service.rb +51 -0
- data/lib/wingify/services/logger_service.rb +114 -0
- data/lib/wingify/services/settings_service.rb +178 -0
- data/lib/wingify/services/storage_service.rb +66 -0
- data/lib/wingify/utils/batch_event_dispatcher_util.rb +178 -0
- data/lib/wingify/utils/brand_context.rb +33 -0
- data/lib/wingify/utils/brand_util.rb +53 -0
- data/lib/wingify/utils/campaign_util.rb +284 -0
- data/lib/wingify/utils/data_type_util.rb +105 -0
- data/lib/wingify/utils/debugger_service_util.rb +40 -0
- data/lib/wingify/utils/decision_util.rb +259 -0
- data/lib/wingify/utils/event_util.rb +55 -0
- data/lib/wingify/utils/function_util.rb +141 -0
- data/lib/wingify/utils/gateway_service_util.rb +101 -0
- data/lib/wingify/utils/impression_util.rb +66 -0
- data/lib/wingify/utils/log_message_util.rb +42 -0
- data/lib/wingify/utils/meg_util.rb +357 -0
- data/lib/wingify/utils/network_util.rb +503 -0
- data/lib/wingify/utils/rule_evaluation_util.rb +57 -0
- data/lib/wingify/utils/settings_util.rb +38 -0
- data/lib/wingify/utils/usage_stats_util.rb +119 -0
- data/lib/wingify/utils/uuid_util.rb +96 -0
- data/lib/wingify/wingify_builder.rb +261 -0
- data/lib/wingify/wingify_client.rb +227 -0
- data/lib/wingify.rb +117 -0
- metadata +327 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Copyright 2024-2026 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
|
+
class GlobalRequestModel
|
|
16
|
+
attr_accessor :url, :timeout, :query, :body, :headers, :is_development_mode
|
|
17
|
+
|
|
18
|
+
# Constructs an instance of the GlobalRequestModel.
|
|
19
|
+
# @param url [String] The base URL of the HTTP request.
|
|
20
|
+
# @param query [Hash] Query parameters as a record of key-value pairs.
|
|
21
|
+
# @param body [Hash] Body of the request as a record of key-value pairs.
|
|
22
|
+
# @param headers [Hash] HTTP headers as a record of key-value pairs.
|
|
23
|
+
def initialize(url, query, body, headers)
|
|
24
|
+
@url = url
|
|
25
|
+
@query = query
|
|
26
|
+
@body = body
|
|
27
|
+
@headers = headers
|
|
28
|
+
@timeout = 3000 # Default timeout in milliseconds
|
|
29
|
+
@is_development_mode = nil # Flag to indicate if the request is in development mode
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Sets the query parameters for the HTTP request.
|
|
33
|
+
# @param query [Hash] A record of key-value pairs representing the query parameters.
|
|
34
|
+
def set_query(query)
|
|
35
|
+
@query = query
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Retrieves the query parameters of the HTTP request.
|
|
39
|
+
# @returns [Hash] A record of key-value pairs representing the query parameters.
|
|
40
|
+
def get_query
|
|
41
|
+
@query
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Sets the body of the HTTP request.
|
|
45
|
+
# @param body [Hash] A record of key-value pairs representing the body content.
|
|
46
|
+
def set_body(body)
|
|
47
|
+
@body = body
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Retrieves the body of the HTTP request.
|
|
51
|
+
# @returns [Hash] A record of key-value pairs representing the body content.
|
|
52
|
+
def get_body
|
|
53
|
+
@body
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Sets the base URL of the HTTP request.
|
|
57
|
+
# @param url [String] The base URL as a string.
|
|
58
|
+
def set_base_url(url)
|
|
59
|
+
@url = url
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# Retrieves the base URL of the HTTP request.
|
|
63
|
+
# @returns [String] The base URL as a string.
|
|
64
|
+
def get_base_url
|
|
65
|
+
@url
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# Sets the timeout duration for the HTTP request.
|
|
69
|
+
# @param timeout [Integer] Timeout in milliseconds.
|
|
70
|
+
def set_timeout(timeout)
|
|
71
|
+
@timeout = timeout
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# Retrieves the timeout duration of the HTTP request.
|
|
75
|
+
# @returns [Integer] Timeout in milliseconds.
|
|
76
|
+
def get_timeout
|
|
77
|
+
@timeout
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
# Sets the HTTP headers for the request.
|
|
81
|
+
# @param headers [Hash] A record of key-value pairs representing the HTTP headers.
|
|
82
|
+
def set_headers(headers)
|
|
83
|
+
@headers = headers
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# Retrieves the HTTP headers of the request.
|
|
87
|
+
# @returns [Hash] A record of key-value pairs representing the HTTP headers.
|
|
88
|
+
def get_headers
|
|
89
|
+
@headers
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# Sets the development mode status for the request.
|
|
93
|
+
# @param is_development_mode [Boolean] Boolean flag indicating if the request is in development mode.
|
|
94
|
+
def set_development_mode(is_development_mode)
|
|
95
|
+
@is_development_mode = is_development_mode
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# Retrieves the development mode status of the request.
|
|
99
|
+
# @returns [Boolean] Boolean indicating if the request is in development mode.
|
|
100
|
+
def get_development_mode
|
|
101
|
+
@is_development_mode
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
# Copyright 2024-2026 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
|
+
class RequestModel
|
|
16
|
+
attr_accessor :url, :method, :path, :query, :timeout, :body, :headers, :scheme, :port, :last_error, :retry_config, :event_name, :uuid, :campaign_id, :event_properties
|
|
17
|
+
|
|
18
|
+
def initialize(url, method = 'GET', path = '', query = {}, body = {}, headers = {}, scheme = 'https', port = nil, retry_config = nil)
|
|
19
|
+
@url = scheme + '://' + url
|
|
20
|
+
@method = method
|
|
21
|
+
@path = path
|
|
22
|
+
@query = query
|
|
23
|
+
@timeout = 5000
|
|
24
|
+
@body = body
|
|
25
|
+
@headers = headers
|
|
26
|
+
@scheme = scheme
|
|
27
|
+
@port = port
|
|
28
|
+
@last_error = nil
|
|
29
|
+
@retry_config = retry_config
|
|
30
|
+
@event_name = nil
|
|
31
|
+
@uuid = nil
|
|
32
|
+
@campaign_id = nil
|
|
33
|
+
@event_properties = nil
|
|
34
|
+
if !@port.nil?
|
|
35
|
+
@url = @url + ':' + @port.to_s
|
|
36
|
+
end
|
|
37
|
+
parse_options
|
|
38
|
+
self
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def parse_options
|
|
42
|
+
_hostname, collection_prefix = @url.split('/')
|
|
43
|
+
|
|
44
|
+
# Process body if present
|
|
45
|
+
if !@body.nil?
|
|
46
|
+
@headers['Content-Type'] = 'application/json'
|
|
47
|
+
@headers['Content-Length'] = @body.to_json.bytesize.to_s
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Process path and query parameters
|
|
51
|
+
if !@path.nil?
|
|
52
|
+
query_string = @query.map { |k,v| "#{k}=#{v}" }.join('&')
|
|
53
|
+
@path = query_string.empty? ? @path : "#{@path}?#{query_string}"
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Add collection prefix if present
|
|
57
|
+
@path = "#{collection_prefix}#{@path}" if collection_prefix
|
|
58
|
+
|
|
59
|
+
# Add timeout
|
|
60
|
+
@timeout = @timeout if @timeout
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def set_timeout(timeout)
|
|
64
|
+
@timeout = timeout
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def get_timeout
|
|
68
|
+
@timeout
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def set_body(body)
|
|
72
|
+
@body = body
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def get_body
|
|
76
|
+
@body
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def set_headers(headers)
|
|
80
|
+
@headers = headers
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def get_headers
|
|
84
|
+
@headers
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def set_scheme(scheme)
|
|
88
|
+
@scheme = scheme
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def get_scheme
|
|
92
|
+
@scheme
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def set_port(port)
|
|
96
|
+
@port = port
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def get_port
|
|
100
|
+
@port
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def set_path(path)
|
|
104
|
+
@path = path
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def get_path
|
|
108
|
+
@path
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
def set_query(query)
|
|
112
|
+
@query = query
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
def get_query
|
|
116
|
+
@query
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
def set_url(url)
|
|
120
|
+
@url = url
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
def get_url
|
|
124
|
+
@url
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
def set_method(method)
|
|
128
|
+
@method = method
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
def get_method
|
|
132
|
+
@method
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
def set_query(query)
|
|
136
|
+
@query = query
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
def get_query
|
|
140
|
+
@query
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
def set_url(url)
|
|
144
|
+
@url = url
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
def get_url
|
|
148
|
+
@url
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
def set_last_error(last_error)
|
|
152
|
+
@last_error = last_error
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
def get_last_error
|
|
156
|
+
@last_error
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
def get_retry_config
|
|
160
|
+
@retry_config
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
def set_retry_config(retry_config)
|
|
164
|
+
@retry_config = retry_config
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
def get_extra_info
|
|
168
|
+
extra_info = {}
|
|
169
|
+
white_listed_keys = [:event_name, :uuid, :campaign_id, :event_properties]
|
|
170
|
+
|
|
171
|
+
white_listed_keys.each do |key|
|
|
172
|
+
value = instance_variable_get("@#{key}")
|
|
173
|
+
extra_info[key] = value if !value.nil?
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
extra_info
|
|
177
|
+
end
|
|
178
|
+
end
|
|
179
|
+
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Copyright 2024-2026 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
|
+
class ResponseModel
|
|
16
|
+
attr_accessor :status_code, :error, :headers, :data, :total_attempts
|
|
17
|
+
|
|
18
|
+
def initialize
|
|
19
|
+
@status_code = nil
|
|
20
|
+
@error = nil
|
|
21
|
+
@headers = {}
|
|
22
|
+
@data = nil
|
|
23
|
+
@total_attempts = 0
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def set_status_code(code)
|
|
27
|
+
@status_code = code
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def set_headers(headers)
|
|
31
|
+
@headers = headers
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def set_data(data)
|
|
35
|
+
@data = data
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def get_data
|
|
39
|
+
@data
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def set_error(error)
|
|
43
|
+
@error = error
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def get_error
|
|
47
|
+
@error
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def get_status_code
|
|
51
|
+
@status_code
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def set_total_attempts(total_attempts)
|
|
55
|
+
@total_attempts = total_attempts
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def get_total_attempts
|
|
59
|
+
@total_attempts
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Copyright 2024-2026 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
|
+
require_relative '../evaluators/segment_evaluator'
|
|
16
|
+
require_relative '../../../models/settings/settings_model'
|
|
17
|
+
require_relative '../../../utils/gateway_service_util'
|
|
18
|
+
require_relative '../../../enums/url_enum'
|
|
19
|
+
require_relative '../../../services/logger_service'
|
|
20
|
+
require_relative '../../../models/user/context_model'
|
|
21
|
+
require_relative '../../../models/campaign/feature_model'
|
|
22
|
+
require_relative '../../../models/user/context_vwo_model'
|
|
23
|
+
require_relative '../../../services/settings_service'
|
|
24
|
+
require_relative '../../../utils/data_type_util'
|
|
25
|
+
require_relative '../../../enums/log_level_enum'
|
|
26
|
+
require_relative '../../../enums/api_enum'
|
|
27
|
+
class SegmentationManager
|
|
28
|
+
@@instance = nil # Singleton instance
|
|
29
|
+
|
|
30
|
+
attr_accessor :evaluator
|
|
31
|
+
|
|
32
|
+
def self.instance
|
|
33
|
+
@@instance ||= SegmentationManager.new
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def initialize
|
|
37
|
+
@evaluator = SegmentEvaluator.new
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def attach_evaluator(evaluator = nil)
|
|
41
|
+
@evaluator = evaluator || SegmentEvaluator.new
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Set the context for the segmentation evaluator
|
|
45
|
+
# @param settings [SettingsModel] The settings model
|
|
46
|
+
# @param feature [FeatureModel] The feature model
|
|
47
|
+
# @param context [ContextModel] The context model
|
|
48
|
+
def set_contextual_data(settings, feature, context)
|
|
49
|
+
attach_evaluator
|
|
50
|
+
@evaluator.settings = settings
|
|
51
|
+
@evaluator.context = context
|
|
52
|
+
@evaluator.feature = feature
|
|
53
|
+
|
|
54
|
+
# If both user agent and IP address are null, avoid making a gateway service call
|
|
55
|
+
return if context&.get_user_agent.nil? && context&.get_ip_address.nil?
|
|
56
|
+
|
|
57
|
+
if feature.get_is_gateway_service_required
|
|
58
|
+
if SettingsService.instance.is_gateway_service_provided && (context.get_vwo.nil?)
|
|
59
|
+
query_params = {}
|
|
60
|
+
query_params['userAgent'] = context.get_user_agent if context&.get_user_agent
|
|
61
|
+
query_params['ipAddress'] = context.get_ip_address if context&.get_ip_address
|
|
62
|
+
|
|
63
|
+
begin
|
|
64
|
+
params = get_query_params(query_params)
|
|
65
|
+
vwo_data = get_from_gateway_service(params, UrlEnum::GET_USER_DATA)
|
|
66
|
+
context.set_vwo(ContextVWOModel.new.model_from_dictionary(vwo_data))
|
|
67
|
+
rescue StandardError => e
|
|
68
|
+
LoggerService.log(LogLevelEnum::ERROR, "ERROR_SETTING_SEGMENTATION_CONTEXT", { err: e.message, an: ApiEnum::GET_FLAG, sId: context.get_session_id, uuid: context.get_uuid})
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def validate_segmentation(dsl, properties)
|
|
75
|
+
@evaluator.is_segmentation_valid(dsl, properties)
|
|
76
|
+
end
|
|
77
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Copyright 2024-2026 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 SegmentOperandRegexEnum
|
|
16
|
+
LOWER = '^lower'
|
|
17
|
+
LOWER_MATCH = '^lower\\((.*)\\)'
|
|
18
|
+
WILDCARD = '^wildcard'
|
|
19
|
+
WILDCARD_MATCH = '^wildcard\\((.*)\\)'
|
|
20
|
+
REGEX = '^regex'
|
|
21
|
+
REGEX_MATCH = '^regex\\((.*)\\)'
|
|
22
|
+
STARTING_STAR = '^\\*'
|
|
23
|
+
ENDING_STAR = '\\*$'
|
|
24
|
+
GREATER_THAN_MATCH = '^gt\\((\\d+(?:\\.\\d+)*|\\.\\d+)\\)'
|
|
25
|
+
GREATER_THAN_EQUAL_TO_MATCH = '^gte\\((\\d+(?:\\.\\d+)*|\\.\\d+)\\)'
|
|
26
|
+
LESS_THAN_MATCH = '^lt\\((\\d+(?:\\.\\d+)*|\\.\\d+)\\)'
|
|
27
|
+
LESS_THAN_EQUAL_TO_MATCH = '^lte\\((\\d+(?:\\.\\d+)*|\\.\\d+)\\)'
|
|
28
|
+
end
|
|
29
|
+
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Copyright 2024-2026 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 SegmentOperandValueEnum
|
|
16
|
+
LOWER_VALUE = 1
|
|
17
|
+
STARTING_ENDING_STAR_VALUE = 2
|
|
18
|
+
STARTING_STAR_VALUE = 3
|
|
19
|
+
ENDING_STAR_VALUE = 4
|
|
20
|
+
REGEX_VALUE = 5
|
|
21
|
+
EQUAL_VALUE = 6
|
|
22
|
+
GREATER_THAN_VALUE = 7
|
|
23
|
+
GREATER_THAN_EQUAL_TO_VALUE = 8
|
|
24
|
+
LESS_THAN_VALUE = 9
|
|
25
|
+
LESS_THAN_EQUAL_TO_VALUE = 10
|
|
26
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Copyright 2024-2026 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 SegmentOperatorValueEnum
|
|
16
|
+
AND = 'and'
|
|
17
|
+
NOT = 'not'
|
|
18
|
+
OR = 'or'
|
|
19
|
+
CUSTOM_VARIABLE = 'custom_variable'
|
|
20
|
+
USER = 'user'
|
|
21
|
+
COUNTRY = 'country'
|
|
22
|
+
REGION = 'region'
|
|
23
|
+
CITY = 'city'
|
|
24
|
+
OPERATING_SYSTEM = 'os'
|
|
25
|
+
DEVICE_TYPE = 'device_type'
|
|
26
|
+
DEVICE = 'device'
|
|
27
|
+
BROWSER_AGENT = 'browser_string'
|
|
28
|
+
UA = 'ua'
|
|
29
|
+
FEATURE_ID = 'featureId'
|
|
30
|
+
IP = 'ip_address'
|
|
31
|
+
BROWSER_VERSION = 'browser_version'
|
|
32
|
+
OS_VERSION = 'os_version'
|
|
33
|
+
end
|