Class: Syntropy::JSONAPI

Inherits:
Object
  • Object
show all
Defined in:
lib/syntropy/json_api.rb

Instance Method Summary collapse

Constructor Details

#initialize(env) ⇒ JSONAPI

Returns a new instance of JSONAPI.



9
10
11
# File 'lib/syntropy/json_api.rb', line 9

def initialize(env)
  @env = env
end

Instance Method Details

#call(req) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/syntropy/json_api.rb', line 13

def call(req)
  response, status = __invoke__(req)
  req.respond(
    response.to_json,
    ':status'       => status,
    'Content-Type'  => 'application/json'
  )
end