optimizely_server_side 0.0.11 → 0.0.12
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2adc2d7c6755664a10e7a43109f478f172e10f0
|
4
|
+
data.tar.gz: ca12b6071d0a8abcc9a2079c4bf366d066115001
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 987383df683e78fadec0b58a9d3f3915b4105505049a33b20734a6a12ebd9d0881d814e2772d0ceda4dd9b30d0c90d48d1919724318b37ce9186298c10bd1a5f
|
7
|
+
data.tar.gz: d4e8a60ab1672b8792f7305b26df719b401462536d0d6438dc2af0d334da36310cbe6db8420e6fd750d8ba32a06ddcd68effb2bd6cb0d7a042c110c96d264105
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -3,8 +3,9 @@
|
|
3
3
|
module OptimizelyServerSide
|
4
4
|
class Experiment
|
5
5
|
|
6
|
-
def initialize(
|
7
|
-
@selected_variation_key =
|
6
|
+
def initialize(experiment_key, selected_variation_key)
|
7
|
+
@selected_variation_key = selected_variation_key
|
8
|
+
@experiment_key = experiment_key
|
8
9
|
@variations = []
|
9
10
|
end
|
10
11
|
|
@@ -39,7 +40,7 @@ module OptimizelyServerSide
|
|
39
40
|
# In case of running test the applicable variation key is present
|
40
41
|
# In case of fallback / paused test we pick the primary variation
|
41
42
|
def applicable_variation
|
42
|
-
ActiveSupport::Notifications.instrument "oss.variation", variation: @selected_variation_key do
|
43
|
+
ActiveSupport::Notifications.instrument "oss.variation", variation: @selected_variation_key, experiment: @experiment_key, visitor_id: OptimizelyServerSide.configuration.user_attributes['visitor_id'] do
|
43
44
|
if @variations.any?(&variation_selector)
|
44
45
|
@variations.find(&variation_selector).call
|
45
46
|
else
|
@@ -23,7 +23,7 @@ module OptimizelyServerSide
|
|
23
23
|
# end
|
24
24
|
def experiment(experiment_key, &blk)
|
25
25
|
variation_key = optimizely_sdk_project_instance(experiment_key)
|
26
|
-
OptimizelyServerSide::Experiment.new(variation_key).start(&blk)
|
26
|
+
OptimizelyServerSide::Experiment.new(experiment_key, variation_key).start(&blk)
|
27
27
|
end
|
28
28
|
|
29
29
|
def optimizely_sdk_project_instance(experiment_key)
|
@@ -2,7 +2,7 @@ $:.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.
|
5
|
+
s.version = '0.0.12'
|
6
6
|
s.date = '2016-08-28'
|
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. "
|
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
RSpec.describe OptimizelyServerSide::Experiment do
|
4
4
|
|
5
|
-
subject { OptimizelyServerSide::Experiment.new(variation_key = 'variation_key_a') }
|
5
|
+
subject { OptimizelyServerSide::Experiment.new('foo', variation_key = 'variation_key_a') }
|
6
6
|
|
7
7
|
|
8
8
|
describe '#applicable_variation' do
|
@@ -29,7 +29,7 @@ RSpec.describe OptimizelyServerSide::Experiment do
|
|
29
29
|
|
30
30
|
|
31
31
|
context 'when variation_key is not present' do
|
32
|
-
subject { OptimizelyServerSide::Experiment.new(variation_key = '') }
|
32
|
+
subject { OptimizelyServerSide::Experiment.new(experiment = 'foo', variation_key = '') }
|
33
33
|
|
34
34
|
it 'should be nil' do
|
35
35
|
expect(subject.applicable_variation).to be_nil
|
@@ -39,7 +39,7 @@ RSpec.describe OptimizelyServerSide::Experiment do
|
|
39
39
|
|
40
40
|
context 'when the variation are named anything else' do
|
41
41
|
|
42
|
-
subject { OptimizelyServerSide::Experiment.new(variation_key = 'foobar') }
|
42
|
+
subject { OptimizelyServerSide::Experiment.new(experiment = 'foo', variation_key = 'foobar') }
|
43
43
|
|
44
44
|
let(:some_method) { Proc.new {|n| n*2 } }
|
45
45
|
|