vwo-fme-ruby-sdk 1.0.0 → 1.1.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/vwo/api/get_flag.rb +236 -0
- data/lib/vwo/api/set_attribute.rb +57 -0
- data/lib/vwo/api/track_event.rb +77 -0
- data/lib/vwo/constants/constants.rb +54 -0
- data/lib/vwo/decorators/storage_decorator.rb +86 -0
- data/lib/vwo/{utils/logger_helper.rb → enums/api_enum.rb} +5 -10
- data/lib/vwo/enums/campaign_type_enum.rb +19 -0
- data/lib/vwo/enums/decision_types_enum.rb +18 -0
- data/lib/vwo/enums/event_enum.rb +19 -0
- data/lib/vwo/enums/headers_enum.rb +20 -0
- data/lib/vwo/enums/hooks_enum.rb +17 -0
- data/lib/vwo/enums/http_method_enum.rb +18 -0
- data/lib/vwo/enums/log_level_enum.rb +21 -0
- data/lib/vwo/enums/status_enum.rb +19 -0
- data/lib/vwo/enums/storage_enum.rb +22 -0
- data/lib/vwo/enums/url_enum.rb +21 -0
- data/lib/vwo/models/campaign/campaign_model.rb +192 -0
- data/lib/vwo/models/campaign/feature_model.rb +111 -0
- data/lib/vwo/models/campaign/impact_campaign_model.rb +38 -0
- data/lib/vwo/models/campaign/metric_model.rb +44 -0
- data/lib/vwo/models/campaign/rule_model.rb +56 -0
- data/lib/vwo/models/campaign/variable_model.rb +51 -0
- data/lib/vwo/models/campaign/variation_model.rb +137 -0
- data/lib/vwo/models/gateway_service_model.rb +39 -0
- data/lib/vwo/models/schemas/settings_schema_validation.rb +102 -0
- data/lib/vwo/models/settings/settings_model.rb +85 -0
- data/lib/vwo/models/storage/storage_data_model.rb +44 -0
- data/lib/vwo/models/user/context_model.rb +100 -0
- data/lib/vwo/models/user/context_vwo_model.rb +38 -0
- data/lib/vwo/{utils/feature_flag_response.rb → models/user/get_flag_response.rb} +14 -14
- data/lib/vwo/models/vwo_options_model.rb +107 -0
- data/lib/vwo/packages/decision_maker/decision_maker.rb +60 -0
- data/lib/vwo/packages/logger/core/log_manager.rb +90 -0
- data/lib/vwo/packages/logger/core/transport_manager.rb +87 -0
- data/lib/vwo/packages/logger/log_message_builder.rb +70 -0
- data/lib/vwo/packages/logger/logger.rb +38 -0
- data/lib/vwo/packages/logger/transports/console_transport.rb +49 -0
- data/lib/vwo/packages/network_layer/client/network_client.rb +107 -0
- data/lib/vwo/packages/network_layer/handlers/request_handler.rb +37 -0
- data/lib/vwo/packages/network_layer/manager/network_manager.rb +78 -0
- data/lib/vwo/packages/network_layer/models/global_request_model.rb +105 -0
- data/lib/vwo/packages/network_layer/models/request_model.rb +145 -0
- data/lib/vwo/packages/network_layer/models/response_model.rb +45 -0
- data/lib/vwo/packages/segmentation_evaluator/core/segmentation_manager.rb +76 -0
- data/lib/vwo/packages/segmentation_evaluator/enums/segment_operand_regex_enum.rb +29 -0
- data/lib/vwo/packages/segmentation_evaluator/enums/segment_operand_value_enum.rb +26 -0
- data/lib/vwo/packages/segmentation_evaluator/enums/segment_operator_value_enum.rb +30 -0
- data/lib/vwo/packages/segmentation_evaluator/evaluators/segment_evaluator.rb +210 -0
- data/lib/vwo/packages/segmentation_evaluator/evaluators/segment_operand_evaluator.rb +198 -0
- data/lib/vwo/packages/segmentation_evaluator/utils/segment_util.rb +44 -0
- data/lib/vwo/{constants.rb → packages/storage/connector.rb} +12 -10
- data/lib/vwo/packages/storage/storage.rb +45 -0
- data/lib/vwo/services/campaign_decision_service.rb +153 -0
- data/lib/vwo/services/hooks_service.rb +51 -0
- data/lib/vwo/services/logger_service.rb +83 -0
- data/lib/vwo/services/settings_service.rb +120 -0
- data/lib/vwo/services/storage_service.rb +65 -0
- data/lib/vwo/utils/campaign_util.rb +249 -0
- data/lib/vwo/utils/data_type_util.rb +105 -0
- data/lib/vwo/utils/decision_util.rb +253 -0
- data/lib/vwo/utils/function_util.rb +123 -0
- data/lib/vwo/utils/gateway_service_util.rb +101 -0
- data/lib/vwo/utils/impression_util.rb +49 -0
- data/lib/vwo/utils/log_message_util.rb +42 -0
- data/lib/vwo/utils/meg_util.rb +350 -0
- data/lib/vwo/utils/network_util.rb +235 -0
- data/lib/vwo/utils/rule_evaluation_util.rb +57 -0
- data/lib/vwo/utils/settings_util.rb +38 -0
- data/lib/vwo/utils/url_util.rb +46 -0
- data/lib/vwo/utils/uuid_util.rb +55 -0
- data/lib/vwo/vwo_builder.rb +156 -11
- data/lib/vwo/vwo_client.rb +163 -113
- data/lib/vwo.rb +49 -31
- metadata +187 -9
- data/lib/vwo/utils/request.rb +0 -89
@@ -0,0 +1,21 @@
|
|
1
|
+
# Copyright 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 LogLevelEnum
|
16
|
+
TRACE = 'trace'
|
17
|
+
DEBUG = 'debug'
|
18
|
+
INFO = 'info'
|
19
|
+
WARN = 'warn'
|
20
|
+
ERROR = 'error'
|
21
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# Copyright 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 StatusEnum
|
16
|
+
PASSED = 'passed'
|
17
|
+
FAILED = 'failed'
|
18
|
+
end
|
19
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# Copyright 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 StorageEnum
|
16
|
+
STORAGE_UNDEFINED = :storage_undefined
|
17
|
+
INCORRECT_DATA = :incorrect_data
|
18
|
+
NO_DATA_FOUND = :no_data_found
|
19
|
+
CAMPAIGN_PAUSED = :campaign_paused
|
20
|
+
VARIATION_NOT_FOUND = :variation_not_found
|
21
|
+
WHITELISTED_VARIATION = :whitelisted_variation
|
22
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# Copyright 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 UrlEnum
|
16
|
+
BASE_URL = 'dev.visualwebsiteoptimizer.com'
|
17
|
+
SETTINGS_URL = '/server-side/settings'
|
18
|
+
EVENTS = '/events/t'
|
19
|
+
ATTRIBUTE_CHECK = '/check-attribute'
|
20
|
+
GET_USER_DATA = '/get-user-details'
|
21
|
+
end
|
@@ -0,0 +1,192 @@
|
|
1
|
+
# Copyright 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
|
+
require_relative 'metric_model'
|
16
|
+
require_relative 'variable_model'
|
17
|
+
require_relative 'variation_model'
|
18
|
+
|
19
|
+
class CampaignModel
|
20
|
+
attr_reader :id, :segments, :salt, :percent_traffic, :is_user_list_enabled, :key, :type, :name,
|
21
|
+
:is_forced_variation_enabled, :variations, :metrics, :variables, :variation_id,
|
22
|
+
:campaign_id, :rule_key
|
23
|
+
|
24
|
+
def initialize
|
25
|
+
@id = nil
|
26
|
+
@segments = {}
|
27
|
+
@salt = ''
|
28
|
+
@percent_traffic = 0
|
29
|
+
@is_user_list_enabled = false
|
30
|
+
@key = ''
|
31
|
+
@type = ''
|
32
|
+
@name = ''
|
33
|
+
@is_forced_variation_enabled = false
|
34
|
+
@variations = []
|
35
|
+
@metrics = []
|
36
|
+
@variables = []
|
37
|
+
@variation_id = nil
|
38
|
+
@campaign_id = nil
|
39
|
+
@rule_key = ''
|
40
|
+
end
|
41
|
+
|
42
|
+
# Copies campaign properties from another CampaignModel instance
|
43
|
+
def copy(campaign_model)
|
44
|
+
@metrics = campaign_model.metrics
|
45
|
+
@variations = campaign_model.variations
|
46
|
+
@variables = campaign_model.variables
|
47
|
+
process_campaign_keys(campaign_model)
|
48
|
+
end
|
49
|
+
|
50
|
+
# Creates a model instance from a dictionary (hash) or CampaignModel
|
51
|
+
def model_from_dictionary(campaign)
|
52
|
+
if campaign.is_a?(Hash)
|
53
|
+
process_campaign_properties(campaign)
|
54
|
+
process_campaign_keys(campaign)
|
55
|
+
elsif campaign.is_a?(CampaignModel)
|
56
|
+
process_campaign_model(campaign)
|
57
|
+
end
|
58
|
+
self
|
59
|
+
end
|
60
|
+
|
61
|
+
def get_id
|
62
|
+
@id
|
63
|
+
end
|
64
|
+
|
65
|
+
def get_segments
|
66
|
+
@segments
|
67
|
+
end
|
68
|
+
|
69
|
+
def get_salt
|
70
|
+
@salt
|
71
|
+
end
|
72
|
+
|
73
|
+
def get_traffic
|
74
|
+
@percent_traffic
|
75
|
+
end
|
76
|
+
|
77
|
+
def get_is_user_list_enabled
|
78
|
+
@is_user_list_enabled
|
79
|
+
end
|
80
|
+
|
81
|
+
def get_key
|
82
|
+
@key
|
83
|
+
end
|
84
|
+
|
85
|
+
def set_key(key)
|
86
|
+
@key = key
|
87
|
+
end
|
88
|
+
|
89
|
+
def get_type
|
90
|
+
@type
|
91
|
+
end
|
92
|
+
|
93
|
+
def get_name
|
94
|
+
@name
|
95
|
+
end
|
96
|
+
|
97
|
+
def get_is_forced_variation_enabled
|
98
|
+
@is_forced_variation_enabled
|
99
|
+
end
|
100
|
+
|
101
|
+
def get_variations
|
102
|
+
@variations
|
103
|
+
end
|
104
|
+
|
105
|
+
def set_variations(variations)
|
106
|
+
@variations = variations
|
107
|
+
end
|
108
|
+
|
109
|
+
def get_metrics
|
110
|
+
@metrics
|
111
|
+
end
|
112
|
+
|
113
|
+
def get_variables
|
114
|
+
@variables
|
115
|
+
end
|
116
|
+
|
117
|
+
def get_variation_id
|
118
|
+
@variation_id
|
119
|
+
end
|
120
|
+
|
121
|
+
def get_campaign_id
|
122
|
+
@campaign_id
|
123
|
+
end
|
124
|
+
|
125
|
+
def get_rule_key
|
126
|
+
@rule_key
|
127
|
+
end
|
128
|
+
|
129
|
+
def set_rule_key(rule_key)
|
130
|
+
@rule_key = rule_key
|
131
|
+
end
|
132
|
+
|
133
|
+
# Process campaign properties (metrics, variations, variables)
|
134
|
+
def process_campaign_properties(campaign)
|
135
|
+
@variables = process_variables(campaign["variables"]) if campaign["variables"]
|
136
|
+
@variations = process_variations(campaign["variations"]) if campaign["variations"]
|
137
|
+
@metrics = process_metrics(campaign["metrics"]) if campaign["metrics"]
|
138
|
+
end
|
139
|
+
|
140
|
+
# Process campaign keys
|
141
|
+
def process_campaign_keys(campaign)
|
142
|
+
@id = campaign["id"]
|
143
|
+
@percent_traffic = campaign["percentTraffic"]
|
144
|
+
@name = campaign["name"]
|
145
|
+
@variation_id = campaign["variationId"]
|
146
|
+
@campaign_id = campaign["campaignId"]
|
147
|
+
@rule_key = campaign["ruleKey"]
|
148
|
+
@is_forced_variation_enabled = campaign["isForcedVariationEnabled"]
|
149
|
+
@is_user_list_enabled = campaign["isUserListEnabled"]
|
150
|
+
@segments = campaign["segments"]
|
151
|
+
@key = campaign["key"]
|
152
|
+
@type = campaign["type"]
|
153
|
+
@salt = campaign["salt"]
|
154
|
+
end
|
155
|
+
|
156
|
+
# Process variables
|
157
|
+
def process_variables(variable_list)
|
158
|
+
return [] if variable_list.nil? || variable_list.is_a?(Hash) # Handle empty cases
|
159
|
+
variable_list.map { |variable| VariableModel.new.model_from_dictionary(variable) }
|
160
|
+
end
|
161
|
+
|
162
|
+
# Process variations
|
163
|
+
def process_variations(variation_list)
|
164
|
+
return [] if variation_list.nil? || variation_list.is_a?(Hash) # Handle empty cases
|
165
|
+
variation_list.map { |variation| VariationModel.new.model_from_dictionary(variation) }
|
166
|
+
end
|
167
|
+
|
168
|
+
# Process metrics
|
169
|
+
def process_metrics(metrics_list)
|
170
|
+
return [] if metrics_list.nil? || metrics_list.is_a?(Hash) # Handle empty cases
|
171
|
+
metrics_list.map { |metric| MetricModel.new.model_from_dictionary(metric) }
|
172
|
+
end
|
173
|
+
|
174
|
+
# Process campaign properties from CampaignModel instance
|
175
|
+
def process_campaign_model(campaign_model)
|
176
|
+
@variables = campaign_model.variables
|
177
|
+
@variations = campaign_model.variations
|
178
|
+
@metrics = campaign_model.metrics
|
179
|
+
@id = campaign_model.id
|
180
|
+
@percent_traffic = campaign_model.percent_traffic
|
181
|
+
@name = campaign_model.name
|
182
|
+
@variation_id = campaign_model.variation_id
|
183
|
+
@campaign_id = campaign_model.campaign_id
|
184
|
+
@rule_key = campaign_model.rule_key
|
185
|
+
@is_forced_variation_enabled = campaign_model.is_forced_variation_enabled
|
186
|
+
@is_user_list_enabled = campaign_model.is_user_list_enabled
|
187
|
+
@segments = campaign_model.segments
|
188
|
+
@key = campaign_model.key
|
189
|
+
@type = campaign_model.type
|
190
|
+
@salt = campaign_model.salt
|
191
|
+
end
|
192
|
+
end
|
@@ -0,0 +1,111 @@
|
|
1
|
+
# Copyright 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
|
+
require_relative 'campaign_model'
|
16
|
+
require_relative 'impact_campaign_model'
|
17
|
+
require_relative 'metric_model'
|
18
|
+
require_relative 'rule_model'
|
19
|
+
|
20
|
+
class FeatureModel
|
21
|
+
attr_reader :id, :key, :name, :type, :rules, :impact_campaign, :rules_linked_campaign, :metrics, :is_gateway_service_required
|
22
|
+
|
23
|
+
def initialize
|
24
|
+
@id = nil
|
25
|
+
@key = ''
|
26
|
+
@name = ''
|
27
|
+
@type = ''
|
28
|
+
@rules = []
|
29
|
+
@impact_campaign = nil
|
30
|
+
@rules_linked_campaign = []
|
31
|
+
@metrics = []
|
32
|
+
@is_gateway_service_required = false
|
33
|
+
end
|
34
|
+
|
35
|
+
# Creates a model instance from a hash (dictionary)
|
36
|
+
def model_from_dictionary(feature)
|
37
|
+
@id = feature["id"]
|
38
|
+
@key = feature["key"]
|
39
|
+
@name = feature["name"]
|
40
|
+
@type = feature["type"]
|
41
|
+
@is_gateway_service_required = feature["is_gateway_service_required"] if feature.key?("is_gateway_service_required")
|
42
|
+
|
43
|
+
if feature["impactCampaign"]
|
44
|
+
@impact_campaign = ImpactCampaignModel.new.model_from_dictionary(feature["impactCampaign"])
|
45
|
+
end
|
46
|
+
|
47
|
+
@metrics = process_metrics(feature["metrics"])
|
48
|
+
@rules = process_rules(feature["rules"])
|
49
|
+
@rules_linked_campaign = feature["rules_linked_campaign"].is_a?(Array) ? feature["rules_linked_campaign"] : []
|
50
|
+
|
51
|
+
self
|
52
|
+
end
|
53
|
+
|
54
|
+
# Setter method for rules_linked_campaign
|
55
|
+
def set_rules_linked_campaign(rules_linked_campaign)
|
56
|
+
@rules_linked_campaign = rules_linked_campaign
|
57
|
+
end
|
58
|
+
|
59
|
+
# Setter method for is_gateway_service_required
|
60
|
+
def set_is_gateway_service_required(is_gateway_service_required)
|
61
|
+
@is_gateway_service_required = is_gateway_service_required
|
62
|
+
end
|
63
|
+
|
64
|
+
def get_id
|
65
|
+
@id
|
66
|
+
end
|
67
|
+
|
68
|
+
def get_key
|
69
|
+
@key
|
70
|
+
end
|
71
|
+
|
72
|
+
def get_name
|
73
|
+
@name
|
74
|
+
end
|
75
|
+
|
76
|
+
def get_type
|
77
|
+
@type
|
78
|
+
end
|
79
|
+
|
80
|
+
def get_rules
|
81
|
+
@rules
|
82
|
+
end
|
83
|
+
|
84
|
+
def get_impact_campaign
|
85
|
+
@impact_campaign
|
86
|
+
end
|
87
|
+
|
88
|
+
def get_rules_linked_campaign
|
89
|
+
@rules_linked_campaign
|
90
|
+
end
|
91
|
+
|
92
|
+
def get_metrics
|
93
|
+
@metrics
|
94
|
+
end
|
95
|
+
|
96
|
+
def get_is_gateway_service_required
|
97
|
+
@is_gateway_service_required
|
98
|
+
end
|
99
|
+
|
100
|
+
# Process rules list
|
101
|
+
def process_rules(rule_list)
|
102
|
+
return [] unless rule_list.is_a?(Array)
|
103
|
+
rule_list.map { |rule| RuleModel.new.model_from_dictionary(rule) }
|
104
|
+
end
|
105
|
+
|
106
|
+
# Process metrics list
|
107
|
+
def process_metrics(metric_list)
|
108
|
+
return [] unless metric_list.is_a?(Array)
|
109
|
+
metric_list.map { |metric| MetricModel.new.model_from_dictionary(metric) }
|
110
|
+
end
|
111
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# Copyright 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
|
+
class ImpactCampaignModel
|
16
|
+
attr_reader :campaign_id, :type
|
17
|
+
|
18
|
+
def initialize
|
19
|
+
@campaign_id = nil
|
20
|
+
@type = ''
|
21
|
+
end
|
22
|
+
|
23
|
+
# Creates a model instance from a hash (dictionary)
|
24
|
+
def model_from_dictionary(impact_campaign)
|
25
|
+
@type = impact_campaign["type"]
|
26
|
+
@campaign_id = impact_campaign["campaignId"]
|
27
|
+
self
|
28
|
+
end
|
29
|
+
|
30
|
+
def get_campaign_id
|
31
|
+
@campaign_id
|
32
|
+
end
|
33
|
+
|
34
|
+
def get_type
|
35
|
+
@type
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# Copyright 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
|
+
class MetricModel
|
16
|
+
attr_reader :id, :identifier, :type
|
17
|
+
|
18
|
+
def initialize
|
19
|
+
@id = nil
|
20
|
+
@identifier = ''
|
21
|
+
@type = ''
|
22
|
+
end
|
23
|
+
|
24
|
+
# Creates a model instance from a hash (dictionary)
|
25
|
+
def model_from_dictionary(metric)
|
26
|
+
@identifier = metric["identifier"]
|
27
|
+
@id = metric["id"]
|
28
|
+
@type = metric["type"]
|
29
|
+
self
|
30
|
+
end
|
31
|
+
|
32
|
+
def get_id
|
33
|
+
@id
|
34
|
+
end
|
35
|
+
|
36
|
+
def get_identifier
|
37
|
+
@identifier
|
38
|
+
end
|
39
|
+
|
40
|
+
def get_type
|
41
|
+
@type
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# Copyright 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
|
+
class RuleModel
|
16
|
+
attr_reader :status, :variation_id, :campaign_id, :type, :rule_key
|
17
|
+
|
18
|
+
def initialize
|
19
|
+
@status = false
|
20
|
+
@variation_id = nil
|
21
|
+
@campaign_id = nil
|
22
|
+
@type = ''
|
23
|
+
@rule_key = ''
|
24
|
+
end
|
25
|
+
|
26
|
+
# Creates a model instance from a hash (dictionary)
|
27
|
+
def model_from_dictionary(rule)
|
28
|
+
@type = rule["type"]
|
29
|
+
@status = rule["status"]
|
30
|
+
@variation_id = rule["variationId"]
|
31
|
+
@campaign_id = rule["campaignId"]
|
32
|
+
@rule_key = rule["ruleKey"]
|
33
|
+
self
|
34
|
+
end
|
35
|
+
|
36
|
+
def get_type
|
37
|
+
@type
|
38
|
+
end
|
39
|
+
|
40
|
+
def get_status
|
41
|
+
@status
|
42
|
+
end
|
43
|
+
|
44
|
+
def get_variation_id
|
45
|
+
@variation_id
|
46
|
+
end
|
47
|
+
|
48
|
+
def get_campaign_id
|
49
|
+
@campaign_id
|
50
|
+
end
|
51
|
+
|
52
|
+
def get_rule_key
|
53
|
+
@rule_key
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# Copyright 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
|
+
class VariableModel
|
16
|
+
attr_accessor :value, :type, :key
|
17
|
+
attr_reader :id
|
18
|
+
|
19
|
+
def initialize
|
20
|
+
@value = nil
|
21
|
+
@type = ''
|
22
|
+
@key = ''
|
23
|
+
@id = nil
|
24
|
+
end
|
25
|
+
|
26
|
+
# Creates a model instance from a hash (dictionary)
|
27
|
+
def model_from_dictionary(variable)
|
28
|
+
@value = variable["value"]
|
29
|
+
@type = variable["type"]
|
30
|
+
@key = variable["key"]
|
31
|
+
@id = variable["id"]
|
32
|
+
self
|
33
|
+
end
|
34
|
+
|
35
|
+
def get_value
|
36
|
+
@value
|
37
|
+
end
|
38
|
+
|
39
|
+
def get_type
|
40
|
+
@type
|
41
|
+
end
|
42
|
+
|
43
|
+
def get_key
|
44
|
+
@key
|
45
|
+
end
|
46
|
+
|
47
|
+
def get_id
|
48
|
+
@id
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|