15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/ldclient-openfeature/impl/details_converter.rb', line 15
def to_resolution_details(detail)
value = detail.value
is_default = detail.variation_index.nil?
variation_index = detail.variation_index
reason = detail.reason
reason_kind = reason.kind
openfeature_reason = kind_to_reason(reason_kind)
openfeature_error_code = nil
if reason_kind == LaunchDarkly::EvaluationReason::ERROR
openfeature_error_code = error_kind_to_code(reason.error_kind)
end
openfeature_variant = nil
openfeature_variant = variation_index.to_s unless is_default
::OpenFeature::SDK::Provider::ResolutionDetails.new(
value: value,
error_code: openfeature_error_code,
error_message: nil,
reason: openfeature_reason,
variant: openfeature_variant
)
end
|