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_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.


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

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

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

Get the cast information for a specific movie id.


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

def self.casts(id, conditions={})
  search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.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.


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

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

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

Get the credits for a specific movie id.


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

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

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

Get the cast information for a specific movie id.


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

def self.crew(id, conditions={})
  search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.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.


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

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

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

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


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

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

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

Get the plot keywords for a specific movie id.


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

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

.latestObject

Get the latest movie id. singular


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

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

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

Get the lists that the movie belongs to.


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

def self.lists(id, conditions={})
  search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.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.


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

def self.now_playing
  search = Tmdb::Search.new("/movie/now_playing")
  search.fetch
end

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


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

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

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

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


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

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

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

Get the similar movies for a specific movie id.


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

def self.similar_movies(id, conditions={})
  search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}/similar_movies")
  search.filter(conditions)
  search.fetch
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.


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

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

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

Get the trailers for a specific movie id.


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

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

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

Get the translations for a specific movie id.


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

def self.translations(id, conditions={})
  search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.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.


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

def self.upcoming
  search = Tmdb::Search.new("/movie/upcoming")
  search.fetch
end