Class: Tmdb::TV

Inherits:
Resource show all
Defined in:
lib/themoviedb/tv.rb

Constant Summary collapse

@@fields =
[
  :backdrop_path,
  :created_by,
  :episode_run_time,
  :first_air_date,
  :genres,
  :homepage,
  :id,
  :in_production,
  :languages,
  :last_air_date,
  :name,
  :networks,
  :number_of_episodes,
  :number_of_seasons,
  :original_name,
  :origin_country,
  :overview,
  :popularity,
  :poster_path,
  :seasons,
  :status,
  :vote_average,
  :vote_count,
  :credits,
  :external_ids
]

Class Method Summary collapse

Methods inherited from Resource

detail, endpoint_id, endpoints, has_resource, #initialize, list, search

Constructor Details

This class inherits a constructor from Tmdb::Resource

Class Method Details

.cast(id, conditions = {}) ⇒ Object

Get the cast information about a TV series.


58
59
60
61
# File 'lib/themoviedb/tv.rb', line 58

def self.cast(id, conditions={})
  search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}/credits")
  search.fetch_response['cast']
end

.crew(id, conditions = {}) ⇒ Object

Get the crew information about a TV series.


64
65
66
67
# File 'lib/themoviedb/tv.rb', line 64

def self.crew(id, conditions={})
  search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}/credits")
  search.fetch_response['crew']
end

.discover(conditions = {}) ⇒ Object

Discover TV shows by different types of data like average rating, number of votes, genres, the network they aired on and air dates


51
52
53
54
55
# File 'lib/themoviedb/tv.rb', line 51

def self.discover(conditions={})
  search = Tmdb::Search.new("/discover/tv")
  search.filter(conditions)
  search.fetch
end

.external_ids(id, conditions = {}) ⇒ Object

Get the external ids that we have stored for a TV series.


70
71
72
73
# File 'lib/themoviedb/tv.rb', line 70

def self.external_ids(id, conditions={})
  search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}/external_ids")
  search.fetch_response
end

.images(id, conditions = {}) ⇒ Object

Get the images (posters and backdrops) for a TV series.


76
77
78
79
# File 'lib/themoviedb/tv.rb', line 76

def self.images(id, conditions={})
  search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}/images")
  search.fetch_response
end

Get the list of popular TV shows. This list refreshes every day.


39
40
41
42
# File 'lib/themoviedb/tv.rb', line 39

def self.popular
  search = Tmdb::Search.new("/tv/popular")
  search.fetch
end

.top_ratedObject

Get the list of top rated TV shows. By default, this list will only include TV shows that have 2 or more votes. This list refreshes every day.


45
46
47
48
# File 'lib/themoviedb/tv.rb', line 45

def self.top_rated
  search = Tmdb::Search.new("/tv/top_rated")
  search.fetch
end