airbrite

0.1.3 • Public • Published

Airbrite Node

Airbrite.io makes it easy to bring e-commerce logic in the client-side of your application. This is an npm wrapper for Airbrite.io.

Installation

Add this line to your application's package.json under dependencies:

"airbrite": "*"

And then execute:

$ npm install

Or install separately:

npm install airbrite

Airbrite Documentation

Documentation is available at https://www.airbrite.io/documentation

Usage

Configuration

var airbrite = new require('airbrite')("{{Airbrite Access Token}}");

Overview

Resources can be accessed through the airbrite instance. These methods accept optional callbacks:

airbrite.product.create({
    "sku": "panda", 
    "price": 100
  }, function(err, product) {
    err; // null if no error
    product; // the created product object
  });

Resource methods also return promises (supported by when.js)

airbrite.customer.create({
    "name": "Bobby Tables",
    "email": "bobby@tables.com"
  })
  .then(function(customer) {
    customer // should have customer data
  })
  .otherwise(function(err) {
    err; // deal with error
  });

Resources

Methods:

  • create(params)
  • update(params)
  • list()
  • find(query)
  • findOne(query)
  • destroy(id)

List of Resources

  • address
  • customer
  • event
  • line_item
  • log
  • order
  • payment
  • product
  • shipment

Examples

Creating a product

var params = {
  "sku": "panda",
  "price": 100
}
 
airbrite.products.create(params)
  .then(function(product) {
    // product json
  });

Creating an order

airbrite.orders.create({ ... });

Updating a customer

airbrite.customer.update({
        "id": "xyz",
        ...
    });

Retrieving orders

airbrite.orders.fetch();

Finding orders

airbrite.orders.find({
    "since": "unix time_stamp or date"
    });

Finding a specific order

airbrite.orders.findOne("xyz");

Deleting an order

airbrite.orders.destroy("xyz");

Questions, Comments, Bugs?

Please email support@airbriteinc.com or add an issue.

Readme

Keywords

none

Package Sidebar

Install

npm i airbrite

Weekly Downloads

3

Version

0.1.3

License

BSD

Last publish

Collaborators

  • badave