Class: Vindi::WebhooksController

Inherits:
ActionController::API
  • Object
show all
Defined in:
lib/generators/vindi/templates/webhooks_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



7
8
9
10
11
12
13
14
15
16
# File 'lib/generators/vindi/templates/webhooks_controller.rb', line 7

def create
  payload = JSON.parse(request.body.read, symbolize_names: true)
  
  # Enqueue Vindi Webhook processing
  Vindi::WebhookJob.perform_later(payload)

  render json: { status: "received" }, status: :ok
rescue JSON::ParserError
  render json: { error: "Invalid payload" }, status: :bad_request
end