Class: JiraCommand::Jira::Sprint
- Defined in:
- lib/jira_command/jira/sprint.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #create(name:, board_id:, start_date:, end_date:) ⇒ Object
-
#list(board_id:, query: {}) ⇒ Object
docs.atlassian.com/jira-software/REST/7.3.1/#agile/1.0/board/boardId/sprint-getAllSprints.
- #move_issue(issue_key:, sprint_id:) ⇒ Object
Methods inherited from Base
Constructor Details
This class inherits a constructor from JiraCommand::Jira::Base
Instance Method Details
#create(name:, board_id:, start_date:, end_date:) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/jira_command/jira/sprint.rb', line 38 def create(name:, board_id:, start_date:, end_date:) request_body = { name: name, originBoardId: board_id } request_body.merge!({ startDate: start_date }) unless start_date.nil? request_body.merge!({ endDate: end_date }) unless end_date.nil? @conn.post do |req| req.url 'rest/agile/1.0/sprint' req.body = request_body.to_json end end |
#list(board_id:, query: {}) ⇒ Object
docs.atlassian.com/jira-software/REST/7.3.1/#agile/1.0/board/boardId/sprint-getAllSprints
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/jira_command/jira/sprint.rb', line 10 def list(board_id:, query: {}) res = @conn.get("rest/agile/1.0/board/#{board_id}/sprint?" + URI.encode_www_form(query)) body = JSON.parse(res.body) body['values'].map do |item| { name: item['name'], id: item['id'], state: item['state'], start_date: item['startDate'], end_date: item['endDate'] } end end |
#move_issue(issue_key:, sprint_id:) ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/jira_command/jira/sprint.rb', line 26 def move_issue(issue_key:, sprint_id:) @conn.post do |req| req.url "rest/agile/1.0/sprint/#{sprint_id}/issue" req.body = { issues: [ issue_key ] }.to_json end end |