Sha256: 9eaf096a21f9e708b809efb14bcdd4b6cd54a7ab531af647b32cf98eaca02d81

Contents?: true

Size: 915 Bytes

Versions: 1

Compression:

Stored size: 915 Bytes

Contents

# Helper functions for lita-jira
module JiraHelper
  # Issues
  module Issue
    def fetch_issue(key)
      client.Issue.find(key)
      rescue
        log.error('JIRA HTTPError')
        nil
    end

    def fetch_project(key)
      client.Project.find(key)
      rescue
        log.error('JIRA HTTPError')
        nil
    end

    def format_issue(issue)
      t('issue.details',
        key: issue.key,
        summary: issue.summary,
        assigned: issue.assignee.displayName,
        priority: issue.priority.name,
        status: issue.status.name)
    end

    def create_issue(project, subject, summary)
      project = fetch_project(project)
      return nil unless project
      issue = client.Issue.build
      issue.save(fields: { subject: subject,
                           summary: summary,
                           project: { id: project.id } })
      issue.fetch
      issue
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lita-jira-0.5.0 lib/jirahelper/issue.rb