class Dude::Toggl::StopTimeEntry

Public Instance Methods

call() click to toggle source
# File lib/dude/time_trackers/toggl/stop_time_entry.rb, line 8
def call
  stop_current_time_entry
  print_success_message
rescue NoMethodError
  print_error_message
end
current_time_entry() click to toggle source
# File lib/dude/time_trackers/toggl/stop_time_entry.rb, line 19
def current_time_entry
  JSON.parse(toggl_api.get('api/v8/time_entries/current').body)['data']
end
print_error_message() click to toggle source
print_success_message() click to toggle source
stop_current_time_entry() click to toggle source
# File lib/dude/time_trackers/toggl/stop_time_entry.rb, line 15
def stop_current_time_entry
  toggl_api.put("api/v8/time_entries/#{current_time_entry['id']}/stop", '')
end