Skip to content

ceeci/httppole

Repository files navigation

httppole

Installation && Quickstart

Install with npm:

npm install --save git+ssh://git@github.com/blairanderson/httppole.git
var httppole = require('httppole');

var client = httppole.createClient({
  endpoint: 'localhost:4000' // endpoint of your edison screen
});

client.weather('98034', callback);
//=> screen updated with forecast!!!
//  => callback on screen update error/success

jQuery

include jquery.httppole.js

add your endpoint

$.httppole.setEndpoint("localhost:3000")
$.httppole.weather("98034", callback);

Node

Requirement: client requires an endpoint. An error will be thrown if it doesn't exist

expect(function(){
  httppole.createClient({});
}).to.throw("function createClient requires an endpoint")

/message

var httppole = require('httppole');

var client = httppole.createClient({
  endpoint: 'localhost:4000'
});

var screenMessage = "This is a message";
var screenLine = 1;
client.message(screenMessage, screenLine, function(error, success){
  if (error) {
    console.log('something went wrong with our edison', error);
    return callback(error);
  }
  return callback(null, "Successfully updated the screen");
});

/weather/:query

var httppole = require('httppole');

var client = httppole.createClient({
  endpoint: 'localhost:4000'
});

var query = "98034" || "Seattle" || "Maui" || "Paris,FR"
client.weather(query, function(error, success){
  if (error) {
    console.log('something went wrong with our edison', error);
    return callback(error);
  }
  return callback(null, "updated screen with forecast");
});

Testing

From the repo root:

npm install
npm test

About

httppole is a node client for interacting with the edison pole

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published