Pass GET parameters with Ruby Curb

I'm trying to use Curb ( to call a RESTful API that needs parameters supplied in a get request.

I want to fetch a URL like I'd like to be able to do something like

Curl::Easy.perform("", :bla => 'blablabla') {|curl|

but so far, the only way I can see to do this is by manually including the ?bla=blablabla in the URL and doing the encoding myself. Surely there is a right way to do this, but I can't figure it out reading the documentation.


If you don't mind using ActiveSupport '~> 3.0', there's an easy workaround - to_query method, which converts hash to query string ready to be used in URL.

# active_support cherry-pick
require 'active_support/core_ext/object/to_query'

params = { :bla => 'blablabla' }

Curl::Easy.perform("" + params.to_query) {|curl|

To pass get parameters with the ruby curb gem you could use


This functions actually falls back to URI.encode_www_form(params) in the curb gem implementation.

An example on how to use this would be

curl =
curl.url = "#{base_url}?#{Curl::postalize(params)}"

To access the curl return string you could use.

data = curl.body_str

The second alternatives would be

curl =
curl.url = Curl::urlalize(base_url, params)
data = curl.body_str

Do note that Curl::urlalize might be slightly flawed see this pull for postalize that has fix this flaw but the urlalize still uses the old implementation.

Need Your Help

Postioning issues while using fixed header

html css position

Here is my working code on

ZeroMQ XREP — Endpoint disappearing


I am using a standard LRU queue as defined by the ZeroMQ guide figure 41, and I am wondering how to add in protection so that I don't send messages to end points that have disappeared (server crash...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.