Class: Lita::Handlers::Jira
- Inherits:
-
Handler
- Object
- Handler
- Lita::Handlers::Jira
- Defined in:
- lib/lita/handlers/jira.rb
Overview
Main handler rubocop:disable Metrics/ClassLength
Constant Summary
Constants included from JiraHelper::Regex
JiraHelper::Regex::AMBIENT_PATTERN, 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
- #ambient(response) ⇒ Object
- #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_issue_link, #format_issues, #optional_issue_property
Instance Method Details
#ambient(response) ⇒ Object
118 119 120 121 122 |
# File 'lib/lita/handlers/jira.rb', line 118 def ambient(response) return if invalid_ambient?(response) issue = fetch_issue(response.match_data['issue'], false) response.reply(format_issue(issue)) if issue end |
#comment(response) ⇒ Object
85 86 87 88 89 90 91 |
# File 'lib/lita/handlers/jira.rb', line 85 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
79 80 81 82 83 |
# File 'lib/lita/handlers/jira.rb', line 79 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
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/lita/handlers/jira.rb', line 102 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')) if issues.empty? response.reply(format_issues(issues)) end |
#summary(response) ⇒ Object
73 74 75 76 77 |
# File 'lib/lita/handlers/jira.rb', line 73 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
93 94 95 96 97 98 99 |
# File 'lib/lita/handlers/jira.rb', line 93 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 |