Sha256: 418470ab8473aaeee6c43ebe1b08c6baf09e572c74693080009d1cb1cff6b02b

Contents?: true

Size: 1.77 KB

Versions: 2

Compression:

Stored size: 1.77 KB

Contents

# Databox bindings for Ruby

[![Build Status][travis-badge]][travis]
[![Gem Version](https://badge.fury.io/rb/databox.svg)](https://badge.fury.io/rb/databox)

Ruby Gem for [Databox](http://databox.com/) - 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.

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

## Usage

Pushing data directly to Databox with help of `push` method:

```ruby
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`:

```ruby
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`:

```ruby
client.last_push

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

## Resources

- [Databox Web App](https://app.databox.com/)
- [Databox Developers Portal](https://developers.databox.com/)

## Author & License

- [Oto Brglez](https://github.com/otobrglez)
- Comes with `MIT` license and terms

[travis-badge]: https://secure.travis-ci.org/databox/databox-ruby.png?branch=v2
[travis]: http://travis-ci.org/databox/databox-ruby

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
databox-2.0.0 README.md
databox-0.2.2 README.md