Class: Syntropy::JSONAPI
- Inherits:
-
Object
- Object
- Syntropy::JSONAPI
- Defined in:
- lib/syntropy/json_api.rb
Overview
JSONAPI is a controller that implements a JSON API.
Instance Method Summary collapse
-
#call(req) ⇒ void
Processes the given request.
-
#initialize(env) ⇒ void
constructor
Initializes the controller.
Constructor Details
#initialize(env) ⇒ void
Initializes the controller.
13 14 15 |
# File 'lib/syntropy/json_api.rb', line 13 def initialize(env) @env = env end |
Instance Method Details
#call(req) ⇒ void
This method returns an undefined value.
Processes the given request.
21 22 23 24 25 26 27 28 |
# File 'lib/syntropy/json_api.rb', line 21 def call(req) response, status = __invoke__(req) req.respond( response.to_json, ':status' => status, 'Content-Type' => 'application/json' ) end |