Repository URL to install this package:
|
Version:
0.1.6 ▾
|
require 'elixir/aws/handler/version'
module Elixir
module Aws
module Handler
class Lambda
class << self
def call(app, event, context, use_stage)
new(app, event, context, use_stage).call.response
end
end
def initialize(app, event, context, use_stage)
@app = app
@event = event
@context = context
@rack = Rack.new event, context, use_stage
@called = false
end
def response
{ statusCode: status,
headers: headers,
body: body }
end
def status
@status
end
def headers
@headers
end
def body
@rbody ||= ''.tap do |rbody| # rubocop:disable all
@body.each { |part| rbody << part }
end
end
def call
return self if @called
@status, @headers, @body = call_app
@called = true
self
end
private
def call_app
# if Debug.on?(@event)
# Debug.call @event, @context, @rack.env
# else
@app.call @rack.env
# end
end
end
# Your code goes here...
end
end
end