Sha256: bdba5924ea5530f654f442652f230ad47fcaab74ee3a6bff928223a1c59df266

Contents?: true

Size: 847 Bytes

Versions: 1

Compression:

Stored size: 847 Bytes

Contents

require_relative 'base_api'

module PactBroker

  module Api


    class PacticipantApi < BaseApi

      namespace '/pacticipants' do
        get '/:name/repository_url' do
          repository_url = pacticipant_service.find_pacticipant_repository_url_by_pacticipant_name(params[:name])
          if repository_url
            content_type 'text/plain'
            repository_url
          else
            status 404
          end
        end

        patch '/:name' do
          logger.info "Recieved request to patch #{params[:name]} with #{params}"
          pacticipant, created = pacticipant_service.create_or_update_pacticipant(
            name: params[:name],
            repository_url: params[:repository_url]
          )
          created ? status(201) : status(200)
          json pacticipant
        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/api/pacticipant_api.rb