Class: Fuik::WebhooksController

Inherits:
Object
  • Object
show all
Includes:
EventType
Defined in:
app/controllers/fuik/webhooks_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'app/controllers/fuik/webhooks_controller.rb', line 9

def create
  verify_signature!

  webhook_event = WebhookEvent.create!(
    provider: params[:provider],
    event_id: event_id,
    event_type: event_type,
    body: json_body,
    headers: headers
  )

  process_later!(webhook_event)

  head :ok
rescue Fuik::InvalidSignature
  head :unauthorized
rescue ActiveRecord::RecordNotUnique
  head :ok
rescue
  head :internal_server_error
end