ruboty-rainfall_jp 1.2.0 → 1.3.0

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: a0302f106a38688378d8042c7170d0ed98ea6f4a
4
- data.tar.gz: 2c729e554cf94bace035ab6153ea4b3ea5e68c44
3
+ metadata.gz: a8c100261aa4226111cf2b240f56e1a18d88611c
4
+ data.tar.gz: 31c9f112f0752823f753497645772186448d8696
5
5
  SHA512:
6
- metadata.gz: 427a07b114df67b0a1ba09ec0799419cbdec7e1a3a8f724f09380d5291322def638f95be1858ecabc1104e55af1254a4f01196684dfc8ae646b12677fe587684
7
- data.tar.gz: 60acbfd581d67f7432c075859a79771d93287bd3d92452f4daaeb41aee59c222a3f7584a4758a10e18eeadaf8d75f759d7d8a9ed080ec4ed561a948f0f53cfbe
6
+ metadata.gz: 691b08476e8ae4e09a500bbf4e26981630df863c9b954fb45c5838c1be9ad20577fd50739fcf8a3ae1735c27bf7e64f887076ad3659d9f50a0eb2fef8240ea57
7
+ data.tar.gz: 3da18a0c0e9870d95da481c875d81845a1d9776b508ed9afd8d850f190a7e6eab203b92ec81f08eb64f19a6fbef6a344643f6a55b941bda2857b44971f706863
@@ -1,5 +1,5 @@
1
1
  module Ruboty
2
2
  module RainfallJp
3
- VERSION = "1.2.0"
3
+ VERSION = "1.3.0"
4
4
  end
5
5
  end
@@ -20,7 +20,7 @@ module Ruboty
20
20
  end
21
21
 
22
22
  query = message.match_data['query'] || DEFAULT_LOCATION
23
- geometry = fetch_coodinated_geometry(query)
23
+ name, geometry = fetch_location_name_and_coodinated_geometry(query)
24
24
 
25
25
  if geometry.nil?
26
26
  message.reply('ಠ_ಠ')
@@ -29,7 +29,7 @@ module Ruboty
29
29
  end
30
30
 
31
31
  result = fetch_rainfall(geometry)
32
- message.reply("Rainfall forecast: #{query} (l/l: #{geometry})")
32
+ message.reply("Rainfall forecast: #{name} (l/l: #{geometry})")
33
33
  message.reply(result)
34
34
  rescue Exception => e
35
35
  message.reply('ಠ_ಠ')
@@ -39,14 +39,14 @@ module Ruboty
39
39
 
40
40
  private
41
41
 
42
- def fetch_coodinated_geometry(query)
42
+ def fetch_location_name_and_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
45
  features = response["Feature"]
46
46
  if features.nil? || features.first.nil?
47
47
  return nil
48
48
  end
49
- features.first["Geometry"]["Coordinates"]
49
+ [features.first["Name"], features.first["Geometry"]["Coordinates"]]
50
50
  end
51
51
 
52
52
  def fetch_rainfall(geometry)
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.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shimpei Makimoto