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