class Dude::ProjectManagement::Jira::FetchCurrentTasks
Attributes
client[R]
Public Class Methods
new(client)
click to toggle source
# File lib/dude/project_management/jira/fetch_current_tasks.rb, line 9 def initialize(client) @client = client end
Public Instance Methods
call()
click to toggle source
# File lib/dude/project_management/jira/fetch_current_tasks.rb, line 13 def call board = client.Board.find(Dude::SETTINGS.dig(:jira, :board_id)) all_issues = board_type(board) all_issues.map { |issue| create_issue(issue) } end
Private Instance Methods
board_type(board)
click to toggle source
# File lib/dude/project_management/jira/fetch_current_tasks.rb, line 25 def board_type(board) case board.type when 'kanban' then board.issues when 'simple', 'scrum' then board.sprints(state: 'active').flat_map(&:issues) else raise Dude::ToBeImplementedError end end
create_issue(issue)
click to toggle source
# File lib/dude/project_management/jira/fetch_current_tasks.rb, line 33 def create_issue(issue) Entities::Issue.new( id: issue.key, title: issue.summary, description: issue.description, status: issue.status.name, assignee: issue&.assignee&.displayName, url: "#{Dude::SETTINGS.dig(:jira, :project, :url)}/browse/#{issue.key}" ) end