Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cd2fd73cc3 | ||
|
|
bd83c6d48a | ||
|
|
4e3d307bdd | ||
|
|
99d89e7dc3 | ||
|
|
55e81fe02c |
@@ -121,11 +121,11 @@ class Guzzle implements Adapter
|
|||||||
throw new JSONException();
|
throw new JSONException();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($json->errors)) {
|
if (isset($json->errors) && count($json->errors) >= 1) {
|
||||||
throw new ResponseException($json->errors[0]->message, $json->errors[0]->code);
|
throw new ResponseException($json->errors[0]->message, $json->errors[0]->code);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($json->success) && ($json->success === false)) {
|
if (isset($json->success) && !$json->success) {
|
||||||
throw new ResponseException('Request was unsuccessful.');
|
throw new ResponseException('Request was unsuccessful.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ class Zones implements API
|
|||||||
*/
|
*/
|
||||||
public function getAnalyticsDashboard(string $zoneID, string $since = '-10080', string $until = '0', bool $continuous = true): \stdClass
|
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;
|
return json_decode($response->getBody())->result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -141,8 +141,8 @@ class ZonesTest extends TestCase
|
|||||||
->method('get')
|
->method('get')
|
||||||
->with(
|
->with(
|
||||||
$this->equalTo('zones/c2547eb745079dac9320b638f5e225cf483cc5cfdda41/analytics/dashboard'),
|
$this->equalTo('zones/c2547eb745079dac9320b638f5e225cf483cc5cfdda41/analytics/dashboard'),
|
||||||
$this->equalTo([]),
|
$this->equalTo(['since' => '-10080', 'until' => '0', 'continuous' => var_export(true, true)]),
|
||||||
$this->equalTo(['since' => '-10080', 'until' => '0', 'continuous' => true])
|
$this->equalTo([])
|
||||||
);
|
);
|
||||||
|
|
||||||
$zones = new \Cloudflare\API\Endpoints\Zones($mock);
|
$zones = new \Cloudflare\API\Endpoints\Zones($mock);
|
||||||
|
|||||||
Reference in New Issue
Block a user