brauchbar

Adj, German. practical, convenient, utilizable, feasible

In other words, a decent HTTP client for Ruby!

Introduction

But what.... what is wrong with all the other client?

The majority of other clients are built on top off Net::HTTP. This is the HTTP library built into Ruby, and it is slow... It also has a few annoying features, such as downcasing all headers. Oh, and they don't have a cool German name!

So, this is special how?

brauchbar is built on top of the patron gem, which itself is based upon libcurl. In other words, it has history. History is good. The brauchbar API is based upon a number of other good HTTP clients and is designed to be simple and easy to integrate to your application.

brauchbar doesn't introduce anything new into the world of HTTP clients, however it brings the best parts of all of them into one place, which is accessible by a simple, future-proof API.

Install

gem install brauchbar

Usage

Basic usage

Brauchbar.get "http://www.google.co.uk/search?hl=en&q=brauchbar&meta=&esrch=FT1"

Headers can be added

Brauchbar.get "http://www.google.co.uk/search?hl=en&q=brauchbar&meta=&esrch=FT1",
              :headers => { 'Accept' => 'text/html', 'User-Agent' => 'brauchbar test 1.0' }

A Response object is returned

res = Brauchbar.get "http://www.google.co.uk/search?hl=en&q=brauchbar&meta=&esrch=FT1"

# response body
# <html><head>.....</html>
puts res

# headers
# { 'Content-Type' => 'text/html' }
puts res.headers

# http status
# 200
puts res.status

Hacking

Feel free to hack away at this, however I won't merge anything unless you have adequate tests for it! Once you have done, send a pull request.

Todo / What would be nice

  • POST requests with POST data
  • Remembering of cookies between requests
  • Changing of timeouts
  • HTTP authentication

Contributors

License

brauchbar is licensed under a Creative Commons Attribution 2.0 UK: England & Wales License.

CC Some Rights Reserved