module WeatherReport

Constants

VERSION

Public Class Methods

cities() click to toggle source

@return [Array] get city list

# File lib/weather-report.rb, line 21
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) click to toggle source

@return [Weather] get weather of the city

# File lib/weather-report.rb, line 16
def self.get(city_name)
  Weather.new(Weather.request_cityid(city_name))
end