Class: Lamby::Rack
Constant Summary collapse
- LAMBDA_EVENT =
'lambda.event'.freeze
- LAMBDA_CONTEXT =
'lambda.context'.freeze
- HTTP_X_REQUESTID =
'HTTP_X_REQUEST_ID'.freeze
- HTTP_X_REQUEST_START =
'HTTP_X_REQUEST_START'.freeze
- HTTP_COOKIE =
'HTTP_COOKIE'.freeze
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#event ⇒ Object
readonly
Returns the value of attribute event.
Class Method Summary collapse
- .lookup(type, event) ⇒ Object
-
.types ⇒ Object
Order is important.
Instance Method Summary collapse
- #env ⇒ Object
-
#initialize(event, context) ⇒ Rack
constructor
A new instance of Rack.
- #multi_value? ⇒ Boolean
- #response(_handler) ⇒ Object
Methods included from SamHelpers
Constructor Details
#initialize(event, context) ⇒ Rack
Returns a new instance of Rack.
30 31 32 33 |
# File 'lib/lamby/rack.rb', line 30 def initialize(event, context) @event = event @context = context end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
28 29 30 |
# File 'lib/lamby/rack.rb', line 28 def context @context end |
#event ⇒ Object (readonly)
Returns the value of attribute event.
28 29 30 |
# File 'lib/lamby/rack.rb', line 28 def event @event end |
Class Method Details
.lookup(type, event) ⇒ Object
14 15 16 |
# File 'lib/lamby/rack.rb', line 14 def lookup(type, event) types[type] || types.values.detect { |t| t.handle?(event) } end |
.types ⇒ Object
Order is important. REST is hardest to isolated with handle? method.
19 20 21 22 23 24 |
# File 'lib/lamby/rack.rb', line 19 def types { alb: RackAlb, http: RackHttp, rest: RackRest, api: RackRest } end |
Instance Method Details
#env ⇒ Object
35 36 37 |
# File 'lib/lamby/rack.rb', line 35 def env @env ||= env_base.merge!(env_headers) end |
#multi_value? ⇒ Boolean
43 44 45 |
# File 'lib/lamby/rack.rb', line 43 def multi_value? false end |
#response(_handler) ⇒ Object
39 40 41 |
# File 'lib/lamby/rack.rb', line 39 def response(_handler) {} end |