lib/Zeta/plugins/weather.rb in zetabot-1.0.6 vs lib/Zeta/plugins/weather.rb in zetabot-1.0.7
- old
+ new
@@ -104,11 +104,11 @@
ac = JSON.parse(
open(URI.encode("https://maps.googleapis.com/maps/api/geocode/json?address=#{location}&key=#{Config.secrets[:google]}")).read,
object_class: OpenStruct
)
- puts ac.status
+ info(ac.status)
return nil if ac.results.nil?
if ac.status == "OVER_QUERY_LIMIT"
msg.reply("Google API - Over query Limit")
return nil
end
@@ -160,11 +160,12 @@
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"
+ info(ac.status)
+ if ac.status == "OVER_QUERY_LIMIT"
msg.reply("Google API - Over query Limit")
return nil
end
ac = ac.results[0]
@@ -198,19 +199,20 @@
return data
end
# DarkSky - https://darksky.net/dev
- def darksky_src(msg,location,stored=false)
+ def ds_src(msg,location,stored=false)
ac = JSON.parse(
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"
+ info(ac.status)
+ if ac.status == "OVER_QUERY_LIMIT"
msg.reply("Google API - Over query Limit")
return nil
end
ac = ac.results[0]
@@ -267,10 +269,11 @@
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"
+ info(ac.status)
+ if ac.status == "OVER_QUERY_LIMIT"
msg.reply("Google API - Over query Limit")
return nil
end
ac = ac.results[0]