Skip to content

lucasbrigida/carriots-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#CarriotsJS Library for Carriot - Internet of Things Platform

Demo

demo

Visit DEMO

The coffee animation in DEMO is a fork this codepen

Description

CarriotsJS is a library for javascript to be used in the integration of hardware and software through the internet platform of the things Carriots

CarriotJS is a module for expose Carriots REST API, benefits:

  • Easy integration
  • Get and Send Data from your browser.
  • CORS Enabled.

Prerequisites

You need the jquery installed, if you not have in your project, run command below:

$ bower install jquery --save

Add script

<script src="../bower_components/jquery/dist/jquery.min.js"></script>

Install

$ bower install carriots-js --save

Don't know Carriots learn more. Carriots Documentation

Uninstall

$ bower uninstall carriots-js --save

Add script

<script src="../bower_components/carriots-js/carriots.min.js"></script>

OR

<script src="http://rawgit.com/lucasbrigida/carriots-js/master/carriots.min.js"></script>

How use - Get data

Get data from a specific device. Follow specification,

  Carriots.config({
    apiKey: '4852309cd37ff6b1ffa6a807608166ecb31ba5b79cec49951dc3dc69fcef2ea3'
  });
  var arduino = Carriots.devices();
  arduino.streams().list('defaultDevice@lucasbrigida.lucasbrigida', {
    sort: 'at',
    order: -1
  })
  .done(function(res){
    console.log(res);
  });
{"total_documents":1,"result":[{"_id":"555ae15b5c5d756b035b751d","protocol":"v1","checksum":"","_t":"str","at":1432019291,"device":"defaultDevice@lucasbrigida.lucasbrigida","data":{"coffees":1},"id_developer":"c593e6ae8c89d97af2fac016e7cf322eeeb7491efe06766e0d59f9fdd5720c65@lucasbrigida.lucasbrigida","created_at":1432019291,"owner":"lucasbrigida"}]}

How use - Send data

  var stream = Carriots.streams();
  stream.create({
      "protocol": "v1",
      "checksum": "",
      "device": "defaultDevice@lucasbrigida.lucasbrigida",
      "at": "now",
      "data": {
        "coffees": 1
      }
    })
    .done(function(res) {
      console.log(res);
    });
```
### Version
1.0.0

### Todo's
 - Create interface for Rule Management
 - Create interface for Triggers
 - Create Test units

License
----
MIT


**Free Software, Hell Yeah!**

About

Carriots library for javascript

Resources

Stars

Watchers

Forks

Packages

No packages published