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.



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
1915
1916
1917
1918
# File 'lib/FlightXML2REST.rb', line 1890

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.



1889
1890
1891
# File 'lib/FlightXML2REST.rb', line 1889

def metarExResult
  @metarExResult
end