README.md in hyperclient-0.6.1 vs README.md in hyperclient-0.7.0

- old
+ new

@@ -1,10 +1,12 @@ # Hyperclient -[![Build Status](https://secure.travis-ci.org/codegram/hyperclient.png)](http://travis-ci.org/codegram/hyperclient) -[![Dependency Status](https://gemnasium.com/codegram/hyperclient.png)](http://gemnasium.com/codegram/hyperclient) -[![Code Climate](https://codeclimate.com/github/codegram/hyperclient.png)](https://codeclimate.com/github/codegram/hyperclient) +[![Gem Version](http://img.shields.io/gem/v/hyperclient.svg)](http://badge.fury.io/rb/hyperclient) +[![Build Status](http://img.shields.io/travis/codegram/hyperclient.svg)](https://travis-ci.org/codegram/hyperclient) +[![Dependency Status](https://gemnasium.com/codegram/hyperclient.svg)](https://gemnasium.com/codegram/hyperclient) +[![Code Climate](https://codeclimate.com/github/codegram/hyperclient.svg)](https://codeclimate.com/github/codegram/hyperclient) +[![Coverage Status](https://img.shields.io/coveralls/codegram/hyperclient.svg)](https://coveralls.io/r/codegram/hyperclient?branch=master) Hyperclient is a Hypermedia API client written in Ruby. It fully supports [JSON HAL](http://stateless.co/hal_specification.html). ## Usage @@ -18,11 +20,11 @@ require 'hyperclient' api = Hyperclient.new('https://grape-with-roar.herokuapp.com/api') ``` -By default, Hyperclient adds `application/json` as `Content-Type` and `Accept` headers. It will also send requests as JSON and parse JSON responses. Specify additional headers or authentication if necessary. +By default, Hyperclient adds `application/hal+json` as `Content-Type` and `Accept` headers. It will also send requests as JSON and parse JSON responses. Specify additional headers or authentication if necessary. ```ruby api = Hyperclient.new('https://grape-with-roar.herokuapp.com/api') do |client| client.headers['Access-Token'] = 'token' end @@ -36,10 +38,28 @@ conn.use Faraday::Request::OAuth end end ``` +You can pass options to the Faraday connection block in the `connection` block: + +```ruby +api = Hyperclient.new('https://grape-with-roar.herokuapp.com/api') do |client| + client.connection(ssl: { verify: false }) do |conn| + conn.use Faraday::Request::OAuth + end +end +``` + +Or when using the default connection configuration you can use `faraday_options`: + +```ruby +api = Hyperclient.new('https://grape-with-roar.herokuapp.com/api') do |client| + client.faraday_options = { ssl: { verify: false } } +end +``` + You can build a new Faraday connection block without inheriting default middleware by specifying `default: false` in the `connection` block. ```ruby api = Hyperclient.new('https://grape-with-roar.herokuapp.com/api') do |client| client.connection(default: false) do |conn| @@ -168,9 +188,10 @@ end let(:client) do Hyperclient.new('http://example.org/api') do |client| client.connection(default: false) do |conn| + conn.request :json conn.response :json conn.use Faraday::Adapter::Rack, app end end end