I receive from yahoo weather an Hash like this one,
response
=> {“xmlns:geo”=>“http://www.w3.org/2003/01/geo/wgs84_pos#”,
“xmlns:yweather”=>“http://xml.weather.yahoo.com/ns/rss/1.0”,
“version”=>“2.0”, “channel”=>[{“title”=>[“Yahoo! Weather - Error”],
“description”=>[“Yahoo! Weather Error”], “item”=>[{“title”=>[“City not
found”], “description”=>["\n Sorry, your location ‘dfghh’ was not
found. Please try again.\n "]}]}]}
I need to test the response for an error on channel title, I wrote :
(response.fetch(“channel”)[0]).fetch(“title”)[0]
=> “Yahoo! Weather - Error”
to get the string, but is there any simpler way to do it ? I’m not yet
very easy with Hash…
thanks