From 4e3d307bdd04bdedc5d5e24cff9176da2a654503 Mon Sep 17 00:00:00 2001 From: Jorgen Phillips Date: Sun, 24 Dec 2017 12:41:38 -0600 Subject: [PATCH 1/2] AnalyticsDashboard params are not headers Also 'continuous' needs to be a string for the API to process it. --- src/Endpoints/Zones.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Endpoints/Zones.php b/src/Endpoints/Zones.php index 90427d7..c58f529 100644 --- a/src/Endpoints/Zones.php +++ b/src/Endpoints/Zones.php @@ -114,7 +114,7 @@ class Zones implements API */ public function getAnalyticsDashboard(string $zoneID, string $since = '-10080', string $until = '0', bool $continuous = true): \stdClass { - $response = $this->adapter->get('zones/' . $zoneID . '/analytics/dashboard', [], ['since' => $since, 'until' => $until, 'continuous' => $continuous]); + $response = $this->adapter->get('zones/' . $zoneID . '/analytics/dashboard', ['since' => $since, 'until' => $until, 'continuous' => var_export($continuous, true)], []); return json_decode($response->getBody())->result; } From bd83c6d48a6db8cab3dd526de8252b4638b39953 Mon Sep 17 00:00:00 2001 From: Jorgen Phillips Date: Sun, 24 Dec 2017 12:48:22 -0600 Subject: [PATCH 2/2] Fix test --- tests/Endpoints/ZonesTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Endpoints/ZonesTest.php b/tests/Endpoints/ZonesTest.php index 990ec1d..e0bb396 100644 --- a/tests/Endpoints/ZonesTest.php +++ b/tests/Endpoints/ZonesTest.php @@ -141,8 +141,8 @@ class ZonesTest extends TestCase ->method('get') ->with( $this->equalTo('zones/c2547eb745079dac9320b638f5e225cf483cc5cfdda41/analytics/dashboard'), - $this->equalTo([]), - $this->equalTo(['since' => '-10080', 'until' => '0', 'continuous' => true]) + $this->equalTo(['since' => '-10080', 'until' => '0', 'continuous' => var_export(true, true)]), + $this->equalTo([]) ); $zones = new \Cloudflare\API\Endpoints\Zones($mock);