demarches-normaliennes/app/jobs/web_hook_job.rb

17 lines
340 B
Ruby
Raw Normal View History

2018-03-01 17:04:05 +01:00
class WebHookJob < ApplicationJob
2020-09-22 17:14:31 +02:00
queue_as :webhooks_v1
2018-03-01 17:04:05 +01:00
TIMEOUT = 10
def perform(procedure, dossier)
body = {
procedure_id: procedure.id,
dossier_id: dossier.id,
state: dossier.state,
updated_at: dossier.updated_at
}
Typhoeus.post(procedure.web_hook_url, body: body, timeout: TIMEOUT)
end
end