Class: Philiprehberger::WebhookBuilder::Delivery
- Inherits:
-
Object
- Object
- Philiprehberger::WebhookBuilder::Delivery
- Defined in:
- lib/philiprehberger/webhook_builder/delivery.rb
Overview
Represents the result of a webhook delivery attempt.
Instance Attribute Summary collapse
-
#attempts ⇒ Integer
readonly
The number of delivery attempts made.
-
#duration ⇒ Float
readonly
The total duration in seconds across all attempts.
-
#error ⇒ String?
readonly
The error message if delivery failed.
-
#response_body ⇒ String?
readonly
The response body.
-
#response_code ⇒ Integer?
readonly
The HTTP response code.
-
#success ⇒ Boolean
readonly
Whether the delivery succeeded (2xx response).
Instance Method Summary collapse
-
#initialize(success:, response_code:, attempts:, duration:, response_body: nil, error: nil) ⇒ Delivery
constructor
A new instance of Delivery.
-
#success? ⇒ Boolean
Whether the delivery was successful.
Constructor Details
#initialize(success:, response_code:, attempts:, duration:, response_body: nil, error: nil) ⇒ Delivery
Returns a new instance of Delivery.
31 32 33 34 35 36 37 38 |
# File 'lib/philiprehberger/webhook_builder/delivery.rb', line 31 def initialize(success:, response_code:, attempts:, duration:, response_body: nil, error: nil) @success = success @response_code = response_code @attempts = attempts @duration = duration @response_body = response_body @error = error end |
Instance Attribute Details
#attempts ⇒ Integer (readonly)
Returns the number of delivery attempts made.
14 15 16 |
# File 'lib/philiprehberger/webhook_builder/delivery.rb', line 14 def attempts @attempts end |
#duration ⇒ Float (readonly)
Returns the total duration in seconds across all attempts.
17 18 19 |
# File 'lib/philiprehberger/webhook_builder/delivery.rb', line 17 def duration @duration end |
#error ⇒ String? (readonly)
Returns the error message if delivery failed.
23 24 25 |
# File 'lib/philiprehberger/webhook_builder/delivery.rb', line 23 def error @error end |
#response_body ⇒ String? (readonly)
Returns the response body.
20 21 22 |
# File 'lib/philiprehberger/webhook_builder/delivery.rb', line 20 def response_body @response_body end |
#response_code ⇒ Integer? (readonly)
Returns the HTTP response code.
11 12 13 |
# File 'lib/philiprehberger/webhook_builder/delivery.rb', line 11 def response_code @response_code end |
#success ⇒ Boolean (readonly)
Returns whether the delivery succeeded (2xx response).
8 9 10 |
# File 'lib/philiprehberger/webhook_builder/delivery.rb', line 8 def success @success end |
Instance Method Details
#success? ⇒ Boolean
Whether the delivery was successful.
43 44 45 |
# File 'lib/philiprehberger/webhook_builder/delivery.rb', line 43 def success? @success end |