Move method out of block scope for ruby 1.9

Ruby 1.9 changes some of the rules of block scope, which was making our
inline hash_to_querystring method not resolve properly. Move it to the
module level to remain compatible with ruby's 1.8 and 1.9.

Fixes issue #3.