Skip to content

databox/databox-ruby

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
lib
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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.