| @@ 243-259 (lines=17) @@ | ||
| 240 | * |
|
| 241 | * @return Response |
|
| 242 | */ |
|
| 243 | public function createGauge(string $title, $tz, string $allowedHosts = null) : Response |
|
| 244 | { |
|
| 245 | if (!$tz instanceof \DateTimeZone) { |
|
| 246 | $tz = new \DateTimeZone($tz); |
|
| 247 | } |
|
| 248 | ||
| 249 | $params = array( |
|
| 250 | 'title' => $title, |
|
| 251 | 'tz' => $tz->getName() |
|
| 252 | ); |
|
| 253 | ||
| 254 | if (isset($allowedHosts)) { |
|
| 255 | $params['allowed_hosts'] = $allowedHosts; |
|
| 256 | } |
|
| 257 | ||
| 258 | return $this->makeApiCall('POST', 'gauges', $params); |
|
| 259 | } |
|
| 260 | ||
| 261 | /** |
|
| 262 | * Gauge Detail |
|
| @@ 287-303 (lines=17) @@ | ||
| 284 | * |
|
| 285 | * @return Response |
|
| 286 | */ |
|
| 287 | public function updateGauge(string $id, string $title, $tz, string $allowedHosts = null) : Response |
|
| 288 | { |
|
| 289 | if (!$tz instanceof \DateTimeZone) { |
|
| 290 | $tz = new \DateTimeZone($tz); |
|
| 291 | } |
|
| 292 | ||
| 293 | $params = array( |
|
| 294 | 'title' => $title, |
|
| 295 | 'tz' => $tz->getName() |
|
| 296 | ); |
|
| 297 | ||
| 298 | if (isset($allowedHosts)) { |
|
| 299 | $params['allowed_hosts'] = $allowedHosts; |
|
| 300 | } |
|
| 301 | ||
| 302 | return $this->makeApiCall('PUT', 'gauges/' . $id, $params); |
|
| 303 | } |
|
| 304 | ||
| 305 | /** |
|
| 306 | * Delete a Gauge |
|
| @@ 449-462 (lines=14) @@ | ||
| 446 | * |
|
| 447 | * @return Response |
|
| 448 | */ |
|
| 449 | public function traffic(string $id, $date = null) : Response |
|
| 450 | { |
|
| 451 | $params = array(); |
|
| 452 | ||
| 453 | if (isset($date)) { |
|
| 454 | if (!$date instanceof \DateTime) { |
|
| 455 | $date = new \DateTime($date); |
|
| 456 | } |
|
| 457 | ||
| 458 | $params['date'] = $date->format('Y-m-d'); |
|
| 459 | } |
|
| 460 | ||
| 461 | return $this->makeApiCall('GET', 'gauges/' . $id . '/traffic', $params); |
|
| 462 | } |
|
| 463 | ||
| 464 | /** |
|
| 465 | * Browser Resolutions |
|
| @@ 474-487 (lines=14) @@ | ||
| 471 | * |
|
| 472 | * @return Response |
|
| 473 | */ |
|
| 474 | public function browserResolutions(string $id, $date = null) : Response |
|
| 475 | { |
|
| 476 | $params = array(); |
|
| 477 | ||
| 478 | if (isset($date)) { |
|
| 479 | if (!$date instanceof \DateTime) { |
|
| 480 | $date = new \DateTime($date); |
|
| 481 | } |
|
| 482 | ||
| 483 | $params['date'] = $date->format('Y-m-d'); |
|
| 484 | } |
|
| 485 | ||
| 486 | return $this->makeApiCall('GET', 'gauges/' . $id . '/resolutions', $params); |
|
| 487 | } |
|
| 488 | ||
| 489 | /** |
|
| 490 | * Technology |
|
| @@ 499-512 (lines=14) @@ | ||
| 496 | * |
|
| 497 | * @return Response |
|
| 498 | */ |
|
| 499 | public function technology(string $id, $date = null) : Response |
|
| 500 | { |
|
| 501 | $params = array(); |
|
| 502 | ||
| 503 | if (isset($date)) { |
|
| 504 | if (!$date instanceof \DateTime) { |
|
| 505 | $date = new \DateTime($date); |
|
| 506 | } |
|
| 507 | ||
| 508 | $params['date'] = $date->format('Y-m-d'); |
|
| 509 | } |
|
| 510 | ||
| 511 | return $this->makeApiCall('GET', 'gauges/' . $id . '/technology', $params); |
|
| 512 | } |
|
| 513 | ||
| 514 | /** |
|
| 515 | * Search Terms |
|
| @@ 554-567 (lines=14) @@ | ||
| 551 | * |
|
| 552 | * @return Response |
|
| 553 | */ |
|
| 554 | public function searchEngines(string $id, $date = null) : Response |
|
| 555 | { |
|
| 556 | $params = array(); |
|
| 557 | ||
| 558 | if (isset($date)) { |
|
| 559 | if (!$date instanceof \DateTime) { |
|
| 560 | $date = new \DateTime($date); |
|
| 561 | } |
|
| 562 | ||
| 563 | $params['date'] = $date->format('Y-m-d'); |
|
| 564 | } |
|
| 565 | ||
| 566 | return $this->makeApiCall('GET', 'gauges/' . $id . '/engines', $params); |
|
| 567 | } |
|
| 568 | ||
| 569 | /** |
|
| 570 | * Locations |
|
| @@ 579-592 (lines=14) @@ | ||
| 576 | * |
|
| 577 | * @return Response |
|
| 578 | */ |
|
| 579 | public function locations(string $id, $date = null) : Response |
|
| 580 | { |
|
| 581 | $params = array(); |
|
| 582 | ||
| 583 | if (isset($date)) { |
|
| 584 | if (!$date instanceof \DateTime) { |
|
| 585 | $date = new \DateTime($date); |
|
| 586 | } |
|
| 587 | ||
| 588 | $params['date'] = $date->format('Y-m-d'); |
|
| 589 | } |
|
| 590 | ||
| 591 | return $this->makeApiCall('GET', 'gauges/' . $id . '/locations', $params); |
|
| 592 | } |
|
| 593 | ||
| 594 | /** |
|
| 595 | * Browser stats |
|
| @@ 605-618 (lines=14) @@ | ||
| 602 | * |
|
| 603 | * @return Response |
|
| 604 | */ |
|
| 605 | public function browserStats(string $id, $date = null) : Response |
|
| 606 | { |
|
| 607 | $params = array(); |
|
| 608 | ||
| 609 | if (isset($date)) { |
|
| 610 | if (!$date instanceof \DateTime) { |
|
| 611 | $date = new \DateTime($date); |
|
| 612 | } |
|
| 613 | ||
| 614 | $params['date'] = $date->format('Y-m-d'); |
|
| 615 | } |
|
| 616 | ||
| 617 | return $this->makeApiCall('GET', 'gauges/' . $id . '/browserstats', $params); |
|
| 618 | } |
|
| 619 | ||
| 620 | /** |
|
| 621 | * Make the actual gauges API call. |
|