From f23cff48b1cdf622fdddcef090a50bae74328cbd Mon Sep 17 00:00:00 2001 From: alphayax Date: Wed, 3 Feb 2016 22:09:51 +0100 Subject: [PATCH] refractor services Add SystemConfig class --- freebox/api/v3/models/SystemConfig.php | 44 +++++++++++++++++++ freebox/api/v3/{ => services}/config/DHCP.php | 2 +- freebox/api/v3/{ => services}/config/FTP.php | 2 +- .../api/v3/{ => services}/config/System.php | 11 +++-- .../api/v3/{ => services}/login/Authorize.php | 2 +- .../Login.php => services/login/Session.php} | 4 +- freebox/utils/Application.php | 6 +-- 7 files changed, 59 insertions(+), 12 deletions(-) create mode 100644 freebox/api/v3/models/SystemConfig.php rename freebox/api/v3/{ => services}/config/DHCP.php (94%) rename freebox/api/v3/{ => services}/config/FTP.php (93%) rename freebox/api/v3/{ => services}/config/System.php (68%) rename freebox/api/v3/{ => services}/login/Authorize.php (98%) rename freebox/api/v3/{login/Login.php => services/login/Session.php} (94%) diff --git a/freebox/api/v3/models/SystemConfig.php b/freebox/api/v3/models/SystemConfig.php new file mode 100644 index 0000000..1deaa30 --- /dev/null +++ b/freebox/api/v3/models/SystemConfig.php @@ -0,0 +1,44 @@ +getAuthService( self::API_SYSTEM); $rest->GET(); - return $rest->getCurlResponse(); + return new SystemConfig( $rest->getCurlResponse()['result']); } /** + * Reboot the Freebox * @return array * @throws \Exception */ - public function reboot( ){ + public function reboot(){ $rest = $this->getAuthService( self::API_SYSTEM_REBOOT); - $rest->POST( ); + $rest->POST(); return $rest->getCurlResponse(); } diff --git a/freebox/api/v3/login/Authorize.php b/freebox/api/v3/services/login/Authorize.php similarity index 98% rename from freebox/api/v3/login/Authorize.php rename to freebox/api/v3/services/login/Authorize.php index 6e59e57..a4a8a2d 100644 --- a/freebox/api/v3/login/Authorize.php +++ b/freebox/api/v3/services/login/Authorize.php @@ -1,5 +1,5 @@ */ -class Login extends Service { +class Session extends Service { /// APIs services const API_LOGIN = '/api/v3/login/'; diff --git a/freebox/utils/Application.php b/freebox/utils/Application.php index 49ae521..c4f04d1 100644 --- a/freebox/utils/Application.php +++ b/freebox/utils/Application.php @@ -1,6 +1,6 @@ ask_login_status(); $Login->create_session();