Class: Mortymer::Rails::EndpointWrapperController
- Inherits:
-
ActionController::API
- Object
- ActionController::API
- Mortymer::Rails::EndpointWrapperController
- Defined in:
- lib/mortymer/rails/endpoint_wrapper_controller.rb
Overview
This controller acts as a wrapper for Morty endpoints, handling param conversion and response rendering
Instance Method Summary collapse
-
#execute ⇒ Object
This method should be used when inheriting from a Controller.
- #handle ⇒ Object
Instance Method Details
#execute ⇒ Object
This method should be used when inheriting from a Controller
12 13 14 15 |
# File 'lib/mortymer/rails/endpoint_wrapper_controller.rb', line 12 def execute endpoint_class = request.env["morty.endpoint_class"] dispatch_action_to(self, endpoint_class.action, endpoint_class.input_class) end |
#handle ⇒ Object
17 18 19 20 21 22 |
# File 'lib/mortymer/rails/endpoint_wrapper_controller.rb', line 17 def handle endpoint_class = request.env["morty.endpoint_class"] controller_class = endpoint_class.controller_class handler = controller_class.new dispatch_action_to(handler, endpoint_class.action, endpoint_class.input_class) end |