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.
|
# Ignore all logfiles and tempfiles.
|
||||||
/log/*.log
|
/log/*.log
|
||||||
/tmp
|
/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'
|
desc 'Import Paper records from setup importers'
|
||||||
task import_papers: :environment do
|
task import_papers: :environment do
|
||||||
require 'open-uri'
|
require 'open-uri'
|
||||||
Importer.all.each do |importer|
|
api_key = Rails.application.config_for(:morph)["key"]
|
||||||
uri = URI.parse(importer.url)
|
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)
|
Paper.import_from_json(uri.read)
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
Loading…
Reference in a new issue