Class: Omnizip::Models::ETAResult

Inherits:
Lutaml::Model::Serializable
  • Object
show all
Defined in:
lib/omnizip/models/eta_result.rb

Overview

Model representing an ETA (Estimated Time to Arrival) calculation result.

This class encapsulates the result of ETA calculations, including seconds remaining, formatted time string, and confidence interval.

Serialized via lutaml-model — no hand-rolled to_h / to_json.

Instance Method Summary collapse

Instance Method Details

#confidence_intervalArray<Float>

Get confidence interval as array

Returns:

  • (Array<Float>)

    [lower, upper] bounds in seconds



28
29
30
# File 'lib/omnizip/models/eta_result.rb', line 28

def confidence_interval
  [confidence_lower, confidence_upper]
end

#reliable?Boolean

Check if ETA is reliable (confidence interval is reasonable)

Returns:

  • (Boolean)

    true if confidence interval is within 50% of estimate



35
36
37
38
39
40
41
42
# File 'lib/omnizip/models/eta_result.rb', line 35

def reliable?
  unless seconds_remaining && confidence_lower && confidence_upper
    return false
  end

  range = confidence_upper - confidence_lower
  range < (seconds_remaining * 0.5)
end