I am setting up an application that can handle LastFM API requests. These are simple receive requests, and I am using the HTTParty stone.
My function is this:
def get_albums self.class.base_uri "http://ws.audioscrobbler.com/2.0/" options = { :user => "Gerard1992", :method => "user.gettopalbums", :api_key => Constants::LASTFM_API_KEY, :format => "json" } puts options.to_query self.class.get "/?#{options.to_query}", {}
This code snippet shown above works. A get request returns a set of JSON. My problem is that this /?#{options.to_query} doesn't look so neat. And also the actual (now empty {} ) parameter does not matter. How to make the HTTParty parameter parameter work as it should?
This is what I tried, but both cases failed:
self.class.get "/", options self.class.get "/", options => options
I appreciate the help.
Biketire
source share