class GetToWork::Command::Stop

Public Instance Methods

run() click to toggle source
# File lib/get_to_work/command/stop.rb, line 4
def run
  if last_timer
    shell.say "\nStopping your current timer...\n\n", :green
    result = harvest_service.stop_timer(last_timer)

    if result["id"]
      config_file.data.delete("last_timer")
      config_file.save
    end
  else
    shell.say "\nYour timer has already been stopped.\n\n", :red
  end
end