skylightio/skylight-ruby — pull request #7 by henrikhodne (2014-04-09 17:33:19+00:00)
Title: Add initial Sinatra support

Here's some initial work for support with Sinatra.

This is almost identical to the code I wrote for the [Travis CI API](https://github.com/travis-ci/travis-api/pull/119), but we use Rack's `map` to mount endpoints on subpaths, so with the code in here `GET /repos/:id` would be logged in Skylight as `GET /:id`. I've tried to figure out a way to figure out the "full path", but I haven't found a way that is fully generic.

I suppose maybe one could pass in a block when doing `register Skylight::Sinatra` that returns the endpoint name, and use the given one as a default, so it would look something like this (equivalent to the default):

``` Ruby
register Skylight::Sinatra.new { |verb, path| "#{verb} #{path}" }
```