lumberyard/lumberyard — pull request #1 by tombell (2012-12-16 22:28:31+00:00)
Title: Reporting Endpoint

## Reporting Endpoint

This is the HTTP endpoint that will receive and handle the exception reports.

**This is work in progress, history could change!**

### Implementation

* `Lumberyard::Reporter::Receiver` - Rack application to handle the incoming request
* `Lumberyard::Reporter::PayloadParser` - Parser class for the incoming report payload
* `Lumberyard::Reporter::Payload` - Payload class for the parsed payload
* `Lumberyard::Reporter` - Module for handling the payload and storing the payload

This design is some-what inspired by how [Janky](https://github.com/github/janky) handles incoming requests from `GitHub` and the `Builder`.

I don't think the `Reporter` module name is that great, and could probably do with a more meaningful (and creative, maybe `LumberMill`) name.

### Process

The Rack app `Lumberyard::Reporter::Receiver` is mapped to the route `/_report` and listens for incoming requests. When a request is received it will authorise the request by checking if the specific API key in the `HTTP_AUTHORIZATION` HTTP header matches any project.

`Lumberyard::Reporter::Receiver` will then pass the request body to `Lumberyard::Reporter::PayloadParser` to parse the payload into a `Lumberyard::Reporter::Payload` object which is then used by `Lumberyard::Reporter` to store the reported exception in the embedded collection for the related project.