# 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