Class: Beatport::Catalog::Genre

Inherits:
Item
  • Object
show all
Defined in:
lib/beatport/catalog/genre.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Item

#[], #associate, associations, find_by_name, has_many, has_one, #id, #initialize, lazy_accessor, #type

Constructor Details

This class inherits a constructor from Beatport::Item

Class Method Details

.all(options = {}) ⇒ Object

Returns all the genres



17
18
19
# File 'lib/beatport/catalog/genre.rb', line 17

def self.all(options = {})
  Client.retrieve 'genres', Genre, options
end

.find(key) ⇒ Object

Returns the genre with the given id or slug



12
13
14
# File 'lib/beatport/catalog/genre.rb', line 12

def self.find(key)
  Client.retrieve 'genres', Genre, :key => key, :string_key_type => :slug, :subgenres => true
end

.overviewObject



21
22
23
# File 'lib/beatport/catalog/genre.rb', line 21

def self.overview
  Client.retrieve 'genres/overview', Genre
end

Instance Method Details

#slideshowObject

Returns the slideshow for the genre



31
32
33
# File 'lib/beatport/catalog/genre.rb', line 31

def slideshow
  @slideshow ||= Slideshow.find(id)
end

#top_downloadsObject

Returns the top downloads for the genre



26
27
28
# File 'lib/beatport/catalog/genre.rb', line 26

def top_downloads
  @top_downloads ||= Track.most_popular_for_genre(id)
end