Class: Tmdb::Movie

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

Constant Summary collapse

@@fields =
[
  :adult,
  :backdrop_path,
  :belongs_to_collection,
  :budget,
  :genres,
  :homepage,
  :id,
  :imdb_id,
  :original_language,
  :original_title,
  :overview,
  :popularity,
  :poster_path,
  :production_companies,
  :production_countries,
  :release_date,
  :revenue,
  :runtime,
  :spoken_languages,
  :status,
  :tagline,
  :title,
  :vote_average,
  :vote_count,
  :alternative_titles,
  :credits,
  :images,
  :keywords,
  :releases,
  :trailers,
  :translations,
  :reviews,
  :lists,
  :changes
]

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

.alternative_titles(id, _conditions = {}) ⇒ Object

Get the alternative titles for a specific movie id.



85
86
87
88
# File 'lib/themoviedb/movie.rb', line 85

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

.casts(id, _conditions = {}) ⇒ Object

Get the cast information for a specific movie id.



91
92
93
94
# File 'lib/themoviedb/movie.rb', line 91

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

.changes(id, _conditions = {}) ⇒ Object

Get the changes for a specific movie id. Changes are grouped by key, and ordered by date in descending order. By default, only the last 24 hours of changes are returned. The maximum number of days that can be returned in a single request is 14. The language is present on fields that are translatable.



150
151
152
153
# File 'lib/themoviedb/movie.rb', line 150

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

.credits(id, _conditions = {}) ⇒ Object

Get the credits for a specific movie id.



156
157
158
159
# File 'lib/themoviedb/movie.rb', line 156

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

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

Get the cast information for a specific movie id.



97
98
99
100
# File 'lib/themoviedb/movie.rb', line 97

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

.discover(conditions = {}) ⇒ Object

Discover movies by different types of data like average rating, number of votes, genres and certifications.



78
79
80
81
82
# File 'lib/themoviedb/movie.rb', line 78

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

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

Get the images (posters and backdrops) for a specific movie id.



103
104
105
106
# File 'lib/themoviedb/movie.rb', line 103

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

.keywords(id, _conditions = {}) ⇒ Object

Get the plot keywords for a specific movie id.



109
110
111
112
# File 'lib/themoviedb/movie.rb', line 109

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

.latestObject

Get the latest movie id. singular



48
49
50
51
# File 'lib/themoviedb/movie.rb', line 48

def self.latest
  search = Tmdb::Search.new("/movie/latest")
  new(search.fetch_response)
end

.lists(id, _conditions = {}) ⇒ Object

Get the lists that the movie belongs to.



140
141
142
143
# File 'lib/themoviedb/movie.rb', line 140

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

.now_playingObject

Get the list of movies playing in theatres. This list refreshes every day. The maximum number of items this list will include is 100.



60
61
62
63
# File 'lib/themoviedb/movie.rb', line 60

def self.now_playing
  search = Tmdb::Search.new("/movie/now_playing")
  search.fetch.collect { |result| new(result) }
end

Get the list of popular movies on The Movie Database. This list refreshes every day.



66
67
68
69
# File 'lib/themoviedb/movie.rb', line 66

def self.popular
  search = Tmdb::Search.new("/movie/popular")
  search.fetch.collect { |result| new(result) }
end

.releases(id, _conditions = {}) ⇒ Object

Get the release date by country for a specific movie id.



115
116
117
118
# File 'lib/themoviedb/movie.rb', line 115

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

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

Get the similar movies for a specific movie id.



133
134
135
136
137
# File 'lib/themoviedb/movie.rb', line 133

def self.similar_movies(id, conditions = {})
  search = Tmdb::Search.new("/#{endpoints[:singular]}/#{endpoint_id + id.to_s}/similar_movies")
  search.filter(conditions)
  search.fetch.collect { |result| new(result) }
end

.top_ratedObject

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



72
73
74
75
# File 'lib/themoviedb/movie.rb', line 72

def self.top_rated
  search = Tmdb::Search.new("/movie/top_rated")
  search.fetch.collect { |result| new(result) }
end

.trailers(id, _conditions = {}) ⇒ Object

Get the trailers for a specific movie id.



121
122
123
124
# File 'lib/themoviedb/movie.rb', line 121

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

.translations(id, _conditions = {}) ⇒ Object

Get the translations for a specific movie id.



127
128
129
130
# File 'lib/themoviedb/movie.rb', line 127

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

.upcomingObject

Get the list of upcoming movies. This list refreshes every day. The maximum number of items this list will include is 100.



54
55
56
57
# File 'lib/themoviedb/movie.rb', line 54

def self.upcoming
  search = Tmdb::Search.new("/movie/upcoming")
  search.fetch.collect { |result| new(result) }
end

.videos(id, _conditions = {}) ⇒ Object



161
162
163
164
# File 'lib/themoviedb/movie.rb', line 161

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