Class: LastFM::Api::Tag
- Inherits:
-
Object
- Object
- LastFM::Api::Tag
- Defined in:
- lib/lastfm/api/tag.rb
Class Method Summary collapse
-
.get_info(params) ⇒ LastFM::Tag
Get the metadata for a tag.
-
.get_similar(params) ⇒ Array<LastFM::Tag>
Search for tags similar to this one.
-
.get_top_albums(params) ⇒ Array[LastFM::Album]
Get the top albums tagged with a tag, ordered by tag count.
-
.get_top_artists(params) ⇒ Array[LastFM::Artist]
Get the top artists tagged with a tag, ordered by tag count.
-
.get_top_tags ⇒ Array<LastFM::Tag>
Fetches the top global tags on Last.fm, sorted by popularity (number of times used).
-
.get_top_tracks(params) ⇒ Array[LastFM::Track]
Get the top tracks tagged with a tag, ordered by tag count.
-
.get_weekly_artist_chart(params) ⇒ Object
Get an artist chart for a tag, for a given date range.
-
.get_weekly_chart_list(params) ⇒ Object
Get a list of available charts for this tag, expressed as date ranges which can be sent to the chart services.
-
.search(params) ⇒ Array<LastFM::Tag>
Search for a tag by name.
Class Method Details
.get_info(params) ⇒ LastFM::Tag
Get the metadata for a tag.
12 13 14 15 |
# File 'lib/lastfm/api/tag.rb', line 12 def get_info( params ) xml = LastFM.get( "tag.getInfo", params ) LastFM::Tag.from_xml( xml ) end |
.get_similar(params) ⇒ Array<LastFM::Tag>
Search for tags similar to this one. Returns tags ranked by similarity, based on listening data.
22 23 24 25 26 27 |
# File 'lib/lastfm/api/tag.rb', line 22 def get_similar( params ) xml = LastFM.get( "tag.getSimilar", params ) xml.find('similartags/tag').map do |tag| LastFM::Tag.from_xml( tag ) end end |
.get_top_albums(params) ⇒ Array[LastFM::Album]
Get the top albums tagged with a tag, ordered by tag count.
36 37 38 39 40 41 |
# File 'lib/lastfm/api/tag.rb', line 36 def get_top_albums( params ) xml = LastFM.get( "tag.getTopAlbums", params ) xml.find('topalbums/album').map do |album| LastFM::Album.from_xml( album ) end end |
.get_top_artists(params) ⇒ Array[LastFM::Artist]
Get the top artists tagged with a tag, ordered by tag count.
50 51 52 53 54 55 |
# File 'lib/lastfm/api/tag.rb', line 50 def get_top_artists( params ) xml = LastFM.get( "tag.getTopArtists", params ) xml.find('topartists/artist').map do |artist| LastFM::Artist.from_xml( artist ) end end |
.get_top_tags ⇒ Array<LastFM::Tag>
Fetches the top global tags on Last.fm, sorted by popularity (number of times used).
61 62 63 64 65 66 |
# File 'lib/lastfm/api/tag.rb', line 61 def xml = LastFM.get( "tag.getTopTags" ) xml.find('toptags/tag').map do |tag| LastFM::Tag.from_xml( tag ) end end |
.get_top_tracks(params) ⇒ Array[LastFM::Track]
Get the top tracks tagged with a tag, ordered by tag count.
75 76 77 78 79 80 |
# File 'lib/lastfm/api/tag.rb', line 75 def get_top_tracks( params ) xml = LastFM.get( "tag.getTopTracks", params ) xml.find('toptracks/track').map do |track| LastFM::Track.from_xml( track ) end end |
.get_weekly_artist_chart(params) ⇒ 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.
90 91 92 |
# File 'lib/lastfm/api/tag.rb', line 90 def get_weekly_artist_chart( params ) LastFM.get( "tag.getWeeklyArtistChart", params ) end |
.get_weekly_chart_list(params) ⇒ Object
Get a list of available charts for this tag, expressed as date ranges which can be sent to the chart services.
99 100 101 |
# File 'lib/lastfm/api/tag.rb', line 99 def get_weekly_chart_list( params ) LastFM.get( "tag.getWeeklyChartList", params ) end |
.search(params) ⇒ Array<LastFM::Tag>
Search for a tag by name. Returns matches sorted by relevance.
110 111 112 113 114 115 |
# File 'lib/lastfm/api/tag.rb', line 110 def search( params ) xml = LastFM.get( "tag.search", params ) xml.find('results/tagmatches/tag').map do |tag| LastFM::Tag.from_xml( tag ) end end |