Sha256: dc14c5821cb70bab9126e0cace71623eae70330ba83bfc495a6f4585065443a6

Contents?: true

Size: 1.77 KB

Versions: 1

Compression:

Stored size: 1.77 KB

Contents

module Ruboty
  module Handlers
    # Ruboty jira client
    class Jira < Base
      on(/jira project associate ?(?<project>.+)\z/,
         name: 'associate_project',
         description: 'Associate this channel with jira project')

      on(/jira details ?(?<issue>.+)/,
         name: 'issue_detail',
         description: 'issue')

      on(/jira comment on (?<issue>\S+) (?<comment>.+)/,
         name: 'comment',
         description: 'comment to issue')

      on(%r{#{ENV['JIRA_URL']}\/browse\/?(?<issue>.+)},
         all: true, name: 'issue_detail',
         description: 'comment to issue')

      on(/jira user #(?<jira_id>.+) is @(?<chat_name>.+)/,
         name: 'associate_user',
         description: 'Associate jira_id with chat_name')

      on(/jira create (?<issue_type>\S+) (?<summary>\S+) ?(?<subject>.*)/,
         name: 'create_issue',
         description: 'Create issue to Jira project')

      env :JIRA_URL, 'https://jira-domain.com:9090'
      env :JIRA_PASSWORD, 'jira password'
      env :JIRA_USERNAME, 'jira username'
      env :JIRA_CONTEXT_PATH, 'jira context path', optional: true
      env :JIRA_USE_SSL, 'jira context path', optional: true

      def associate_project(message)
        Ruboty::Jira::Actions::AssociateProject.new(message).call
      end

      def issue(message)
        Ruboty::Jira::Actions::Issue.new(message).call
      end

      def issue_detail(message)
        Ruboty::Jira::Actions::IssueDetail.new(message).call
      end

      def comment(message)
        Ruboty::Jira::Actions::Comment.new(message).call
      end

      def create_issue(message)
        Ruboty::Jira::Actions::CreateIssue.new(message).call
      end

      def associate_user(message)
        Ruboty::Jira::Actions::AssociateUser.new(message).call
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruboty-jira-0.3.0 lib/ruboty/handlers/jira.rb