Sha256: 9a1d28e8fba59c57c6c6c7146918a26a4a6be5936613cb47d81dbf196794c8b0

Contents?: true

Size: 1.28 KB

Versions: 9

Compression:

Stored size: 1.28 KB

Contents

require 'pact_broker/services'
require 'pact_broker/repositories'
require 'pact_broker/logging'
require 'pact_broker/integrations/integration'

module PactBroker
  module Integrations
    class Service
      extend PactBroker::Repositories
      extend PactBroker::Services
      include PactBroker::Logging

      def self.find_all
        PactBroker::Integrations::Integration.eager(:consumer).eager(:provider).all
      end

      def self.delete(consumer_name, provider_name)
        consumer = pacticipant_service.find_pacticipant_by_name(consumer_name)
        provider = pacticipant_service.find_pacticipant_by_name(provider_name)
        # this takes care of the triggered webhooks and webhook executions
        pact_service.delete_all_pact_publications_between(consumer_name, and: provider_name)
        verification_service.delete_all_verifications_between(consumer_name, and: provider_name)
        pact_service.delete_all_pact_versions_between(consumer_name, and: provider_name)
        webhook_repository.delete_by_consumer_and_provider(consumer, provider)
        version_repository.delete_orphan_versions(consumer, provider)

        pacticipant_service.delete_if_orphan(consumer)
        pacticipant_service.delete_if_orphan(provider) unless consumer == provider
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
pact_broker-2.38.1 lib/pact_broker/integrations/service.rb
pact_broker-2.38.0 lib/pact_broker/integrations/service.rb
pact_broker-2.37.0 lib/pact_broker/integrations/service.rb
pact_broker-2.36.1 lib/pact_broker/integrations/service.rb
pact_broker-2.36.0 lib/pact_broker/integrations/service.rb
pact_broker-2.35.0 lib/pact_broker/integrations/service.rb
pact_broker-2.34.0 lib/pact_broker/integrations/service.rb
pact_broker-2.33.0 lib/pact_broker/integrations/service.rb
pact_broker-2.32.0 lib/pact_broker/integrations/service.rb