nandos-node
Server-side JS library for the Nando's API. It is not publicly documented, so may break at any time.
; const client = clientKeyId: 'some_key_here' // ~30 characters clientKeySecret: 'some_key_here' // ~10 characters userEmail: 'foobar@example.com' userPassword: 'SoSecure0mg!'; const account = await client;const rewards = await client;const transactions = await client; console; // => 07123456789console; // => falseconsole; // => 3console; // => 13console; // => Whitechapelconsole; // => 1
Installation
$ npm install --save nandos
API
All async methods return promises. Traditional Node callbacks are not supported.
Currently, only the Nando's loyalty program is supported (the reward card).
Loyalty
Loyalty#constructor(options)
First, set up a client by creating an instance of Loyalty
.
Options:
clientKeyId
- the key which is sent to the API as-isclientKeySecret
- the key used to create the HMAC digest sent to the APIuserEmail
- the user's email address for loginuserPassword
- the user's password for login
const client = clientKeyId: 'some_key_here' // ~30 characters clientKeySecret: 'some_key_here' // ~10 characters userEmail: 'foobar@example.com' userPassword: 'SoSecure0mg!';
Loyalty#getAccount()
Verify the user's login details and retrieve their account details (including card number).
await client;
Loyalty#getRewards(cardNumber)
Retrieve the card's rewards status - the number of 'chillies' they have, and the number of green/mild, orange/med and red/hot rewards they have.
await client;
Loyalty#getTransactions(cardNumber)
Retrieve the card's historical transactions, including rewards provided from each visit.
await client;
Notes
- data is provided back from the Nando's API exactly as-is - as such, many keys/values are quite inconsistent and unpredictable
Support
Please open an issue on this repository.
Authors
- James Billingham james@jamesbillingham.com
License
MIT licensed - see LICENSE file