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 = ;var recurly = apiKey: 'api-key-goes-here' subdomain: 'subdomain-goes-there'; recurlyaccounts;
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:
- Get the request library.
- Set the default headers.
- 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:
- URI parameters go as separate parameters.
- Body object if any goes after all URI parameters.
- 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:
recurlysubscription;
How would another random call would look like, if there would be multiple URI parameters? Easy!
recurlyrandom;
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
recurlyaccounts;recurlyaccounts;recurlyaccounts;recurlyaccounts;recurlyaccounts;recurlyaccounts;recurlyaccounts;recurlyaccounts;
Account Acquisition
recurlyaccountAcquisition;recurlyaccountAcquisition;recurlyaccountAcquisition;recurlyaccountAcquisitionclearaccountCode cb;
Adjustments
recurlyadjustments;recurlyadjustments;recurlyadjustments;recurlyadjustments;
Billing info
recurlybillingInfo;recurlybillingInfo;recurlybillingInfo;recurlybillingInfoclearaccountCode cb;
Coupons
recurlycoupons;recurlycoupons;recurlycoupons;recurlycoupons;recurlycoupons;recurlycoupons;recurlycoupons;recurlycoupons;
Coupon redemptions
recurlycouponRedemptions;recurlycouponRedemptions;recurlycouponRedemptions;recurlycouponRedemptions;recurlycouponRedemptions;recurlycouponRedemptions;
Gift cards
recurlygiftCards;recurlygiftCards;recurlygiftCards;recurlygiftCards;recurlygiftCards;recurlygiftCards;recurlygiftCards;
Invoices
recurlyinvoices;recurlyinvoices;recurlyinvoices;recurlyinvoices;recurlyinvoices;recurlyinvoices;recurlyinvoices;recurlyinvoices;recurlyinvoices;recurlyinvoices;
Plans
recurlyplans;recurlyplans;recurlyplans;recurlyplans;recurlyplans;
Plan add-ons
recurlyplanAddOns;recurlyplanAddOns;recurlyplanAddOns;recurlyplanAddOns;recurlyplanAddOns;
Measured units
recurlymeasuredUnits;recurlymeasuredUnits;recurlymeasuredUnits;recurlymeasuredUnits;recurlymeasuredUnits;
Subscriptions
recurlysubscriptions;recurlysubscriptions;recurlysubscriptions;recurlysubscriptions;recurlysubscriptions;recurlysubscriptions;recurlysubscriptions;recurlysubscriptions;recurlysubscriptions;recurlysubscriptions;recurlysubscriptions;