mirror of
https://github.com/CodeforLeipzig/stadtratmonitor.git
synced 2024-12-22 15:43:14 +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
|
||||
get '/' => 'search#index', as: :search
|
||||
get '/:id' => 'search#show', as: :saved_search
|
||||
end
|
||||
|
||||
post '/auth/:provider/callback', to: 'sessions#create'
|
||||
get '/auth/browser_id', as: 'sign_in'
|
||||
scope '/a7d34068d8e22f75898ce838c0e59669bc047e46', :controller => :import do
|
||||
post :new_papers_callback
|
||||
end
|
||||
|
||||
resource :session, only: [:create, :destroy]
|
||||
|
||||
|
|
Loading…
Reference in a new issue