EotB Gem

Rails plugin which allow you easily track and observe your apps.

Installation

Bundler

For rails3 you just want to add this line to the Gemfile

gem 'eotb'

and run

$ bundle install

RubyGems

Install gem in traditional way

$ gem install eotb

GitHub

Install gem from GitHub repository

$ git clone git://github.com/Quirke/eotb_rails_plugin.git
$ cd eotb_rails_plugin
$ rake build
$ gem install ./pkg/eotb-0.5.14.gem

Getting API Key

Create new account on Beholder website and add new application by clicking “Applications » Add application”. As a result you will get API Key of your application.

Configure eotb in you app

Rails 3

To configure your rails 3 app just run the generator with your_api_key, app login and password:

rails generate eotb --api-key=your_api_key --login=app_login --password=app_password

Rails 2

To configure your rails 2 app just run the generator with your_api_key, app login and password:

script/generate eotb --api-key=your_api_key --login=app_login --password=app_password

Configuration file

If you didn’t use rails generator you can manualy create a file eotb.rb in directory config/initializers in your rails application with content:

require 'Eotb'
Eotb.configure("your_api_key", "app_login", "app_password")

Deprecated methods

Please note that methods:

Eotb.configure("your_api_key")
Eotb.configure("your_api_key", events, "host", "port")

are deprecated and will be removed in Eotb –version=0.5.17.

Using in your apps

Register events by:

Eotb.register_event("user", "did_sth", {:username => "John", :time => "12:39:00"}) # actor, action, subject

Examples

Register actor and his action

Eotb.register_event("user", "registered")

Register subject of event

Eotb.register_event("user", "registered", {:username => "John", :when => "today"})

Use symbols instead of strings

Eotb.register_event(:admin, :deleted, {:what => "News", :category => "Ruby"})

Register hashes and nested hashes

Eotb.register_event({:username => "John", :mail => "[email protected]"}, :connected, {:with_values => {:a => 20, :b => 30}, :when => "Now"})

You can register any type of objects

Eotb.register_event(Object.new, :fed, {:pet => Dog.new})

Copyright © 2010 Ragnarson. See LICENSE for details.