Class: SearchApi::GoogleFlightsResult

Inherits:
GoogleFlightsResultSchema
  • Object
show all
Extended by:
Forwardable
Includes:
Enumerable
Defined in:
lib/searchapi/google_flights_result.rb

Instance Method Summary collapse

Instance Method Details

#all_flightsObject



262
263
264
# File 'lib/searchapi/google_flights_result.rb', line 262

def all_flights
  ( best_flights || [] ) + ( other_flights || [] )
end

#cheapestObject



266
267
268
# File 'lib/searchapi/google_flights_result.rb', line 266

def cheapest
  all_flights.min_by { | f | f.price || Float::INFINITY }
end

#fastestObject



270
271
272
# File 'lib/searchapi/google_flights_result.rb', line 270

def fastest
  all_flights.min_by { | f | f.total_duration || Float::INFINITY }
end

#success?Boolean

Returns:

  • (Boolean)


258
259
260
# File 'lib/searchapi/google_flights_result.rb', line 258

def success?
  self.error.nil?
end