Sha256: 03c6e05de7c3c836e55d8c60a412209749acfcf48c64377232398e02b559965a

Contents?: true

Size: 624 Bytes

Versions: 2

Compression:

Stored size: 624 Bytes

Contents

# frozen_string_literal: true

require "gitlab"

module Gitlab
  class Pipeline
    attr_accessor :id
    attr_accessor :status
    attr_accessor :created_at

    def initialize(id, status, created_at)
      @id = id
      @status = status
      @created_at = created_at
    end
  end

  def running?
    @status == "running"
  end
  class Client < API
    def running_pipelines_for_mr(project_id, mr_iid)
      pipelines = merge_request_pipelines(project_id, mr_iid)
      pipelines.filter { |p| p.status == "running" }
        .map { |p| Pipeline.new(p.id.to_i, p.status, DateTime.parse(p.created_at)) }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
danger-gitlab_cancelbot-1.0.1 lib/gitlab_cancelbot/gitlab.rb
danger-gitlab_cancelbot-1.0.0 lib/gitlab_cancelbot/gitlab.rb