demarches-normaliennes/app/jobs/web_hook_job.rb
2022-06-10 17:28:07 +02:00

16 lines
393 B
Ruby

class WebHookJob < ApplicationJob
queue_as :webhooks_v1
TIMEOUT = 10
def perform(procedure_id, dossier_id, state, updated_at)
body = {
procedure_id: procedure_id,
dossier_id: dossier_id,
state: state,
updated_at: updated_at
}
procedure = Procedure.find(procedure_id)
Typhoeus.post(procedure.web_hook_url, body: body, timeout: TIMEOUT)
end
end