Sixpack
Ruby client library for SeatGeak's Sixpack ab testing framework.
Installation
Add this line to your application's Gemfile:
gem 'sixpack-client'
And then execute:
$ bundle
Or install it yourself as:
$ gem install sixpack-client
Usage
Basic example:
require 'sixpack'
session = Sixpack::Session.new
# Participate in a test (creates the test if necessary)
session.participate("new-test", ["alternative-1", "alternative-2"])
# Convert
session.convert("new-test")
Each session has a client_id
associated with it that must be preserved across requests. Here's what the first request might look like:
session = Sixpack::Session.new
session.participate("new-test", ["alternative-1", "alternative-2"])
("sixpack-id", session.client_id)
For future requests, create the Session
using the client_id
stored in the cookie:
client_id = ("sixpack-id")
session = Sixpack::Session.new client_id
session.convert("new-test")
If you already have a client_id (you can generate one using Sixpack.generate_client_id()
) you can use the simple_participate()
and simple_convert()
methods to avoid instantiating a Session
:
Sixpack::simple_partipate("new-test", ["alternative-1", "alternative-2"], client_id)
Sixpack::simple_convert("new-test", client_id)
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request