Sha256: 79c03303b9ce36c083d7772090cc3e8ca16e87dc4e4a168004b37106653ca5cb

Contents?: true

Size: 1.45 KB

Versions: 13

Compression:

Stored size: 1.45 KB

Contents

Faraday Middleware
==================

A collection of useful [Faraday][] middleware. [See the documentation][docs].

    gem install faraday_middleware

Dependencies
------------

Some dependent libraries are needed only when using specific middleware:

* FaradayMiddleware::EncodeJson & FaradayMiddleware::ParseJson: "json"
  for ruby older than 1.9
* FaradayMiddleware::ParseXml: "multi_xml"
* FaradayMiddleware::OAuth: "simple_oauth"
* FaradayMiddleware::Mashify: "hashie"
* FaradayMiddleware::Rashify: "rash"
* FaradayMiddleware::Instrumentation: "activesupport"

Examples
--------

``` rb
require 'faraday_middleware'

## in Faraday 0.8 or above:
connection = Faraday.new 'http://example.com/api' do |conn|
  conn.request :oauth2, 'TOKEN'
  conn.request :json

  conn.response :xml,  :content_type => /\bxml$/
  conn.response :json, :content_type => /\bjson$/

  conn.use :instrumentation
  conn.adapter Faraday.default_adapter
end

## with Faraday 0.7:
connection = Faraday.new 'http://example.com/api' do |builder|
  builder.use FaradayMiddleware::OAuth2, 'TOKEN'
  builder.use FaradayMiddleware::EncodeJson

  builder.use FaradayMiddleware::ParseXml,  :content_type => /\bxml$/
  builder.use FaradayMiddleware::ParseJson, :content_type => /\bjson$/

  builder.use FaradayMiddleware::Instrumentation
  builder.adapter Faraday.default_adapter
end
```


  [faraday]: https://github.com/technoweenie/faraday#readme
  [docs]: https://github.com/pengwynn/faraday_middleware/wiki

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
agiley-faraday_middleware-0.9.0 README.md
faraday_middleware-0.9.0 README.md
faraday_middleware-0.8.8 README.md
faraday_middleware-0.8.7 README.md
faraday_middleware-0.8.6 README.md
faraday_middleware-0.8.5 README.md
agiley-faraday_middleware-0.8.3.2 README.md
agiley-faraday_middleware-0.8.3.1 README.md
faraday_middleware-0.8.4 README.md
agiley-faraday_middleware-0.8.3 README.md
faraday_middleware-0.8.3 README.md
faraday_middleware-0.8.2 README.md
faraday_middleware-0.8.1 README.md