Class: PactBroker::Services::PacticipantService

Inherits:
Object
  • Object
show all
Extended by:
Repositories
Defined in:
lib/pact_broker/services/pacticipant_service.rb

Class Method Summary collapse

Methods included from Repositories

pact_repository, pacticipant_repository, version_repository

Class Method Details

.create_or_update_pacticipant(params) ⇒ Object



19
20
21
22
23
24
25
26
27
28
# File 'lib/pact_broker/services/pacticipant_service.rb', line 19

def self.create_or_update_pacticipant params
  pacticipant = pacticipant_repository.find_by_name(params[:name])
  if pacticipant
    pacticipant.update(repository_url: params[:repository_url])
    return pacticipant, false
  else
    pacticipant = pacticipant_repository.create(name: params[:name], repository_url: params[:repository_url])
    return pacticipant, true
  end
end

.find_pacticipant_repository_url_by_pacticipant_name(name) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/pact_broker/services/pacticipant_service.rb', line 10

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