lib/tmdb/movie.rb in tmdb-0.6.1 vs lib/tmdb/movie.rb in tmdb-0.7.0
- old
+ new
@@ -47,18 +47,24 @@
language: 'en',
certification_country: 'US')
results = TMDB::API.get("/3/discover/movie", query: options)['results']
movies = []
results.each do |result|
- movies.push(Hashie::Mash.new(result))
+ movies.push(TMDB::Movie.new(result))
end
return movies
end
def self.id(movie_id)
options = { api_key: TMDB::API.api_key }
- TMDB::Movie.new(TMDB::API.get("/3/movie/#{movie_id}", query: options))
- # movie.title = "Fight Club"
+ return TMDB::Movie.new(TMDB::API.get("/3/movie/#{movie_id}", query: options))
+ end
+
+ def self.imdb_id(imdb_id)
+ options = { api_key: TMDB::API.api_key,
+ external_source: 'imdb_id'}
+ result = TMDB::API.get("/3/find/#{imdb_id}", query: options)['movie_results'].first
+ return TMDB::Movie.new(result)
end
def self.popular
options = { api_key: TMDB::API.api_key }
results = TMDB::API.get("/3/movie/popular", query: options)['results']
\ No newline at end of file