-
-
Save mpcoding/60a1115238d0b0075c35 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :db do | |
require 'open-uri' | |
require 'rubygems' | |
require 'ruby-tmdb3' | |
task :pull_tmdb_data => :environment do | |
Tmdb.api_key = "API_KEY" | |
results = Tmdb.api_call( | |
"discover/movie", | |
{ | |
page: 1, | |
sort_by: 'release_date.asc' | |
}, | |
"en" | |
) | |
results.map!{|m| TmdbMovie.new(m, true)} # `true` tells TmdbMovie.new to expand results | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment