0.1.9 • Published 12 years ago

lelylan-node v0.1.9

Weekly downloads
42
License
-
Repository
-
Last release
12 years ago

Lelylan API for Node.js

Node.js client library for Lelylan API

Requirements

Node client library is tested against Node ~0.8.x

Installation

Install the client library using npm:

$ npm install lelylan-node

Install the client library using git:

$ git clone git://github.com/lelylan/lelylan-node.git
$ cd lelylan-node
$ npm install

Getting started

Before calling Lelylan APIs you need to set the access token using Simple OAuth2.

// Set the OAuth2 client credentials
var credentials = { client: { id: '<client-id>', secret: '<client-secret>', site: 'https://example.org' }};

// Initialize the OAuth2 Library
var OAuth2 = require('simple-oauth2')(credentials);

// Authorization OAuth2 URI
var authorization_uri = OAuth2.AuthCode.authorizeURL({ redirect_uri: 'http://localhost:3000/callback' });

// Redirect example using Express (see http://expressjs.com/api.html#res.redirect)
res.redirect(authorization_uri);

// Get the access token object (the authorization code is given from the previous step).
var token;
OAuth2.AuthCode.getToken({ code: 'authorization-code', redirectURI: 'http://localhost:3000/callback' },
  function(error, result) { token = OAuth2.AccessToken.create(result); }
);

// Initialize Lelylan Node library
Lelylan = require('lelylan-node')({ token: token });

// Get all devices
Lelylan.Devices.all(function(error, response) {
  console.log(response)
})

Using Simple OAuth2 the access token is automatically refreshed when expired.

Documentation

Settings

API endpoint

Configuration block.

options = { 'endpoint' : 'http://localhost:8000' }
Lelylan = require('lelylan')(options);

Contributing

Fork the repo on github and send a pull requests with topic branches. Do not forget to provide specs to your contribution.

Running specs

  • Fork and clone the repository.
  • Run npm install for dependencies.
  • Run npm test to execute all specs.
  • Run make test-watch to auto execute all specs when a file change.

Coding guidelines

Follow github guidelines.

Feedback

Use the issue tracker for bugs. Mail or Tweet us for any idea that can improve the project.

Links

Authors

Andrea Reginato

Contributors

Special thanks to the following people for submitting patches.

Changelog

See CHANGELOG

Copyright

Copyright (c) 2013 Lelylan. See LICENSE for details.

0.1.9

12 years ago

0.1.8

12 years ago

0.1.7

12 years ago

0.1.6

12 years ago

0.1.5

12 years ago

0.1.4

12 years ago

0.1.3

12 years ago

0.1.2

12 years ago

0.1.1

12 years ago

0.1.0

12 years ago