Sha256: 0dd4c15a79e1db1b0ebb71d840398a91b8c9a369050722f6e4b9832b3cb1abbc

Contents?: true

Size: 1.24 KB

Versions: 82

Compression:

Stored size: 1.24 KB

Contents

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

82 entries across 82 versions & 1 rubygems

Version Path
pact_broker-client-1.41.0 lib/pact_broker/client/pacticipants.rb
pact_broker-client-1.40.0 lib/pact_broker/client/pacticipants.rb
pact_broker-client-1.39.0 lib/pact_broker/client/pacticipants.rb
pact_broker-client-1.38.3 lib/pact_broker/client/pacticipants.rb
pact_broker-client-1.38.2 lib/pact_broker/client/pacticipants.rb
pact_broker-client-1.38.1 lib/pact_broker/client/pacticipants.rb
pact_broker-client-1.38.0 lib/pact_broker/client/pacticipants.rb
pact_broker-client-1.37.1 lib/pact_broker/client/pacticipants.rb
pact_broker-client-1.37.0 lib/pact_broker/client/pacticipants.rb
pact_broker-client-1.36.0 lib/pact_broker/client/pacticipants.rb
pact_broker-client-1.35.0 lib/pact_broker/client/pacticipants.rb
pact_broker-client-1.34.0 lib/pact_broker/client/pacticipants.rb
pact_broker-client-1.33.0 lib/pact_broker/client/pacticipants.rb
pact_broker-client-1.32.0 lib/pact_broker/client/pacticipants.rb
pact_broker-client-1.31.0 lib/pact_broker/client/pacticipants.rb
pact_broker-client-1.30.0 lib/pact_broker/client/pacticipants.rb
pact_broker-client-1.29.1 lib/pact_broker/client/pacticipants.rb
pact_broker-client-1.29.0 lib/pact_broker/client/pacticipants.rb
pact_broker-client-1.28.4 lib/pact_broker/client/pacticipants.rb
pact_broker-client-1.28.3 lib/pact_broker/client/pacticipants.rb