Class: Tmdb::Keyword

Inherits:
Struct show all
Defined in:
lib/tmdb/keyword.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

.detail(keyword_id, filters = {}) ⇒ Object



4
5
6
7
# File 'lib/tmdb/keyword.rb', line 4

def self.detail(keyword_id, filters={})
  result = Resource.new("/keyword/#{keyword_id}", filters).get
  self.new(result)
end

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



9
10
11
12
13
14
15
16
17
18
# File 'lib/tmdb/keyword.rb', line 9

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

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

  keyword
end