← All changes
|
includes/Core/Integration/ZohoCRM/MetaDataApiHelper.php
+12
-8
2.0
→
V3.3.2
View file →
| @@ -1,5 +1,6 @@ | ||
| 1 | 1 | <?php |
| 2 | + | |
| 2 | 3 | /** |
| 3 | 4 | * Zoho CRM Meta Data Api Helper |
| 4 | 5 | * |
| 5 | 6 | */ |
| @@ -10,9 +11,10 @@ | ||
| 10 | 11 | |
| 11 | 12 | /** |
| 12 | 13 | * Provide functionality for Tags in Zoho CRM |
| 13 | 14 | */ |
| 14 | -final class MetaDataApiHelper { | |
| 15 | +final class MetaDataApiHelper | |
| 16 | +{ | |
| 15 | 17 | private $_defaultHeader; |
| 16 | 18 | private $_apiDomain; |
| 17 | 19 | private $_module; |
| 18 | 20 | |
| @@ -18,11 +20,11 @@ | ||
| 18 | 20 | |
| 19 | 21 | /** |
| 20 | 22 | * Constructor function |
| 21 | 23 | * |
| 22 | - * @param Object $tokenDetails Api token details | |
| 23 | 24 | */ |
| 24 | - public function __construct($tokenDetails, $minorV = false) { | |
| 25 | + public function __construct($tokenDetails, $minorV = false) | |
| 26 | + { | |
| 25 | 27 | $this->_defaultHeader['Authorization'] = "Zoho-oauthtoken {$tokenDetails->access_token}"; |
| 26 | 28 | $this->_apiDomain = $minorV ? |
| 27 | 29 | urldecode($tokenDetails->api_domain) . '/crm/v2.1/settings' |
| 28 | 30 | : urldecode($tokenDetails->api_domain) . '/crm/v2/settings'; |
| @@ -32,11 +34,12 @@ | ||
| 32 | 34 | * Helps to get Assignment rules of a Zoho CRM module |
| 33 | 35 | * |
| 34 | 36 | * @param $module Name of the module for which Assignment rules needs to retrive |
| 35 | 37 | * |
| 36 | - * @return Array $relatedLists Assignment rules | |
| 38 | + * @return mixed $relatedLists Assignment rules | |
| 37 | 39 | */ |
| 38 | - public function getAssignmentRules($module) { | |
| 40 | + public function getAssignmentRules($module) | |
| 41 | + { | |
| 39 | 42 | $getAssignmentRulesEndpoint = "{$this->_apiDomain}/automation/assignment_rules"; |
| 40 | 43 | $getAssignmentRulesResponse = HttpHelper::get($getAssignmentRulesEndpoint, ['module' => $module], $this->_defaultHeader); |
| 41 | 44 | if (is_wp_error($getAssignmentRulesResponse)) { |
| 42 | 45 | return $getAssignmentRulesResponse; |
| @@ -54,13 +57,14 @@ | ||
| 54 | 57 | |
| 55 | 58 | /** |
| 56 | 59 | * Helps to get Related Lists of a Zoho CRM module |
| 57 | 60 | * |
| 58 | - * @param $module Name of the module for which related lists needs to retrive | |
| 61 | + * @param $module Name of the module for which related lists needs to retrieve | |
| 59 | 62 | * |
| 60 | - * @return Array $relatedLists Related Lists | |
| 63 | + * @return mixed $relatedLists Related Lists | |
| 61 | 64 | */ |
| 62 | - public function getRelatedLists($module) { | |
| 65 | + public function getRelatedLists($module) | |
| 66 | + { | |
| 63 | 67 | $getRelatedListsEndpoint = "{$this->_apiDomain}/related_lists"; |
| 64 | 68 | $getRelatedListsResponse = HttpHelper::get($getRelatedListsEndpoint, ['module' => $module], $this->_defaultHeader); |
| 65 | 69 | if (is_wp_error($getRelatedListsResponse)) { |
| 66 | 70 | return $getRelatedListsResponse; |