Skip to content

Instantly share code, notes, and snippets.

@callumj
Created July 26, 2010 17:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save callumj/490848 to your computer and use it in GitHub Desktop.
Save callumj/490848 to your computer and use it in GitHub Desktop.
def doRummbleMethod(method, queryString)
consumer = OAuth::Consumer.new(API_KEY, API_SECRET, { :site => "http://api.rummble.com", :request_token_url => "http://www.rummble.com/oauth/request_token", :access_token_url => "http://www.rummble.com/oauth/access_token", :authorize_url => "http://www.rummble.com/oauth/authorize" })
paramsString = ""
if queryString.size > 0
queryString.to_a.collect {|key, value| paramsString << "#{key}=#{value}&"}
paramsString[paramsString.length - 1] = '' #remove last &
end
returnObj = consumer.request(:get, "/?method=#{method}&#{paramsString}", nil, {:scheme => :query_string})
returnObj.body
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment