diff --git a/.gitignore b/.gitignore index 6a502e9..70851bc 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ # Ignore all logfiles and tempfiles. /log/*.log /tmp +config/morph.yml diff --git a/config/morph.yml.example b/config/morph.yml.example new file mode 100644 index 0000000..6a37aa4 --- /dev/null +++ b/config/morph.yml.example @@ -0,0 +1,2 @@ +development: + key: insertyourkeyhere diff --git a/lib/tasks/import_papers.rake b/lib/tasks/import_papers.rake index 28f77b0..d5ffd52 100644 --- a/lib/tasks/import_papers.rake +++ b/lib/tasks/import_papers.rake @@ -1,8 +1,7 @@ desc 'Import Paper records from setup importers' task import_papers: :environment do require 'open-uri' - Importer.all.each do |importer| - uri = URI.parse(importer.url) - Paper.import_from_json(uri.read) - end + api_key = Rails.application.config_for(:morph)["key"] + uri = "https://api.morph.io/ahx/city_council_leipzig_recent_papers/data.json?key=#{api_key}&query=select%20*%20from%20%27data%27" + Paper.import_from_json(uri.read) end