Class: Volt::HttpController
- Defined in:
- lib/volt/controllers/http_controller.rb
Overview
Allow you to create controllers that act as http endpoints
Instance Attribute Summary collapse
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
-
#response_body ⇒ Object
Returns the value of attribute response_body.
-
#response_headers ⇒ Object
readonly
Returns the value of attribute response_headers.
Instance Method Summary collapse
-
#initialize(params, request) ⇒ HttpController
constructor
Initialzed with the params parsed from the route and the HttpRequest.
- #perform(action) ⇒ Object
Constructor Details
#initialize(params, request) ⇒ HttpController
Initialzed with the params parsed from the route and the HttpRequest
11 12 13 14 15 16 |
# File 'lib/volt/controllers/http_controller.rb', line 11 def initialize(params, request) @response_headers = HttpResponseHeader.new @response_body = [] @request = request @params = Volt::Model.new(params.symbolize_keys.merge(request.params)) end |
Instance Attribute Details
#params ⇒ Object (readonly)
Returns the value of attribute params.
8 9 10 |
# File 'lib/volt/controllers/http_controller.rb', line 8 def params @params end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
8 9 10 |
# File 'lib/volt/controllers/http_controller.rb', line 8 def request @request end |
#response_body ⇒ Object
Returns the value of attribute response_body.
7 8 9 |
# File 'lib/volt/controllers/http_controller.rb', line 7 def response_body @response_body end |
#response_headers ⇒ Object (readonly)
Returns the value of attribute response_headers.
8 9 10 |
# File 'lib/volt/controllers/http_controller.rb', line 8 def response_headers @response_headers end |
Instance Method Details
#perform(action) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/volt/controllers/http_controller.rb', line 18 def perform(action) # TODO: before actions send(action.to_sym) # TODO: after actions / around actions respond end |