Sha256: 319270bbe9b85a21cddfa546a8341926a467d53dc1c41f6a3cc78f82b6f453fe

Contents?: true

Size: 1.41 KB

Versions: 45

Compression:

Stored size: 1.41 KB

Contents

# New code
require 'pact_broker/client/pacticipants/create'
require 'pact_broker/client/pacticipants/describe'
require 'pact_broker/client/pacticipants/list'

# Old code
require 'pact_broker/client/base_client'

module PactBroker
  module Client
    class Pacticipants < BaseClient

      def versions
        Versions.new base_url: base_url, client_options: client_options
      end

      def update options
        body = options.select{ | key, v | [:repository_url].include?(key)}
        response = patch(pacticipant_base_url(options), body: body, headers: default_patch_headers)
        handle_response(response) do
          true
        end
      end

      def get1 options
        response = get(pacticipant_base_url(options), headers: default_get_headers)
        handle_response(response) do
          JSON.parse(response.body)
        end
      end

      def list
        response = get("/pacticipants", headers: default_get_headers)
        handle_response(response) do
          JSON.parse(response.body)
        end
      end

      def repository_url options
        response = get("#{pacticipant_base_url(options)}/repository_url", headers: default_get_headers.merge('Accept' => 'text/plain'))
        handle_response(response) do
          response.body
        end
      end

      private

      def pacticipant_base_url options
        "/pacticipants/#{encode_param(options[:pacticipant])}"
      end

    end
  end
end

Version data entries

45 entries across 45 versions & 1 rubygems

Version Path
pact_broker-client-1.47.1 lib/pact_broker/client/pacticipants.rb
pact_broker-client-1.47.0 lib/pact_broker/client/pacticipants.rb
pact_broker-client-1.46.0 lib/pact_broker/client/pacticipants.rb
pact_broker-client-1.45.0 lib/pact_broker/client/pacticipants.rb
pact_broker-client-1.44.0 lib/pact_broker/client/pacticipants.rb