Module: Rockstar

Extended by:
Rockstar
Included in:
Rockstar
Defined in:
lib/rockstar/tag.rb,
lib/rockstar.rb,
lib/rockstar/geo.rb,
lib/rockstar/auth.rb,
lib/rockstar/base.rb,
lib/rockstar/rest.rb,
lib/rockstar/user.rb,
lib/rockstar/album.rb,
lib/rockstar/chart.rb,
lib/rockstar/event.rb,
lib/rockstar/metro.rb,
lib/rockstar/track.rb,
lib/rockstar/venue.rb,
lib/rockstar/artist.rb,
lib/rockstar/library.rb,
lib/rockstar/session.rb,
lib/rockstar/version.rb

Overview

Below are examples of how to find an artists top tracks and similar artists.

artist = Rockstar::Artist.new('Carrie Underwood')

puts 'Top Tracks'
puts "=" * 10
artist.top_tracks.each { |t| puts "#{t.name}" }

puts

puts 'Similar Artists'
puts "=" * 15
artist.similar.each { |a| puts "(#{a.match}%) #{a.name}" }

Would output something similar to:

Top Tracks
==========
(8797) Before He Cheats
(3574) Don't Forget to Remember Me
(3569) Wasted
(3246) Some Hearts
(3142) Jesus, Take the Wheel
(2600) Starts With Goodbye
(2511) Jesus Take The Wheel
(2423) Inside Your Heaven
(2328) Lessons Learned
(2040) I Just Can't Live a Lie
(1899) Whenever You Remember
(1882) We're Young and Beautiful
(1854) That's Where It Is
(1786) I Ain't in Checotah Anymore
(1596) The Night Before (Life Goes On)

Similar Artists
===============
(100%) Rascal Flatts
(84.985%) Keith Urban
(84.007%) Kellie Pickler
(82.694%) Katharine McPhee
(81.213%) Martina McBride
(79.397%) Faith Hill
(77.121%) Tim McGraw
(75.191%) Jessica Simpson
(75.182%) Sara Evans
(75.144%) The Wreckers
(73.034%) Kenny Chesney
(71.765%) Dixie Chicks
(71.084%) Kelly Clarkson
(69.535%) Miranda Lambert
(66.952%) LeAnn Rimes
(66.398%) Mandy Moore
(65.817%) Bo Bice
(65.279%) Diana DeGarmo
(65.115%) Gretchen Wilson
(62.982%) Clay Aiken
(62.436%) Ashlee Simpson
(62.160%) Christina Aguilera

Defined Under Namespace

Modules: REST Classes: Album, Artist, Auth, Base, Chart, Event, Geo, Library, Metro, Session, Tag, Track, User, Venue

Constant Summary collapse

API_URL =
'http://ws.audioscrobbler.com/'
API_VERSION =
'2.0'
Version =
File.open(File.join(File.dirname(__FILE__), "../../VERSION"), "r").read.strip

Instance Method Summary collapse

Instance Method Details

#lastfm=(args) ⇒ Object



34
35
36
37
# File 'lib/rockstar.rb', line 34

def lastfm=(args)
  @api_key    = args["api_key"] || args[:api_key]
  @api_secret = args["api_secret"] || args[:api_secret]
end

#lastfm_api_keyObject



39
40
41
# File 'lib/rockstar.rb', line 39

def lastfm_api_key
  @api_key
end

#lastfm_api_secretObject



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

def lastfm_api_secret
  @api_secret
end