-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathActivities.php
More file actions
47 lines (42 loc) · 1.36 KB
/
Copy pathActivities.php
File metadata and controls
47 lines (42 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php namespace Benhawker\Pipedrive\Library;
use Benhawker\Pipedrive\Exceptions\PipedriveMissingFieldError;
/**
* Pipedrive Activities Methods
*
* Activities are appointments/tasks/events on a calendar that can be
* associated with a Deal, a Person and an Organization. Activities can
* be of different type (such as call, meeting, lunch or a custom type
* - see ActivityTypes object) and can be assigned to a particular User.
* Note that activities can also be created without a specific date/time.
*
*/
class Activities
{
/**
* Hold the pipedrive cURL session
* @var Curl Object
*/
protected $curl;
/**
* Initialize the object load master class
*/
public function __construct(\Benhawker\Pipedrive\Pipedrive $master)
{
//associate curl class
$this->curl = $master->curl();
}
/**
* Adds a activity
*
* @param array $data activity details
* @return array returns details of the activity
*/
public function add(array $data)
{
//if there is no subject or type set chuck error as both of the fields are required
if (!isset($data['subject']) or !isset($data['type'])) {
throw new PipedriveMissingFieldError('You must include both a "subject" and "type" field when inserting a note');
}
return $this->curl->post('activities', $data);
}
}