For the Ruby crowd, a simple way to perform public OAuth methods

2 views
Skip to first unread message

CallumJ

unread,
Jul 26, 2010, 1:15:22 PM7/26/10
to Rummble API
Hey,

While working on Rummble Recommend a Place for Facebook, we wrote a
simple little Ruby function to make it easier to call Rummble API
methods that don't require authentication. All you need is the OAuth
gem for Ruby (available from RubyGems) and you are set to go.

You can grab the source from Github at http://gist.github.com/490848,
be sure to change the API_KEY and API_SECRET.

Here are some examples of where Recommend a Place uses the simple
little doRummbleMethod helper.

Looking for a city:
rummbleMethod = "search.placeLookup"
rummbleParams = {"format" => "json", "fields" =>
"name,longitude,latitude", "search_text" => "London"}
buffer = doRummbleMethod(rummbleMethod, rummbleParams)

Looking for a place in a specific city (for example The Bull in
London):
rummbleMethod = "rummble.getNearestRummbles"
rummbleParams = {"format" => "json", "fields" =>
"name,address,rummble_id,photo_thumbnail,photo_mobile", "name" => "The
Bull", "latitude" => "51.50008749807709" , "longitude" =>
"-0.12668609619140625"}
buffer = doRummbleMethod(rummbleMethod, rummbleParams)

You can then use the JSON parser for ruby to parse buffer as a Hash,
very cool.
Reply all
Reply to author
Forward
0 new messages