embedly/embedly-ruby — pull request #11 by felipeelias (2011-11-26 21:43:32+00:00)
Title: Add request adapters

This introduces a new module called `Request`. The idea is to remove duplication in the `API` class by moving request related methods to their own class and allow the user to create its own requester class:

```ruby
class MyRequester < Embedly::Request::Base
def get(uri, options = {})
# performs the request
end
end
```

This class is responsible to make the request. The user can register the new class in configuration and use it as follow:

```ruby
Embedly.configuration.add_requester :my_requester do |api|
MyRequester.new(api)
end

Embedly.configure do |config|
config.request_with :my_requester
end
```

After that, all api requests are made with the new request class. This allows users to user `faraday` gem for example, without messing up with the api class.

As an example, you can check that the `_do_typhoeus_call` method was moved to `Embedly::Typhoeus::Request`.