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.



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

def initialize(env)
  @env = env
end

Instance Method Details

#call(req) ⇒ Object



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

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