Sha256: ca1d0f186470c418038fe30e42bb10b485587fe9a0fe53ee4070ffabae0a5b13

Contents?: true

Size: 874 Bytes

Versions: 1

Compression:

Stored size: 874 Bytes

Contents

require 'pact_broker/repositories'

module PactBroker

  module Services
    class PacticipantService

      extend PactBroker::Repositories

      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

      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
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pact_broker-0.0.1 lib/pact_broker/services/pacticipant_service.rb