optimizely_server_side 0.0.15 → 0.0.16

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: f506295e66ef04bebba7204e6dd2c4b82620f989
4
- data.tar.gz: b7b5095fd720aff8aeb7d6aa2d91816fdace6b2e
3
+ metadata.gz: 0a7fc6e25fdfc8553b5fff5cceedbbdd3dd8e370
4
+ data.tar.gz: f71fd7a2326133b7da816ad4ad03ebfa7fc8fb9e
5
5
  SHA512:
6
- metadata.gz: 5fa254e7a84ec77046bfbc924757dd162e578c699b8dc861ec51784392ccbb1f4690ac2eb2092f2dc636b1e1155ddbd43a51ef76371090471c8d7782eb1bee41
7
- data.tar.gz: 4c02481cc0760ecffa75a9ca5840c069aa003ab594ece6e2c2a0128aed675ef7f8aeece73b7f7edcff0362e13c608d2dd3f1fd920e3c59a90559fc8ddce1caa5
6
+ metadata.gz: 1a7662d270eafcd8554c735f4caad460c25b8a69dea3b97b51798c9412c7009c950f57b8ec9f63a28df1a782b391d60e0dca4ea8013f286cfc5daf2dd65341b5
7
+ data.tar.gz: 970fe6afc3f367f9d3c2057fd57b5d25e92d853b5fbcac6bd558e4defd59b58f59e1a63bb7a235c71d5c2c066584f5bda3cd32d456fdd8e0a34fbb906afe8085
data/Changelog.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 0.0.16
2
+
3
+ Updated the tracking tag.
4
+
1
5
  # 0.0.15
2
6
 
3
7
  JSON schema validation was making things slow. We are turning it off permanently
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- optimizely_server_side (0.0.15)
4
+ optimizely_server_side (0.0.16)
5
5
  activesupport (~> 4.2, >= 4.2.6)
6
6
  optimizely-sdk (~> 0.1.1)
7
7
 
@@ -14,7 +14,10 @@ module OptimizelyServerSide
14
14
  # Hidden omniture tag for HTML tracking
15
15
  def omniture_tag(evar: nil)
16
16
  if @selected_variation_key
17
- "<input type='hidden' data-optimizely=#{@experiment_key}:#{@selected_variation_key} data-optimizely-evar=#{evar}></input>".html_safe
17
+ #"<input type='hidden' data-optimizely=#{@experiment_key}:#{@selected_variation_key} data-optimizely-evar=#{evar}></input>".html_safe
18
+ #{}"<input type='hidden' data-optimizely=#{@experiment_key}:#{@selected_variation_key} data-optimizely-evar=#{evar}></input>".html_safe
19
+ key = "#{@experiment_key}:#{@selected_variation_key}"
20
+ %Q(<input type="hidden" name="ab_#{key}" id="ab_id_#{key}" value="" data-optimizely="#{key}" data-optimizely-evar="#{evar}"/>).html_safe
18
21
  end
19
22
  end
20
23
 
@@ -48,38 +51,38 @@ module OptimizelyServerSide
48
51
  # Selects and calls the variation which is applicable
49
52
  # In case of running test the applicable variation key is present
50
53
  # In case of fallback / paused test we pick the primary variation
51
- def applicable_variation
52
- ActiveSupport::Notifications.instrument "oss.variation", variation: @selected_variation_key, experiment: @experiment_key, visitor_id: OptimizelyServerSide.configuration.user_attributes['visitor_id'] do
53
- if @variations.any?(&variation_selector)
54
- @variations.find(&variation_selector).call
55
- else
56
- primary_variation.call if primary_variation
57
- end
58
- end
59
- end
54
+ def applicable_variation
55
+ ActiveSupport::Notifications.instrument "oss.variation", variation: @selected_variation_key, experiment: @experiment_key, visitor_id: OptimizelyServerSide.configuration.user_attributes['visitor_id'] do
56
+ if @variations.any?(&variation_selector)
57
+ @variations.find(&variation_selector).call
58
+ else
59
+ primary_variation.call if primary_variation
60
+ end
61
+ end
62
+ end
60
63
 
61
- # Primary variation is where primary: true
62
- def primary_variation
63
- @primary_variation ||= @variations.find(&:primary)
64
- end
64
+ # Primary variation is where primary: true
65
+ def primary_variation
66
+ @primary_variation ||= @variations.find(&:primary)
67
+ end
65
68
 
66
- private
69
+ private
67
70
 
68
- # Scope to query on selected variation
69
- def variation_selector
70
- ->(variation) { variation.key == @selected_variation_key }
71
- end
71
+ # Scope to query on selected variation
72
+ def variation_selector
73
+ ->(variation) { variation.key == @selected_variation_key }
74
+ end
72
75
 
73
- # Add all the variation to the variations collection
74
- def add_variation(key, opts = {}, &blk)
75
- Variation.new(
76
- key: key,
77
- primary: opts[:primary] || false,
78
- content: blk
79
- ).tap do |variation_instance|
80
- @variations << variation_instance
81
- end
82
- end
76
+ # Add all the variation to the variations collection
77
+ def add_variation(key, opts = {}, &blk)
78
+ Variation.new(
79
+ key: key,
80
+ primary: opts[:primary] || false,
81
+ content: blk
82
+ ).tap do |variation_instance|
83
+ @variations << variation_instance
84
+ end
85
+ end
83
86
 
84
- end
85
- end
87
+ end
88
+ end
@@ -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.15'
6
- s.date = '2016-09-14'
5
+ s.version = '0.0.16'
6
+ s.date = '2016-09-19'
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"]
@@ -357,7 +357,7 @@ RSpec.describe OptimizelyServerSide::Experiment do
357
357
  context 'when experiment and selected variation is present' do
358
358
 
359
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>")
360
+ expect(subject.omniture_tag(evar: '11')).to eq("<input type=\"hidden\" name=\"ab_foo:variation_key_a\" id=\"ab_id_foo:variation_key_a\" value=\"\" data-optimizely=\"foo:variation_key_a\" data-optimizely-evar=\"11\"/>")
361
361
  end
362
362
 
363
363
  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.15
4
+ version: 0.0.16
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-14 00:00:00.000000000 Z
11
+ date: 2016-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec