0.2.20 • Published 10 years ago

cloudy-ubersmith v0.2.20

Weekly downloads
3
License
MIT
Repository
github
Last release
10 years ago

Ubersmith

Ubersmith.com

A painless way to interact with the Ubermsith API asynchronously in your node app

With this API wrapper, you can send requests to your Ubersmith instance in your node app with fairly minimal effort.

Installation

npm install ubersmith

###Usage

First, create a variable with your instance details:

var client = new UberAPI('user', 'password', 'url');

You can create as many of these as you need if you're working with multiple instances.

Each level of your API call(s) needs to be represented with an object with child objects to represent the API methods. In these child objects, you can include optional arguments and callbacks:

var uber_calls = {};

uber_calls['client.count'] = {};
uber_calls['device.list'] = {
  args: {
    inactive: 0,
    limit: 10
  },
  callback: function (err, res) {
    err ? console.log (err) : console.log(res.body);
  }
}

Once your API calls are defined, call the Async() function on the original client object created:

client.Async(uber_calls);

Since these API calls are asynchronously, there's no way to predict which callback will fire first. In most cases, you'll probably find that calls which normally return less data and take less arguments will process faster, but you should never rely on that and always write your callbacks accordingly.

Methods with no function defined will call console.log on the JSON output. If you would rather this be silenced, define a callback object, but leave it empty:

uber_calls['device_list'] = {
  callback: {}
}
0.2.20

10 years ago

0.2.18

10 years ago

0.2.17

10 years ago

0.2.16

10 years ago

0.2.15

10 years ago

0.2.14

10 years ago

0.2.13

10 years ago

0.2.12

10 years ago

0.2.11

10 years ago

0.2.10

10 years ago

0.2.8

10 years ago

0.2.7

10 years ago

0.2.6

10 years ago

0.2.5

10 years ago

0.2.4

10 years ago

0.2.3

10 years ago

0.2.2

10 years ago

0.2.1

10 years ago

0.1.20

10 years ago

0.1.19

10 years ago

0.1.15

10 years ago

0.1.14

10 years ago