diff options
| author | Teddy Wing | 2017-11-08 18:37:47 +0100 |
|---|---|---|
| committer | cedricnjanga | 2017-11-13 17:52:54 +0100 |
| commit | 89f518891cff138643eaa14977aa20a3ef01930d (patch) | |
| tree | 7eef684875ba54e6853ad5d6b32b9ea89fdafb0e /app | |
| parent | 80f932d417744488c7dadc53d7369ca573f1fc61 (diff) | |
| download | chouette-core-89f518891cff138643eaa14977aa20a3ef01930d.tar.bz2 | |
ComplianceCheckSets#validated: Add response body
On successful status update, respond with the `ComplianceCheckSet`
object attributes. Otherwise, respond with an error JSON.
Refs #4757
Diffstat (limited to 'app')
| -rw-r--r-- | app/controllers/api/v1/compliance_check_sets_controller.rb | 10 | ||||
| -rw-r--r-- | app/views/api/v1/compliance_check_sets/validated.rabl | 11 |
2 files changed, 20 insertions, 1 deletions
diff --git a/app/controllers/api/v1/compliance_check_sets_controller.rb b/app/controllers/api/v1/compliance_check_sets_controller.rb index e34d269ee..acb38c834 100644 --- a/app/controllers/api/v1/compliance_check_sets_controller.rb +++ b/app/controllers/api/v1/compliance_check_sets_controller.rb @@ -1,6 +1,14 @@ class Api::V1::ComplianceCheckSetsController < Api::V1::IbooController def validated @compliance_check_set = ComplianceCheckSet.find(params[:id]) - @compliance_check_set.update_status + + if @compliance_check_set.update_status + render :validated + else + render json: { + status: "error", + messages: @compliance_check_set.errors.full_messages + } + end end end diff --git a/app/views/api/v1/compliance_check_sets/validated.rabl b/app/views/api/v1/compliance_check_sets/validated.rabl new file mode 100644 index 000000000..1368a8014 --- /dev/null +++ b/app/views/api/v1/compliance_check_sets/validated.rabl @@ -0,0 +1,11 @@ +object @compliance_check_set + +attributes( + :id, + :referential_id, + :name, + :creator, + :status, + :started_at, + :ended_at +) |
