vwo-sdk 1.28.1 → 1.30.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1c400549b29ac39cc261161405dce7f824dfbcb93988b72be6f04f4174560f10
4
- data.tar.gz: 1c5d98bcab0c7f3746f8757ff8bbac99fae551ef29c5f5f6273fc2c0dbe6623c
3
+ metadata.gz: a8bf50eeb65a850a9a49fb00628208670c6bd7a167c591d8d649573fa0a67bc7
4
+ data.tar.gz: cfc520d123444c23f36683a1d89bef145e466ea21a9044543641226614e076df
5
5
  SHA512:
6
- metadata.gz: 5b5e7dacb7dc0c911eb58a62537785215a22294e76934a0df09729895af37f43d9c0fb527e7c29d3949f37f52ae386f76306ce983e0077942cc13d9a871c589d
7
- data.tar.gz: c15cb7db865a5578660d48ba1708b39cf9591a8f408bf7ed351724147ffa3cd1628cf7536fe92014cbc8f946c5cdd8e90ddc0488c535fb756cea9fc6c91398a3
6
+ metadata.gz: 1e79a2e33a718e0379724b39d115f59e4ef0925f9dcc682f6c553166af90d444f7a74c5551a9474051fcee1213104a8b6fe8c9842a51da1be90f76020c38a3da
7
+ data.tar.gz: 553e1b3553f5c3b49d3d1dae6fdd176706129d892439b04517d5e670f1945b91246c69ec0a2ceb95b14ad7334fb4b9b580cbbc26be1cbfd10495f77fae13673c
data/lib/vwo/constants.rb CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright 2019-2021 Wingify Software Pvt. Ltd.
1
+ # Copyright 2019-2022 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.
@@ -27,7 +27,7 @@ class VWO
27
27
  HTTP_PROTOCOL = 'http://'
28
28
  HTTPS_PROTOCOL = 'https://'
29
29
  URL_NAMESPACE = '6ba7b811-9dad-11d1-80b4-00c04fd430c8'
30
- SDK_VERSION = '1.28.1'
30
+ SDK_VERSION = '1.30.0'
31
31
  SDK_NAME = 'ruby'
32
32
  VWO_DELIMITER = '_vwo_'
33
33
  MAX_EVENTS_PER_REQUEST = 5000
@@ -1,4 +1,4 @@
1
- # Copyright 2019-2021 Wingify Software Pvt. Ltd.
1
+ # Copyright 2019-2022 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.
@@ -95,8 +95,8 @@ class VWO
95
95
  end
96
96
 
97
97
  user_id_for_hash_value = user_id
98
- if campaign[:isBucketingSeedEnabled]
99
- user_id_for_hash_value = campaign[:id].to_s + "_" + user_id
98
+ if campaign['isBucketingSeedEnabled']
99
+ user_id_for_hash_value = campaign['id'].to_s + "_" + user_id
100
100
  end
101
101
  hash_value = MurmurHash3::V32.str_hash(user_id_for_hash_value, SEED_VALUE) & U_MAX_32_BIT
102
102
  normalize = MAX_TRAFFIC_VALUE.to_f / campaign['percentTraffic']
@@ -147,8 +147,8 @@ class VWO
147
147
  user_id_for_hash_value = user_id
148
148
  if group_id
149
149
  user_id_for_hash_value = group_id.to_s + "_" + user_id
150
- elsif campaign[:isBucketingSeedEnabled]
151
- user_id_for_hash_value = campaign[:id].to_s + "_" + user_id
150
+ elsif campaign['isBucketingSeedEnabled']
151
+ user_id_for_hash_value = campaign['id'].to_s + "_" + user_id
152
152
  end
153
153
  hash_value = MurmurHash3::V32.str_hash(user_id_for_hash_value, SEED_VALUE) & U_MAX_32_BIT
154
154
  bucket_value = get_bucket_value(hash_value, MAX_TRAFFIC_PERCENT)
@@ -1,4 +1,4 @@
1
- # Copyright 2019-2021 Wingify Software Pvt. Ltd.
1
+ # Copyright 2019-2022 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.
data/lib/vwo/enums.rb CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright 2019-2021 Wingify Software Pvt. Ltd.
1
+ # Copyright 2019-2022 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.
data/lib/vwo/logger.rb CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright 2019-2021 Wingify Software Pvt. Ltd.
1
+ # Copyright 2019-2022 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.
@@ -1,4 +1,4 @@
1
- # Copyright 2019-2021 Wingify Software Pvt. Ltd.
1
+ # Copyright 2019-2022 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.
@@ -29,6 +29,9 @@ class VWO
29
29
  isEventArchEnabled: {
30
30
  type: ['boolean']
31
31
  },
32
+ collectionPrefix: {
33
+ type: ['string']
34
+ },
32
35
  campaigns: {
33
36
  if: {
34
37
  type: 'array'
@@ -1,4 +1,4 @@
1
- # Copyright 2019-2021 Wingify Software Pvt. Ltd.
1
+ # Copyright 2019-2022 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.
@@ -15,10 +15,12 @@
15
15
  require_relative '../logger'
16
16
  require_relative '../enums'
17
17
  require_relative '../utils/request'
18
+ require_relative '../utils/utility'
18
19
  class VWO
19
20
  module Services
20
21
  class BatchEventsDispatcher
21
22
  include VWO::Enums
23
+ include VWO::Utils::Utility
22
24
  # Initialize the BatchEventDispatcher with logger and development mode
23
25
  #
24
26
  # @param [Boolean] : To specify whether the request
@@ -36,7 +38,7 @@ class VWO
36
38
  # @return[Boolean]
37
39
  #
38
40
  def dispatch(impression, callback, query_params)
39
- url = CONSTANTS::HTTPS_PROTOCOL + CONSTANTS::ENDPOINTS::BASE_URL + CONSTANTS::ENDPOINTS::BATCH_EVENTS
41
+ url = CONSTANTS::HTTPS_PROTOCOL + get_url(CONSTANTS::ENDPOINTS::BATCH_EVENTS)
40
42
  account_id = query_params[:a]
41
43
  resp = VWO::Utils::Request.post(url, query_params, impression)
42
44
  if resp.code == '200'
@@ -1,4 +1,4 @@
1
- # Copyright 2019-2021 Wingify Software Pvt. Ltd.
1
+ # Copyright 2019-2022 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.
@@ -1,4 +1,4 @@
1
- # Copyright 2019-2021 Wingify Software Pvt. Ltd.
1
+ # Copyright 2019-2022 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.
@@ -15,6 +15,7 @@
15
15
  require_relative '../logger'
16
16
  require_relative '../enums'
17
17
  require_relative '../utils/request'
18
+ require_relative '../utils/utility'
18
19
  require_relative '../constants'
19
20
 
20
21
  class VWO
@@ -22,6 +23,7 @@ class VWO
22
23
  class EventDispatcher
23
24
  include VWO::Enums
24
25
  include VWO::CONSTANTS
26
+ include Utils::Utility
25
27
 
26
28
  EXCLUDE_KEYS = ['url'].freeze
27
29
 
@@ -69,7 +71,7 @@ class VWO
69
71
  def dispatch_event_arch_post(params, post_data)
70
72
  return true if @is_development_mode
71
73
 
72
- url = HTTPS_PROTOCOL + ENDPOINTS::BASE_URL + ENDPOINTS::EVENTS
74
+ url = HTTPS_PROTOCOL + get_url(ENDPOINTS::EVENTS)
73
75
  resp = VWO::Utils::Request.event_post(url, params, post_data, SDK_NAME)
74
76
  if resp.code == '200'
75
77
  @logger.log(
@@ -1,4 +1,4 @@
1
- # Copyright 2019-2021 Wingify Software Pvt. Ltd.
1
+ # Copyright 2019-2022 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.
@@ -1,4 +1,4 @@
1
- # Copyright 2019-2021 Wingify Software Pvt. Ltd.
1
+ # Copyright 2019-2022 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.
@@ -1,4 +1,4 @@
1
- # Copyright 2019-2021 Wingify Software Pvt. Ltd.
1
+ # Copyright 2019-2022 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.
@@ -1,4 +1,4 @@
1
- # Copyright 2019-2021 Wingify Software Pvt. Ltd.
1
+ # Copyright 2019-2022 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.
@@ -1,4 +1,4 @@
1
- # Copyright 2019-2021 Wingify Software Pvt. Ltd.
1
+ # Copyright 2019-2022 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.
@@ -1,4 +1,4 @@
1
- # Copyright 2019-2021 Wingify Software Pvt. Ltd.
1
+ # Copyright 2019-2022 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.
@@ -1,4 +1,4 @@
1
- # Copyright 2019-2021 Wingify Software Pvt. Ltd.
1
+ # Copyright 2019-2022 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.
@@ -1,4 +1,4 @@
1
- # Copyright 2019-2021 Wingify Software Pvt. Ltd.
1
+ # Copyright 2019-2022 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.
@@ -1,4 +1,4 @@
1
- # Copyright 2019-2021 Wingify Software Pvt. Ltd.
1
+ # Copyright 2019-2022 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.
@@ -29,7 +29,7 @@ class VWO
29
29
  include VWO::Utils::Utility
30
30
 
31
31
  def get_url_params(settings_file, tag_key, tag_value, user_id, sdk_key)
32
- url = HTTPS_PROTOCOL + ENDPOINTS::BASE_URL + ENDPOINTS::PUSH
32
+ url = HTTPS_PROTOCOL + get_url(ENDPOINTS::PUSH)
33
33
  tag = { 'u' => {} }
34
34
  tag['u'][tag_key] = tag_value
35
35
 
@@ -0,0 +1,46 @@
1
+ # Copyright 2019-2022 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
+
16
+ require_relative '../constants'
17
+
18
+ # Utility module for generating uuid
19
+ class VWO
20
+ module Utils
21
+ class DataLocationManager
22
+
23
+ @@instance = nil
24
+
25
+ def self.get_instance
26
+ if @@instance.nil?
27
+ @@instance = self.new
28
+ end
29
+ @@instance
30
+ end
31
+
32
+
33
+ def get_data_location
34
+ url = VWO::CONSTANTS::ENDPOINTS::BASE_URL
35
+ if @settings.key?("collectionPrefix")
36
+ url = url + '/' + @settings["collectionPrefix"]
37
+ end
38
+ url
39
+ end
40
+
41
+ def set_settings(settings)
42
+ @settings = settings
43
+ end
44
+ end
45
+ end
46
+ end
@@ -1,4 +1,4 @@
1
- # Copyright 2019-2021 Wingify Software Pvt. Ltd.
1
+ # Copyright 2019-2022 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.
@@ -1,4 +1,4 @@
1
- # Copyright 2019-2021 Wingify Software Pvt. Ltd.
1
+ # Copyright 2019-2022 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.
@@ -1,4 +1,4 @@
1
- # Copyright 2019-2021 Wingify Software Pvt. Ltd.
1
+ # Copyright 2019-2022 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.
@@ -67,12 +67,11 @@ class VWO
67
67
 
68
68
  impression = usage_stats.merge(impression)
69
69
 
70
- url = HTTPS_PROTOCOL + ENDPOINTS::BASE_URL
71
70
  logger = VWO::Logger.get_instance
72
71
 
73
72
  if is_track_user_api
74
73
  impression['ed'] = JSON.generate(p: 'server')
75
- impression['url'] = "#{url}#{ENDPOINTS::TRACK_USER}"
74
+ impression['url'] = HTTPS_PROTOCOL + get_url(ENDPOINTS::TRACK_USER)
76
75
  logger.log(
77
76
  LogLevelEnum::DEBUG,
78
77
  format(
@@ -82,7 +81,7 @@ class VWO
82
81
  )
83
82
  )
84
83
  else
85
- impression['url'] = url + ENDPOINTS::TRACK_GOAL
84
+ impression['url'] = HTTPS_PROTOCOL + get_url(ENDPOINTS::TRACK_GOAL)
86
85
  impression['goal_id'] = goal_id
87
86
  impression['r'] = revenue if revenue
88
87
  logger.log(
@@ -1,4 +1,4 @@
1
- # Copyright 2019-2021 Wingify Software Pvt. Ltd.
1
+ # Copyright 2019-2022 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.
@@ -1,4 +1,4 @@
1
- # Copyright 2019-2021 Wingify Software Pvt. Ltd.
1
+ # Copyright 2019-2022 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.
@@ -1,4 +1,4 @@
1
- # Copyright 2019-2021 Wingify Software Pvt. Ltd.
1
+ # Copyright 2019-2022 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.
@@ -14,12 +14,16 @@
14
14
 
15
15
  require 'json'
16
16
  require_relative './validations'
17
+ require_relative './data_location_manager'
18
+ require_relative '../constants'
17
19
 
18
20
  # Generic utility module
19
21
  class VWO
20
22
  module Utils
21
23
  module Utility
22
24
  include Validations
25
+ include VWO::Utils
26
+ include VWO::CONSTANTS
23
27
 
24
28
  # converting hash with keys as strings into hash with keys as strings
25
29
  # @param[Hash]
@@ -42,6 +46,10 @@ class VWO
42
46
  properties.delete("env".to_sym)
43
47
  JSON.generate(properties)
44
48
  end
49
+
50
+ def get_url(endpoint)
51
+ return DataLocationManager.get_instance().get_data_location + endpoint
52
+ end
45
53
  end
46
54
  end
47
55
  end
@@ -1,4 +1,4 @@
1
- # Copyright 2019-2021 Wingify Software Pvt. Ltd.
1
+ # Copyright 2019-2022 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.
@@ -1,4 +1,4 @@
1
- # Copyright 2019-2021 Wingify Software Pvt. Ltd.
1
+ # Copyright 2019-2022 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.
data/lib/vwo.rb CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright 2019-2021 Wingify Software Pvt. Ltd.
1
+ # Copyright 2019-2022 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.
@@ -24,6 +24,7 @@ require_relative 'vwo/utils/impression'
24
24
  require_relative 'vwo/utils/feature'
25
25
  require_relative 'vwo/utils/custom_dimensions'
26
26
  require_relative 'vwo/utils/utility'
27
+ require_relative 'vwo/utils/data_location_manager'
27
28
  require_relative 'vwo/constants'
28
29
  require_relative 'vwo/core/variation_decider'
29
30
  require_relative 'vwo/services/batch_events_dispatcher'
@@ -41,6 +42,7 @@ class VWO
41
42
  include Utils::Campaign
42
43
  include Utils::Impression
43
44
  include Utils::Utility
45
+ include VWO::Utils
44
46
  include CONSTANTS
45
47
 
46
48
  FILE = FileNameEnum::VWO
@@ -123,6 +125,7 @@ class VWO
123
125
  # Process the settings file
124
126
  @config.process_settings_file
125
127
  @settings_file = @config.get_settings_file
128
+ DataLocationManager.get_instance().set_settings(@settings_file)
126
129
 
127
130
  @usage_stats = VWO::Services::UsageStats.new(usage_stats, @is_development_mode)
128
131
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vwo-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.28.1
4
+ version: 1.30.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - VWO
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-23 00:00:00.000000000 Z
11
+ date: 2022-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: codecov
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0.1'
83
+ - !ruby/object:Gem::Dependency
84
+ name: vwo_log_messages
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 0.7.1
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.7.1
83
97
  description: Ruby SDK for VWO FullStack testing.
84
98
  email:
85
99
  - dev@wingify.com
@@ -106,6 +120,7 @@ files:
106
120
  - lib/vwo/user_storage.rb
107
121
  - lib/vwo/utils/campaign.rb
108
122
  - lib/vwo/utils/custom_dimensions.rb
123
+ - lib/vwo/utils/data_location_manager.rb
109
124
  - lib/vwo/utils/feature.rb
110
125
  - lib/vwo/utils/function.rb
111
126
  - lib/vwo/utils/impression.rb