Class: TMDb::Movie
- Extended by:
- Searchable
- Defined in:
- lib/tmdb-api/movie.rb
Constant Summary collapse
- ATTRIBUTES =
:id, :adult, :backdrop_path, :belongs_to_collection, :budget, :genres, :homepage, :imdb_id, :original_title, :overview, :popularity, :poster_path, :production_companies, :runtime, :production_countries, :release_date, :revenue, :spoken_languages, :status, :tagline, :title, :vote_average, :vote_count
Class Method Summary collapse
-
.alternative_titles(id, options = {}) ⇒ Object
Public: Get the alternative titles for a specific movie ID.
-
.cast(id, options = {}) ⇒ Object
Public: Get the cast for a specific movie ID.
-
.crew(id, options = {}) ⇒ Object
Public: Get the crew for a specific movie ID.
-
.find(id, options = {}) ⇒ Object
Public: Get the basic movie information for a specific movie ID.
-
.images(id, options = {}) ⇒ Object
Public: Get the images (posters and backdrops) for a specific movie ID.
-
.keywords(id, options = {}) ⇒ Object
Public: Get the plot keywords for a specific movie ID.
-
.releases(id) ⇒ Object
Public: Get the release date by country for a specific movie ID.
-
.trailers(id, options = {}) ⇒ Object
Public: Get the trailers for a specific movie ID.
-
.upcoming(options = {}) ⇒ Object
Public: Get the list of upcoming movies.
Methods included from Searchable
Methods inherited from Base
Constructor Details
This class inherits a constructor from TMDb::Base
Class Method Details
.alternative_titles(id, options = {}) ⇒ Object
37 38 39 40 |
# File 'lib/tmdb-api/movie.rb', line 37 def self.alternative_titles(id, = {}) res = get("/movie/#{id}/alternative_titles", query: ) res.success? ? res['titles'] : bad_response(res) end |
.cast(id, options = {}) ⇒ Object
50 51 52 53 |
# File 'lib/tmdb-api/movie.rb', line 50 def self.cast(id, = {}) res = get("/movie/#{id}/credits", query: ) res.success? ? res['cast'] : bad_response(res) end |
.crew(id, options = {}) ⇒ Object
63 64 65 66 |
# File 'lib/tmdb-api/movie.rb', line 63 def self.crew(id, = {}) res = get("/movie/#{id}/credits", query: ) res.success? ? res['crew'] : bad_response(res) end |
.find(id, options = {}) ⇒ Object
Public: Get the basic movie information for a specific movie ID.
id - The ID of the movie. options - The hash options used to filter the search (default: {}):
:language - Language of the result data (ISO 639-1 codes)
(default: en).
Examples
TMDb::Movie.find(68721)
TMDb::Movie.find(68721, language: 'pt')
24 25 26 27 |
# File 'lib/tmdb-api/movie.rb', line 24 def self.find(id, = {}) res = get("/movie/#{id}", query: ) res.success? ? Movie.new(res) : bad_response(res) end |
.images(id, options = {}) ⇒ Object
77 78 79 80 |
# File 'lib/tmdb-api/movie.rb', line 77 def self.images(id, = {}) res = get("/movie/#{id}/images", query: ) res.success? ? res : bad_response(res) end |
.keywords(id, options = {}) ⇒ Object
90 91 92 93 |
# File 'lib/tmdb-api/movie.rb', line 90 def self.keywords(id, = {}) res = get("/movie/#{id}/keywords", query: ) res.success? ? res['keywords'] : bad_response(res) end |
.releases(id) ⇒ Object
113 114 115 116 |
# File 'lib/tmdb-api/movie.rb', line 113 def self.releases(id) res = get("/movie/#{id}/releases") res.success? ? res['countries'] : bad_response(res) end |
.trailers(id, options = {}) ⇒ Object
103 104 105 106 |
# File 'lib/tmdb-api/movie.rb', line 103 def self.trailers(id, = {}) res = get("/movie/#{id}/trailers", query: ) res.success? ? res : bad_response(res) end |
.upcoming(options = {}) ⇒ Object
Public: Get the list of upcoming movies. This list refreshes every day. The maximum number of items this list will include is 100.
options - The hash options used to filter the search (default: {}):
:page - Page.
:language - Images of a specific language (ISO 639-1 code).
Examples
TMDb::Movie.upcoming
TMDb::Movie.upcoming(page: 3, language: 'pt')
129 130 131 132 133 134 135 136 137 |
# File 'lib/tmdb-api/movie.rb', line 129 def self.upcoming( = {}) res = get('/movie/upcoming', query: ) if res.success? res['results'].map { |movie| Movie.new(movie) } else bad_response(res) end end |