Class: Reji::WebhookController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
app/controllers/reji/webhook_controller.rb

Instance Method Summary collapse

Instance Method Details

#handle_webhookObject



7
8
9
10
11
12
13
14
15
16
17
# File 'app/controllers/reji/webhook_controller.rb', line 7

def handle_webhook
  payload = JSON.parse(request.body.read)

  type = payload['type']

  return missing_method if type.nil?

  method = "handle_#{payload['type'].gsub('.', '_')}"

  respond_to?(method, true) ? send(method, payload) : missing_method
end