# Introduction
HAPILib provides a set of JavaScript libraries to interact with the HAPI API.
It also provides a collection of utility classes which should help the creation 
of Avatar Builder Applications.

#Installation

```
npm install hapilib
```

#Usage

These libraries depend on jQuery >= 1.7.x so to be able to use them you need
to include jQuery in your html page / project.

To use the libraries just include the solo/hapi.js in your html page.

```html
<script type="text/javascript" src="hapi.js"></script>
```

then create a hapi client object

```javascript
var hc = hapi.require('./lib/com/huzutech/hapi/HAPI').Singleton;
hc.init("https://yourHAPIendpoint", "yourclientid", initialisedCallback);

hc.facebookLogin(signed_request_object, username, loggedinCallback);
```

#Development

You need to have phantomJS installed on your machine and linked in your PATH.

from the root of the repo install all the npm dependencies 
```
npm install .
```

you also need to install hem globally, because windows doesn't want to run node_modules/hem/bin/hem from a childProcess exec function.

```
npm install hem -g
```

run the tests
```
cake test
```

build the library
```
cake build
```

#Documentation (beta)

Documentation is automatically generated when building the libraries.
All the docs are in the doc folder. Open the doc/index.html file to see it.

#NPM publishing

At the moment hapilib is distributed using NPM. To publish a new version of hapilib follow these steps:

test and build the library
```
cake test
```
```
cake build
```

login into the NPM regisrty
```
nmp login
```
input user details. You can find them in the IT Authentication doc on Google Drive

bump the version up if needed. You need to change it in the package.json file in the root of the repo.

publish the npm

```
npm publish
```

if you want to republish the same version of the npm just force it

```
npm publish -f
```

done!

