Class: DepartedResults

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(departedResult = nil) ⇒ DepartedResults

Returns a new instance of DepartedResults.



736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
# File 'lib/FlightXML2REST.rb', line 736

def initialize(departedResult = nil)
  begin
    rawDepartedResult = JSON.parse(departedResult)
    departedResult = rawDepartedResult['DepartedResult']
    @departedResult = DepartureStruct.new([], departedResult['next_offset'])
    departedResult['departures'].each do |departure|
      @departedResult.departures << DepartureFlightStruct.new(departure['actualarrivaltime'],
                                                              departure['actualdeparturetime'],
                                                              departure['aircrafttype'],
                                                              departure['destination'],
                                                              departure['destinationCity'],
                                                              departure['destinationName'],
                                                              departure['estimatedarrivaltime'],
                                                              departure['ident'],
                                                              departure['origin'],
                                                              departure['originCity'],
                                                              departure['originName']
                                                              )
    end
  rescue
      raise FlightAwareError.new(rawDepartedResult['error']).error
  end
end

Instance Attribute Details

#departedResultObject

Returns the value of attribute departedResult.



735
736
737
# File 'lib/FlightXML2REST.rb', line 735

def departedResult
  @departedResult
end