 #     This is the subdomain you access the Harvest service with, e.g.
 #     if you have the Harvest URL http://yourcompany.harvestapp.com
 #     you should set this to "yourcompany" (without the quotes).
-# 
+#
 # Author:
 #   Quintus @ Asquera
 #

        callback res.statusCode, JSON.parse(body)
      else
        callback res.statusCode, null

  # Issues /daily/add to the Harvest API to add a new timer
  # starting from now.

    catch error
      msg.reply "Failed to start timer: fatal error: #{error}"

  robot.respond /start harvest/i, (msg) ->
    unless user = check_user(robot, msg)
      return

    harvest = new HarvestService(user.harvest_account)

    try
      harvest.restart msg, (status, body) ->
        if 200 <= status <= 299
          if body.hours_for_previously_running_timer?
            msg.reply "Previously running timer stopped at #{body.hours_for_previously_running_timer}h."
          msg.reply "OK, I started tracking you on #{body.project}/#{body.task}."
        else
          msg.reply "Failed to start timer: request failed with status #{status}."
    catch error
      msg.reply "Failed to start timer: fatal error: #{error}"

  # Stops the timer running for a project/task combination,
  # if any. If no combination is given, stops the first
  # active timer available.
