0.0.2 • Published 8 years ago

ginger-node v0.0.2

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

Ginger Payments Node Bindings

Code Climate Test Coverage

Installation:

npm install ginger-node --save

Usage:

First create a ginger instance:

var ginger = require('ginger-node')('API-key');

Every resource method accepts a callback as last argument:

ginger.get_order( order_id,
 function (error, response, order){
	if(error){
		// do something with the error, will be null if no error ocurred
	}
	else {
		// if you want, you can check the response object for statusCode
		// or do something with the order object you received
	}
});

Promises

If you like to use promises, install bluebird (or any other npm promises package you want):

npm install bluebird

Then:

var Promise = require("bluebird");
var ginger = require('ginger-node')('API-key');

Promise.promisifyAll(ginger);
ginger.get_orders().then(...)

API Documentation:

For all the methods you should check the Ginger Payments api:

API Ginger Payments

Testing:

You can easily test ginger-node on your own computer, just install json-server globally:

npm install -g json-server

Now you can easily start json-server with the following command:

npm run server:test

Open a new tab and type the following command for running the test, linting and code coverage:

npm run test