Module: Chatops::Controller
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/chatops/controller.rb
Defined Under Namespace
Modules: ClassMethods, TestCaseHelpers
Classes: ConfigurationError, TestCase
Instance Method Summary
collapse
Instance Method Details
#execute_chatop ⇒ Object
48
49
50
51
|
# File 'lib/chatops/controller.rb', line 48
def execute_chatop
end
|
#list ⇒ Object
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/chatops/controller.rb', line 18
def list
chatops = self.class.chatops
chatops.each { |name, hash| hash[:path] = name }
render :json => {
namespace: self.class.chatops_namespace,
help: self.class.chatops_help,
error_response: self.class.chatops_error_response,
methods: chatops,
version: "3" }
end
|
#process(*args) ⇒ Object
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/chatops/controller.rb', line 29
def process(*args)
scrubbed_params = jsonrpc_params.except(
:user, :mention_slug, :method, :controller, :action, :params, :room_id)
scrubbed_params.each { |k, v| params[k] = v }
if params[:chatop].present?
params[:action] = params[:chatop]
args[0] = params[:action]
unless self.respond_to?(params[:chatop].to_sym)
raise AbstractController::ActionNotFound
end
end
super *args
rescue AbstractController::ActionNotFound
return jsonrpc_method_not_found
end
|