1.0.9 • Published 8 years ago

vero-promise v1.0.9

Weekly downloads
51
License
ISC
Repository
github
Last release
8 years ago

vero-promise

This is a wrapper for Vero's public API based on promises and superagent

Simply...

  1. npm install vero-promise or git clone the repository or download the zip file. All the relevant code is in index.js.
  2. index.js returns a function that takes your auth_token as a parameter. To use the library, you'll need to do something like this:
// vero.js
var vero = require('vero-promise');

module.exports = vero(yourAuthToken);

Then, when you need to use vero:

var vero = require('vero');

vero.trackUser('randomId', 'randomEmail', {firstName: 'gandalf'})
  .then(function(res) {
    // rest of your code
  })
  .catch(function(error) {
    // do whatever with what the promise rejected with
  });

If you are using ES6 and are using co, you won't even need to use .then since co automatically unravels promises.

co(function*() {
  let response = yield vero.trackUser('randomId', 'randomEmail', {firstName: 'gandalf'});
  assert.ok(response.ok);
})
.catch(function(error) {
  // handle rejection
});

3.To run the tests, either create a config.js file and create a vero instance with your auth token, or edit the part in test.js where vero is required in and pass in the auth token there. Then, run npm install and npm test.

Feel free to reach out if you have any questions or find any bugs.

1.0.9

8 years ago

1.0.8

8 years ago

1.0.7

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago