Fingertips/nap — pull request #2 by alloy (2014-03-01 16:04:46+00:00)
Title: Add optional Net::HTTP configuration block.

This patch adds a `configure_block` to the `REST::Request` initializer, which yields the underlying `Net::HTTP` request object. This allows the user to set fine-grained options that most people don’t need to set, for instance:

```ruby
REST.get('http://example.com') do |http_request|
http_request.open_timeout = 3
http_request.read_timeout = 7
end
```

====

The second commit refactors the code slightly to build the complete request object in `REST::Request#http_request`, which should also make testing the applied settings slightly simpler as you can just ask for a fully configured request object.

====

Finally, we discussed setting timeout defaults in Nap, but I think it’s more appropriate if you come up with those defaults, if at all. These are the various options:

* `ssl_timeout`
* `read_timeout`: defaults to `60`.
* `open_timeout`:
- Docs say this is not available on 1.8.7, but it seems to have been there for 11 years.
- Was at some point changed from `30` to `nil`: https://github.com/ruby/ruby/commit/9d0758b3b0f85a0a3ca26e1e83b4a6f04c460873