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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c875ad79a6273a3ae783c2313fed32da33d4944d
4
- data.tar.gz: b1cf98f6afb7f6fa2cfad698b49734f57b7b6dd7
3
+ metadata.gz: aa16ff0ec30a13f5f0a926faf7524f184a383721
4
+ data.tar.gz: a0180b74e86e87db051b2d754a8a46c379ac703f
5
5
  SHA512:
6
- metadata.gz: d9bcdae7626f0a63ec77f6558d3e338043ea5152bcfb58e5a6ac86bd44efb05e8cd71aa825621560d5f1ba95c7605bb1c160b0ba79c21cb5e7e85a5616f3e323
7
- data.tar.gz: fd2bf8c73508327ed756e4da2f82af18e8793de8237ecdbc42e3f7ac92301b1a449c547950100f6629153ed5ee49eff991da3a6e7306bd9a95bca34e7b9ec9e9
6
+ metadata.gz: 64cd6ca1ccbd073e13ce7794a0a7094ac18cf6382d0d048161589dbf6e905beeb44ca30279545e2e151a7af929bbb6323e7aba8d449a085eedac0a4caec702d7
7
+ data.tar.gz: 5da091b6efa977c7879f9ad38c1409ecc91979c349a81d9c3394ff9d873b4bcc7cd4e883ab661e343e138f318ad5aa6bc5254558bdadb0617965686a5c6ff797
data/.gitignore CHANGED
@@ -3,6 +3,7 @@
3
3
  .bundle
4
4
  .config
5
5
  .yardoc
6
+ .ruby-version
6
7
  Gemfile.lock
7
8
  InstalledFiles
8
9
  _yardoc
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,3 +1,3 @@
1
1
  module WeatherReport
2
- VERSION = "0.3.5"
2
+ VERSION = "0.3.6"
3
3
  end
@@ -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
 
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: weather-report
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - zakuni