Sha256: 8e7f61ecd5daaf817dac77e03acc014c6bfd10a3b31f86114f3676be993930e9

Contents?: true

Size: 1.35 KB

Versions: 9

Compression:

Stored size: 1.35 KB

Contents

module Beatport
  module Catalog  
    class Track < Item
      has_many :genres, Genre
      has_many :sub_genres, Genre
      has_many :artists, Artist
      has_many :charts, Chart
      has_one :release, Release
      has_one :label, Label
      has_one :price, Price
      has_one :images, Images
      has_one :audio_format_fee, AudioFormatFee
      has_one :key, Keys
    
      # Returns the track with the given id
      def self.find(key)
        Client.retrieve 'tracks', Track, :key => key
      end
  
      # Returns all the tracks matching the criterea
      def self.all(options = {})
        Client.retrieve 'tracks', Track, options
      end    
    
      def self.most_popular(options = {})
        Client.retrieve 'most-popular', Track, options
      end
    
      def self.most_popular_for_genre(id, options = {})
        options[:id] = id
        options[:collection] = true
        Client.retrieve "most-popular/genre", Track, options
      end
    
      def self.most_popular_for_artist(id, options = {})
        options[:id] = id
        options[:collection] = true
        Client.retrieve "most-popular/artist", Track, options
      end

      def self.most_popular_for_label(id, options = {})
        options[:id] = id
        options[:collection] = true
        Client.retrieve "most-popular/label", Track, options
      end
    
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
beatport-0.2.0 lib/beatport/catalog/track.rb
beatport-0.1.10 lib/beatport/catalog/track.rb
beatport-0.1.9 lib/beatport/catalog/track.rb
beatport-0.1.8 lib/beatport/catalog/track.rb
beatport-0.1.7 lib/beatport/catalog/track.rb
beatport-0.1.6 lib/beatport/catalog/track.rb
beatport-0.1.5 lib/beatport/catalog/track.rb
beatport-0.1.3 lib/beatport/catalog/track.rb
beatport-0.1.2 lib/beatport/catalog/track.rb