Class: PactBroker::Client::Pacticipants

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

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



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

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

#listObject



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

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

#repository_url(options) ⇒ Object



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

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



11
12
13
14
15
16
17
# File 'lib/pact_broker/client/pacticipants.rb', line 11

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



7
8
9
# File 'lib/pact_broker/client/pacticipants.rb', line 7

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