Sha256: 5ccb213838b0de1ed07b2bc4f53630bfec298f844f900782d7f155ec5b09d866

Contents?: true

Size: 1.04 KB

Versions: 5

Compression:

Stored size: 1.04 KB

Contents

require 'pact_broker/repositories'

module PactBroker
  module Tags
    module Service
      extend self
      extend PactBroker::Repositories

      def create args
        pacticipant = pacticipant_repository.find_by_name_or_create args.fetch(:pacticipant_name)
        version = version_repository.find_by_pacticipant_id_and_number_or_create pacticipant.id, args.fetch(:pacticipant_version_number)
        tag_repository.create version: version, name: args.fetch(:tag_name)
      end

      def find args
        tag_repository.find args
      end

      def delete args
        version = version_repository.find_by_pacticipant_name_and_number args.fetch(:pacticipant_name), args.fetch(:pacticipant_version_number)
        connection = PactBroker::Domain::Tag.new.db
        connection.run("delete from tags where name = '#{args.fetch(:tag_name)}' and version_id = '#{version.id}'")
      end

      def find_all_tag_names_for_pacticipant pacticipant_name
        tag_repository.find_all_tag_names_for_pacticipant pacticipant_name
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pact_broker-2.79.1 lib/pact_broker/tags/service.rb
pact_broker-2.79.0 lib/pact_broker/tags/service.rb
pact_broker-2.78.1 lib/pact_broker/tags/service.rb
pact_broker-2.78.0 lib/pact_broker/tags/service.rb
pact_broker-2.77.0 lib/pact_broker/tags/service.rb