diff --git a/src/Endpoints/ZoneSettings.php b/src/Endpoints/TLS.php similarity index 81% rename from src/Endpoints/ZoneSettings.php rename to src/Endpoints/TLS.php index 95bce73..7063c6e 100644 --- a/src/Endpoints/ZoneSettings.php +++ b/src/Endpoints/TLS.php @@ -10,7 +10,7 @@ namespace Cloudflare\API\Endpoints; use Cloudflare\API\Adapter\Adapter; -class ZoneSettings implements API +class TLS implements API { private $adapter; @@ -19,20 +19,23 @@ class ZoneSettings implements API $this->adapter = $adapter; } - public function enableTLS13($zoneID, $enable=false) { - + public function enableTLS13($zoneID, $enable=false) + { $return = $this->adapter->patch( 'zones/' . $zoneID . '/settings/tls_1_3', ['value' => $enable ? 'on' : 'off'] ); $body = json_decode($return->getBody()); - return $body->result; + if ($body->success) { + return true; + } + return false; } - public function changeMinimumTLSVersion($zoneID, $minimumVersion) { - + public function changeMinimumTLSVersion($zoneID, $minimumVersion) + { $return = $this->adapter->patch( 'zones/' . $zoneID . '/settings/min_tls_version', [ @@ -42,9 +45,5 @@ class ZoneSettings implements API $body = json_decode($return->getBody()); return $body->result; - } - - - -} \ No newline at end of file +} diff --git a/tests/Endpoints/ZoneSettingsTest.php b/tests/Endpoints/TLSTest.php similarity index 75% rename from tests/Endpoints/ZoneSettingsTest.php rename to tests/Endpoints/TLSTest.php index 097c2cc..b8c9229 100644 --- a/tests/Endpoints/ZoneSettingsTest.php +++ b/tests/Endpoints/TLSTest.php @@ -7,7 +7,7 @@ * Time: 09:09 */ -class ZoneSettingsTest extends TestCase +class TLSTest extends TestCase { public function testEnableTLS13() { @@ -23,11 +23,9 @@ class ZoneSettingsTest extends TestCase $this->equalTo(['value' => 'on']) ); - $zoneSettings = new \Cloudflare\API\Endpoints\ZoneSettings($mock); - $result = $zoneSettings->enableTLS13('c2547eb745079dac9320b638f5e225cf483cc5cfdda41', true); + $ZoneTLSSettings = new \Cloudflare\API\Endpoints\TLS($mock); + $result = $ZoneTLSSettings->enableTLS13('c2547eb745079dac9320b638f5e225cf483cc5cfdda41', true); $this->assertTrue($result); } - - } diff --git a/tests/Fixtures/Endpoints/enableTLS13.json b/tests/Fixtures/Endpoints/enableTLS13.json index 878457d..17da752 100644 --- a/tests/Fixtures/Endpoints/enableTLS13.json +++ b/tests/Fixtures/Endpoints/enableTLS13.json @@ -2,5 +2,5 @@ "success": true, "errors": [], "messages": [], - "result": "off" + "result": "on" } \ No newline at end of file