Class: Webhookdb::Replicator::WebhookRequest
- Inherits:
-
TypedStruct
- Object
- TypedStruct
- Webhookdb::Replicator::WebhookRequest
- Defined in:
- lib/webhookdb/replicator/webhook_request.rb
Constant Summary collapse
- JSON_KEYS =
["body", "headers", "path", "method"].freeze
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#method ⇒ Object
Returns the value of attribute method.
-
#path ⇒ Object
Returns the value of attribute path.
-
#rack_request ⇒ Object
When a webhook is processed synchronously, this will be set to the Rack::Request.
Instance Method Summary collapse
Methods inherited from TypedStruct
#[], #_apply, #_defaults, #change, #initialize
Constructor Details
This class inherits a constructor from Webhookdb::TypedStruct
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
4 5 6 |
# File 'lib/webhookdb/replicator/webhook_request.rb', line 4 def body @body end |
#headers ⇒ Object
Returns the value of attribute headers.
4 5 6 |
# File 'lib/webhookdb/replicator/webhook_request.rb', line 4 def headers @headers end |
#method ⇒ Object
Returns the value of attribute method.
4 5 6 |
# File 'lib/webhookdb/replicator/webhook_request.rb', line 4 def method @method end |
#path ⇒ Object
Returns the value of attribute path.
4 5 6 |
# File 'lib/webhookdb/replicator/webhook_request.rb', line 4 def path @path end |
#rack_request ⇒ Object
When a webhook is processed synchronously, this will be set to the Rack::Request. Normal (async) webhook processing does not have this available.
8 9 10 |
# File 'lib/webhookdb/replicator/webhook_request.rb', line 8 def rack_request @rack_request end |
Instance Method Details
#as_json ⇒ Object
11 12 13 14 15 16 |
# File 'lib/webhookdb/replicator/webhook_request.rb', line 11 def as_json return JSON_KEYS.each_with_object({}) do |k, h| v = self.send(k) h[k] = v.as_json unless v.nil? end end |