-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fcf273e
commit 796d973
Showing
1 changed file
with
91 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
<?php | ||
|
||
namespace Devio\Pipedrive\Resources; | ||
|
||
use Devio\Pipedrive\Http\Response; | ||
use Devio\Pipedrive\Resources\Basics\Resource; | ||
|
||
class Leads extends Resource | ||
{ | ||
/** | ||
* Disabled abstract methods. | ||
* | ||
* @var array | ||
*/ | ||
protected $disabled = ['deleteBulk']; | ||
|
||
/** | ||
* Get all labels. | ||
* | ||
* @return Response | ||
*/ | ||
public function labels() | ||
{ | ||
$this->request->setResource('/'); | ||
$result = $this->request->get('leadLabels'); | ||
|
||
$this->request->setResource($this->getName()); | ||
|
||
return $result; | ||
} | ||
|
||
/** | ||
* Add a label. | ||
* | ||
* @return Response | ||
*/ | ||
public function addLabel(array $values = []) | ||
{ | ||
$this->request->setResource('/'); | ||
$result = $this->request->post('leadLabels', $values); | ||
|
||
$this->request->setResource($this->getName()); | ||
|
||
return $result; | ||
} | ||
|
||
/** | ||
* Delete a label. | ||
* | ||
* @return Response | ||
*/ | ||
public function deleteLabel($id) | ||
{ | ||
$this->request->setResource('/'); | ||
$result = $this->request->delete('leadLabels/' . $id); | ||
|
||
$this->request->setResource($this->getName()); | ||
|
||
return $result; | ||
} | ||
|
||
/** | ||
* @param $id | ||
* @param array $values | ||
* @return Response | ||
*/ | ||
public function update($id, array $values = []) | ||
{ | ||
$this->request->setResource('/'); | ||
$result = $this->request->put('leadLabels/' . $id, $values); | ||
|
||
$this->request->setResource($this->getName()); | ||
|
||
return $result; | ||
} | ||
|
||
/** | ||
* Get all sources. | ||
* | ||
* @return Response | ||
*/ | ||
public function sources() | ||
{ | ||
$this->request->setResource('/'); | ||
$result = $this->request->get('leadSources'); | ||
|
||
$this->request->setResource($this->getName()); | ||
|
||
return $result; | ||
} | ||
} |