Class: Lita::Handlers::Jira
- Inherits:
-
Handler
- Object
- Handler
- Lita::Handlers::Jira
- Defined in:
- lib/lita/handlers/jira.rb
Overview
Main handler
Constant Summary
Constants included from JiraHelper::Regex
JiraHelper::Regex::COMMENT_PATTERN, JiraHelper::Regex::EMAIL_PATTERN, JiraHelper::Regex::ISSUE_PATTERN, JiraHelper::Regex::PROJECT_PATTERN, JiraHelper::Regex::SUBJECT_PATTERN, JiraHelper::Regex::SUMMARY_PATTERN
Instance Method Summary collapse
- #comment(response) ⇒ Object
- #details(response) ⇒ Object
-
#myissues(response) ⇒ Object
rubocop:disable Metrics/AbcSize.
- #summary(response) ⇒ Object
- #todo(response) ⇒ Object
Methods included from JiraHelper::Utility
#delete_user!, #get_email, #normalize_user, #store_user!, #user_stored?
Methods included from JiraHelper::Misc
Methods included from JiraHelper::Issue
#create_issue, #fetch_issue, #fetch_issues, #fetch_project, #format_issue, #format_issues, #optional_issue_property
Instance Method Details
#comment(response) ⇒ Object
76 77 78 79 80 81 82 |
# File 'lib/lita/handlers/jira.rb', line 76 def comment(response) issue = fetch_issue(response.match_data['issue']) return response.reply(t('error.request')) unless issue comment = issue.comments.build comment.save!(body: response.match_data['comment']) response.reply(t('comment.added', issue: issue.key)) end |
#details(response) ⇒ Object
70 71 72 73 74 |
# File 'lib/lita/handlers/jira.rb', line 70 def details(response) issue = fetch_issue(response.match_data['issue']) return response.reply(t('error.request')) unless issue response.reply(format_issue(issue)) end |
#myissues(response) ⇒ Object
rubocop:disable Metrics/AbcSize
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/lita/handlers/jira.rb', line 93 def myissues(response) return response.reply(t('error.not_identified')) unless user_stored?(response.user) begin issues = fetch_issues("assignee = '#{get_email(response.user)}' AND status not in (Closed)") rescue log.error('JIRA HTTPError') response.reply(t('error.request')) return end return response.reply(t('myissues.empty')) unless issues.size > 0 response.reply(format_issues(issues)) end |
#summary(response) ⇒ Object
64 65 66 67 68 |
# File 'lib/lita/handlers/jira.rb', line 64 def summary(response) issue = fetch_issue(response.match_data['issue']) return response.reply(t('error.request')) unless issue response.reply(t('issue.summary', key: issue.key, summary: issue.summary)) end |
#todo(response) ⇒ Object
84 85 86 87 88 89 90 |
# File 'lib/lita/handlers/jira.rb', line 84 def todo(response) issue = create_issue(response.match_data['project'], response.match_data['subject'], response.match_data['summary']) return response.reply(t('error.request')) unless issue response.reply(t('issue.created', key: issue.key)) end |