Class: LaunchDarkly::Interfaces::DataSystem::FetchResult
- Inherits:
-
Object
- Object
- LaunchDarkly::Interfaces::DataSystem::FetchResult
- Defined in:
- lib/ldclient-rb/interfaces/data_system.rb
Overview
FetchResult pairs the result of an Initializer#fetch call with the server-directed FDv1 Fallback Directive signal.
When the LaunchDarkly server returns the ‘X-LD-FD-Fallback: true` response header on an initializer response, the SDK must apply any accompanying payload and then switch to the FDv1 Fallback Synchronizer. Surfacing this signal alongside the Result ensures callers cannot silently drop it.
Instance Attribute Summary collapse
-
#fallback_to_fdv1 ⇒ Boolean
readonly
Whether the server has instructed the SDK to fall back to the FDv1 protocol.
-
#result ⇒ LaunchDarkly::Result
readonly
A Result containing either a Basis or an error.
Instance Method Summary collapse
-
#error ⇒ String?
An error description, or nil on success.
-
#exception ⇒ Exception?
An optional exception describing the failure.
-
#initialize(result:, fallback_to_fdv1: false) ⇒ FetchResult
constructor
A new instance of FetchResult.
-
#success? ⇒ Boolean
True when the underlying Result was successful.
-
#value ⇒ Object?
The Basis returned from a successful fetch, or nil.
Constructor Details
#initialize(result:, fallback_to_fdv1: false) ⇒ FetchResult
Returns a new instance of FetchResult.
567 568 569 570 |
# File 'lib/ldclient-rb/interfaces/data_system.rb', line 567 def initialize(result:, fallback_to_fdv1: false) @result = result @fallback_to_fdv1 = fallback_to_fdv1 end |
Instance Attribute Details
#fallback_to_fdv1 ⇒ Boolean (readonly)
Returns Whether the server has instructed the SDK to fall back to the FDv1 protocol.
561 562 563 |
# File 'lib/ldclient-rb/interfaces/data_system.rb', line 561 def fallback_to_fdv1 @fallback_to_fdv1 end |
#result ⇒ LaunchDarkly::Result (readonly)
Returns A Result containing either a Basis or an error.
558 559 560 |
# File 'lib/ldclient-rb/interfaces/data_system.rb', line 558 def result @result end |
Instance Method Details
#error ⇒ String?
Returns An error description, or nil on success.
583 584 585 |
# File 'lib/ldclient-rb/interfaces/data_system.rb', line 583 def error @result.error end |
#exception ⇒ Exception?
Returns An optional exception describing the failure.
588 589 590 |
# File 'lib/ldclient-rb/interfaces/data_system.rb', line 588 def exception @result.exception end |
#success? ⇒ Boolean
Returns true when the underlying Result was successful.
573 574 575 |
# File 'lib/ldclient-rb/interfaces/data_system.rb', line 573 def success? @result.success? end |
#value ⇒ Object?
Returns The Basis returned from a successful fetch, or nil.
578 579 580 |
# File 'lib/ldclient-rb/interfaces/data_system.rb', line 578 def value @result.value end |