Module: Legion::Extensions::Jira::Agile::Runners::Sprints
- Includes:
- Helpers::Lex, Helpers::Client
- Included in:
- Client
- Defined in:
- lib/legion/extensions/jira/agile/runners/sprints.rb
Instance Method Summary
collapse
-
#create_sprint(name:, board_id:, start_date: nil, end_date: nil, goal: nil) ⇒ Object
-
#delete_sprint(sprint_id:) ⇒ Object
-
#get_sprint(sprint_id:) ⇒ Object
-
#get_sprint_issues(sprint_id:, jql: nil, start_at: 0, max_results: 50) ⇒ Object
-
#move_issues_to_sprint(sprint_id:, issue_keys:) ⇒ Object
-
#update_sprint(sprint_id:, name: nil, state: nil, start_date: nil, end_date: nil, goal: nil) ⇒ Object
#connection, #upload_connection
Instance Method Details
#create_sprint(name:, board_id:, start_date: nil, end_date: nil, goal: nil) ⇒ Object
18
19
20
21
22
23
24
25
|
# File 'lib/legion/extensions/jira/agile/runners/sprints.rb', line 18
def create_sprint(name:, board_id:, start_date: nil, end_date: nil, goal: nil, **)
body = { name: name, originBoardId: board_id }
body[:startDate] = start_date if start_date
body[:endDate] = end_date if end_date
body[:goal] = goal if goal
resp = connection(**).post('/rest/agile/1.0/sprint', body)
{ sprint: resp.body }
end
|
#delete_sprint(sprint_id:) ⇒ Object
38
39
40
41
|
# File 'lib/legion/extensions/jira/agile/runners/sprints.rb', line 38
def delete_sprint(sprint_id:, **)
resp = connection(**).delete("/rest/agile/1.0/sprint/#{sprint_id}")
{ deleted: resp.status == 204, sprint_id: sprint_id }
end
|
#get_sprint(sprint_id:) ⇒ Object
13
14
15
16
|
# File 'lib/legion/extensions/jira/agile/runners/sprints.rb', line 13
def get_sprint(sprint_id:, **)
resp = connection(**).get("/rest/agile/1.0/sprint/#{sprint_id}")
{ sprint: resp.body }
end
|
#get_sprint_issues(sprint_id:, jql: nil, start_at: 0, max_results: 50) ⇒ Object
43
44
45
46
47
48
|
# File 'lib/legion/extensions/jira/agile/runners/sprints.rb', line 43
def get_sprint_issues(sprint_id:, jql: nil, start_at: 0, max_results: 50, **)
params = { startAt: start_at, maxResults: max_results }
params[:jql] = jql if jql
resp = connection(**).get("/rest/agile/1.0/sprint/#{sprint_id}/issue", params)
{ issues: resp.body }
end
|
#move_issues_to_sprint(sprint_id:, issue_keys:) ⇒ Object
50
51
52
53
|
# File 'lib/legion/extensions/jira/agile/runners/sprints.rb', line 50
def move_issues_to_sprint(sprint_id:, issue_keys:, **)
resp = connection(**).post("/rest/agile/1.0/sprint/#{sprint_id}/issue", { issues: issue_keys })
{ moved: resp.status == 204, sprint_id: sprint_id }
end
|
#update_sprint(sprint_id:, name: nil, state: nil, start_date: nil, end_date: nil, goal: nil) ⇒ Object
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/legion/extensions/jira/agile/runners/sprints.rb', line 27
def update_sprint(sprint_id:, name: nil, state: nil, start_date: nil, end_date: nil, goal: nil, **)
body = {}
body[:name] = name if name
body[:state] = state if state
body[:startDate] = start_date if start_date
body[:endDate] = end_date if end_date
body[:goal] = goal if goal
resp = connection(**).put("/rest/agile/1.0/sprint/#{sprint_id}", body)
{ sprint: resp.body }
end
|