mirror of
https://github.com/CodeforLeipzig/stadtratmonitor.git
synced 2024-12-22 23:53:15 +01:00
Add config file for morph for importing papers
This commit is contained in:
parent
5bda50a753
commit
ef27bce6a9
3 changed files with 6 additions and 4 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -14,3 +14,4 @@
|
|||
# Ignore all logfiles and tempfiles.
|
||||
/log/*.log
|
||||
/tmp
|
||||
config/morph.yml
|
||||
|
|
2
config/morph.yml.example
Normal file
2
config/morph.yml.example
Normal file
|
@ -0,0 +1,2 @@
|
|||
development:
|
||||
key: insertyourkeyhere
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue