Class: Slackathon::WebhooksController

Inherits:
ApplicationController show all
Defined in:
app/controllers/slackathon/webhooks_controller.rb

Instance Method Summary collapse

Instance Method Details

#commandObject


5
6
7
8
9
10
11
12
# File 'app/controllers/slackathon/webhooks_controller.rb', line 5

def command
  command = payload[:command][1..-1]
  klass = "#{command}_command".classify.constantize

  SlackCommandJob.perform_later(klass.name, "command", payload.to_unsafe_h)

  head :ok
end

#interactionObject


14
15
16
17
18
19
20
21
# File 'app/controllers/slackathon/webhooks_controller.rb', line 14

def interaction
  command = payload[:callback_id]
  klass = "#{command}_command".classify.constantize

  SlackCommandJob.perform_later(klass.name, "interaction", payload)

  head :ok
end