Added 'availabilitiesType' to REST API (#185).

This commit is contained in:
Alex Tselegidis 2016-07-20 21:24:00 +02:00
parent 29a694e5de
commit 4d5b3ecad2
2 changed files with 8 additions and 0 deletions

View file

@ -186,6 +186,7 @@ You can also try the GET requests with your browser by navigating to the respeci
"price": 10.00,
"currency": "Euro",
"description": "Male haircut trends.",
"availabilitiesType": "flexible",
"categoryId": null
}
```
@ -195,6 +196,8 @@ You can also try the GET requests with your browser by navigating to the respeci
- `PUT /api/v1/services/:id` Provide the updated service JSON in the request body to update an existing record. The ID in the URI is required.
- `DELETLE /api/v1/services/:id` Remove an existing service record.
* The `availabilitiesType` must be either `flexible` or `fixed`.
### Categories
**Resource JSON**

View file

@ -32,6 +32,7 @@ class Services implements ParsersInterface {
'price' => $response['price'],
'currency' => $response['currency'],
'description' => $response['description'],
'availabilitiesType' => $response['availabilities_type'],
'categoryId' => $response['id_service_categories'] !== null ? (int)$response['id_service_categories'] : null
];
@ -71,6 +72,10 @@ class Services implements ParsersInterface {
$decodedRequest['description'] = $request['description'];
}
if (!empty($request['availabilitiesType'])) {
$decodedRequest['availabilities_type'] = $request['availabilitiesType'];
}
if (!empty($request['categoryId'])) {
$decodedRequest['id_service_categories'] = $request['categoryId'];
}