class PunkyBrewster::Server
Public Class Methods
call(env)
click to toggle source
# File lib/punky_brewster/server.rb, line 21 def self.call(env) self.new.call(env) end
Public Instance Methods
call(env)
click to toggle source
# File lib/punky_brewster/server.rb, line 7 def call(env) headers = { 'Content-Type' => 'application/json' } begin body = BeerRepository.list.to_json status = 200 rescue => error body = JSON.generate(error: "#{error.class}: #{error}") status = 500 end [status, headers, [body]] end