weather-report 0.3.5 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/bin/weather-report +7 -0
- data/lib/weather-report/version.rb +1 -1
- data/lib/weather-report/weather.rb +8 -0
- data/test/test_weather-report.rb +7 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa16ff0ec30a13f5f0a926faf7524f184a383721
|
4
|
+
data.tar.gz: a0180b74e86e87db051b2d754a8a46c379ac703f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64cd6ca1ccbd073e13ce7794a0a7094ac18cf6382d0d048161589dbf6e905beeb44ca30279545e2e151a7af929bbb6323e7aba8d449a085eedac0a4caec702d7
|
7
|
+
data.tar.gz: 5da091b6efa977c7879f9ad38c1409ecc91979c349a81d9c3394ff9d873b4bcc7cd4e883ab661e343e138f318ad5aa6bc5254558bdadb0617965686a5c6ff797
|
data/.gitignore
CHANGED
data/bin/weather-report
CHANGED
@@ -14,6 +14,13 @@ opt_parser = OptionParser.new do |opts|
|
|
14
14
|
opts.separator ""
|
15
15
|
opts.separator "Common options:"
|
16
16
|
|
17
|
+
opts.on_tail("-list", "Show city list") do
|
18
|
+
WeatherReport.cities.each do |city|
|
19
|
+
puts city
|
20
|
+
end
|
21
|
+
exit
|
22
|
+
end
|
23
|
+
|
17
24
|
opts.on_tail("-h", "--help", "Show this message") do
|
18
25
|
puts opts
|
19
26
|
exit
|
@@ -1,6 +1,14 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
|
3
3
|
module WeatherReport
|
4
|
+
def self.cities
|
5
|
+
proxy = Weather.parse_proxy(ENV["http_proxy"])
|
6
|
+
doc = Nokogiri::XML(open("http://weather.livedoor.com/forecast/rss/primary_area.xml", :proxy_http_basic_authentication => [proxy.server, proxy.user, proxy.pass]))
|
7
|
+
doc.xpath("//city").map{|i|
|
8
|
+
i["title"]
|
9
|
+
}
|
10
|
+
end
|
11
|
+
|
4
12
|
class Weather
|
5
13
|
attr_reader :today, :tomorrow, :day_after_tomorrow
|
6
14
|
|
data/test/test_weather-report.rb
CHANGED
@@ -8,4 +8,11 @@ class TestWeatherReport < MiniTest::Unit::TestCase
|
|
8
8
|
assert_respond_to WeatherReport, :get
|
9
9
|
assert_instance_of WeatherReport::Weather, WeatherReport.get("横浜")
|
10
10
|
end
|
11
|
+
|
12
|
+
def test_cities
|
13
|
+
cities = WeatherReport.cities
|
14
|
+
assert_instance_of Array, cities
|
15
|
+
assert cities.include? "東京"
|
16
|
+
assert cities.include? "横浜"
|
17
|
+
end
|
11
18
|
end
|