stadtratmonitor/lib/tasks/import_papers.rake

12 lines
406 B
Ruby
Raw Normal View History

2015-04-13 22:09:28 +02:00
namespace :import_papers do
desc 'Import Paper records from CSV'
task :from_morph => :environment do |t, args|
require 'open-uri'
api_key = ENV['MORPH_API_KEY']
2015-04-27 23:14:48 +02:00
uri = URI.parse "https://api.morph.io/ahx/city_council_leipzig_recent_papers/data.json?key=#{api_key}&query=select%20*%20from%20%27data%27"
puts "Download files from #{uri}"
Paper.import_from_json(uri.read)
2015-04-13 22:09:28 +02:00
end
end