Class: Tmdb::Change

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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Struct

#analyze_value, #initialize

Constructor Details

This class inherits a constructor from Tmdb::Struct

Class Method Details

.movie(filters = {}) ⇒ Object



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

def self.movie(filters={})
  result = Resource.new("/movie/changes", filters).get

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

  change
end

.person(filters = {}) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# File 'lib/tmdb/change.rb', line 15

def self.person(filters={})
  result = Resource.new("/person/changes", filters).get

  change = self.new(result.except('results'))
  change.results = result['results'].map do |result|
    Person.new(result)
  end

  change
end

.tv(filters = {}) ⇒ Object



26
27
28
29
30
31
32
33
34
35
# File 'lib/tmdb/change.rb', line 26

def self.tv(filters={})
  result = Resource.new("/tv/changes", filters).get

  change = self.new(result.except('results'))
  change.results = result['results'].map do |result|
    TV.new(result)
  end

  change
end

Instance Method Details

#convert_items!Object



37
38
39
40
41
# File 'lib/tmdb/change.rb', line 37

def convert_items!
  items.map! do |change_item|
    ChangeItem.new(change_item.to_h)
  end
end