Sha256: 7060314ec5ff6cfaf8dc56736b999ba90a5d56d25aadc83b76eba5333beee7d3
Contents?: true
Size: 810 Bytes
Versions: 1
Compression:
Stored size: 810 Bytes
Contents
# -*- coding: utf-8 -*- require 'date' require 'json' require 'open-uri' require 'nokogiri' require 'weather-report/weather' require 'weather-report/day' require 'weather-report/version' module WeatherReport class Error < StandardError; end class ArgumentError < Error; end class NoCityError < Error; end class NoForecastError < Error; end # @return [Weather] get weather of the city def self.get(city_name) Weather.new(Weather.request_cityid(city_name)) end # @return [Array] get city list 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 end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
weather-report-0.4.2 | lib/weather-report.rb |