optimizely_server_side 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/Readme.md +11 -3
- data/lib/optimizely_server_side/configuration.rb +2 -1
- data/lib/optimizely_server_side/helpers/support.rb +1 -1
- data/optimizely_server_side.gemspec +2 -2
- data/spec/optimizely_server_side/configuration_spec.rb +9 -0
- data/spec/optimizely_server_side_spec.rb +9 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e914671dc234dd0b0a8cc3b7aa11903a4398095
|
4
|
+
data.tar.gz: 6b2e99cc7637393048c5b4fd1930a0d811c69b3e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb68662ca48927d48c1bfea819646234181cc06c298d5c3af713432a156c80fcb39945435cb7e439266a286329810bc468a7f30e3c7e5b5c6b4cdcf1b3253982
|
7
|
+
data.tar.gz: edbfc9ce0f8200fe70e594030fa37092b8119095c486ee46b3fbee99f9ae5c19be3bb866390e0c523fec18fde906350d303b1499ba9df30380d155a6c6eb23af
|
data/Gemfile.lock
CHANGED
data/Readme.md
CHANGED
@@ -51,12 +51,20 @@ Add an initializer in `config/initializers/optimizely_server_side.rb`
|
|
51
51
|
```ruby
|
52
52
|
#config/initializers/optimizely_server_side.rb
|
53
53
|
OptimizelyServerSide.configure do |config|
|
54
|
-
config.config_endpoint
|
55
|
-
config.cache_expiry
|
54
|
+
config.config_endpoint = 'https://cdn.optimizely.com/json/PROJECT_ID.json'
|
55
|
+
config.cache_expiry = 15 #(this is in minutes)
|
56
|
+
config.event_dispatcher = MyEventDispatcher.new
|
56
57
|
end
|
57
58
|
|
58
59
|
```
|
59
|
-
|
60
|
+
|
61
|
+
Config info
|
62
|
+
|
63
|
+
`config_endpoint` - This is the Datafile endpoint which returns JSON config. `PROJECT_ID` is a id of your server side project at https://app.optimizely.com .
|
64
|
+
`cache_expiry` - Time we want to keep the config cached in memory.
|
65
|
+
`event_dispatcher` - Optimizely needs to track every visit. You can pass your own event dispatcher from here. Read [more](https://developers.optimizely.com/server/reference/index#event-dispatcher)
|
66
|
+
|
67
|
+
|
60
68
|
|
61
69
|
|
62
70
|
Optimizely needs a `visitor_id` to track the unique user and server a constant experience.
|
@@ -6,7 +6,8 @@ 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, :logger
|
9
|
+
attr_accessor :config_endpoint, :cache_expiry, :visitor_id, :logger,
|
10
|
+
:event_dispatcher
|
10
11
|
|
11
12
|
def initialize
|
12
13
|
@config_endpoint = 'http://foo.com'
|
@@ -26,7 +26,7 @@ module OptimizelyServerSide
|
|
26
26
|
|
27
27
|
def optimizely_sdk_project_instance(experiment_key)
|
28
28
|
OptimizelyServerSide::OptimizelySdk
|
29
|
-
.project_instance(event_dispatcher:
|
29
|
+
.project_instance(event_dispatcher: OptimizelyServerSide.configuration.event_dispatcher)
|
30
30
|
.activate(experiment_key,
|
31
31
|
OptimizelyServerSide.configuration.visitor_id,
|
32
32
|
OptimizelyServerSide.configuration.logger)
|
@@ -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-08-
|
5
|
+
s.version = '0.0.9'
|
6
|
+
s.date = '2016-08-24'
|
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"]
|
@@ -2,6 +2,8 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
RSpec.describe OptimizelyServerSide do
|
4
4
|
|
5
|
+
class Anonymous; end
|
6
|
+
|
5
7
|
describe "#configure" do
|
6
8
|
|
7
9
|
context 'when config is set in regular way' do
|
@@ -31,8 +33,9 @@ RSpec.describe OptimizelyServerSide do
|
|
31
33
|
|
32
34
|
before do
|
33
35
|
OptimizelyServerSide.configure do |config|
|
34
|
-
config.config_endpoint
|
35
|
-
config.cache_expiry
|
36
|
+
config.config_endpoint = 'https://cdn.optimizely.com/json/5960232316.json'
|
37
|
+
config.cache_expiry = 12
|
38
|
+
config.event_dispatcher = Anonymous.new
|
36
39
|
end
|
37
40
|
end
|
38
41
|
|
@@ -51,6 +54,10 @@ RSpec.describe OptimizelyServerSide do
|
|
51
54
|
it 'has no visitor_id' do
|
52
55
|
expect(OptimizelyServerSide.configuration.visitor_id).to eq('1234abcdef')
|
53
56
|
end
|
57
|
+
|
58
|
+
it 'has instance of event_dispatcher' do
|
59
|
+
expect(OptimizelyServerSide.configuration.event_dispatcher).to be_kind_of(Anonymous)
|
60
|
+
end
|
54
61
|
end
|
55
62
|
|
56
63
|
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.9
|
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-
|
11
|
+
date: 2016-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -126,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
126
126
|
version: '0'
|
127
127
|
requirements: []
|
128
128
|
rubyforge_project:
|
129
|
-
rubygems_version: 2.
|
129
|
+
rubygems_version: 2.5.1
|
130
130
|
signing_key:
|
131
131
|
specification_version: 4
|
132
132
|
summary: Optimizely server side. A wrapper on top of optimizely's ruby sdk for easy
|