Class: Shortwave::Facade::Tag

Inherits:
Remote
  • Object
show all
Defined in:
lib/shortwave/facade/lastfm.rb

Instance Attribute Summary

Attributes inherited from Remote

#session

Instance Method Summary collapse

Methods inherited from Remote

#initialize

Constructor Details

This class inherits a constructor from Shortwave::Facade::Remote

Instance Method Details

#search(tag, options = {}) ⇒ Object

Search for a tag by name. Returns matches sorted by relevance.

tag

The tag name in question.

Options

limit

Limit the number of tags returned at one time. Default (maximum) is 30.

page

Scan into the results by specifying a page number. Defaults to first page.



390
391
392
# File 'lib/shortwave/facade/lastfm.rb', line 390

def search(tag, options={})
  get(:standard, {:method => "tag.search", :tag => tag}.merge(options))
end

#similar(tag) ⇒ Object

Search for tags similar to this one. Returns tags ranked by similarity, based on listening data.

tag

The tag name in question.



355
356
357
# File 'lib/shortwave/facade/lastfm.rb', line 355

def similar(tag)
  get(:standard, {:method => "tag.getSimilar", :tag => tag})
end

#top_albums(tag) ⇒ Object

Get the top albums tagged by this tag, ordered by tag count.

tag

Last.fm tag



374
375
376
# File 'lib/shortwave/facade/lastfm.rb', line 374

def top_albums(tag)
  get(:standard, {:method => "tag.getTopAlbums", :tag => tag})
end

#top_artists(tag) ⇒ Object

Get the top artists tagged by this tag, ordered by tag count.

tag

Last.fm tag



397
398
399
# File 'lib/shortwave/facade/lastfm.rb', line 397

def top_artists(tag)
  get(:standard, {:method => "tag.getTopArtists", :tag => tag})
end

#top_tagsObject

Fetches the top global tags on Last.fm, sorted by popularity (number of times used)



379
380
381
# File 'lib/shortwave/facade/lastfm.rb', line 379

def top_tags()
  get(:standard, {:method => "tag.getTopTags"})
end

#top_tracks(tag) ⇒ Object

Get the top tracks tagged by this tag, ordered by tag count.

tag

Last.fm tag



404
405
406
# File 'lib/shortwave/facade/lastfm.rb', line 404

def top_tracks(tag)
  get(:standard, {:method => "tag.getTopTracks", :tag => tag})
end

#weekly_artist_chart(tag, options = {}) ⇒ Object

Get an artist chart for a tag, for a given date range. If no date range is supplied, it will return the most recent artist chart for this tag.

tag

The tag name in question

Options

from

The date at which the chart should start from. See Tag.getWeeklyChartList for more.

to

The date at which the chart should end on. See Tag.getWeeklyChartList for more.

limit

The number of chart items to return.



367
368
369
# File 'lib/shortwave/facade/lastfm.rb', line 367

def weekly_artist_chart(tag, options={})
  get(:standard, {:method => "tag.getWeeklyArtistChart", :tag => tag}.merge(options))
end

#weekly_chart_list(tag) ⇒ Object

Get a list of available charts for this tag, expressed as date ranges which can be sent to the chart services.

tag

The tag name in question



411
412
413
# File 'lib/shortwave/facade/lastfm.rb', line 411

def weekly_chart_list(tag)
  get(:standard, {:method => "tag.getWeeklyChartList", :tag => tag})
end