Class: YaYahooWeather::Client

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

Constant Summary collapse

@@YAHOO_WEATHER_API =
"http://weather.yahooapis.com/forecastrss"

Instance Method Summary collapse

Instance Method Details

#get_weather_conditions_by_woeid(woeid) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/ya_yahoo_weather/client.rb', line 6

def get_weather_conditions_by_woeid(woeid) 
  begin 
    url = @@YAHOO_WEATHER_API + "?w=" + woeid.to_s + "&u=f"
    response = do_http_get(url)
    response_hash = Nori.parse(response)
    response_hash['rss']['channel']['item']['yweather:condition']
  rescue => e 
    raise RuntimeError.new("Failed to get weather.  woeid => #{woeid.inspect} url => #{url.inspect} e => #{e.inspect}")
  end 
end