Hello all,
I’ve written a Ruby client for the Particle cloud API. I wanted something that is comprehensive so it includes the device API, the login/token API, the publish API and the webhook API.
The only omission is the subscribe API since the default Ruby HTTP client doesn’t supports streaming responses. This didn’t seem too bad since I expect this Ruby gem to be used mostly in web applications like Rails and using webhooks to receive events makes more sense in a web application than using subscribe.
The interface is object oriented so you can do things like
Particle.device('lighting').function('changeColor', 'blue')
Particle.publish(name: "wakeup", private: true)
connected_devices = Particle.devices.select { |device| device.connected? }
connected_devices.each { |device| device.flash('blink_led.ino') }
Go check out the particlerb
repository and star it!
I took a look at RubySpark repository by @nixpulvis and @efatsi but I wanted to take a different approach with wrapping the API and providing uniform error handling. Still I want to thank you both for your work.
Comments are of course welcome.