lib/ruboty/rainfall_jp.rb in ruboty-rainfall_jp-1.3.0 vs lib/ruboty/rainfall_jp.rb in ruboty-rainfall_jp-1.4.0

- old
+ new

@@ -38,21 +38,21 @@ end private def fetch_location_name_and_coodinated_geometry(query) - url = "http://geo.search.olp.yahooapis.jp/OpenLocalPlatform/V1/geoCoder?appid=#{YAHOO_JAPAN_APP_ID}&output=json&query=#{CGI.escape(query)}" - response = JSON.parse(open(url).read) + url = "https://map.yahooapis.jp/geocode/V1/geoCoder?appid=#{YAHOO_JAPAN_APP_ID}&output=json&query=#{CGI.escape(query)}" + response = JSON.parse(OpenURI.open_uri(url).read) features = response["Feature"] if features.nil? || features.first.nil? return nil end [features.first["Name"], features.first["Geometry"]["Coordinates"]] end def fetch_rainfall(geometry) - url = "http://weather.olp.yahooapis.jp/v1/place\?appid\=#{YAHOO_JAPAN_APP_ID}\&output=json&coordinates\=#{geometry}" - response = JSON.parse(open(url).read) + url = "https://map.yahooapis.jp/weather/V1/place?appid=#{YAHOO_JAPAN_APP_ID}&output=json&coordinates=#{geometry}" + response = JSON.parse(OpenURI.open_uri(url).read) features = response["Feature"] if features.nil? || features.first.nil? return nil end datapoints = features.first["Property"]["WeatherList"]["Weather"]