Ruby wrapper for Databox Push API
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
spec
.env
.gitignore
.pryrc
.rspec
.ruby-gemset
.ruby-version
.travis.yml
CHANGELOG.md
Gemfile
Guardfile
LICENSE.txt
README.md
Rakefile
databox.gemspec
example.rb

README.md

Databox bindings for Ruby

Build Status Gem Version

Ruby Gem for Databox - Mobile Executive Dashboard.

Installation

Add this line to your application's Gemfile:

gem 'databox'

And then execute:

$ bundle

Or install it yourself as:

$ gem install databox

Initialisation

Before pushing data to Databox you have to initialize it with token.

Databox.configure do |c|
  c.push_token   = "YOUR_TOKEN"
end

Usage

Pushing data directly to Databox with help of push method:

client = Databox::Client.new

client.push(key: 'sales.total', value: 3000)
client.push(key: 'temp.boston', value: 52.0)
client.push(key: 'temp.boston', value: 52.0, date: '2015-01-01 17:00:00')
client.push(key: 'temp.boston', value: 52.0, attributes: {
    location: 'boston-south'
})

Inserting multiple matrices with one insert_all:

client = Databox::Client.new

client.insert_all [
    {key: 'temp.boston', value: 52},
    {key: 'temp.boston', value: 50, date: '2015-01-01 17:00:00'},
    {key: 'temp.ny', value: 49}
]

Retrieving information from last push with last_push:

client.last_push

# =>
#[{
#  "push"=>"{\"data\":[{\"$sales.total\":2000}]}",
#  "err"=>"[]",
#  "no_err"=>0,
#  "datetime"=>"2015-06-05T10:21:23.861Z",
#  "keys"=>"[\"132|sales.total\"]"
#}]

Resources

Author & License

License

  • Comes with MIT license and terms.