Module: WeatherReport
- Defined in:
- lib/weather-report.rb,
lib/weather-report/day.rb,
lib/weather-report/version.rb,
lib/weather-report/weather.rb
Defined Under Namespace
Classes: ArgumentError, Day, Error, NoCityError, NoForecastError, Weather
Constant Summary collapse
- VERSION =
'0.4.2'.freeze
Class Method Summary collapse
-
.cities ⇒ Array
Get city list.
-
.get(city_name) ⇒ Weather
Get weather of the city.
Class Method Details
.cities ⇒ Array
Returns get city list.
22 23 24 25 26 27 28 |
# File 'lib/weather-report.rb', line 22 def self.cities proxy = Weather.parse_proxy(ENV["http_proxy"]) doc = Nokogiri::XML(URI.open("https://weather.tsukumijima.net/primary_area.xml", :proxy_http_basic_authentication => [proxy.server, proxy.user, proxy.pass])) doc.xpath("//city").map{|i| i["title"] } end |
.get(city_name) ⇒ Weather
Returns get weather of the city.
17 18 19 |
# File 'lib/weather-report.rb', line 17 def self.get(city_name) Weather.new(Weather.request_cityid(city_name)) end |