lib/ruboty/jira/actions/create_issue.rb in ruboty-jira-0.2.0 vs lib/ruboty/jira/actions/create_issue.rb in ruboty-jira-0.3.0
- old
+ new
@@ -1,39 +1,21 @@
module Ruboty
module Jira
module Actions
class CreateIssue < Base
def call
- return unless valid_project
- return unless valid_user
+ return unless valid_project?
+ return unless valid_user?
issue = create_issue
message.reply <<"EOF"
Create issue
#{jira_site}#{jira_context}/browse/#{issue.key}
EOF
rescue => e
message.reply(e.message)
end
private
-
- def valid_project
- return true unless associate_project.nil?
- message.reply <<ERROR
-Please associate this channel with the jira project
-ex: @Botname jira project associate <project_name>
-ERROR
- false
- end
-
- def valid_user
- return true unless associate_user.nil?
- message.reply <<ERROR
-Please associate chat name with the jira account
-ex: @Botname jira user #<jira_user_name> is @<chat_name>
-ERROR
- false
- end
def create_issue
issue = client.Issue.build
issue.save(
fields: {