Sha256: e50b4676deb4bf6b4c7d14028c967d5d45a64b83b436fc5e1e402a287f960b03

Contents?: true

Size: 643 Bytes

Versions: 1

Compression:

Stored size: 643 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_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_last_version name

      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pact_broker-0.0.1 lib/pact_broker/repositories/pacticipant_repository.rb