npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

nandos

v0.1.0

Published

Server-side JS library for the Nando's API

Downloads

16

Readme

nandos-node

Server-side JS library for the Nando's API. It is not publicly documented, so may break at any time.

import * as Nandos from 'nandos';

const client = new Nandos.Loyalty({
	clientKeyId: 'some_key_here', // ~30 characters
	clientKeySecret: 'some_key_here', // ~10 characters
	userEmail: '[email protected]',
	userPassword: 'SoSecure0mg!',
});

const account = await client.getAccount();
const rewards = await client.getRewards(account.cardNumber);
const transactions = await client.getTransactions(account.cardNumber);

console.log(account.phoneNumber); // => 07123456789
console.log(account.card_lost); // => false
console.log(rewards.wheel_position); // => 3
console.log(rewards.lifetime_chillies); // => 13
console.log(transactions[0].store); // => Whitechapel
console.log(transactions[0].credit); // => 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-is
  • clientKeySecret - the key used to create the HMAC digest sent to the API
  • userEmail - the user's email address for login
  • userPassword - the user's password for login
const client = new Loyalty({
	clientKeyId: 'some_key_here', // ~30 characters
	clientKeySecret: 'some_key_here', // ~10 characters
	userEmail: '[email protected]',
	userPassword: 'SoSecure0mg!',
});

Loyalty#getAccount()

Verify the user's login details and retrieve their account details (including card number).

await client.getAccount();

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.getRewards('12341234123412');

Loyalty#getTransactions(cardNumber)

Retrieve the card's historical transactions, including rewards provided from each visit.

await client.getTransactions('12341234123412');

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

License

MIT licensed - see LICENSE file