[![Coverage Status](https://coveralls.io/repos/github/GreetzNL/abby-client/badge.svg)](https://coveralls.io/github/GreetzNL/abby-client)
[![Build Status](https://travis-ci.com/GreetzNL/abby-client.svg?token=n8i4tz6gpgW4zgU5pvDP&branch=master)](https://travis-ci.com/GreetzNL/abby-client)


# Abby client

This is the client library for Greetz's very own A/B testing platform.

## Usage

First you need to init the module to be able to fetch all active experiment.

`const abbyClient = require('abby-client')({ apiEndpoint, tags, logger }, synchroniser);`

### Config

`apiEndpoint` - String: absolute address of API endpoint

`tags` - String: meta info like name of current envouriment

`logger` - Class|Object: logger object which will replace default logger. Note that it should support `log`, `debug`, and `error` methods. By default it will use `console`.

`interval` - Number: amount of milliseconds before calling api for experiments. Default 1 minute (60000ms)
### Synchroniser
*TODO*:
`synchroniser` - Class|Object: synchroniser object.

to start fetching you need to run

`abbyClient.ready()`

and then you are ready to use it. Just pass your request and response objects and abby-client will set appropirate experiments to response object.

`abbyClient(req, res)`

## Test
Run `npm test` to start tests. It will automatically generate coverage.
