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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 395cfc72480c54d7496ff48ce7f682705d88d4ac
4
- data.tar.gz: d987a1ef921031138855b6b5eb27e67bb906a705
3
+ metadata.gz: 8e914671dc234dd0b0a8cc3b7aa11903a4398095
4
+ data.tar.gz: 6b2e99cc7637393048c5b4fd1930a0d811c69b3e
5
5
  SHA512:
6
- metadata.gz: 5a73a00dad7f421378571df87d7e153878092c7eac2c8564f1ff8ad8fe7fbde23abfc7f5b2a7d6858e9d4fd7fd6b57106bd4a2ed56e6be951dddf9419e99791b
7
- data.tar.gz: 37d648f8125bdab609eb42ca5b0b45025a91e3ed7ba541647c276d84fecc396a9ed794cc959ca1958e1f01883dbe82619c9fe9c3543dfa4231ca840d29c5e6ec
6
+ metadata.gz: fb68662ca48927d48c1bfea819646234181cc06c298d5c3af713432a156c80fcb39945435cb7e439266a286329810bc468a7f30e3c7e5b5c6b4cdcf1b3253982
7
+ data.tar.gz: edbfc9ce0f8200fe70e594030fa37092b8119095c486ee46b3fbee99f9ae5c19be3bb866390e0c523fec18fde906350d303b1499ba9df30380d155a6c6eb23af
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- optimizely_server_side (0.0.8)
4
+ optimizely_server_side (0.0.9)
5
5
  activesupport (~> 4.2, >= 4.2.6)
6
6
  optimizely-sdk (~> 0.1.1)
7
7
 
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 = 'https://cdn.optimizely.com/json/PROJECT_ID.json'
55
- config.cache_expiry = 15 #(this is in minutes)
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
- `PROJECT_ID` is a id of your server side project at https://app.optimizely.com .
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: MyEventDispatcher.new)
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.8'
6
- s.date = '2016-08-16'
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"]
@@ -18,4 +18,13 @@ RSpec.describe OptimizelyServerSide::Configuration do
18
18
  expect(subject.visitor_id).to be_nil
19
19
  end
20
20
  end
21
+
22
+
23
+ describe '#event_dispatcher' do
24
+
25
+ it 'defaults to nil' do
26
+ expect(subject.visitor_id).to be_nil
27
+ end
28
+
29
+ end
21
30
  end
@@ -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 = 'https://cdn.optimizely.com/json/5960232316.json'
35
- config.cache_expiry = 12
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.8
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-16 00:00:00.000000000 Z
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.4.8
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