lib/Zeta/plugins/weather.rb in zetabot-1.0.5 vs lib/Zeta/plugins/weather.rb in zetabot-1.0.6
- old
+ new
@@ -100,16 +100,18 @@
if stored
lat, lon = @store[msg.user.to_s].split(',')
else
ac = JSON.parse(
- open(URI.encode("http://maps.googleapis.com/maps/api/geocode/json?address=#{location}&key=#{Config.secrets[:google]}")).read,
+ open(URI.encode("https://maps.googleapis.com/maps/api/geocode/json?address=#{location}&key=#{Config.secrets[:google]}")).read,
object_class: OpenStruct
)
+
+ puts ac.status
return nil if ac.results.nil?
- if ac.status = "OVER_QUERY_LIMIT"
- return msg.reply("Google API - Over query Limit")
+ if ac.status == "OVER_QUERY_LIMIT"
+ msg.reply("Google API - Over query Limit")
return nil
end
ac = ac.results[0]
lat = ac.geometry.location.lat
@@ -153,17 +155,17 @@
if stored
lat, lon = @store[msg.user.to_s].split(',')
else
ac = JSON.parse(
- open(URI.encode("http://maps.googleapis.com/maps/api/geocode/json?address=#{location}&key=#{Config.secrets[:google]}")).read,
+ open(URI.encode("https://maps.googleapis.com/maps/api/geocode/json?address=#{location}&key=#{Config.secrets[:google]}")).read,
object_class: OpenStruct
)
return nil if ac.results.nil? ## Unable to locate
if ac.status = "OVER_QUERY_LIMIT"
- return msg.reply("Google API - Over query Limit")
+ msg.reply("Google API - Over query Limit")
return nil
end
ac = ac.results[0]
lat = ac.geometry.location.lat
@@ -199,17 +201,17 @@
# DarkSky - https://darksky.net/dev
def darksky_src(msg,location,stored=false)
ac = JSON.parse(
- open(URI.encode("http://maps.googleapis.com/maps/api/geocode/json?address=#{location}&key=#{Config.secrets[:google]}")).read,
+ open(URI.encode("https://maps.googleapis.com/maps/api/geocode/json?address=#{location}&key=#{Config.secrets[:google]}")).read,
object_class: OpenStruct
)
return nil if ac.results.nil? ## Unable to locate
if ac.status = "OVER_QUERY_LIMIT"
- return msg.reply("Google API - Over query Limit")
+ msg.reply("Google API - Over query Limit")
return nil
end
ac = ac.results[0]
if stored
@@ -260,16 +262,16 @@
if stored
lat, lon = @store[msg.user.to_s].split(',')
else
ac = JSON.parse(
- open(URI.encode("http://maps.googleapis.com/maps/api/geocode/json?address=#{location}&key=#{Config.secrets[:google]}")).read,
+ open(URI.encode("https://maps.googleapis.com/maps/api/geocode/json?address=#{location}&key=#{Config.secrets[:google]}")).read,
object_class: OpenStruct
)
return nil if ac.results.nil? ## Unable to locate
if ac.status = "OVER_QUERY_LIMIT"
- return msg.reply("Google API - Over query Limit")
+ msg.reply("Google API - Over query Limit")
return nil
end
ac = ac.results[0]
lat = ac.geometry.location.lat