README
Armor Payments Node.js Client
This is intended to be a clean, idiomatic client for the Armor Payments API. This will handle generating the authenticated headers and constructing the properly nested request URI, as well as parsing any response JSON for you.
Installation
To install use npm
and add the package to your application's dependencies:
$ npm install armor-payments --save
Usage
The Armor Payments API is REST-ish and nested, so the client relies on chaining. We use request-promise to return a Promise for all operations resulting in an API request, with the added nice-ness that we've parsed the JSON response body for you if possible.
var armorPayments = require('armor-payments');
var client = new armorPayments.API('your-key', 'your-secret', shouldUseSandbox);
// There are four top-level resources: accounts, users, orders, and shipmentcarriers
// Querying users and orders requires an accountId
client.accounts().all().then(function (response) {
// response.body contains parsed JSON object
});
Fore more detailed usage examples, See the Ruby client. We follow the same API naming and method chaining conventions with only differences being the usage of camelCase instead of under_scores, and using Promises for handling responses as above.
Developing
We use CoffeeScript for development. The source files are under src and the tests are under test. To compile CoffeeScript into JavaScript and run tests, invoke Grunt:
$ grunt
Features branching and release management are handled using git-flow, and active development is always done on the develop branch.
Releasing a Version
Making a release involves the following steps:
Update CHANGELOG.md with relevant changes
Create new release branch, for example:
$ git flow release start v0.2.0
Bump version:
$ npm version --no-git-tag-version [major|minor|patch|...]
Commit and finalize release:
$ git commit -a -m "bumped version for release" $ git flow release finish v0.2.0
Push to NPM:
$ npm publish
Contributing
- Fork it
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create new Pull Request
License
MIT License. See accompanying LICENSE.txt file.