snogmetrics 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/lib/snogmetrics.rb CHANGED
@@ -14,7 +14,7 @@
14
14
  # the default implementation outputs the real API only when
15
15
  # `Rails.env.production?` is true.
16
16
  module Snogmetrics
17
- VERSION = '0.1.2'
17
+ VERSION = '0.1.3'
18
18
 
19
19
  # Returns an instance of KissmetricsApi, which is an interface to the
20
20
  # KISSmetrics API. It has the methods #record and #identify, which work just
@@ -68,6 +68,11 @@ private
68
68
  end
69
69
  end
70
70
 
71
+ # Register which variant the user saw in an A/B test.
72
+ def set(experiment, variant)
73
+ queue << ['set', experiment, variant]
74
+ end
75
+
71
76
  # Equivalent to `js(:reset => true)`, i.e. returns the JavaScript code
72
77
  # needed to load the KISSmetrics API and send the current state, and reset
73
78
  # the state afterwards.
data/snogmetrics.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{snogmetrics}
8
- s.version = "0.1.2"
8
+ s.version = "0.1.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Theo"]
12
- s.date = %q{2010-04-02}
12
+ s.date = %q{2010-04-16}
13
13
  s.description = %q{SNOGmetrics gives you the best of both worlds: access to KISSmetrics' JavaScript API through Ruby}
14
14
  s.email = %q{theo@iconara.net}
15
15
  s.extra_rdoc_files = [
@@ -74,6 +74,13 @@ describe Snogmetrics do
74
74
  end
75
75
  end
76
76
 
77
+ describe '#set' do
78
+ it 'will output code that pushes a set call with the provided experiment name and variant' do
79
+ @context.km.set('My Awesome Experiment', 'variant_a')
80
+ @context.km.js.should include('_kmq.push(["set","My Awesome Experiment","variant_a"])')
81
+ end
82
+ end
83
+
77
84
  describe '#js' do
78
85
  it 'outputs nothing if there are no events and no identity' do
79
86
  @context.km.js.should be_empty
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 2
9
- version: 0.1.2
8
+ - 3
9
+ version: 0.1.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Theo
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-02 00:00:00 +02:00
17
+ date: 2010-04-16 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies: []
20
20