Skip to content

Commit

Permalink
Merge pull request #110 from jr-k/patch-1
Browse files Browse the repository at this point in the history
Fix leadLabels and leadSources
  • Loading branch information
IsraelOrtuno committed Mar 24, 2021
2 parents 92bb79e + c4ccab9 commit 8424610
Showing 1 changed file with 12 additions and 24 deletions.
36 changes: 12 additions & 24 deletions src/Resources/Leads.php
Expand Up @@ -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('');
}

/**
Expand All @@ -38,27 +35,24 @@ 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.
*
* @return Response
*/
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);
}

/**
Expand All @@ -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);
}

/**
Expand All @@ -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('');
}
}

0 comments on commit 8424610

Please sign in to comment.