Skip to content

Commit

Permalink
Fix response to object for create operations
Browse files Browse the repository at this point in the history
  • Loading branch information
bonroyage committed Nov 16, 2020
1 parent 97f4b9c commit 5f643cf
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
6 changes: 4 additions & 2 deletions src/Operations/Create.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

}
4 changes: 3 additions & 1 deletion src/Operations/Delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

}
8 changes: 4 additions & 4 deletions src/Operations/Get.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

}

0 comments on commit 5f643cf

Please sign in to comment.