No commit activity in last 3 years
No release in over 3 years
RestClient Adapters
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.9
~> 10.0
~> 3.4.0
~> 3.0
 Project Readme

RestClient Adapters Build Status

This gem allows to use different HTTP implementation in RestClient with next adapters:

  • :net_http - Net::HTTP (default, blocking I/O)
  • :em_http - EventMachine::HttpRequest (non-blocking I/0)

Installation

Add this line to your application's Gemfile:

gem 'rest-client-adapters'

And then execute:

$ bundle

Or install it yourself as:

$ gem install rest-client-adapters

Usage

You may specify adapter for each request:

RestClient.get('https://www.google.com')
RestClient.get('https://www.google.com', adapter: :em_http)

Or you may specify adapter globaly:

RestClient.adapter = :em_http
RestClient.get('https://www.google.com')

Notes

When EventMachine is already running we assume that you are responsible for Fiber allocation. You can add Rack::FiberPool to your application middleware and it automatically provides a Fiber for each incoming HTTP request. It creates pool of Fibers and re-use fiber for each incoming HTTP request. Also you can control the connection pool size.

Authors

References