module JiraIssues class JiraIssueMapper # WIP # ATM mapper serialises issue to JSON # We might consider using objects def call(issue) filter_status = decode_status(issue) JiraIssues::JiraIssue.new do |i| i.key = issue.key i.type = issue.issuetype.name i.priority = issue.priority.name i.status = issue.status.name i.filter_status = filter_status i.description = issue.description i.summary = issue.summary i.assignee = issue.assignee i.reporter = issue.reporter i.created_date = issue.created i.closed_date = issue.resolutiondate i.due_date = issue.due_date end end private def decode_status(issue) JiraIssues::JiraWorkflow.issue_status_for_name(project_key(issue),issue.status.name) end def project_key(issue) issue.key.split('-').first end end end