Sha256: d32427bf3f6d0e82c6482887fe62eec6f4fdb538609fd3b5b4e03c8987a2c43f

Contents?: true

Size: 901 Bytes

Versions: 1

Compression:

Stored size: 901 Bytes

Contents

module RSpotify

  class Track < Base

    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 = {})
      @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']

      @album = if options['album']
        Album.new options['album']
      end

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

      super(options)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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