Class: JiraCommand::Jira::Epic

Inherits:
Base
  • Object
show all
Defined in:
lib/jira_command/jira/epic.rb

Instance Attribute Summary

Attributes inherited from Base

#config, #conn

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from JiraCommand::Jira::Base

Instance Method Details

#issue_key_without_epicObject



29
30
31
32
33
34
# File 'lib/jira_command/jira/epic.rb', line 29

def issue_key_without_epic
  res = @conn.get('rest/agile/1.0/epic/none/issue')
  body = JSON.parse(res.body)

  body['issues'].map { |item| item['key'] }
end

#list(board_id:) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/jira_command/jira/epic.rb', line 10

def list(board_id:)
  res = @conn.get("rest/agile/1.0/board/#{board_id}/epic")

  body = JSON.parse(res.body)

  body['values'].map { |item| { name: item['name'], id: item['id'] } }
end

#move_issue(issue_key:, epic_id:) ⇒ Object



18
19
20
21
22
23
24
25
26
27
# File 'lib/jira_command/jira/epic.rb', line 18

def move_issue(issue_key:, epic_id:)
  @conn.post do |req|
    req.url "rest/agile/1.0/epic/#{epic_id}/issue"
    req.body = {
      issues: [
        issue_key
      ]
    }.to_json
  end
end