Sha256: 7d07927cd01ef23d4d58061d5e1b0d063f1b9ff11b2c3d9fb3993e8a08c5e8ed

Contents?: true

Size: 951 Bytes

Versions: 4

Compression:

Stored size: 951 Bytes

Contents

module JiraIssues
  class JiraIssueMapper
    # WIP
    # ATM mapper serialises issue to JSON
    # We might consider using objects

    def call(issue)
      filter_status = decode_status(issue)
      i = JiraIssues::JiraIssue.new
      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.duedate
      i
    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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
jira_issues-0.0.10 lib/jira_issues/jira_issue_mapper.rb
jira_issues-0.0.9 lib/jira_issues/jira_issue_mapper.rb
jira_issues-0.0.8 lib/jira_issues/jira_issue_mapper.rb
jira_issues-0.0.7 lib/jira_issues/jira_issue_mapper.rb