Sha256: 6a5dd0c00411959e3ac8e7f2fec457efbf22c9b5b77019d40a394dfee0762df2

Contents?: true

Size: 1005 Bytes

Versions: 1

Compression:

Stored size: 1005 Bytes

Contents

module RSpotify

  class Album < Base

    def self.find(id)
      super(id, 'album')
    end

    def self.search(query, limit = 20, offset = 0)
      super(query, 'album', limit, offset)
    end

    def initialize(options = {})
      @album_type             = options['album_type']
      @available_markets      = options['available_markets']
      @external_ids           = options['external_ids']
      @genres                 = options['genres']
      @images                 = options['images']
      @name                   = options['name']
      @popularity             = options['popularity']
      @release_date           = options['release_date']
      @release_date_precision = options['release_date_precision']

      @artists = if options['artists']
        options['artists'].map { |a| Artist.new a }
      end

      @tracks = if options['tracks'] && options['tracks']['items']
        options['tracks']['items'].map { |t| Track.new t }
      end

      super(options)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rspotify-0.5.0 lib/rspotify/album.rb