Class: GetToWork::Command::Stop

Inherits:
GetToWork::Command show all
Defined in:
lib/get_to_work/command/stop.rb

Instance Method Summary collapse

Methods inherited from GetToWork::Command

#config_file, #harvest_service, #initialize, #last_story, #last_timer, run

Methods included from Menu

#menu_ask

Constructor Details

This class inherits a constructor from GetToWork::Command

Instance Method Details

#runObject



4
5
6
7
8
9
10
11
12
13
14
15
16
# 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