Class: Tmdb::Collection

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

.backdrops(id, filters = {}) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/tmdb/collection.rb', line 15

def self.backdrops(id, filters={})
  result = Resource.new("/collection/#{id}/images", filters).get

  result['backdrops'].map do |backdrop|
    Backdrop.new(backdrop)
  end
end

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



4
5
6
7
8
9
10
11
12
13
# File 'lib/tmdb/collection.rb', line 4

def self.detail(id, filters={})
  result = Resource.new("/collection/#{id}", filters).get

  collection = self.new(result.except('parts'))
  collection.parts = result['parts'].map do |part|
    Movie.new(part)
  end

  collection
end

.posters(id, filters = {}) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/tmdb/collection.rb', line 23

def self.posters(id, filters={})
  result = Resource.new("/collection/#{id}/images", filters).get

  result['posters'].map do |poster|
    Poster.new(poster)
  end
end