@gradecam/restler-q

Q Wrapper for Restler


Keywords
q, promises, restful, restler
License
MIT
Install
npm install @gradecam/restler-q@0.2.0

Documentation

restler-q Build Status

(C) Andrew Newdigate (@suprememoocow), Licensed under the MIT-LICENSE

An extremely simple Q promises wrapper for Don Wrong's Restler library.

Installing

npm install restler-q

Using

The interface is similar to Restler's interface:

var rest = require('restler-q');

rest.get('https://api.github.com/orgs/Troupe/repos')
  .then(function(repos) {
    assert(Array.isArray(repos));
  })
  .nodeify(done);

If you would like to gain access to the response object, do it like this

var rest = require('restler-q').spread; // Note the .spread on the end!
rest.get('https://api.github.com/orgs/Troupe/repos')
  .spread(function(repos, response) {
    // Use Q's `spread`, not `then` 
    assert(Array.isArray(repos));
  })
  .fail(function(err) {
    // err.response contains the HTTP Response
  })
  .nodeify(done);

Running the tests

npm install
make test

TODO

  • Provide ability to call abort and retry methods.