5 Commits
1.0.7 ... 1.0.9

Author SHA1 Message Date
Junade
cd2fd73cc3 Merge pull request #42 from JorgenPhi/master
AnalyticsDashboard params are not headers
2017-12-26 18:52:26 +00:00
Jorgen Phillips
bd83c6d48a Fix test 2017-12-24 12:48:22 -06:00
Jorgen Phillips
4e3d307bdd AnalyticsDashboard params are not headers
Also 'continuous' needs to be a string for the API to process it.
2017-12-24 12:41:38 -06:00
Junade
99d89e7dc3 Merge pull request #39 from MeekLogic/master
Fixed checkError index out of range
2017-11-27 16:50:05 +08:00
Tyler Vigario
55e81fe02c Fixed checkError index out of range 2017-11-26 19:23:31 -08:00
3 changed files with 5 additions and 5 deletions

View File

@@ -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.');
} }
} }

View File

@@ -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;
} }

View File

@@ -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);