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: 1a9de3f586adcdcd32d071dfbd99f711e0306f49
4
- data.tar.gz: 329491b4394170d8203f3e96fccd79d06634e5ea
3
+ metadata.gz: b2adc2d7c6755664a10e7a43109f478f172e10f0
4
+ data.tar.gz: ca12b6071d0a8abcc9a2079c4bf366d066115001
5
5
  SHA512:
6
- metadata.gz: 8c40bdc79a081f230581026c07743211191d59f369c1a40dd893fd239b3391dc9755027e40a035ca8f8da20c443c5f309a2efb5913febb525d5bc61e43c8e4bd
7
- data.tar.gz: 371e4984981fa146a7a3fd1a94dae1ae5eacacf41459c1fc516d15f1071662bba1ea7fe42fc3021eafa978533164e1a50561e0da530eda3b97ab757d531e762e
6
+ metadata.gz: 987383df683e78fadec0b58a9d3f3915b4105505049a33b20734a6a12ebd9d0881d814e2772d0ceda4dd9b30d0c90d48d1919724318b37ce9186298c10bd1a5f
7
+ data.tar.gz: d4e8a60ab1672b8792f7305b26df719b401462536d0d6438dc2af0d334da36310cbe6db8420e6fd750d8ba32a06ddcd68effb2bd6cb0d7a042c110c96d264105
data/.gitignore CHANGED
@@ -1,4 +1,5 @@
1
1
  .DS_Store
2
2
  optimizely_server_side-*.gem
3
3
  coverage
4
- blocky.rb
4
+ blocky.rb
5
+ ground.rb
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- optimizely_server_side (0.0.11)
4
+ optimizely_server_side (0.0.12)
5
5
  activesupport (~> 4.2, >= 4.2.6)
6
6
  optimizely-sdk (~> 0.1.1)
7
7
 
@@ -3,8 +3,9 @@
3
3
  module OptimizelyServerSide
4
4
  class Experiment
5
5
 
6
- def initialize(key)
7
- @selected_variation_key = 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.11'
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: optimizely_server_side
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ankit Gupta