class OauthUtil

def query_string

@ref http://oauth.net/core/1.0/#rfc.section.A.5.1
@ref http://oauth.net/core/1.0/#9.2.1
@ref http://oauth.net/core/1.0/#rfc.section.9.1.1
sort (very important as it affects the signature), concat, and percent encode
def query_string
  pairs = []
  @params.sort.each { | key, val | 
    pairs.push( "#{ CGI.escape(key.to_s).gsub(/%(5B|5D)/n) { [$1].pack('H*') } }=#{ CGI.escape(val.to_s) }" )
  }
  pairs.join '&'
end