Remove code duplication for Rack middleware

Browsing through the code in an attempt to understand the logic for sending notifications I found that *Airbrake::Rack* and *Airbrake::Rails::Middleware* classes had a lot of common logic.
This made the code hard to follow and understand the differences between the two implementations.

This pulls requests makes the code of the two classes DRY :) [Don't Repeat Yourself]
All tests are passing, and I have performed some manual testing to make sure the full integration works well in both Rails 3.2 and Sinatra.