Class: RackOnLambda::Adapters::RestApi
- Inherits:
-
Object
- Object
- RackOnLambda::Adapters::RestApi
- Defined in:
- lib/rack_on_lambda/adapters/rest_api.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#event ⇒ Object
readonly
Returns the value of attribute event.
Instance Method Summary collapse
- #env ⇒ Object
-
#initialize(context:, event:) ⇒ RestApi
constructor
A new instance of RestApi.
- #response(status, headers, body) ⇒ Object
Constructor Details
#initialize(context:, event:) ⇒ RestApi
Returns a new instance of RestApi.
8 9 10 11 |
# File 'lib/rack_on_lambda/adapters/rest_api.rb', line 8 def initialize(context:, event:) @context = context @event = event.deep_stringify_keys end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
6 7 8 |
# File 'lib/rack_on_lambda/adapters/rest_api.rb', line 6 def context @context end |
#event ⇒ Object (readonly)
Returns the value of attribute event.
6 7 8 |
# File 'lib/rack_on_lambda/adapters/rest_api.rb', line 6 def event @event end |
Instance Method Details
#env ⇒ Object
13 14 15 16 17 18 |
# File 'lib/rack_on_lambda/adapters/rest_api.rb', line 13 def env @env ||= default_env.merge() .merge(env_headers) .merge(env_params) .merge(env_body) end |
#response(status, headers, body) ⇒ Object
20 21 22 |
# File 'lib/rack_on_lambda/adapters/rest_api.rb', line 20 def response(status, headers, body) Responses::RestApiResponse.new(status, headers, body).as_json end |