Class: FlightInfoExResults

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(flightInfoExResult = nil) ⇒ FlightInfoExResults

Returns a new instance of FlightInfoExResults.



1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
# File 'lib/FlightXML2REST.rb', line 1155

def initialize(flightInfoExResult = nil)
  begin
    rawFlightInfoResult = JSON.parse(flightInfoExResult)
    flightInfoExResult = rawFlightInfoResult['FlightInfoExResult']
    @flightInfoExResult = FlightInfoExStruct.new([], flightInfoExResult['next_offset'])
    flightInfoExResult['flights'].each do |flight|
      @flightInfoExResult.flights << FlightExStruct.new(flight['actualarrivaltime'],
                                                    flight['actualdeparturetime'],
                                                    flight['aircrafttype'],
                                                    flight['destination'],
                                                    flight['destinationCity'],
                                                    flight['destinationName'],
                                                    flight['diverted'],
                                                    flight['estimatedarrivaltime'],
                                                    flight['faFlightID'],
                                                    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

#flightInfoExResultObject

Returns the value of attribute flightInfoExResult.



1154
1155
1156
# File 'lib/FlightXML2REST.rb', line 1154

def flightInfoExResult
  @flightInfoExResult
end