0.0
No commit activity in last 3 years
No release in over 3 years
StatHat JSON API Client.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

StatHat::Json

StatHat JSON API Client.

Build Status Gem Version Dependency Status Code Climate Test Coverage

Installation

Add this line to your application's Gemfile:

gem 'stathat-json'

And then execute:

$ bundle

Or install it yourself as:

$ gem install stathat-json

Usage

Batch post stats

require 'stathat/json'

StatHat::Json::Api.ez_key = 'YOUR_EZ_KEY' # will also be picked up from ENV['STATHAT_EZKEY']

stats = []
stats << {stat: 'count_stat1'} # implicit count and time
stats << {stat: 'count_stat2', count: 2, t: 1420428506} # explicit count and time
stats << {stat: 'value_stat1', value: 3.14159} # delicious Pi

StatHat::Json::Api.post_stats(stats)

Post individual stats

require 'stathat/json'

StatHat::Json::Api.ez_key = 'YOUR_EZ_KEY' # will also be picked up from ENV['STATHAT_EZKEY']

StatHat::Json::Api.post_count('count_stat1') # implicit count and time
StatHat::Json::Api.post_count('count_stat2', 2, 1420428506) # explicit count and time
StatHat::Json::Api.post_value('value_stat1', 3.14159) # delicious Pi

Short lived processes

StatHat::Json::Api uses Celluloid::IO for threading and async network IO for long runing processes.
Use StatHat::Json::SyncApi for short lived processes, the API is identical.

Tested with the following Rubies

  • 1.9.3
  • 2.0.0
  • 2.1.0
  • rbx-2.2.10
  • jruby-19mode
  • ruby-head
  • jruby-head

Contributing

  1. Fork it ( https://github.com/[my-github-username]/stathat-json/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