@@ 236-255 (lines=20) @@ | ||
233 | * @return Contact |
|
234 | * @throws LPTrackerSDKException |
|
235 | */ |
|
236 | public function getContact($contact) |
|
237 | { |
|
238 | if ($contact instanceof Contact) { |
|
239 | $contact = $contact->getId(); |
|
240 | } else { |
|
241 | $contact = intval($contact); |
|
242 | } |
|
243 | ||
244 | if ($contact <= 0) { |
|
245 | throw new LPTrackerSDKException('Invalid contact ID'); |
|
246 | } |
|
247 | ||
248 | $url = '/contact/'.$contact; |
|
249 | ||
250 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
|
251 | ||
252 | $resultContact = new Contact($response); |
|
253 | ||
254 | return $resultContact; |
|
255 | } |
|
256 | ||
257 | ||
258 | /** |
|
@@ 474-493 (lines=20) @@ | ||
471 | * @return View |
|
472 | * @throws LPTrackerSDKException |
|
473 | */ |
|
474 | public function getView($view) |
|
475 | { |
|
476 | if ($view instanceof View) { |
|
477 | $view = $view->getId(); |
|
478 | } else { |
|
479 | $view = intval($view); |
|
480 | } |
|
481 | ||
482 | if ($view <= 0) { |
|
483 | throw new LPTrackerSDKException('Invalid view ID'); |
|
484 | } |
|
485 | ||
486 | $url = '/view/'.$view; |
|
487 | ||
488 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
|
489 | ||
490 | $resultView = new View($response); |
|
491 | ||
492 | return $resultView; |
|
493 | } |
|
494 | ||
495 | ||
496 | /** |
|
@@ 591-610 (lines=20) @@ | ||
588 | * @return Lead |
|
589 | * @throws LPTrackerSDKException |
|
590 | */ |
|
591 | public function getLead($lead) |
|
592 | { |
|
593 | if ($lead instanceof Lead) { |
|
594 | $lead = $lead->getId(); |
|
595 | } else { |
|
596 | $lead = intval($lead); |
|
597 | } |
|
598 | ||
599 | if ($lead <= 0) { |
|
600 | throw new LPTrackerSDKException('Invalid lead ID'); |
|
601 | } |
|
602 | ||
603 | $url = '/lead/'.$lead; |
|
604 | ||
605 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
|
606 | ||
607 | $resultLead = new Lead($response); |
|
608 | ||
609 | return $resultLead; |
|
610 | } |
|
611 | ||
612 | ||
613 | /** |