optimizely_server_side 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e32298f15f7388b74f47abe8f85550d0b590d96d
4
- data.tar.gz: babcf58d56c9adc0a8cc13458ff14b0921eed38d
3
+ metadata.gz: 145b5a0f2ef2177328463547242c89d2ed4ed033
4
+ data.tar.gz: 9f91dde0bcdeac9263a8a9cdd1e5cd61dd63f094
5
5
  SHA512:
6
- metadata.gz: a948ea8f67705f498e8b9783eb6834140227a5a87944e4f3f67c499becfd774ba04a333ab9bbff82a687e285c31996232bbeb6e4ee3fe6ea70644b2a1db59ab2
7
- data.tar.gz: c44efd2ba68bdf260569b254c88b9b69beddc90c3d90d93be507d12bc5d55fbe122ff29f0ad9fac8c7ffdea8408b5e27e56990cb511949bd9f861fe06e54a1b6
6
+ metadata.gz: 71c7edd22820a695d10a3c99ace963614206af5bf0453d8b5819380dc0d0ac9f977c4200da8574c0458a9bb490e042a0ccd2debd659fdaef7ec65a0a475e2116
7
+ data.tar.gz: adfc46a67cab06fc9b5cdb1529fcfc11bdac350a94d9260b0d59a0164f46e781d6223007b6e014e3eaae772d88cf046fd4c144b0a9a08639256f1e995b717927
data/Gemfile.lock CHANGED
@@ -1,21 +1,21 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- optimizely_server_side (0.0.3)
4
+ optimizely_server_side (0.0.4)
5
5
  activesupport (~> 4.2, >= 4.2.6)
6
6
  optimizely-sdk (~> 0.1.1)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- activesupport (4.2.7)
11
+ activesupport (4.2.7.1)
12
12
  i18n (~> 0.7)
13
13
  json (~> 1.7, >= 1.7.7)
14
14
  minitest (~> 5.1)
15
15
  thread_safe (~> 0.3, >= 0.3.4)
16
16
  tzinfo (~> 1.1)
17
17
  addressable (2.3.8)
18
- codeclimate-test-reporter (0.5.0)
18
+ codeclimate-test-reporter (0.6.0)
19
19
  simplecov (>= 0.7.1, < 1.0.0)
20
20
  crack (0.4.3)
21
21
  safe_yaml (~> 1.0.0)
@@ -50,9 +50,9 @@ GEM
50
50
  rspec-support (~> 3.5.0)
51
51
  rspec-support (3.5.0)
52
52
  safe_yaml (1.0.4)
53
- simplecov (0.11.2)
53
+ simplecov (0.12.0)
54
54
  docile (~> 1.1.0)
55
- json (~> 1.8)
55
+ json (>= 1.8, < 3)
56
56
  simplecov-html (~> 0.10.0)
57
57
  simplecov-html (0.10.0)
58
58
  thread_safe (0.3.5)
@@ -6,7 +6,7 @@ module OptimizelyServerSide
6
6
  # Configuration enables to open up the configuration of gem for the application.
7
7
  # config_endpoint: Optimizely config endpoint
8
8
  # cache_expiry: (In minutes) How long we want to cache the config.
9
- attr_accessor :config_endpoint, :cache_expiry, :visitor_id
9
+ attr_accessor :config_endpoint, :cache_expiry, :visitor_id, :logger
10
10
 
11
11
  def initialize
12
12
  @config_endpoint = 'http://foo.com'
@@ -19,11 +19,8 @@ module OptimizelyServerSide
19
19
  def fetch
20
20
  begin
21
21
  response = call_optimizely_cdn
22
- if response.is_a?(Net::HTTPSuccess)
23
- new(content: response.body, success: true)
24
- else
25
- fallback
26
- end
22
+ return fallback unless response.is_a?(Net::HTTPSuccess)
23
+ new(content: response.body, success: true)
27
24
  rescue Exception => e
28
25
  fallback
29
26
  end
@@ -32,9 +29,11 @@ module OptimizelyServerSide
32
29
 
33
30
  # Gets data from Optimizely cdn
34
31
  def call_optimizely_cdn
35
- Net::HTTP.get_response(
36
- URI(OptimizelyServerSide.configuration.config_endpoint)
37
- )
32
+ ActiveSupport::Notifications.instrument "oss.call_optimizely_cdn",this: :data do
33
+ Net::HTTP.get_response(
34
+ URI(OptimizelyServerSide.configuration.config_endpoint)
35
+ )
36
+ end
38
37
  end
39
38
 
40
39
  def fallback
@@ -11,7 +11,6 @@ module OptimizelyServerSide
11
11
  self.compute
12
12
  end
13
13
 
14
-
15
14
  def variation_one(key, &blk)
16
15
  @store[key] = blk
17
16
  end
@@ -29,24 +28,12 @@ module OptimizelyServerSide
29
28
  end
30
29
 
31
30
  def compute
32
- puts "---Experience selected----- #{@another_key}"
33
- if @store[@another_key]
34
- @store[@another_key].call
31
+ ActiveSupport::Notifications.instrument "variation.variation", variation: @another_key do
32
+ if @store[@another_key]
33
+ @store[@another_key].call
34
+ end
35
35
  end
36
36
  end
37
37
 
38
38
  end
39
39
  end
40
- #
41
- # a = Foo.new.start do |config|
42
- #
43
- # config.game_one('aa') do
44
- # '<div> \n </div>'
45
- # end
46
- #
47
- # config.game_two('bb') do
48
- # '<div> \n kjsdkaskfsajkfjk </div>'
49
- # end
50
- # end
51
- #
52
- # p a
@@ -28,7 +28,9 @@ module OptimizelyServerSide
28
28
  def optimizely_sdk_project_instance(experiment_key)
29
29
  OptimizelyServerSide::OptimizelySdk
30
30
  .project_instance(event_dispatcher: MyEventDispatcher.new)
31
- .activate(experiment_key, OptimizelyServerSide.configuration.visitor_id)
31
+ .activate(experiment_key,
32
+ OptimizelyServerSide.configuration.visitor_id,
33
+ OptimizelyServerSide.configuration.logger)
32
34
  end
33
35
 
34
36
  end
@@ -16,7 +16,6 @@ module OptimizelyServerSide
16
16
 
17
17
  def cached_datafile
18
18
  Cache.fetch('optimizely_sdk_config') do
19
- puts "*********** Getting the config ***********"
20
19
  DatafileFetcher.datafile.content
21
20
  end
22
21
  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.4'
6
- s.date = '2016-08-13'
5
+ s.version = '0.0.5'
6
+ s.date = '2016-08-14'
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 AB 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"]
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
4
+ version: 0.0.5
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-08-13 00:00:00.000000000 Z
11
+ date: 2016-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -125,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
125
125
  version: '0'
126
126
  requirements: []
127
127
  rubyforge_project:
128
- rubygems_version: 2.5.1
128
+ rubygems_version: 2.4.8
129
129
  signing_key:
130
130
  specification_version: 4
131
131
  summary: Optimizely server side. A wrapper on top of optimizely's ruby sdk for easy