Project

phant_rb

0.0
No commit activity in last 3 years
No release in over 3 years
Ruby client for Sparkfun's Phant https://data.sparkfun.com/
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.6
>= 0
>= 0

Runtime

 Project Readme

PhantRb

A Ruby client for Phant. See data.sparkfun.com for more information.

Gem Version

Installation

Add this line to your application's Gemfile:

gem 'phant_rb'

And then execute:

$ bundle

Or install it yourself as:

$ gem install phant_rb

Usage

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/'}

TODO

  • delete a stream
  • use local server in specs

Contributing

  1. Fork it ( https://github.com/girishso/phant_rb/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Licence

MIT License

This software is provided as is, use it your own risk.

Brought to you by: Cube Root Software (c) 2014