Class: Tmdb::Genre

Inherits:
Struct show all
Defined in:
lib/tmdb/genre.rb

Class Method Summary collapse

Methods inherited from Struct

#analyze_value, #initialize

Constructor Details

This class inherits a constructor from Tmdb::Struct

Class Method Details

.movie_list(filters = {}) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/tmdb/genre.rb', line 4

def self.movie_list(filters={})
  result = Resource.new('/genre/movie/list', filters).get

  result['genres'].map do |genre|
    self.new(genre)
  end
end

.movies(genre_id, filters = {}) ⇒ Object



20
21
22
23
24
25
26
27
28
29
# File 'lib/tmdb/genre.rb', line 20

def self.movies(genre_id, filters={})
  result = Resource.new("/genre/#{genre_id}/movies", filters).get

  genre = self.new(result.except('results'))
  genre.results = result['results'].map do |movie|
    Movie.new(movie)
  end

  genre
end

.tv_list(filters = {}) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/tmdb/genre.rb', line 12

def self.tv_list(filters={})
  result = Resource.new('/genre/tv/list', filters).get

  result['genres'].map do |genre|
    self.new(genre)
  end
end