class OAuthClient

def get_oauth_response(res)

Parse response and returns a Hash.
def get_oauth_response(res)
  enc = res.header['content-encoding']
  body = nil
  if enc and enc[0] and enc[0].downcase == 'gzip'
    body = Zlib::GzipReader.wrap(StringIO.new(res.content)) { |gz| gz.read }
  else
    body = res.content
  end
  body.split('&').inject({}) { |r, e|
    key, value = e.split('=', 2)
    r[unescape(key)] = unescape(value)
    r
  }
end