Class: ArrivedResults

Inherits:
Object
  • Object
show all
Defined in:
lib/FlightXML2REST.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(arrivedResult = nil) ⇒ ArrivedResults

Returns a new instance of ArrivedResults.



479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
# File 'lib/FlightXML2REST.rb', line 479

def initialize(arrivedResult = nil)
  begin
    rawArrivedResult = JSON.parse(arrivedResult)
    arrivedResult = rawArrivedResult['ArrivedResult']
    @arrivedResult = ArrivalStruct.new([], arrivedResult['next_offset'])
    arrivedResult['arrivals'].each do |arrival|
      @arrivedResult.arrivals << ArrivalFlightStruct.new(arrival['actualarrivaltime'],
                                                         arrival['actualdeparturetime'],
                                                         arrival['aircrafttype'],
                                                         arrival['destination'],
                                                         arrival['destinationCity'],
                                                         arrival['destinationName'],
                                                         arrival['ident'],
                                                         arrival['origin'],
                                                         arrival['originCity'],
                                                         arrival['originName']
                                                         )
    end
  rescue
      raise FlightAwareError.new(rawArrivedResult['error']).error
  end
end

Instance Attribute Details

#arrivedResultObject

Returns the value of attribute arrivedResult.



478
479
480
# File 'lib/FlightXML2REST.rb', line 478

def arrivedResult
  @arrivedResult
end