Class: Tracebook::Result
- Inherits:
-
Object
- Object
- Tracebook::Result
- Defined in:
- lib/tracebook/result.rb
Overview
Result object returned by record!.
Contains either the persisted interaction (when sync) or success/error information.
Instance Attribute Summary collapse
-
#error ⇒ Exception?
readonly
The error that occurred during recording.
-
#idempotency_key ⇒ String?
readonly
Idempotency key for deduplication.
-
#interaction ⇒ TraceBook::Interaction?
readonly
The persisted interaction (sync mode only).
Instance Method Summary collapse
-
#initialize(interaction: nil, error: nil, idempotency_key: nil) ⇒ Result
constructor
Creates a new Result.
-
#success? ⇒ Boolean
Returns true if recording succeeded (no error).
Constructor Details
#initialize(interaction: nil, error: nil, idempotency_key: nil) ⇒ Result
Creates a new Result.
38 39 40 41 42 |
# File 'lib/tracebook/result.rb', line 38 def initialize(interaction: nil, error: nil, idempotency_key: nil) @interaction = interaction @error = error @idempotency_key = idempotency_key end |
Instance Attribute Details
#error ⇒ Exception? (readonly)
Returns The error that occurred during recording.
28 29 30 |
# File 'lib/tracebook/result.rb', line 28 def error @error end |
#idempotency_key ⇒ String? (readonly)
Returns Idempotency key for deduplication.
31 32 33 |
# File 'lib/tracebook/result.rb', line 31 def idempotency_key @idempotency_key end |
#interaction ⇒ TraceBook::Interaction? (readonly)
Returns The persisted interaction (sync mode only).
25 26 27 |
# File 'lib/tracebook/result.rb', line 25 def interaction @interaction end |
Instance Method Details
#success? ⇒ Boolean
Returns true if recording succeeded (no error).
47 48 49 |
# File 'lib/tracebook/result.rb', line 47 def success? error.nil? end |