0.03
No commit activity in last 3 years
No release in over 3 years
Ruby client library for Geckoboard
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.8
~> 10.0
~> 3.4
~> 2.1
 Project Readme

geckoboard-ruby

CircleCI

Ruby client library for Geckoboard (https://developer.geckoboard.com/api-reference/ruby).

Installation

Add this line to your application's Gemfile:

gem 'geckoboard-ruby'

And then execute:

$ bundle

Or install it yourself as:

$ gem install geckoboard-ruby

Usage

Require the gem

require 'geckoboard'

Ping to authenticate

Verify that your API key is valid and that you can reach the Geckoboard API.

client = Geckoboard.client('222efc82e7933138077b1c2554439e15')
client.ping # => true

Find or create

Verify an existing dataset or create a new one.

dataset = client.datasets.find_or_create('sales.gross', fields: [
  Geckoboard::MoneyField.new(:cost, name: 'Cost', currency_code: 'USD'),
  Geckoboard::DateTimeField.new(:timestamp, name: 'Time'),
  Geckoboard::NumberField.new(:amount, name: 'Amount', optional: true)
], unique_by: [:timestamp])

Available field types:

  • DateField
  • DateTimeField
  • NumberField
  • PercentageField
  • StringField
  • MoneyField

unique_by is an optional array of one or more field names whose values will be unique across all your records.

Delete

Delete a dataset and all data therein.

dataset.delete # => true

Delete a dataset with a given id.

client.datasets.delete('sales.gross') # => true

Put

Replace all data in the dataset.

dataset.put([
  {
    timestamp: DateTime.new(2016, 1, 2, 12, 0, 0),
    amount: 40900
  },
  {
    timestamp: DateTime.new(2016, 1, 3, 12, 0, 0),
    amount: 16400
  },
])

Post

Append data to a dataset.

dataset.post([
  {
    timestamp: DateTime.new(2016, 1, 2, 12, 0, 0),
    amount: 40900
  },
  {
    timestamp: DateTime.new(2016, 1, 3, 12, 0, 0),
    amount: 16400
  },
], delete_by: :timestamp)

delete_by is an optional field by which to order the truncation of records once the maximum record count has been reached. By default the oldest records (by insertion time) will be removed.

Development

After checking out the repo, run bin/setup to install dependencies. Then, run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release to create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

  1. Fork it ( https://github.com/geckoboard/geckoboard-ruby/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