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

node-recurly-client

v0.2.7

Published

YANRC (Yet Another Node Recurly Client)

Downloads

14

Readme

The Recurly Client

There was a library already. But I didn't quite like it. So I created my own library, with blackjack and generics.

The code covers most methods described in the Recurly Developer Hub.

Why?

You can configure xml2js parser, that lives under the hood. Like this:

new Recurly({
  /* API key, subdomain */
}, {
  /* xml2js conf! */
})

The library doesn't check weird callback length whatsoever (as neighboring does). Who need those things?

Usage

Installation

npm install --save node-recurly-client

Usage

var Recurly = require('node-recurly-client');
var recurly = new Recurly({
  apiKey: 'api-key-goes-here',
  subdomain: 'subdomain-goes-there'
});

recurly.accounts.create({
  account_code: '0xdeadbeef',
  email: '[email protected]'
}, function (err, response) {/* processing etc. */});

How does this thing work?

You may notice, that library doesn't have any methods explicitly defined, that call Recurly resource. Isn't it lovely?

Roughly saying, the library does the following:

  1. Get the request library.
  2. Set the default headers.
  3. Magically create methods by provided JSON files.

The JSON files live in the library under lib/schemas path. Usually, you don't need to worry about them.

All request parameters subordinate to the following logic:

  1. URI parameters go as separate parameters.
  2. Body object if any goes after all URI parameters.
  3. The callback is obligatory and is the last parameter.

Let's take as an example update subscription call. It wants one parameter in URI and a body. The call would look like this:

recurly.subscription.update('uuid-string', {/* body */}, callback);

How would another random call would look like, if there would be multiple URI parameters? Easy!

recurly.random.call(uriParamString1, uriParamString2, bodyObj, callback);

If there are no modifiers in URI, those parameters have to be omitted. If there is no body, body parameter has to be omitted.

Methods

Accounts

recurly.accounts.list(cb);
recurly.accounts.create(body, cb);
recurly.accounts.lookup(accountCode, body, cb);
recurly.accounts.update(accountCode, body, cb);
recurly.accounts.close(accountCode, cb);
recurly.accounts.reopen(accountCode, body, cb);
recurly.accounts.balance(accountCode, cb);
recurly.accounts.notes(accountCode, cb);

Account Acquisition

recurly.accountAcquisition.create(accountCode, body, cb);
recurly.accountAcquisition.lookup(accountCode, cb);
recurly.accountAcquisition.update(accountCode, body, cb);
recurly.accountAcquisition.clear(accountCode, cb);

Adjustments

recurly.adjustments.list(accountCode, cb);
recurly.adjustments.create(accountCode, body, cb);
recurly.adjustments.lookup(uuid, cb);
recurly.adjustments.delete(uuid, cb);

Billing info

recurly.billingInfo.create(accountCode, body, cb);
recurly.billingInfo.lookup(accountCode, cb);
recurly.billingInfo.update(accountCode, body, cb);
recurly.billingInfo.clear(accountCode, cb);

Coupons

recurly.coupons.list(cb);
recurly.coupons.create(body, cb);
recurly.coupons.lookup(couponCode, cb);
recurly.coupons.generate(couponCode, body, cb);
recurly.coupons.expire(couponCode, cb);
recurly.coupons.edit(couponCode, body, cb);
recurly.coupons.restore(couponCode, body, cb);
recurly.coupons.listUnique(couponCode, cb);

Coupon redemptions

recurly.couponRedemptions.account(accountCode, cb);
recurly.couponRedemptions.coupon(accountCode, redemptionUuid, cb);
recurly.couponRedemptions.invoice(invoiceNumber, cb);
recurly.couponRedemptions.subscription(uuid, cb);
recurly.couponRedemptions.redeem(couponCode, cb);
recurly.couponRedemptions.remove(accountCode, uuid, cb);

Gift cards

recurly.giftCards.list(cb);
recurly.giftCards.preview(body, cb);
recurly.giftCards.create(body, cb);
recurly.giftCards.lookup(id, cb);
recurly.giftCards.redeem(redemptionCode, body, cb);
recurly.giftCards.previewSubscription(body, cb);
recurly.giftCards.createSubscription(body, cb);

Invoices

recurly.invoices.list(cb);
recurly.invoices.listAccount(accountCode, cb);
recurly.invoices.preview(accountCode, body, cb);
recurly.invoices.post(accountCode, body, cb);
recurly.invoices.lookup(invoiceNumber, cb);
recurly.invoices.markAsPaid(invoiceNumber, cb);
recurly.invoices.markAsFailed(invoiceNumber, cb);
recurly.invoices.refundLineItem(invoiceNumber, body, cb);
recurly.invoices.refundOpenAmount(invoiceNumber, body, cb);
recurly.invoices.offlinePayment(invoiceNumber, body, cb);

Plans

recurly.plans.list(cb);
recurly.plans.create(body, cb);
recurly.plans.lookup(planCode, cb);
recurly.plans.update(planCode, cb);
recurly.plans.delete(planCode, cb);

Plan add-ons

recurly.planAddOns.list(planCode, cb);
recurly.planAddOns.create(planCode, body, cb);
recurly.planAddOns.lookup(planCode, addOnCode, cb);
recurly.planAddOns.update(planCode, addOnCode, body, cb);
recurly.planAddOns.delete(planCode, addOnCode, cb);

Measured units

recurly.measuredUnits.list(cb);
recurly.measuredUnits.create(body, cb);
recurly.measuredUnits.lookup(measuredUnitId, cb);
recurly.measuredUnits.update(measuredUnitId, body, cb);
recurly.measuredUnits.delete(measuredUnitId, cb);

Subscriptions

recurly.subscriptions.list(accountCode, cb);
recurly.subscriptions.preview(body, cb);
recurly.subscriptions.create(body, cb);
recurly.subscriptions.lookup(uuid, cb);
recurly.subscriptions.previewChange(uuid, body, cb);
recurly.subscriptions.update(uuid, body, cb);
recurly.subscriptions.updateNotes(uuid, body, cb);
recurly.subscriptions.cancel(uuid, cb);
recurly.subscriptions.reactivate(uuid, cb);
recurly.subscriptions.terminate(uuid, refundType, charge, cb);
recurly.subscriptions.postpone(uuid, nextRenewalDate, bulk, cb);