Added 'attendants_number' setting to REST API (#109).

This commit is contained in:
Alex Tselegidis 2016-07-21 21:00:38 +02:00
parent b35ab3bbe3
commit 6d081ad471
2 changed files with 8 additions and 2 deletions

View file

@ -187,6 +187,7 @@ You can also try the GET requests with your browser by navigating to the respeci
"currency": "Euro", "currency": "Euro",
"description": "Male haircut trends.", "description": "Male haircut trends.",
"availabilitiesType": "flexible", "availabilitiesType": "flexible",
"attendantsNumber": 1,
"categoryId": null "categoryId": null
} }
``` ```

View file

@ -28,11 +28,12 @@ class Services implements ParsersInterface {
$encodedResponse = [ $encodedResponse = [
'id' => $response['id'] !== null ? (int)$response['id'] : null, 'id' => $response['id'] !== null ? (int)$response['id'] : null,
'name' => $response['name'], 'name' => $response['name'],
'duration' => $response['duration'], 'duration' => (int)$response['duration'],
'price' => $response['price'], 'price' => (float)$response['price'],
'currency' => $response['currency'], 'currency' => $response['currency'],
'description' => $response['description'], 'description' => $response['description'],
'availabilitiesType' => $response['availabilities_type'], 'availabilitiesType' => $response['availabilities_type'],
'attendantsNumber' => (int)$response['attendants_number'],
'categoryId' => $response['id_service_categories'] !== null ? (int)$response['id_service_categories'] : null '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']; $decodedRequest['availabilities_type'] = $request['availabilitiesType'];
} }
if (!empty($request['attendantsNumber'])) {
$decodedRequest['attendants_number'] = $request['attendantsNumber'];
}
if (!empty($request['categoryId'])) { if (!empty($request['categoryId'])) {
$decodedRequest['id_service_categories'] = $request['categoryId']; $decodedRequest['id_service_categories'] = $request['categoryId'];
} }