forked from oprimus/PHP-Zoho
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ZohoCrm.php
43 lines (35 loc) · 1.06 KB
/
ZohoCrm.php
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
<?php
include('ZohoCrmModule.php');
// Enum
abstract class ZohoCrmUserType {
const All = 'AllUsers';
const Active = 'ActiveUsers';
const Inactive = 'DeactiveUsers';
const Admin = 'AdminUsers';
const ActiveConfirmedAdmin = 'ActiveConfirmedAdmins';
}
class ZohoCrm extends Zoho {
protected $modules = array(
'Accounts' => null,
'Contacts' => null,
'Leads' => null,
'Notes' => null,
'Products' => null,
'Users' => null
);
public function __construct($authToken) {
parent::__construct('crmapi', 'https://crm.zoho.com/crm/private', $authToken);
}
public function module($name) {
if (array_key_exists($name, $this->modules)) {
if ($this->modules[$name] === null) {
$this->modules[$name] = new ZohoCrmModule($name, $this);
}
return $this->modules[$name];
}
throw new Exception('Unknown module: ' . $name);
}
public function __get($name) {
return $this->module($name);
}
}