Giter VIP home page Giter VIP logo

faraday_middleware's Introduction

Faraday Middleware

Gem Version Build Status Maintainability

A collection of useful Faraday middleware. See the documentation.

gem install faraday_middleware

Dependencies

Some dependent libraries are needed only when using specific middleware:

Middleware Library Notes
FaradayMiddleware::Instrumentation activesupport
FaradayMiddleware::OAuth simple_oauth
FaradayMiddleware::ParseXml multi_xml
FaradayMiddleware::ParseYaml safe_yaml Not backwards compatible with versions of this middleware prior to faraday_middleware v0.12. See code comments for alternatives.
FaradayMiddleware::Mashify hashie
FaradayMiddleware::Rashify rash_alt Make sure to uninstall original rash gem to avoid conflict.

Examples

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_middleware's People

Contributors

sferik avatar mislav avatar pengwynn avatar joshk avatar imactia avatar olleolleolle avatar jjb avatar nbibler avatar stve avatar hone avatar grosser avatar knu avatar cjford avatar natebarnes avatar coderanger avatar stefansedich avatar tylerhunt avatar akilburge avatar percyhanna avatar lolindrath avatar ushu avatar thomsbg avatar shingara avatar erickrause avatar gibzondev avatar hsbt avatar jaimeiniesta avatar jabley avatar kmamykin avatar lislis avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.