cbdr/ruby-cb-api — pull request #85 by usbsnowcrash (2014-03-23 02:05:52+00:00)
Title: Observers

This pull requests exposes a hook so that people using the ruby api gem can get notifications before and after each api call is made. This would be very useful downstream if you wanted to, for example, send api information to new relic when an error occurs. I added spec tests to ensure that the observers receive notification and I added some missing specs around the Api class.

**To test:**
````
bundle exec irb
irb(main):006:0> require 'Cb'
irb(main):006:0> Cb.configuration.dev_key = 'WXXXXXPUTYOURKEYHERE'
irb(main):006:0> Cb.configuration.observers.push Cb::Utils::ConsoleObserver
irb(main):006:0> job = Cb.job.find_by_did('J3J00C6JBQR2M6D43Y3')
````
You should see that before and after each api call there is something in the console now because you added a console observer to the config file. Specifically you should see a cb_get_before and a cb_get_after message.