class PactBroker::Pacticipants::Service
Public Class Methods
create(params)
click to toggle source
# File lib/pact_broker/pacticipants/service.rb, line 71 def self.create(params) pacticipant_repository.create(params) end
delete(name)
click to toggle source
# File lib/pact_broker/pacticipants/service.rb, line 79 def self.delete(name) pacticipant = find_pacticipant_by_name name webhook_service.delete_all_webhhook_related_objects_by_pacticipant(pacticipant) pacticipant.destroy end
delete_if_orphan(pacticipant)
click to toggle source
# File lib/pact_broker/pacticipants/service.rb, line 85 def self.delete_if_orphan(pacticipant) pacticipant_repository.delete_if_orphan(pacticipant) end
find(options)
click to toggle source
# File lib/pact_broker/pacticipants/service.rb, line 50 def self.find(options) pacticipant_repository.find options end
find_all_pacticipant_versions_in_reverse_order(name, pagination_options = nil)
click to toggle source
# File lib/pact_broker/pacticipants/service.rb, line 54 def self.find_all_pacticipant_versions_in_reverse_order(name, pagination_options = nil) pacticipant_repository.find_all_pacticipant_versions_in_reverse_order(name, pagination_options) end
find_all_pacticipants()
click to toggle source
# File lib/pact_broker/pacticipants/service.rb, line 34 def self.find_all_pacticipants pacticipant_repository.find_all end
find_by_id(id)
click to toggle source
# File lib/pact_broker/pacticipants/service.rb, line 46 def self.find_by_id(id) pacticipant_repository.find_by_id(id) end
find_pacticipant_by_name(name)
click to toggle source
# File lib/pact_broker/pacticipants/service.rb, line 38 def self.find_pacticipant_by_name(name) pacticipant_repository.find_by_name(name) end
find_pacticipant_by_name!(name)
click to toggle source
# File lib/pact_broker/pacticipants/service.rb, line 42 def self.find_pacticipant_by_name!(name) pacticipant_repository.find_by_name!(name) end
find_pacticipant_repository_url_by_pacticipant_name(name)
click to toggle source
# File lib/pact_broker/pacticipants/service.rb, line 58 def self.find_pacticipant_repository_url_by_pacticipant_name(name) pacticipant = pacticipant_repository.find_by_name(name) if pacticipant && pacticipant.repository_url pacticipant.repository_url else nil end end
find_potential_duplicate_pacticipants(pacticipant_name)
click to toggle source
# File lib/pact_broker/pacticipants/service.rb, line 25 def self.find_potential_duplicate_pacticipants pacticipant_name PactBroker::Pacticipants::FindPotentialDuplicatePacticipantNames .call(pacticipant_name, pacticipant_names).tap { | names| if names.any? logger.info "The following potential duplicate pacticipants were found for #{pacticipant_name}: #{names.join(", ")}" end } .collect{ | name | pacticipant_repository.find_by_name(name) } end
maybe_set_main_branch(pacticipant, potential_main_branch)
click to toggle source
# File lib/pact_broker/pacticipants/service.rb, line 93 def self.maybe_set_main_branch(pacticipant, potential_main_branch) if pacticipant.main_branch.nil? && PactBroker.configuration.auto_detect_main_branch && PactBroker.configuration.main_branch_candidates.include?(potential_main_branch) logger.info "Setting #{pacticipant.name} main_branch to '#{potential_main_branch}' (because the #{pacticipant.name} main_branch was nil and auto_detect_main_branch=true)" pacticipant_repository.set_main_branch(pacticipant, potential_main_branch) else pacticipant end end
messages_for_potential_duplicate_pacticipants(pacticipant_names, base_url)
click to toggle source
# File lib/pact_broker/pacticipants/service.rb, line 14 def self.messages_for_potential_duplicate_pacticipants(pacticipant_names, base_url) messages = [] pacticipant_names.each do | name | potential_duplicate_pacticipants = find_potential_duplicate_pacticipants(name) if potential_duplicate_pacticipants.any? messages << Messages.potential_duplicate_pacticipant_message(name, potential_duplicate_pacticipants, base_url) end end messages end
pacticipant_names()
click to toggle source
# File lib/pact_broker/pacticipants/service.rb, line 89 def self.pacticipant_names pacticipant_repository.pacticipant_names end
replace(pacticipant_name, open_struct_pacticipant)
click to toggle source
# File lib/pact_broker/pacticipants/service.rb, line 75 def self.replace(pacticipant_name, open_struct_pacticipant) pacticipant_repository.replace(pacticipant_name, open_struct_pacticipant) end
update(pacticipant_name, pacticipant)
click to toggle source
# File lib/pact_broker/pacticipants/service.rb, line 67 def self.update(pacticipant_name, pacticipant) pacticipant_repository.update(pacticipant_name, pacticipant) end