Ruby Icon

Weary, Ruby DSL for HTTP goes 1.0, now built on Rack

logged by @logbot 2012-04-03T14:42:44Z permalink #ruby

Mark Wunsch, whose awesome Tumblr library you might already use, has spent the last few weeks refactoring his Weary project to be fully Rack compatible.

Weary has always sported a rather elegant DSL for wrapping Net::HTTP, but after the big rewrite, you can now use Rack middleware and your client is a Rack application:

class GithubRepo < Weary::Client
  domain ""

  use Rack::Lint

  get :list_user_repos, "/users/{user}/repos" do |resource|
    resource.optional :type

  get :get, "/repos/{user}/{repo}"

client =
client.list_user_repos(:user => "mwunsch").perform do |response|
  puts response.body if response.success?

Check out Mark’s Gilt API wrapper for a complete example of building a wrapper with Weary or the project wiki for more info on how a Weary Request works. Mark has also recorded an introductory screencast that covers what’s new in 1.0:

0:00 / 0:00