Compare commits
13 Commits
1.0.7
...
revert-49-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
67c34b789e | ||
|
|
9c56941516 | ||
|
|
e18a64e7e4 | ||
|
|
dc53414c2a | ||
|
|
a628cac283 | ||
|
|
0112425a61 | ||
|
|
fe854e1b21 | ||
|
|
45cb8ee539 | ||
|
|
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.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,15 +23,15 @@ class Zones implements API
|
|||||||
* @SuppressWarnings(PHPMD.BooleanArgumentFlag)
|
* @SuppressWarnings(PHPMD.BooleanArgumentFlag)
|
||||||
*
|
*
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @param bool $jumpstart
|
* @param bool $jumpStart
|
||||||
* @param string $organizationID
|
* @param string $organizationID
|
||||||
* @return \stdClass
|
* @return \stdClass
|
||||||
*/
|
*/
|
||||||
public function addZone(string $name, bool $jumpstart = false, string $organizationID = ''): \stdClass
|
public function addZone(string $name, bool $jumpStart = false, string $organizationID = ''): \stdClass
|
||||||
{
|
{
|
||||||
$options = [
|
$options = [
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
'jumpstart' => $jumpstart
|
'jump_start' => $jumpStart
|
||||||
];
|
];
|
||||||
|
|
||||||
if (!empty($organizationID)) {
|
if (!empty($organizationID)) {
|
||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ class ZonesTest extends TestCase
|
|||||||
->with(
|
->with(
|
||||||
$this->equalTo('zones'),
|
$this->equalTo('zones'),
|
||||||
$this->equalTo([]),
|
$this->equalTo([]),
|
||||||
$this->equalTo(['name' => 'example.com', 'jumpstart' => false])
|
$this->equalTo(['name' => 'example.com', 'jump_start' => false])
|
||||||
);
|
);
|
||||||
|
|
||||||
$zones = new \Cloudflare\API\Endpoints\Zones($mock);
|
$zones = new \Cloudflare\API\Endpoints\Zones($mock);
|
||||||
@@ -41,7 +41,7 @@ class ZonesTest extends TestCase
|
|||||||
$this->equalTo([]),
|
$this->equalTo([]),
|
||||||
$this->equalTo([
|
$this->equalTo([
|
||||||
'name' => 'example.com',
|
'name' => 'example.com',
|
||||||
'jumpstart' => true,
|
'jump_start' => true,
|
||||||
'organization' => (object)['id' => '01a7362d577a6c3019a474fd6f485823']
|
'organization' => (object)['id' => '01a7362d577a6c3019a474fd6f485823']
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
@@ -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