Class: Scrobbler::Tag
Instance Attribute Summary collapse
-
#count ⇒ Object
Returns the value of attribute count.
-
#name ⇒ Object
Returns the value of attribute name.
-
#url ⇒ Object
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
- #api_path ⇒ Object
-
#initialize(name) ⇒ Tag
constructor
A new instance of Tag.
- #top_albums(force = false) ⇒ Object
- #top_artists(force = false) ⇒ Object
- #top_tracks(force = false) ⇒ Object
Methods inherited from Base
api_key=, connection, fetch_and_parse, sanitize
Constructor Details
#initialize(name) ⇒ Tag
Returns a new instance of Tag.
72 73 74 75 |
# File 'lib/scrobbler/tag.rb', line 72 def initialize(name) raise ArgumentError, "Name is required" if name.blank? @name = name end |
Instance Attribute Details
#count ⇒ Object
Returns the value of attribute count.
60 61 62 |
# File 'lib/scrobbler/tag.rb', line 60 def count @count end |
#name ⇒ Object
Returns the value of attribute name.
60 61 62 |
# File 'lib/scrobbler/tag.rb', line 60 def name @name end |
#url ⇒ Object
Returns the value of attribute url.
60 61 62 |
# File 'lib/scrobbler/tag.rb', line 60 def url @url end |
Class Method Details
Instance Method Details
#api_path ⇒ Object
77 78 79 |
# File 'lib/scrobbler/tag.rb', line 77 def api_path "/#{API_VERSION}/tag/#{CGI::escape(name)}" end |
#top_albums(force = false) ⇒ Object
85 86 87 |
# File 'lib/scrobbler/tag.rb', line 85 def top_albums(force=false) get_instance2('tag.gettopalbums', :top_albums, :album, {'tag'=>@name}, force) end |
#top_artists(force = false) ⇒ Object
81 82 83 |
# File 'lib/scrobbler/tag.rb', line 81 def top_artists(force=false) get_instance2('tag.gettopartists', :top_artists, :artist, {'tag'=>@name}, force) end |
#top_tracks(force = false) ⇒ Object
89 90 91 |
# File 'lib/scrobbler/tag.rb', line 89 def top_tracks(force=false) get_instance2('tag.gettoptracks', :top_tracks, :track, {'tag'=>@name}, force) end |