From cb425e42214f0113eca7478d8d6ae186dfe3acf3 Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Mon, 18 Jul 2016 23:51:15 +0200 Subject: [PATCH] Integrated 'calendar_view' setting in the API (#182). --- doc/rest-api.md | 7 +++++-- src/engine/Api/V1/Parsers/Admins.php | 7 ++++++- src/engine/Api/V1/Parsers/Providers.php | 5 +++++ src/engine/Api/V1/Parsers/Secretaries.php | 7 ++++++- 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/doc/rest-api.md b/doc/rest-api.md index 500054c4..dde22971 100644 --- a/doc/rest-api.md +++ b/doc/rest-api.md @@ -216,7 +216,8 @@ You can also try the GET requests with your browser by navigating to the respeci "notes": "Test admin notes.", "settings":{ "username": "chrisdoe", - "notifications": true + "notifications": true, + "calendarView": "default" } } ``` @@ -256,6 +257,7 @@ You can also try the GET requests with your browser by navigating to the respeci "googleToken": "23897dfasdf7a98gas98d9", "syncFutureDays":10, "syncPastDays":10, + "calendarView": "default", "workingPlan":{ "monday":{ "start": "09:00", @@ -332,7 +334,8 @@ You can also try the GET requests with your browser by navigating to the respeci ], "settings":{ "username":"chrisdoe", - "notifications": true + "notifications": true, + "calendarView": "default" } } ``` diff --git a/src/engine/Api/V1/Parsers/Admins.php b/src/engine/Api/V1/Parsers/Admins.php index 8a1c7ee9..23a7549d 100644 --- a/src/engine/Api/V1/Parsers/Admins.php +++ b/src/engine/Api/V1/Parsers/Admins.php @@ -39,7 +39,8 @@ class Admins implements ParsersInterface { 'notes' => $response['notes'], 'settings' => [ 'username' => $response['settings']['username'], - 'notifications' => filter_var($response['settings']['notifications'], FILTER_VALIDATE_BOOLEAN) + 'notifications' => filter_var($response['settings']['notifications'], FILTER_VALIDATE_BOOLEAN), + 'calendarView' => $response['settings']['calendar_view'] ] ]; @@ -116,6 +117,10 @@ class Admins implements ParsersInterface { $decodedRequest['settings']['notifications'] = filter_var($request['settings']['notifications'], FILTER_VALIDATE_BOOLEAN); } + + if (!empty($request['settings']['calendarView'])) { + $decodedRequest['settings']['calendar_view'] = $request['settings']['calendarView']; + } } $request = $decodedRequest; diff --git a/src/engine/Api/V1/Parsers/Providers.php b/src/engine/Api/V1/Parsers/Providers.php index 7e4635ee..13819aea 100644 --- a/src/engine/Api/V1/Parsers/Providers.php +++ b/src/engine/Api/V1/Parsers/Providers.php @@ -41,6 +41,7 @@ class Providers implements ParsersInterface { 'settings' => [ 'username' => $response['settings']['username'], 'notifications' => filter_var($response['settings']['notifications'], FILTER_VALIDATE_BOOLEAN), + 'calendarView' => $response['settings']['calendar_view'], 'googleSync' => filter_var($response['settings']['google_sync'], FILTER_VALIDATE_BOOLEAN), 'googleCalendar' => $response['settings']['google_calendar'], 'googleToken' => $response['settings']['google_token'], @@ -123,6 +124,10 @@ class Providers implements ParsersInterface { $decodedRequest['settings']['password'] = $request['settings']['password']; } + if (!empty($request['settings']['calendrView'])) { + $decodedRequest['settings']['calendr_view'] = $request['settings']['calendrView']; + } + if ($request['settings']['notifications'] !== null) { $decodedRequest['settings']['notifications'] = filter_var($request['settings']['notifications'], FILTER_VALIDATE_BOOLEAN); diff --git a/src/engine/Api/V1/Parsers/Secretaries.php b/src/engine/Api/V1/Parsers/Secretaries.php index cd12e2fb..6b200f24 100644 --- a/src/engine/Api/V1/Parsers/Secretaries.php +++ b/src/engine/Api/V1/Parsers/Secretaries.php @@ -40,7 +40,8 @@ class Secretaries implements ParsersInterface { 'providers' => $response['providers'], 'settings' => [ 'username' => $response['settings']['username'], - 'notifications' => filter_var($response['settings']['notifications'], FILTER_VALIDATE_BOOLEAN) + 'notifications' => filter_var($response['settings']['notifications'], FILTER_VALIDATE_BOOLEAN), + 'calendarView' => $response['settings']['calendar_view'] ] ]; @@ -121,6 +122,10 @@ class Secretaries implements ParsersInterface { $decodedRequest['settings']['notifications'] = filter_var($request['settings']['notifications'], FILTER_VALIDATE_BOOLEAN); } + + if (!empty($request['settings']['calendarView'])) { + $decodedRequest['settings']['calendar_view'] = $request['settings']['calendarView']; + } } $request = $decodedRequest;