Coder Social home page Coder Social logo

vero-promise's Introduction

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.

vero-promise's People

Contributors

sobafuchs avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.