diff options
author | kballou <kballou@devnulllabs.io> | 2016-06-21 11:35:11 -0600 |
---|---|---|
committer | kballou <kballou@devnulllabs.io> | 2016-06-21 11:35:11 -0600 |
commit | 77e4e8647d565218bfc72fbe569eb7eb00c4d8e6 (patch) | |
tree | 59e270b417e88374aad365e70f2992af410fb662 /lib/toglx.ex | |
parent | 4ca1b6dbdd1c58155faddde18908e6b09e80c757 (diff) | |
download | toglx-77e4e8647d565218bfc72fbe569eb7eb00c4d8e6.tar.gz toglx-77e4e8647d565218bfc72fbe569eb7eb00c4d8e6.tar.xz |
Add discard command to discard current time entry
Add a `discard` option for discontinue tracking on the current time entry.
Diffstat (limited to 'lib/toglx.ex')
-rw-r--r-- | lib/toglx.ex | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/toglx.ex b/lib/toglx.ex index 454233b..9bb086c 100644 --- a/lib/toglx.ex +++ b/lib/toglx.ex @@ -24,6 +24,15 @@ defmodule Toglx do end end + def submit_discard_event do + case current do + %{data: nil} -> :ok + %{data: %{id: time_entry_id}} -> + create_togglex_client + |> Togglex.Api.TimeEntries.delete(time_entry_id) + end + end + def current do create_togglex_client |> Togglex.Api.TimeEntries.current |