Module: Weather
- Defined in:
- lib/weather-api.rb,
lib/weather-api/wind.rb,
lib/weather-api/image.rb,
lib/weather-api/units.rb,
lib/weather-api/utils.rb,
lib/weather-api/version.rb,
lib/weather-api/forecast.rb,
lib/weather-api/location.rb,
lib/weather-api/response.rb,
lib/weather-api/astronomy.rb,
lib/weather-api/condition.rb,
lib/weather-api/atmosphere.rb
Defined Under Namespace
Classes: Astronomy, Atmosphere, Condition, Forecast, Image, Location, Response, Units, Utils, Wind
Constant Summary collapse
- ROOT =
Yahoo! Weather info endpoint
"http://query.yahooapis.com/v1/public/yql"- VERSION =
"1.1.1"
Class Method Summary collapse
-
.lookup(woeid, units = 'f') ⇒ Object
Public: Looks up current weather information using WOEID.
Class Method Details
.lookup(woeid, units = 'f') ⇒ Object
Public: Looks up current weather information using WOEID
woeid - Int - Where On Earth IDentifier – unique ID for
location to get weather data for. To find
a WOEID, refer to Yahoo!'s documentation
at http://developer.yahoo.com/weather/
units - String - whether to retrieve data in Farenheit
or Celsius. Defaults to Farenheit
Returns a Weather::Response object containing forecast
33 34 35 36 37 38 39 40 |
# File 'lib/weather-api.rb', line 33 def lookup woeid, units = 'f' url = ROOT url += "?q=select%20*%20from%20weather.forecast%20" url += "where%20woeid%3D#{woeid}%20and%20u%3D'#{units}'&format=json" doc = get_response url Response.new woeid, url, doc end |