vwo-sdk 1.28.1 → 1.29.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: 6441e86fb035c61a71233efc6b806be9e5f9bb0ef7a36e4eb20b1de9ddec7f82
4
+ data.tar.gz: 9e027431282f2fc73d45759590999ce85c3a8745cbedb3725e22da592254ee87
5
5
  SHA512:
6
- metadata.gz: 5b5e7dacb7dc0c911eb58a62537785215a22294e76934a0df09729895af37f43d9c0fb527e7c29d3949f37f52ae386f76306ce983e0077942cc13d9a871c589d
7
- data.tar.gz: c15cb7db865a5578660d48ba1708b39cf9591a8f408bf7ed351724147ffa3cd1628cf7536fe92014cbc8f946c5cdd8e90ddc0488c535fb756cea9fc6c91398a3
6
+ metadata.gz: 04dbb5829f1a23dc90b54ae403f93a6c1b8d9f25fccbcce4f94da401faf218aaf0ad928ea555d064043db06c63ddfa5a6373371ebb7f786cdd6e05ce3866dd2a
7
+ data.tar.gz: e1c2f58fb4150a4b76dfcb0da80c1040cd720e9cb0d94b0a7669ec297cef23f9ab5f1ab67711159a8bbb22ce0a749a04039acc24ff2b5063c98df070f64b4706
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.29.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.
@@ -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.29.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-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: codecov
@@ -106,6 +106,7 @@ files:
106
106
  - lib/vwo/user_storage.rb
107
107
  - lib/vwo/utils/campaign.rb
108
108
  - lib/vwo/utils/custom_dimensions.rb
109
+ - lib/vwo/utils/data_location_manager.rb
109
110
  - lib/vwo/utils/feature.rb
110
111
  - lib/vwo/utils/function.rb
111
112
  - lib/vwo/utils/impression.rb