From 5f643cf41fd3340764f49ca128397c78bd5ffd27 Mon Sep 17 00:00:00 2001 From: Roy de Vos Burchart Date: Mon, 16 Nov 2020 17:56:53 +0100 Subject: [PATCH] Fix response to object for create operations --- src/Operations/Create.php | 6 ++++-- src/Operations/Delete.php | 4 +++- src/Operations/Get.php | 8 ++++---- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/Operations/Create.php b/src/Operations/Create.php index e3adbf3..ee0ba68 100644 --- a/src/Operations/Create.php +++ b/src/Operations/Create.php @@ -8,14 +8,16 @@ trait Create { - public function create(array $data, array $additionalData = []) + public function create(array $data) { $data = $this->objectToPayload($data); - return $this->client->post( + $response = $this->client->post( $this->path(), $data ); + + return $this->payloadToObject($response); } } \ No newline at end of file diff --git a/src/Operations/Delete.php b/src/Operations/Delete.php index b23f1e8..727e65f 100644 --- a/src/Operations/Delete.php +++ b/src/Operations/Delete.php @@ -10,9 +10,11 @@ trait Delete public function delete(int $id) { - return $this->client->delete( + $response = $this->client->delete( $this->path($id) ); + + return $this->payloadToObject($response); } } \ No newline at end of file diff --git a/src/Operations/Get.php b/src/Operations/Get.php index 1e5d256..ed7b3b9 100644 --- a/src/Operations/Get.php +++ b/src/Operations/Get.php @@ -10,11 +10,11 @@ trait Get public function get(int $id) { - return $this->payloadToObject( - $this->client->get( - $this->path($id) - ) + $response = $this->client->get( + $this->path($id) ); + + return $this->payloadToObject($response); } } \ No newline at end of file