 # Configuration
 #   HUBOT_DARK_SKY_API_KEY
 #   HUBOT_DARK_SKY_DEFAULT_LOCATION
+#   HUBOT_DARK_SKY_UNITS (optional - us, si, ca, or uk)
 #
 # Commands:
 #   hubot weather - Get the weather for HUBOT_DARK_SKY_DEFAULT_LOCATION


darkSkyMe = (msg, lat, lng, cb) ->
  url = "https://api.forecast.io/forecast/#{process.env.HUBOT_DARK_SKY_API_KEY}/#{lat},#{lng}/"
  msg.http(url)
    .get() (err, res, body) ->
      result = JSON.parse(body)

        cb "#{result.error}"
        return

      response = "Currently: #{result.currently.summary} (#{result.currently.temperature}°)"
      response += "\nNext hour: #{result.hourly.summary}"
      response += "\nToday: #{result.daily.summary}"
      cb response
