From 6d081ad47164befa8364703b9475c0d77bc3bd3c Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Thu, 21 Jul 2016 21:00:38 +0200 Subject: [PATCH] Added 'attendants_number' setting to REST API (#109). --- doc/rest-api.md | 1 + src/engine/Api/V1/Parsers/Services.php | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/doc/rest-api.md b/doc/rest-api.md index 0996643c..72eb7896 100644 --- a/doc/rest-api.md +++ b/doc/rest-api.md @@ -187,6 +187,7 @@ You can also try the GET requests with your browser by navigating to the respeci "currency": "Euro", "description": "Male haircut trends.", "availabilitiesType": "flexible", + "attendantsNumber": 1, "categoryId": null } ``` diff --git a/src/engine/Api/V1/Parsers/Services.php b/src/engine/Api/V1/Parsers/Services.php index 25ab4b60..cc8edd18 100644 --- a/src/engine/Api/V1/Parsers/Services.php +++ b/src/engine/Api/V1/Parsers/Services.php @@ -28,11 +28,12 @@ class Services implements ParsersInterface { $encodedResponse = [ 'id' => $response['id'] !== null ? (int)$response['id'] : null, 'name' => $response['name'], - 'duration' => $response['duration'], - 'price' => $response['price'], + 'duration' => (int)$response['duration'], + 'price' => (float)$response['price'], 'currency' => $response['currency'], 'description' => $response['description'], 'availabilitiesType' => $response['availabilities_type'], + 'attendantsNumber' => (int)$response['attendants_number'], 'categoryId' => $response['id_service_categories'] !== null ? (int)$response['id_service_categories'] : null ]; @@ -76,6 +77,10 @@ class Services implements ParsersInterface { $decodedRequest['availabilities_type'] = $request['availabilitiesType']; } + if (!empty($request['attendantsNumber'])) { + $decodedRequest['attendants_number'] = $request['attendantsNumber']; + } + if (!empty($request['categoryId'])) { $decodedRequest['id_service_categories'] = $request['categoryId']; }