Class: FaaStRuby::Event
- Inherits:
-
Object
- Object
- FaaStRuby::Event
- Defined in:
- lib/faastruby/spec_helper.rb,
lib/faastruby/server/event.rb
Overview
Add default initialize values to the Event class for backwards compatibility. This will be removed on v0.6
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#context ⇒ Object
Returns the value of attribute context.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#query_params ⇒ Object
Returns the value of attribute query_params.
Instance Method Summary collapse
-
#initialize(body:, query_params:, headers:, context:) ⇒ Event
constructor
A new instance of Event.
- #to_h ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(body:, query_params:, headers:, context:) ⇒ Event
Returns a new instance of Event.
22 23 24 25 26 27 |
# File 'lib/faastruby/spec_helper.rb', line 22 def initialize(body: nil, query_params: {}, headers: {}, context: nil) @body = body @query_params = query_params @headers = headers @context = context end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
3 4 5 |
# File 'lib/faastruby/server/event.rb', line 3 def body @body end |
#context ⇒ Object
Returns the value of attribute context.
3 4 5 |
# File 'lib/faastruby/server/event.rb', line 3 def context @context end |
#headers ⇒ Object
Returns the value of attribute headers.
3 4 5 |
# File 'lib/faastruby/server/event.rb', line 3 def headers @headers end |
#query_params ⇒ Object
Returns the value of attribute query_params.
3 4 5 |
# File 'lib/faastruby/server/event.rb', line 3 def query_params @query_params end |
Instance Method Details
#to_h ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/faastruby/server/event.rb', line 10 def to_h { "body" => @body, "query_params" => @query_params, "headers" => @headers, "context" => @context } end |
#to_json ⇒ Object
18 19 20 |
# File 'lib/faastruby/server/event.rb', line 18 def to_json Oj.dump(to_h) end |