Class: FlightInfoResults

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(flightInfoResult = nil) ⇒ FlightInfoResults

Returns a new instance of FlightInfoResults.



1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
# File 'lib/FlightXML2REST.rb', line 1035

def initialize(flightInfoResult = nil)
  begin
    rawFlightInfoResult = JSON.parse(flightInfoResult)
    flightInfoResult = rawFlightInfoResult['FlightInfoResult']
    @flightInfoResult = FlightInfoStruct.new([], flightInfoResult['next_offset'])
    flightInfoResult['flights'].each do |flight|
      @flightInfoResult.flights << FlightStruct.new(flight['actualarrivaltime'],
                                                    flight['actualdeparturetime'],
                                                    flight['aircrafttype'],
                                                    flight['destination'],
                                                    flight['destinationCity'],
                                                    flight['destinationName'],
                                                    flight['diverted'],
                                                    flight['estimatedarrivaltime'],
                                                    flight['filed_airspeed_kts'],
                                                    flight['filed_airspeed_mach'],
                                                    flight['filed_altitude'],
                                                    flight['filed_departuretime'],
                                                    flight['filed_ete'],
                                                    flight['filed_time'],
                                                    flight['ident'],
                                                    flight['origin'],
                                                    flight['originCity'],
                                                    flight['originName'],
                                                    flight['route']
                                                   )
    end
  rescue
      raise FlightAwareError.new(rawFlightInfoResult['error']).error
  end
end

Instance Attribute Details

#flightInfoResultObject

Returns the value of attribute flightInfoResult.



1034
1035
1036
# File 'lib/FlightXML2REST.rb', line 1034

def flightInfoResult
  @flightInfoResult
end