Class: Rockstar::Geo

Inherits:
Base
  • Object
show all
Defined in:
lib/rockstar/geo.rb

Instance Method Summary collapse

Methods inherited from Base

connection, fetch_and_parse, get_instance

Instance Method Details

#events(opts = {}, force = false) ⇒ Object

Get events in a specific location. Opts can be

  • :location => ‘madrid’ # A city name from geo.metros

  • :lat => 50.0, :long => 14.0 # A geo point

Additionally you can set the distance from that point with

:distance => 50 # 50 km from the given location


11
12
13
# File 'lib/rockstar/geo.rb', line 11

def events(opts = {}, force = false)
  get_instance("geo.getEvents", :events, :event, opts, force)
end

#metros(country, force = false) ⇒ Object



15
16
17
# File 'lib/rockstar/geo.rb', line 15

def metros(country, force = false)
  get_instance("geo.getMetros", :metros, :metro, {:country => country}, force)
end

#topartists(country, limit = nil, page = nil, force = false) ⇒ Object

Get a list of the Top Artists for a specified country

Country is specified in last.fm API docs as ‘A country name, as defined by the ISO 3166-1 country names standard’ Not sure of the coverage

Also specify limit and page to page through full resultset

returns array of Artist instances



29
30
31
# File 'lib/rockstar/geo.rb', line 29

def topartists(country, limit = nil, page = nil, force = false)
  get_instance("geo.getTopArtists", :topartists, :artist, {:country => country, :limit => limit, :page => page}, force)
end

#toptracks(country, limit = nil, page = nil, force = false) ⇒ Object

Get a list of the Top Tracks for a specified country

Country is specified in last.fm API docs as ‘A country name, as defined by the ISO 3166-1 country names standard’ Not sure of the coverage

Also specify limit and page to page through full resultset

returns array of Track instances

TODO: is this the correct object to return? We dont have the full data so is this really best



42
43
44
# File 'lib/rockstar/geo.rb', line 42

def toptracks(country, limit = nil, page = nil, force = false)
  get_instance("geo.getTopTracks", :toptracks, :track, {:country => country, :limit => limit, :page => page}, force)
end