Sha256: bac167838374e86c42f92285d08ed94c802fdc9311935c04b9a9260a6b58c355

Contents?: true

Size: 1.02 KB

Versions: 3

Compression:

Stored size: 1.02 KB

Contents

module RSpotify

  class Track < Base

    attr_accessor :album, :artists, :available_markets, :disc_number, :duration_ms, :explicit,
                  :external_ids, :name, :popularity, :preview_url, :track_number

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

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

    def initialize(options = {})
      @album             = Album.new options['album'] if options['album']
      @artists           = options['artists'].map { |a| Artist.new a }
      @available_markets = options['available_markets']
      @disc_number       = options['disc_number']
      @duration_ms       = options['duration_ms']
      @explicit          = options['explicit']
      @external_ids      = options['external_ids']
      @name              = options['name']
      @popularity        = options['popularity']
      @preview_url       = options['preview_url']
      @track_number      = options['track_number']

      super(options)
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rspotify-0.2.0 lib/rspotify/track.rb
rspotify-0.1.0 lib/rspotify/track.rb
rspotify-0.1.1 lib/rspotify/track.rb