optimizely_server_side 0.0.13 → 0.0.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog.md +4 -0
- data/Gemfile.lock +1 -1
- data/lib/optimizely_server_side/experiment.rb +9 -0
- data/optimizely_server_side.gemspec +2 -2
- data/spec/optimizely_server_side/experiment_spec.rb +22 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c1dc5c657f7b38c66727a22cfd4be6a821f1a07
|
4
|
+
data.tar.gz: 4278097eedfbc0f0af5764fbd04c57596c82e59a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: afce5a49010d64e70c03d4fcbb71b27bfb1544220e301f0b9bf018b7ee840a234641445ac8ea685f8d6b05270883c0a3213314309583709f808fad23b5a68a62
|
7
|
+
data.tar.gz: a496c71cb65c78df42a45697f24e43465fffa924f0be8ce09e63d84203082f458663f494f80d393d301b53ff37a03bf1052785175b24936825fb6d321015af57
|
data/Changelog.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'active_support/core_ext/string/output_safety'
|
4
|
+
|
3
5
|
module OptimizelyServerSide
|
4
6
|
class Experiment
|
5
7
|
|
@@ -9,6 +11,13 @@ module OptimizelyServerSide
|
|
9
11
|
@variations = []
|
10
12
|
end
|
11
13
|
|
14
|
+
# Hidden omniture tag for HTML tracking
|
15
|
+
def omniture_tag(evar: nil)
|
16
|
+
if @selected_variation_key
|
17
|
+
"<input type='hidden' data-optimizely=#{@experiment_key}:#{@selected_variation_key} data-optimizely-evar=#{evar}></input>".html_safe
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
12
21
|
# Starts the experiment
|
13
22
|
def start
|
14
23
|
yield(self)
|
@@ -2,8 +2,8 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = 'optimizely_server_side'
|
5
|
-
s.version = '0.0.
|
6
|
-
s.date = '2016-09-
|
5
|
+
s.version = '0.0.14'
|
6
|
+
s.date = '2016-09-13'
|
7
7
|
s.summary = "Optimizely server side. A wrapper on top of optimizely's ruby sdk for easy caching of server side config "
|
8
8
|
s.description = "Optimizely server side. A A/B test wrapper on top of optimizely's ruby sdk for easy caching of server side config and exposing few more utility helpers. Handling of fallbacks and marking primary experiments. "
|
9
9
|
s.authors = ["Ankit Gupta"]
|
@@ -350,4 +350,26 @@ RSpec.describe OptimizelyServerSide::Experiment do
|
|
350
350
|
end
|
351
351
|
|
352
352
|
end
|
353
|
+
|
354
|
+
|
355
|
+
describe '#omniture_tag' do
|
356
|
+
|
357
|
+
context 'when experiment and selected variation is present' do
|
358
|
+
|
359
|
+
it 'should have omniture_tag' do
|
360
|
+
expect(subject.omniture_tag(evar: '11')).to eq("<input type='hidden' data-optimizely=foo:variation_key_a data-optimizely-evar=11></input>")
|
361
|
+
end
|
362
|
+
|
363
|
+
end
|
364
|
+
|
365
|
+
context 'when experiment is not having selected variation' do
|
366
|
+
|
367
|
+
subject { OptimizelyServerSide::Experiment.new('bar',nil) }
|
368
|
+
|
369
|
+
it 'should have omniture_tag' do
|
370
|
+
expect(subject.omniture_tag(evar: '11')).to be_nil
|
371
|
+
end
|
372
|
+
|
373
|
+
end
|
374
|
+
end
|
353
375
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: optimizely_server_side
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ankit Gupta
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|