A simple Ruby wrapper for the Pachube REST API.
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
resources
spec
.gitignore
Gemfile
MIT-LICENSE
README.textile
Rakefile
init.rb
pachuber.gemspec

README.textile

First whack at a Ruby API for interacting with Pachube

Work in progress at this point

Requires version 0.2.0 or greater of the eeml-simple EEML wrapper library (not the eeml gem). Thanks to James Smith for including my changes upstream.

Take a peek at the test cases for examples of how to consume/contribute to Pachube in either EEML XML or EEML objects.

Wants

To support the whole API, I don’t need it all yet. So…if you’re interested fork away or let me know how I can help.

Using

require 'rubygems'
require 'pachuber'
require 'gotempr'
require 'position'

pos = Position.new

tmp = GoTempR::Fetcher.new("/dev/ldusb0").celcius

env = EEML::Environment.new
env.location = EEML::Location.new(:physical, :disposition => :mobile,   
  :exposure => :outdoor,
  :lat => pos.lat.to_f, :lon => pos.lng.to_f,
  :name => "Temp where Kit is")

data = EEML::Data.new(tmp)
data.tags << "temperature"
data.unit = EEML::Unit.new("Celsius", :symbol => 'C', :type => :derivedSI)
env << data

pach = Pachube.new(PACHUBE_KEY)
resp = pach.update("/4078.xml", env.to_eeml).code.to_s
puts "RESPONSE CODE: #{resp}"