Class: WeatherUnderground::Base

Inherits:
Object
  • Object
show all
Includes:
Utils
Defined in:
lib/weather-underground/base.rb

Overview

This is an data retriever for the weather underground personal weather station service, as found at wunderground.com.

It is build from the documentation provided at wiki.wunderground.com/index.php/API_-_XML

Instance Method Summary collapse

Constructor Details

#initializeBase

Returns a new instance of Base.



15
16
# File 'lib/weather-underground/base.rb', line 15

def initialize
end

Instance Method Details

#Alerts(loc) ⇒ Object

Return any active weather alerts for loc

loc can be:

  • zipcode (US or Canadian)

  • city state; city, state

  • city

  • state

  • country

  • airport code (3-letter or 4-letter)

  • lat,lon



86
87
88
# File 'lib/weather-underground/base.rb', line 86

def Alerts( loc )
    AlertsXML( loc )
end

#CurrentObservations(loc) ⇒ Object

Return the current observed weather data from location for loc

loc can be:

  • zipcode (US or Canadian)

  • city state; city, state

  • city

  • state

  • country

  • airport code (3-letter or 4-letter)

  • lat,lon



28
29
30
# File 'lib/weather-underground/base.rb', line 28

def CurrentObservations( loc )
    WXCurrentObXML( loc ) 
end

#GeoLookup(loc) ⇒ Object

– TODO: Implement GeoLookup ++



72
73
74
# File 'lib/weather-underground/base.rb', line 72

def GeoLookup( loc )

end

#SimpleForecast(loc) ⇒ Object

Return the forecast weather data from location for loc

A SimpleForecast contains more detailed data for each day than a TextForcase of the same location.

loc can be:

  • zipcode (US or Canadian)

  • city state; city, state

  • city

  • state

  • country

  • airport code (3-letter or 4-letter)

  • lat,lon



45
46
47
48
# File 'lib/weather-underground/base.rb', line 45

def SimpleForecast( loc )
    f = ForecastXML( loc )
    f.simple_forecast
end

#TextForecast(loc) ⇒ Object

Return the forecast weather data from location for loc

A TextForecast contains basic data in sentence form for the location queried. If you need more detailed data use a SimpleForecast

loc can be:

  • zipcode (US or Canadian)

  • city state; city, state

  • city

  • state

  • country

  • airport code (3-letter or 4-letter)

  • lat,lon



64
65
66
67
# File 'lib/weather-underground/base.rb', line 64

def TextForecast( loc )
    f = ForecastXML( loc )
    f.text_forecast
end