Class: AirlineInsightResults

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(airlineInsightResult = nil) ⇒ AirlineInsightResults

Returns a new instance of AirlineInsightResults.



277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
# File 'lib/FlightXML2REST.rb', line 277

def initialize(airlineInsightResult = nil)
  begin
    rawAirlineInsightResult = JSON.parse(airlineInsightResult)
    airlineInsightResult = rawAirlineInsightResult['AirlineInsightResult']
    @airlineInsightResult = ArrayOfAirlineInsightStruct.new([], airlineInsightResult['end_date'], airlineInsightResult['start_date'])
    airlineInsightResult['data'].each do |data|
      @airlineInsightResult.data << AirlineInsightStruct.new(data['carrier'],
                                                          data['destination'],
                                                          data['fare_max'],
                                                          data['fare_median'],
                                                          data['fare_min'],
                                                          data['flights_performed'],
                                                          data['flights_scheduled'],
                                                          data['layover'],
                                                          data['opcarrier'],
                                                          data['origin'],
                                                          data['percent'],
                                                          data['total_mail'],
                                                          data['total_passengers'],
                                                          data['total_payload'],
                                                          data['total_seats']
                                                         )
    end
  rescue
      raise FlightAwareError.new(rawInboundFlightInfoResult['error']).error
  end
end

Instance Attribute Details

#airlineInsightResultObject

Returns the value of attribute airlineInsightResult.



276
277
278
# File 'lib/FlightXML2REST.rb', line 276

def airlineInsightResult
  @airlineInsightResult
end