Sha256: 1e256e6bae40d9bc84d08b624b5cfd179acaf3cefffbc6ed42ad8371c00dd06b

Contents?: true

Size: 927 Bytes

Versions: 20

Compression:

Stored size: 927 Bytes

Contents

module Lita
  module GithubPrList
    class MergeRequest
      attr_accessor :id, :title, :state, :redis

      def initialize(params = {})
        self.id = params[:id]
        self.title = params[:title]
        self.state = params[:state]
        self.redis = params[:redis]
      end

      def open?
        state == 'opened'
      end

      def handle
        if open?
          add_merge_request
        else
          remove_merge_request
        end
      end

    private

      def url
        "https://gitlab.corp.ads/ama/#{project}/merge_requests/#{id}"
      end

      def project
        'rails_envs'
      end

      def emoji
        "(new)"
      end

      def message
        "#{project} #{emoji} #{title} #{url}"
      end

      def add_merge_request
        redis.set("gitlab_mr_#{id}", message)
      end

      def remove_merge_request
        redis.del("gitlab_mr_#{id}")
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
lita-github_pr_list-0.3.2 lib/lita/github_pr_list/merge_request.rb
lita-github_pr_list-0.3.1 lib/lita/github_pr_list/merge_request.rb
lita-github_pr_list-0.3.0 lib/lita/github_pr_list/merge_request.rb
lita-github_pr_list-0.2.2 lib/lita/github_pr_list/merge_request.rb
lita-github_pr_list-0.2.1 lib/lita/github_pr_list/merge_request.rb
lita-github_pr_list-0.2.0 lib/lita/github_pr_list/merge_request.rb
lita-github_pr_list-0.1.3 lib/lita/github_pr_list/merge_request.rb
lita-github_pr_list-0.1.2 lib/lita/github_pr_list/merge_request.rb
lita-github_pr_list-0.1.1 lib/lita/github_pr_list/merge_request.rb
lita-github_pr_list-0.1.0 lib/lita/github_pr_list/merge_request.rb
lita-github_pr_list-0.0.21 lib/lita/github_pr_list/merge_request.rb
lita-github_pr_list-0.0.20 lib/lita/github_pr_list/merge_request.rb
lita-github_pr_list-0.0.19 lib/lita/github_pr_list/merge_request.rb
lita-github_pr_list-0.0.16 lib/lita/github_pr_list/merge_request.rb
lita-github_pr_list-0.0.15 lib/lita/github_pr_list/merge_request.rb
lita-github_pr_list-0.0.14 lib/lita/github_pr_list/merge_request.rb
lita-github_pr_list-0.0.13 lib/lita/github_pr_list/merge_request.rb
lita-github_pr_list-0.0.12 lib/lita/github_pr_list/merge_request.rb
lita-github_pr_list-0.0.11 lib/lita/github_pr_list/merge_request.rb
lita-github_pr_list-0.0.10 lib/lita/github_pr_list/merge_request.rb