From 3d3196fe970791f2a032ec02a8b44b972558cab9 Mon Sep 17 00:00:00 2001 From: JRK <3283866+jr-k@users.noreply.github.com> Date: Tue, 23 Mar 2021 14:17:15 +0100 Subject: [PATCH] Fix leadLabels and leadSources --- src/Resources/Leads.php | 36 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/src/Resources/Leads.php b/src/Resources/Leads.php index b5924e2..f86e897 100644 --- a/src/Resources/Leads.php +++ b/src/Resources/Leads.php @@ -23,12 +23,9 @@ class Leads extends Resource */ public function labels() { - $this->request->setResource('/'); - $result = $this->request->get('leadLabels'); + $this->request->setResource('leadLabels'); - $this->request->setResource($this->getName()); - - return $result; + return $this->request->get(''); } /** @@ -38,14 +35,14 @@ public function labels() */ public function addLabel(array $values = []) { - $this->request->setResource('/'); - $result = $this->request->post('leadLabels', $values); + $this->request->setResource('leadLabels'); - $this->request->setResource($this->getName()); + $values['json'] = true; - return $result; + return $this->request->post('', $values); } + /** * Delete a label. * @@ -53,12 +50,9 @@ public function addLabel(array $values = []) */ public function deleteLabel($id) { - $this->request->setResource('/'); - $result = $this->request->delete('leadLabels/' . $id); - - $this->request->setResource($this->getName()); + $this->request->setResource('leadLabels'); - return $result; + return $this->request->delete('' . $id); } /** @@ -68,12 +62,9 @@ public function deleteLabel($id) */ public function update($id, array $values = []) { - $this->request->setResource('/'); - $result = $this->request->put('leadLabels/' . $id, $values); + $this->request->setResource('leadLabels'); - $this->request->setResource($this->getName()); - - return $result; + return $this->request->put('/' . $id, $values); } /** @@ -83,11 +74,8 @@ public function update($id, array $values = []) */ public function sources() { - $this->request->setResource('/'); - $result = $this->request->get('leadSources'); - - $this->request->setResource($this->getName()); + $this->request->setResource('leadSources'); - return $result; + return $this->request->get(''); } }