Skip to content

Commit af22e98

Browse files
author
filipe.barcelos
committed
Adds revisions detailed documentation
1 parent 1efb56c commit af22e98

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

app/controllers/revisions_controller.rb

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,83 @@ class RevisionsController < ApplicationController
1111
validate_sprint_dependencies(:id, "revision")
1212
end
1313

14+
def_param_group :revision do
15+
param :done_report, Array, of: String, :desc => "Sprint revision's done report"
16+
param :undone_report, Array, of: String, :desc => "Sprint revision's undone report"
17+
param :created_at, Date, "Revision's time of creation", :allow_nil => false
18+
param :updated_at, Date, "Revision's time of edition", :allow_nil => false
19+
param :sprint_id, :number, "Id of sprint revised"
20+
end
21+
22+
api :GET, "/sprints/:sprint_id/revisions", "Show revisions for a sprint"
23+
error :code => 401, :desc => "Unauthorized"
24+
error :code => 404, :desc => "Not Found"
25+
error :code => 500, :desc => "Internal Server Error"
26+
description "Show all revisions of a specific sprint"
27+
returns :code => 200, :desc => "Ok" do
28+
param_group :revision
29+
end
30+
example <<-EOS
31+
{
32+
"id": 1,
33+
"done_report": [
34+
"Story US11 was done."
35+
],
36+
"undone_report": [
37+
"Story US21 was not done."
38+
],
39+
"created_at": "2019-04-11T15:42:35.826Z",
40+
"updated_at": "2019-04-11T15:42:35.826Z",
41+
"sprint_id": 1
42+
}
43+
EOS
1444
def index
1545
@revision = @sprint.revision
1646
render json: @revision
1747
end
1848

49+
api :POST, "/sprints/:sprint_id/revisions", "Create a revision"
50+
error :code => 401, :desc => "Unauthorized"
51+
error :code => 404, :desc => "Not Found"
52+
error :code => 500, :desc => "Internal Server Error"
53+
description 'Create revision for a specific sprint'
54+
param_group :revision
1955
def create
2056
create_sprint_dependencies("revision", revision_params)
2157
end
2258

59+
api :GET, "/revisions/:id", "Show a revision"
60+
error :code => 401, :desc => "Unauthorized"
61+
error :code => 404, :desc => "Not Found"
62+
error :code => 500, :desc => "Internal Server Error"
63+
description "Show a revision of a specific sprint"
64+
returns :code => 200, :desc => "Ok" do
65+
param_group :revision
66+
end
67+
example <<-EOS
68+
{
69+
"id": 2,
70+
"done_report": [
71+
"Story US12 was done."
72+
],
73+
"undone_report": [
74+
"Story US22 was not done."
75+
],
76+
"created_at": "2019-04-11T15:42:35.851Z",
77+
"updated_at": "2019-04-11T15:42:35.851Z",
78+
"sprint_id": 2
79+
}
80+
EOS
2381
def show
2482
render json: @revision
2583
end
2684

85+
api :PATCH, "/revisions/:id", "Update a revision"
86+
error :code => 401, :desc => "Unauthorized"
87+
error :code => 404, :desc => "Not Found"
88+
error :code => 500, :desc => "Internal Server Error"
89+
description 'Update revision for a specific sprint'
90+
param_group :revision
2791
def update
2892
if @revision.update(revision_params)
2993
render json: @revision
@@ -32,6 +96,12 @@ def update
3296
end
3397
end
3498

99+
api :DELETE, "/revisions/:id", "Delete a revision"
100+
error :code => 401, :desc => "Unauthorized"
101+
error :code => 404, :desc => "Not Found"
102+
error :code => 500, :desc => "Internal Server Error"
103+
description 'Delete revision for a specific sprint'
104+
param_group :revision
35105
def destroy
36106
@revision.destroy
37107
end

0 commit comments

Comments
 (0)