@@ 216-235 (lines=20) @@ | ||
213 | * @return Contact |
|
214 | * @throws LPTrackerSDKException |
|
215 | */ |
|
216 | public function getContact($contact) |
|
217 | { |
|
218 | if ($contact instanceof Contact) { |
|
219 | $contact = $contact->getId(); |
|
220 | } else { |
|
221 | $contact = intval($contact); |
|
222 | } |
|
223 | ||
224 | if ($contact <= 0) { |
|
225 | throw new LPTrackerSDKException('Invalid contact ID'); |
|
226 | } |
|
227 | ||
228 | $url = '/contact/'.$contact; |
|
229 | ||
230 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
|
231 | ||
232 | $resultContact = new Contact($response); |
|
233 | ||
234 | return $resultContact; |
|
235 | } |
|
236 | ||
237 | ||
238 | /** |
|
@@ 454-473 (lines=20) @@ | ||
451 | * @return View |
|
452 | * @throws LPTrackerSDKException |
|
453 | */ |
|
454 | public function getView($view) |
|
455 | { |
|
456 | if ($view instanceof View) { |
|
457 | $view = $view->getId(); |
|
458 | } else { |
|
459 | $view = intval($view); |
|
460 | } |
|
461 | ||
462 | if ($view <= 0) { |
|
463 | throw new LPTrackerSDKException('Invalid view ID'); |
|
464 | } |
|
465 | ||
466 | $url = '/view/'.$view; |
|
467 | ||
468 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
|
469 | ||
470 | $resultView = new View($response); |
|
471 | ||
472 | return $resultView; |
|
473 | } |
|
474 | ||
475 | ||
476 | /** |
|
@@ 567-586 (lines=20) @@ | ||
564 | * @return Lead |
|
565 | * @throws LPTrackerSDKException |
|
566 | */ |
|
567 | public function getLead($lead) |
|
568 | { |
|
569 | if ($lead instanceof Lead) { |
|
570 | $lead = $lead->getId(); |
|
571 | } else { |
|
572 | $lead = intval($lead); |
|
573 | } |
|
574 | ||
575 | if ($lead <= 0) { |
|
576 | throw new LPTrackerSDKException('Invalid lead ID'); |
|
577 | } |
|
578 | ||
579 | $url = '/lead/'.$lead; |
|
580 | ||
581 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
|
582 | ||
583 | $resultLead = new Lead($response); |
|
584 | ||
585 | return $resultLead; |
|
586 | } |
|
587 | ||
588 | ||
589 | /** |