Sha256: 229b70185298ddbb62ca48f60bca5c0753a67687d032bcf6a70b77b4af073118

Contents?: true

Size: 946 Bytes

Versions: 14

Compression:

Stored size: 946 Bytes

Contents

module Beatport
  module Catalog
    class Genre < Item
      has_many :subgenres, Genre
#      has_many :top_downloads, Track
#      has_one :slideshow, Slideshow
#      has_many :features, Feature
      has_one :counts, Item
      has_one :list, List
    
      # Returns the genre with the given id or slug
      def self.find(key)
        Client.retrieve 'genres', Genre, :key => key, :string_key_type => :slug, :subgenres => true
      end
  
      # Returns all the genres
      def self.all(options = {})
        Client.retrieve 'genres', Genre, options
      end
    
      def self.overview
        Client.retrieve 'genres/overview', Genre
      end
      
      # Returns the top downloads for the genre
      def top_downloads
        @top_downloads ||= Track.most_popular_for_genre(id)
      end
    
      # Returns the slideshow for the genre
      def slideshow
        @slideshow ||= Slideshow.find(id)
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
beatport-0.4.0 lib/beatport/catalog/genre.rb
beatport-0.3.0 lib/beatport/catalog/genre.rb
beatport-0.2.3 lib/beatport/catalog/genre.rb
beatport-0.2.2 lib/beatport/catalog/genre.rb
beatport-0.2.1 lib/beatport/catalog/genre.rb
beatport-0.2.0 lib/beatport/catalog/genre.rb
beatport-0.1.10 lib/beatport/catalog/genre.rb
beatport-0.1.9 lib/beatport/catalog/genre.rb
beatport-0.1.8 lib/beatport/catalog/genre.rb
beatport-0.1.7 lib/beatport/catalog/genre.rb
beatport-0.1.6 lib/beatport/catalog/genre.rb
beatport-0.1.5 lib/beatport/catalog/genre.rb
beatport-0.1.3 lib/beatport/catalog/genre.rb
beatport-0.1.2 lib/beatport/catalog/genre.rb