Class: PactBroker::Client::Pacticipants

Inherits:
BaseClient
  • Object
show all
Defined in:
lib/pact_broker/client/pacticipants.rb

Constant Summary

Constants inherited from BaseClient

BaseClient::ERROR_CODE_MAPPING

Instance Attribute Summary

Attributes inherited from BaseClient

#base_url, #client_options

Instance Method Summary collapse

Methods inherited from BaseClient

#default_get_headers, #default_patch_headers, #default_put_headers, #default_request_headers, #get, #handle_response, #initialize, #patch, #put, #url_for_relation, #verbose?

Methods included from StringToSymbol

#string_keys_to_symbols

Methods included from UrlHelpers

#encode_param, #encode_query_param

Constructor Details

This class inherits a constructor from PactBroker::Client::BaseClient

Instance Method Details

#get1(options) ⇒ Object



25
26
27
28
29
30
# File 'lib/pact_broker/client/pacticipants.rb', line 25

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

#listObject



32
33
34
35
36
37
# File 'lib/pact_broker/client/pacticipants.rb', line 32

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

#repository_url(options) ⇒ Object



39
40
41
42
43
44
# File 'lib/pact_broker/client/pacticipants.rb', line 39

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

#update(options) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/pact_broker/client/pacticipants.rb', line 17

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

#versionsObject



13
14
15
# File 'lib/pact_broker/client/pacticipants.rb', line 13

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