mirror of
https://github.com/CodeforLeipzig/stadtratmonitor.git
synced 2024-12-22 23:53:15 +01:00
#21: added web hook for paper scraper notification
This commit is contained in:
parent
e3a81fea4c
commit
6b1b85c6df
2 changed files with 12 additions and 3 deletions
9
app/controllers/import_controller.rb
Normal file
9
app/controllers/import_controller.rb
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
class ImportController < ApplicationController
|
||||||
|
def new_papers_callback
|
||||||
|
require 'open-uri'
|
||||||
|
api_key = Rails.application.config_for(:morph)["key"]
|
||||||
|
uri = URI.parse("https://api.morph.io/jrlover/city_council_leipzig_recent_papers/data.json?key=#{api_key}&query=select%20*%20from%20%27data%27")
|
||||||
|
Paper.import_from_json(uri.read)
|
||||||
|
render :nothing => true
|
||||||
|
end
|
||||||
|
end
|
|
@ -3,11 +3,11 @@ Rails.application.routes.draw do
|
||||||
|
|
||||||
scope ':body' do
|
scope ':body' do
|
||||||
get '/' => 'search#index', as: :search
|
get '/' => 'search#index', as: :search
|
||||||
get '/:id' => 'search#show', as: :saved_search
|
|
||||||
end
|
end
|
||||||
|
|
||||||
post '/auth/:provider/callback', to: 'sessions#create'
|
scope '/a7d34068d8e22f75898ce838c0e59669bc047e46', :controller => :import do
|
||||||
get '/auth/browser_id', as: 'sign_in'
|
post :new_papers_callback
|
||||||
|
end
|
||||||
|
|
||||||
resource :session, only: [:create, :destroy]
|
resource :session, only: [:create, :destroy]
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue