@@ 207-226 (lines=20) @@ | ||
204 | * @return Contact |
|
205 | * @throws LPTrackerSDKException |
|
206 | */ |
|
207 | public function getContact($contact) |
|
208 | { |
|
209 | if ($contact instanceof Contact) { |
|
210 | $contact = $contact->getId(); |
|
211 | } else { |
|
212 | $contact = intval($contact); |
|
213 | } |
|
214 | ||
215 | if ($contact <= 0) { |
|
216 | throw new LPTrackerSDKException('Invalid contact ID'); |
|
217 | } |
|
218 | ||
219 | $url = '/contact/'.$contact; |
|
220 | ||
221 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
|
222 | ||
223 | $resultContact = new Contact($response); |
|
224 | ||
225 | return $resultContact; |
|
226 | } |
|
227 | ||
228 | ||
229 | /** |
|
@@ 443-462 (lines=20) @@ | ||
440 | * @return View |
|
441 | * @throws LPTrackerSDKException |
|
442 | */ |
|
443 | public function getView($view) |
|
444 | { |
|
445 | if ($view instanceof View) { |
|
446 | $view = $view->getId(); |
|
447 | } else { |
|
448 | $view = intval($view); |
|
449 | } |
|
450 | ||
451 | if ($view <= 0) { |
|
452 | throw new LPTrackerSDKException('Invalid view ID'); |
|
453 | } |
|
454 | ||
455 | $url = '/view/'.$view; |
|
456 | ||
457 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
|
458 | ||
459 | $resultView = new View($response); |
|
460 | ||
461 | return $resultView; |
|
462 | } |
|
463 | ||
464 | ||
465 | /** |
|
@@ 551-570 (lines=20) @@ | ||
548 | * @return Lead |
|
549 | * @throws LPTrackerSDKException |
|
550 | */ |
|
551 | public function getLead($lead) |
|
552 | { |
|
553 | if ($lead instanceof Lead) { |
|
554 | $lead = $lead->getId(); |
|
555 | } else { |
|
556 | $lead = intval($lead); |
|
557 | } |
|
558 | ||
559 | if ($lead <= 0) { |
|
560 | throw new LPTrackerSDKException('Invalid lead ID'); |
|
561 | } |
|
562 | ||
563 | $url = '/lead/'.$lead; |
|
564 | ||
565 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
|
566 | ||
567 | $resultLead = new Lead($response); |
|
568 | ||
569 | return $resultLead; |
|
570 | } |
|
571 | ||
572 | ||
573 | /** |