Sha256: 8330192e3f0c581213776d24bddaf929deafcd728debfb1893a23fe2358c9da0

Contents?: true

Size: 596 Bytes

Versions: 5

Compression:

Stored size: 596 Bytes

Contents

module MetaSpotify
  class Artist < MetaSpotify::Base
    
    URI_REGEX = /^spotify:artist:[A-Za-z0-9]+$/
    
    attr_reader :albums
    
    def initialize(hash)
      @name = hash['name']
      @popularity = hash['popularity'].to_f if hash.has_key? 'popularity'
      @uri = hash['href'] if hash.has_key? 'href'
      if hash.has_key? 'albums'
        @albums = []
        if hash['albums']['album'].is_a? Array
          hash['albums']['album'].each { |a| @albums << Album.new(a) }
        else
          @albums << Album.new(hash['albums']['album'])
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
meta-spotify-0.2.0 lib/meta-spotify/artist.rb
meta-spotify-0.1.6 lib/meta-spotify/artist.rb
meta-spotify-0.1.5 lib/meta-spotify/artist.rb
meta-spotify-0.1.4 lib/meta-spotify/artist.rb
meta-spotify-0.1.3 lib/meta-spotify/artist.rb