Class: MetarExResults

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(metarExResult = nil) ⇒ MetarExResults

Returns a new instance of MetarExResults.



1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
# File 'lib/FlightXML2REST.rb', line 1886

def initialize(metarExResult = nil)
  begin
    rawMetarExResult = JSON.parse(metarExResult)
    metarExResult = rawMetarExResult['MetarExResult']
    @metarExResult = ArrayOfMetarStruct.new([], metarExResult['next_offset'])
    metarExResult['metar'].each do |metar|
      @metarExResult.metar << MetarStruct.new(metar['airport'],
                                              metar['cloud_altitude'],
                                              metar['cloud_friendly'],
                                              metar['cloud_type'],
                                              metar['conditions'],
                                              metar['pressure'],
                                              metar['raw_data'],
                                              metar['temp_air'],
                                              metar['temp_dewpoint'],
                                              metar['temp_relhum'],
                                              metar['time'],
                                              metar['visibility'],
                                              metar['wind_direction'],
                                              metar['wind_friendly'],
                                              metar['wind_speed'],
                                              metar['wind_speed_gust']
                                             )

    end
  rescue
      raise FlightAwareError.new(rawMetarExResult['error']).error
  end
end

Instance Attribute Details

#metarExResultObject

Returns the value of attribute metarExResult.



1885
1886
1887
# File 'lib/FlightXML2REST.rb', line 1885

def metarExResult
  @metarExResult
end