Skip to content
Browse files

added few methods for artist class

  • Loading branch information...
1 parent 656557e commit 04a31e225b9a4e5676d5388e94ee1adad4ed3092 @indrekj committed
Showing with 89 additions and 1 deletion.
  1. +1 −0 lib/rlastfm.rb
  2. +2 −1 lib/rlastfm/album.rb
  3. +86 −0 lib/rlastfm/artist.rb
View
1 lib/rlastfm.rb
@@ -1,6 +1,7 @@
module RLastFM
autoload :Api, File.dirname(__FILE__) + "/rlastfm/api"
autoload :Album, File.dirname(__FILE__) + "/rlastfm/album"
+ autoload :Artist, File.dirname(__FILE__) + "/rlastfm/artist"
class Config
class << self
View
3 lib/rlastfm/album.rb
@@ -33,7 +33,8 @@ def get_buy_links(artist, album, country, options = {})
# * +album+ - The album name.
# == Optional parameters
# * +mbid+ - The musicbrainz id for the album.
- # * +lang+ - The language to return the biography in.
+ # * +lang+ - The language to return the biography in, expressed as an
+ # ISO 639 alpha-2 code.
# * +autocorrect+ - 1 or 0, transform misspelled artist names into
# correct artist names, returning the correct version instead. The
# corrected artist name will be returned in the response.
View
86 lib/rlastfm/artist.rb
@@ -1,6 +1,92 @@
module RLastFM
class Artist < Api
class << self
+ def add_tags(artist, tags, options = {})
+ raise NotImplementedError
+ end
+
+ # Use the last.fm corrections data to check whether the supplied artist
+ # has a correction to a canonical artist.
+ #
+ # == Parameters
+ # * +artist+ - The artist name.
+ # == Example
+ # RLastFM::Artist.get_correction("MG-MT")
+ def get_correction(artist, options = {})
+ options.merge!(:artist => artist)
+ get("artist.getCorrection", options)
+ end
+
+ # Get a list of upcoming events for this artist. Easily integratable into
+ # calendars, using the ical standard.
+ #
+ # == Parameters
+ # * +artist+ - The artist name.
+ # == Optional parameters
+ # * +mbid+ - The musicbrainz id for the album.
+ # * +autocorrect+ - 1 or 0, transform misspelled artist names into
+ # correct artist names, returning the correct version instead. The
+ # corrected artist name will be returned in the response.
+ # == Example
+ # RLastFM::Artist.get_events("MGMT")
+ def get_events(artist, options = {})
+ options.merge!(:artist => artist)
+ get("artist.getEvents", options)
+ end
+
+ # Get a list of upcoming events for this artist. Easily integratable into
+ # calendars, using the ical standard.
+ #
+ # == Parameters
+ # * +artist+ - The artist name.
+ # == Optional parameters
+ # * +mbid+ - The musicbrainz id for the album.
+ # * +autocorrect+ - 1 or 0, transform misspelled artist names into
+ # correct artist names, returning the correct version instead. The
+ # corrected artist name will be returned in the response.
+ # * +page+ - The page number to fetch.
+ # * +limit+ - How many to return. Defaults and maxes out at 50.
+ # * +order+ - Sort ordering can be either 'popularity' (default) or
+ # 'dateadded'.
+ # == Example
+ # RLastFM::Artist.get_images("MGMT")
+ def get_images(artist, options = {})
+ options.merge!(:artist => artist)
+ get("artist.getImages", options)
+ end
+
+ # Get the metadata for an artist. Includes biography.
+ #
+ # == Parameters
+ # * +artist+ - The artist name.
+ # == Optional parameters
+ # * +mbid+ - The musicbrainz id for the album.
+ # * +autocorrect+ - 1 or 0, transform misspelled artist names into
+ # correct artist names, returning the correct version instead. The
+ # corrected artist name will be returned in the response.
+ # * +lang+ - The language to return the biography in, expressed as an
+ # ISO 639 alpha-2 code.
+ # == Example
+ # RLastFM::Artist.get_info("MGMT")
+ def get_info(artist, options = {})
+ options.merge!(:artist => artist)
+ get("artist.getInfo", options)
+ end
+
+ # TODO:
+ # def get_past_events
+ # def get_podcast
+ # def get_shouts
+ # def get_similar
+ # def get_tags
+ # def get_top_albums
+ # def get_top_fans
+ # def get_top_tags
+ # def get_top_tracks
+ # def remove_tag
+ # def search
+ # def share
+ # def shout
end
end
end

0 comments on commit 04a31e2

Please sign in to comment.
Something went wrong with that request. Please try again.