A Ruby client for Phant. See data.sparkfun.com for more information.
Add this line to your application's Gemfile:
gem 'phant_rb'
And then execute:
$ bundle
Or install it yourself as:
$ gem install phant_rb
client = PhantRb::Client.new "PUBLIC_KEY", %w(humidity temp), private_key: 'PRIVATE_KEY'
# log data, http://phant.io/docs/input/http/
client.log(22.7, 17.8)
# retrieve your data, http://phant.io/docs/output/http/
data = client.get()
puts data
# paginate data
data = client.get(page: 1)
# retrieve info about the current state of your stream, http://phant.io/docs/output/stats/
stats = client.stats()
puts stats.pageCount
puts stats.remaining
# retrieve rate limit for the current stream, http://phant.io/docs/input/limit/
# must be called only after PhantRb::Client#log is called
limits = client.rate_limits()
puts limits.x_rate_limit_remaining
# clear all logged data from a stream, http://phant.io/docs/management/clear/
client.clear()
To use different Phant server
client = PhantRb::Client.new "PUBLIC_KEY", %w(humidity temp), {private_key: 'PRIVATE_KEY', base_url: 'http://127.0.0.1/'}
- delete a stream
- use local server in specs
- Fork it ( https://github.com/girishso/phant_rb/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
MIT License
This software is provided as is, use it your own risk.
Brought to you by: Cube Root Software (c) 2014