node-bufferapp

0.1.2 • Public • Published

node-bufferapp

Node.js SDK for Buffer APIs

Installation

npm install node-bufferapp

Usage

var express = require('express')
, app = express()
,BufferApp = require('node-bufferapp');

var bufferapp = new BufferApp({
    clientID : YOUR_APP_CLIENT_ID,
    clientSecret : YOUR_APP_CLIENT_SECRET,
    callbackURL : YOUR_APP_CALLBACK_URL
});

app.get('/auth', function(req, res) {
    // Your user has to authorize your app to use his/her account
    res.redirect(bufferapp.getAuthorizationURI());
});

app.get('YOUR_CALLBACK_PATH', function(req, res) {
    // Extract the code that would have been sent as a query parameter to your callback URL
    var code = req.query.code;
    bufferapp.login(code, function(error, user) {
        // user is an instance of BufferUser which can then be used to make authorized api calls
        user.getInfo(function(err, info) {
            console.log(JSON.stringify(info));
        });
    });
});

The complete API documentation is in docs

Development

$git clone https://github.com/shrikrishnaholla/node-bufferapp.git
$cd node-bufferapp
$npm install

Running tests

  • Register a test application here (For login test)
  • Get the Client ID, Client Secret, Callback URL, Test Access token
  • Add these information to tests/config.js
  • Run $npm test
Note

The tests include one for login, which runs a local server. You need to access it through a web browser and complete the authorization process to finish the test

Generating Test Coverage Report

Needs JSCoverage and Mocha

$make coverage

Then go to http://localhost:YOUR_TEST_SERVER_PORT to complete the login test

Generating Documentation

Needs Docco

$make doc

Readme

Keywords

none

Package Sidebar

Install

npm i node-bufferapp

Weekly Downloads

1

Version

0.1.2

License

MIT

Last publish

Collaborators

  • shrikrishna