armor-payments

0.1.4 • Public • Published

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.

Circle CI npm version

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:

  1. Update CHANGELOG.md with relevant changes

  2. Create new release branch, for example:

     $ git flow release start v0.2.0
    
  3. Bump version:

     $ npm version --no-git-tag-version [major|minor|patch|...]
    
  4. Commit and finalize release:

     $ git commit -a -m "bumped version for release"
     $ git flow release finish v0.2.0
    
  5. Push to NPM:

     $ npm publish
    

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

License

MIT License. See accompanying LICENSE.txt file.

Readme

Keywords

none

Package Sidebar

Install

npm i armor-payments

Weekly Downloads

2

Version

0.1.4

License

MIT

Last publish

Collaborators

  • adamhadani