This gem provides a driver implementation for unobtainium based on faraday.
To use it, require it after requiring unobtainium, then create the appropriate driver:
require 'unobtainium'
require 'unobtainium-faraday'
include Unobtainium::World
drv = driver(:faraday)
The main purpose of this gem is to make API testing a little easier. To that end, the driver (which is a faraday connection object) is initialized with some middleware, in particular faraday_json to fix some encoding issues in the default middleware.
If you're coming from faraday, initializing the driver/connection is going to feel a little different. Instead of the block-initialization favoured by faraday, you pass an options hash:
drv = driver(:faraday,
uri: 'http://finkhaeuser.de',
connection: {
request: :json,
response: [:logger, [:json, content_type: /\bjson$/ ]]
})
Afterwards, using the driver is identical to faraday usage:
res = drv.get '/'
puts res.body