Class: ScheduledResults

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scheduledResult = nil) ⇒ ScheduledResults

Returns a new instance of ScheduledResults.



2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
# File 'lib/FlightXML2REST.rb', line 2169

def initialize(scheduledResult = nil)
  begin
    rawScheduledResult = JSON.parse(scheduledresult)
    scheduledResult = rawScheduledResult['ScheduledResult']
    @scheduledResult = ScheduledStruct.new(scheduledResult['next_offset'], [])
    scheduledResult['scheduled'].each do |scheduled|
      @scheduledResult.scheduled << ScheduledFlightStruct.new(scheduled['aircrafttype'],
                                                              scheduled['destination'],
                                                              scheduled['destinationCity'],
                                                              scheduled['destinationName'],
                                                              scheduled['estimatedarrivaltime'],
                                                              scheduled['filed_departuretime'],
                                                              scheduled['ident'],
                                                              scheduled['origin'],
                                                              scheduled['originCity'],
                                                              scheduled['originName']
                                                             )
    end
  rescue
      raise FlightAwareError.new(rawScheduledResult['error']).error
  end
end

Instance Attribute Details

#scheduledResultObject

Returns the value of attribute scheduledResult.



2168
2169
2170
# File 'lib/FlightXML2REST.rb', line 2168

def scheduledResult
  @scheduledResult
end