From 6bb2f5fbd9d547301ac59beff451966104aff92c Mon Sep 17 00:00:00 2001 From: Mateusz Grochala Date: Wed, 13 Sep 2017 15:12:08 +0200 Subject: [PATCH] Added methods for time-entries find() - single time entry edit() delete() --- src/Rossedman/Teamwork/Time.php | 37 ++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/src/Rossedman/Teamwork/Time.php b/src/Rossedman/Teamwork/Time.php index b8312cf..669d486 100644 --- a/src/Rossedman/Teamwork/Time.php +++ b/src/Rossedman/Teamwork/Time.php @@ -21,4 +21,39 @@ public function all($args = null) return $this->client->get($this->endpoint, $args)->response(); } -} \ No newline at end of file + + /** + * GET /time_entries/id.json + * + * @return mixed + */ + public function find($args = null) + { + $this->areArgumentsValid($args, ['page']); + + return $this->client->get("$this->endpoint/$this->id.json", $args)->response(); + } + + /** + * Edit A Time entry + * PUT /time_entries/{id}.json + * + * @return mixed + */ + public function edit($data) + { + return $this->client->put("$this->endpoint/$this->id.json", ['time-entry' => $data])->response(); + } + + /** + * Delete A Time entry + * DELETE /time_entries/{id}.json + * + * @return mixed + */ + public function delete() + { + return $this->client->delete("$this->endpoint/$this->id.json")->response(); + } + +}