0.0.14 • Published 5 years ago

@truebill/regaliator v0.0.14

Weekly downloads
600
License
MIT
Repository
github
Last release
5 years ago

Regalii Node.js Client

A Node.js client for connecting to the Regalii API.

The client is tested and compatible with the following versions of Node.js:

  • v4.7.2 ;
  • v5.12.0 ;
  • v6.9.4 ;
  • v7.4.0.

Usage

Example:

const Regaliator = require('regaliator');

const client = new Regaliator(
  'https://test.casiregalii.com',
  processs.env.REGALII_API_KEY,
  processs.env.REGALII_SECRET
);

client.account().then((args) => {
  console.log(args.body)
});

All methods of the object regaliator returns a Promise. In case of success, an object having the following keys:

  • body: The decoded JSON response ;
  • req: The request emitted ;
  • res: The response returned by server.

For instance, to get all arguments:

client.account().then((args) => console.log(args.body));

Examples

Examples of some common use-cases:

Creating a credential bill

client.createCredentialsBill(12376, 'login', 'challengeme').then((args) => {
  console.log('Created bill ' + args.body.id);
});

Polling for while bill updating

Coming soon.

Answering MFA Challenge

Coming soon.

Test

To test with your current version of Node.js:

npm test

If you want to test in multiple versions (requires Docker), run:

# For the first time:
npm install -g node-docker-test
ndt --setup

# Then, each time you want:
ndt

Todo

  • Factor test code:
    • Repetitive parts ;
    • Fake server init.
  • Expose some private method as function ;
  • Implement missing methods existing on Ruby client.
0.0.14

5 years ago

0.0.13

5 years ago

0.0.12

5 years ago

0.0.10

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago