Sha256: d9eef4998f4808ec3c440923176478306e30228109c9e83f032dd53f77a103aa

Contents?: true

Size: 732 Bytes

Versions: 6

Compression:

Stored size: 732 Bytes

Contents

require 'sequel'
require 'pact_broker/models/pacticipant'

module PactBroker
  module Repositories
    class PacticipantRepository

      def find_by_name name
        PactBroker::Models::Pacticipant.where(name: name).single_record
      end

      def find_all
        PactBroker::Models::Pacticipant.order(:name).all
      end

      def find_by_name_or_create name
        if pacticipant = find_by_name(name)
          pacticipant
        else
          create name: name
        end
      end

      def create args
        PactBroker::Models::Pacticipant.new(name: args[:name], repository_url: args[:repository_url]).save(raise_on_save_failure: true)
      end

      def find_latest_version name

      end

    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
pact_broker-1.0.0 lib/pact_broker/repositories/pacticipant_repository.rb
pact_broker-1.0.0.alpha3 lib/pact_broker/repositories/pacticipant_repository.rb
pact_broker-1.0.0.alpha2 lib/pact_broker/repositories/pacticipant_repository.rb
pact_broker-1.0.0.alpha1 lib/pact_broker/repositories/pacticipant_repository.rb
pact_broker-0.0.10 lib/pact_broker/repositories/pacticipant_repository.rb
pact_broker-0.0.9 lib/pact_broker/repositories/pacticipant_repository.rb