Class: Azeroth::RequestHandler Private
- Inherits:
-
Object
- Object
- Azeroth::RequestHandler
- Defined in:
- lib/azeroth/request_handler.rb,
lib/azeroth/request_handler/new.rb,
lib/azeroth/request_handler/edit.rb,
lib/azeroth/request_handler/show.rb,
lib/azeroth/request_handler/index.rb,
lib/azeroth/request_handler/create.rb,
lib/azeroth/request_handler/update.rb,
lib/azeroth/request_handler/destroy.rb,
lib/azeroth/request_handler/pagination.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Handle a request on behalf of the controller
Request handler sends messages to the controller in order to get the resource and rendering the response
Defined Under Namespace
Classes: Create, Destroy, Edit, Index, New, Pagination, Show, Update
Instance Method Summary collapse
-
#initialize(controller, model, options) ⇒ RequestHandler
constructor
private
A new instance of RequestHandler.
-
#process ⇒ String
private
process the request.
Constructor Details
#initialize(controller, model, options) ⇒ RequestHandler
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of RequestHandler.
22 23 24 25 26 |
# File 'lib/azeroth/request_handler.rb', line 22 def initialize(controller, model, ) @controller = ControllerInterface.new(controller) @model = model @options = end |
Instance Method Details
#process ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
process the request
No action is performd when format is HTML
When format is json, the resource is fetched/processed (by the subclass) and returned as json (decorated)
36 37 38 39 40 41 42 43 44 |
# File 'lib/azeroth/request_handler.rb', line 36 def process return unless json? controller.add_headers(headers) controller.render_json( model.decorate(resource), status ) end |