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-cratejoy

v0.1.0

Published

Simplify nodeJS integration with CrateJoy

Downloads

2

Readme

node-cratejoy

A small node module that helps integration your application with cratejoy. There is still several API endpoints with cratejoy that is not implemented in this implementation. Feel free to fork and make pull requests, or adding issues as you please.

Install

npm install node-cratejoy

Usage

After having installed it, simply require it, set it up with your own clientId and clientSecret, and start calling methods!

var cratejoyAPI = require('node-cratejoy');
var cratejoy = new cratejoyAPI(
  'clientId',
  'clientSecret');

cratejoy.callMethods();

Functions and responses

| Functions | Returns to callback | Explanation | | ---------------- | ---------------- | ---------------- | | get (link, options, callback) | callback(err, res, body) | Base function for using get on cratejoy API. Can be used if non-implemented API call needed. | | put (link, data, callback) | callback(err, res, body)| Base function for using put on cratejoy API. Can be used if non-implemented API call needed. | | post (link, data, callback) | callback(err, res, body) | Base function for using post on cratejoy API. Can be used if non-implemented API call needed. | | del (link, options, callback) | callback(err, res, body) | Base function for using delete on cratejoy API. Can be used if non-implemented API call needed. | | getSubscriptions ([options], callback) | callback(err, res, body) | Gets all subscriptions matching filters set in options. | | getSubscription (id, callback) | callback(err, res, body) | Gets subscription by id. | | updateSubscription ([id], data, callback) | callback(err, res, body) | Update subscription with id (could also be in data). Only documented fields supported. | | getSubscriptionMetadata (id, callback) | callback(err, res, body) | Gets all metadata for a subscription by subscription id. | | updateSubscriptionMetadata ([id], data, callback) | callback(err, res, body) | Replaces all metadata for a subscription by subscription id. | | addNoteToSubscription ([id], note, callback) | callback(err, res, body) | Update/Set a note for the subscription by subscription id. | | getProducts ([options], callback) | callback(err, res, body) | Gets all products matching filters set in options. | | getProduct (id, callback) | callback(err, res, body) | Gets product by id. | | updateProduct ([id], data, callback) | callback(err, res, body) | Update product with id (could also be in data). Only documented fields supported. | | getProductMetadata (id, callback) | callback(err, res, body) | Gets all metadata for a product by product id. | | updateProductMetadata ([id], data, callback) | callback(err, res, body) | Replaces all metadata for a product by product id. | | toggleProduct (id, visible, callback) | callback(err, res, body) | Sets the product's visiblity to the specific value by product id. | | getOrders ([options], callback) | callback(err, res, body) | Gets all orders matching filters set in options. | | getOrder (id, callback) | callback(err, res, body) | Gets order by id. | | updateOrder ([id], data, callback) | callback(err, res, body) | Update order with id (could also be in data). Only documented fields supported. | | getOrderMetadata (id, callback) | callback(err, res, body) | Gets all metadata for an order by order id. | | updateOrderMetadata ([id], data, callback) | callback(err, res, body) | Replaces all metadata for an order by order id. | | addNoteToOrder ([id], note, callback) | callback(err, res, body) | Update/Set a note for the order by order id. | | getCustomers ([options], callback) | callback(err, res, body) | Gets all customers matching filters set in options. | | getCustomer (id, callback) | callback(err, res, body) | Gets customer by id. | | updateCustomer ([id], data, callback) | callback(err, res, body) | Update customer with id (could also be in data). Only documented fields supported. | | getCustomerMetadata (id, callback) | callback(err, res, body) | Gets all metadata for a customer by customer id. | | updateCustomerMetadata ([id], data, callback) | callback(err, res, body) | Replaces all metadata for a customer by customer id. | | addNoteToCustomer ([id], note, callback) | callback(err, res, body) | Update/Set a note for the customer by customer id. | | getShipments ([options], callback) | callback(err, res, body) | Gets all shipments matching filters set in options. | | getShipment (id, callback) | callback(err, res, body) | Gets shipment by id. | | updateShipment ([id], data, callback) | callback(err, res, body) | Update shipment with id (could also be in data). Only documented fields supported. |

Examples

Getting A Subscription

cratejoy.getSubscription(12345, function(err, res, body){
  if(err) throw err;
  console.log('Got subscription');
  console.log(body);
});

Updating A Subscription

var subscriptionUpdate = {
  end_date: '12/27/2014',
  note: 'Updated end date so that customer didn\'t need to cancel to change their billing date.',
  credit: 0
}

cratejoy.updateSubscription(12345, subscriptionUpdate, function(err, res, body){
  //Handle the callback.
});