Class: EnrouteResults

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(enrouteResult = nil) ⇒ EnrouteResults

Returns a new instance of EnrouteResults.



825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
# File 'lib/FlightXML2REST.rb', line 825

def initialize(enrouteResult = nil)
  begin
    rawEnrouteResult = JSON.parse(enrouteResult)
    enrouteResult = rawEnrouteResult['EnrouteResult']
    @enrouteResult = EnrouteStruct.new([], enrouteResult['next_offset'])
    enrouteResult['enroute'].each do |enroute|
      @enrouteResult.enroute << EnrouteFlightStruct.new(enroute['actualdeparturetime'],
                                                  enroute['aircrafttype'],
                                                  enroute['destination'],
                                                  enroute['destinationCity'],
                                                  enroute['destinationName'],
                                                  enroute['estimatedarrivaltime'],
                                                  enroute['filed_departuretime'],
                                                  enroute['ident'],
                                                  enroute['origin'],
                                                  enroute['originCity'],
                                                  enroute['originName']
                                                  )
    end
  rescue
      raise FlightAwareError.new(rawEnrouteResult['error']).error
  end
end

Instance Attribute Details

#enrouteResultObject

Returns the value of attribute enrouteResult.



824
825
826
# File 'lib/FlightXML2REST.rb', line 824

def enrouteResult
  @enrouteResult
end