lib/weather-report/weather.rb in weather-report-0.3.3 vs lib/weather-report/weather.rb in weather-report-0.3.4
- old
+ new
@@ -11,9 +11,12 @@
# @return [String] the id of given city
def self.request_cityid(city_name)
proxy = Weather.parse_proxy(ENV["http_proxy"])
doc = Nokogiri::XML(open("http://weather.livedoor.com/forecast/rss/primary_area.xml", :proxy_http_basic_authentication => [proxy.server, proxy.user, proxy.pass]))
doc.search("//city[@title='#{city_name}']").attr("id").value
+ rescue NoMethodError
+ puts "It seems like city #{city_name} does not exist.\nPlease look at http://weather.livedoor.com/forecast/rss/primary_area.xml for city list."
+ exit 1
rescue => e
raise WeatherReportError
end
def self.parse_proxy(proxy)