class PactBroker::Integrations::Service
Public Class Methods
Source
# File lib/pact_broker/integrations/service.rb, line 36 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) integration_repository.delete(consumer.id, provider.id) pacticipant_service.delete_if_orphan(consumer) pacticipant_service.delete_if_orphan(provider) unless consumer == provider end
Source
# File lib/pact_broker/integrations/service.rb, line 50 def self.delete_all # TODO move all these into their own repositories PactBroker::DB.each_integration_model do | model | if PactBroker::Dataset::Helpers.postgres? logger.info("Truncating ", model.table_name) model.truncate(cascade: true) else logger.info("Deleting all from ", model.table_name) # Mysql adapter needs to support cascade truncate # https://travis-ci.org/pact-foundation/pact_broker/jobs/633050220#L841 # https://travis-ci.org/pact-foundation/pact_broker/jobs/633053228#L849 model.dataset.delete end end end
Source
# File lib/pact_broker/integrations/service.rb, line 16 def self.find_all(filter_options = {}, pagination_options = {}, eager_load_associations = []) integration_repository.find(filter_options, pagination_options, eager_load_associations) end
Source
# File lib/pact_broker/integrations/service.rb, line 66 def self.find_for_provider(provider) scope_for(PactBroker::Integrations::Integration).where(provider_id: provider.id).eager(:consumer).eager(:provider).all.sort end
Source
# File lib/pact_broker/integrations/service.rb, line 31 def self.handle_bulk_contract_data_published(objects_with_consumer_and_provider) integration_repository.create_for_pacts(objects_with_consumer_and_provider) integration_repository.set_contract_data_updated_at_for_multiple_integrations(objects_with_consumer_and_provider) end
Callback to invoke when a batch of contract data is published (eg. the publish contracts endpoint) @param [Array<Object>] where each object has a consumer and a provider
Source
# File lib/pact_broker/integrations/service.rb, line 23 def self.handle_contract_data_published(consumer, provider) integration_repository.create_for_pact(consumer.id, provider.id) integration_repository.set_contract_data_updated_at(consumer, provider) end
Callback to invoke when a consumer contract, verification result (or provider contract in Pactflow) is published @param [PactBroker::Domain::Pacticipant] consumer or nil @param [PactBroker::Domain::Pacticipant] provider