ruboty-rainfall_jp 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ruboty/rainfall_jp/version.rb +1 -1
- data/lib/ruboty/rainfall_jp.rb +6 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4113aa1bc338af3b2adcf6fa8038db59e2c6294e
|
4
|
+
data.tar.gz: 0b5dff11fa4a5bd38f4509c4aa0216df6ddcd44b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 567733c9b4fc7ed82a84026eeb64eec23005de0bbfac681ef54799707207c42677383bee7e6ab1204eab6f89abab41390913ef82e748f86dfffe93bb09405e7a
|
7
|
+
data.tar.gz: 9776e5debd06be636e4ebada2ce6317502f2f2d09c373bff3fb3954d1abd70f2eb231930592968f7cceda4298c0a1e0a15e198431b142e45f875d2f845a2c84b
|
data/lib/ruboty/rainfall_jp.rb
CHANGED
@@ -42,21 +42,21 @@ module Ruboty
|
|
42
42
|
def fetch_coodinated_geometry(query)
|
43
43
|
url = "http://geo.search.olp.yahooapis.jp/OpenLocalPlatform/V1/geoCoder?appid=#{YAHOO_JAPAN_APP_ID}&output=json&query=#{CGI.escape(query)}"
|
44
44
|
response = JSON.parse(open(url).read)
|
45
|
-
|
46
|
-
if
|
45
|
+
features = response["Feature"]
|
46
|
+
if features.nil? || features.first.nil?
|
47
47
|
return nil
|
48
48
|
end
|
49
|
-
|
49
|
+
features.first["Geometry"]["Coordinates"]
|
50
50
|
end
|
51
51
|
|
52
52
|
def fetch_rainfall(geometry)
|
53
53
|
url = "http://weather.olp.yahooapis.jp/v1/place\?appid\=#{YAHOO_JAPAN_APP_ID}\&output=json&coordinates\=#{geometry}"
|
54
54
|
response = JSON.parse(open(url).read)
|
55
|
-
|
56
|
-
if
|
55
|
+
features = response["Feature"]
|
56
|
+
if features.nil? || features.first.nil?
|
57
57
|
return nil
|
58
58
|
end
|
59
|
-
datapoints =
|
59
|
+
datapoints = features.first["Property"]["WeatherList"]["Weather"]
|
60
60
|
result = StringIO.new
|
61
61
|
datapoints.each do |data|
|
62
62
|
result.puts("#{Time.parse(data["Date"]).strftime("%m-%d %H:%M")} #{data["Rainfall"]} mm/h")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruboty-rainfall_jp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shimpei Makimoto
|
@@ -89,7 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
89
89
|
version: '0'
|
90
90
|
requirements: []
|
91
91
|
rubyforge_project:
|
92
|
-
rubygems_version: 2.
|
92
|
+
rubygems_version: 2.6.6
|
93
93
|
signing_key:
|
94
94
|
specification_version: 4
|
95
95
|
summary: A Ruboty plugin to check rainfall forecast in Japan
|