Javascript wrapper library for the Cashboard API
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
example
lib
LICENSE
README.textile

README.textile

Cashboard-js

This project is the official Javascript wrapper for the Cashboard API created and maintained by Subimage LLC.

Cashboard is an online service that allows you to track time, create estimates, invoice your clients, and collect payments via credit cards or PayPal.

Cashboard-js uses the JSON data format to speak to the Cashboard API.

Purpose

The aim of this project is to provide a quick and simple way to use the Cashboard API from javascript widgets, mobile devices, and other lightweight clients. We will most likely be using it for any new Apple Dashboard Widgets or small client apps we develop in house.

Cashboard-js doesn’t leverage a framework like prototype.js, jquery, or mootools so you can hopefully mix and match it with your favorite framework of choice.

Usage

All methods that go across the wire (list, create, update, destroy) can be passed callback functions. These functions are run at the appropriate time in the request lifecycle as you’d expect.

Callbacks will be returned either single or multiple CashboardObjects inside an array, depending on the resource type you’re interacting with.

Callbacks

  • onLoading
  • onSuccess
  • onFailure

Simple LIST Usage

CASHBOARD.authenticate('my_subdomain', 'my_api_key');
var employees = CASHBOARD.employees.list({
 onLoading: function() {
   // Your loading function here
 },
 onSuccess: function(cb_employees) {
   // Do something with employees here
 },
 onFailure: function(code, message) {
   alert("API error: " + code + " - " + message);
 }
});

Simple CREATE Usage

CASHBOARD.authenticate('my_subdomain', 'my_api_key');
CASHBOARD.employees.create(
 {
   first_name: 'Bob',
   last_name: 'Builder',
   email_address: 'bob@builder.com'
 },
 {
   onLoading: yourLoaderFunction,
   onSuccess: function(created_employee){
     // do something with the employee here
   },
   onFailure: referenceToFailureFunction
 }
);

Demo

For a more extended use scenario, check out the /example folder.

You can open the demo.html file in Safari and poke around using the API. Check out demo.js for a very quick example of interacting with the API.

You could probably even use demo.js as a base to develop Webkit based widgets for your own personal use. Right now it only works in Safari (and I’m guessing Google Chrome). Firefox will NOT work with the demo, as it doesn’t allow HTTPS requests via XMLHttpRequest from your local machine to the Cashboard server.

Roadmap

I’d like to get around to this sooner or later.

  1. Some sort of documentation besides the code files
  2. A testing framework of some sort and actual unit tests :)
  3. Automated build script that combines all JS files and minifies them

Links

License

Cashboard-js is released under the MIT License.