Nestful: A Simple Ruby HTTP/REST Client Library

By Peter Cooper

Nestful is a simple HTTP/REST client library for Ruby, developed by Alex MacCaw (of Juggernaut) fame. Nestful allows you to consume basic Web services easily, usually in a single line of code. It can deal with JSON, buffered downloads, and callbacks out of the box.

HTTParty is the current, de-facto simple HTTP/REST client library used by most Rubyists (when net/http won't do or when Typhoeus is too overkill) but Nestful differs enough from HTTParty to live alongside it. While HTTParty encourages you to build up some structure and separate the types of resources you're accessing into classes (that HTTParty then extends), Nestful offers a simpler, "just call a method from anywhere" approach.

Some basic Nestful examples:

Nestful.get 'http://example.com' #=> "body" Nestful.post 'http://example.com', :format => :form #=> "body" Nestful.get 'http://example.com', :params => {:nestled => {:params => 1}} Nestful.get 'http://example.com', :format => :json #=> {:json_hash => 1} Nestful::Resource.new('http://example.com')['assets'][1].get(:format => :xml) #=> {:xml_hash => 1}

Nestful's features include: