Class: PactBroker::Client::Versions
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
#string_keys_to_symbols
Methods included from UrlHelpers
#encode_param
Instance Method Details
#latest(options) ⇒ Object
8
9
10
11
12
13
14
15
|
# File 'lib/pact_broker/client/versions.rb', line 8
def latest options
query = options[:tag] ? {tag: options[:tag]} : {}
response = self.class.get("#{versions_base_url(options)}/latest", query: query, headers: )
handle_response(response) do
string_keys_to_symbols(response.to_hash)
end
end
|
#pacts ⇒ Object
34
35
36
|
# File 'lib/pact_broker/client/versions.rb', line 34
def pacts
Pacts.new base_url: base_url, client_options: client_options
end
|
#tag(options) ⇒ Object
17
18
19
20
21
22
|
# File 'lib/pact_broker/client/versions.rb', line 17
def tag options
response = put(tag_url(options), headers: .merge("Content-Length" => "0"))
handle_response(response) do
true
end
end
|
#update(options) ⇒ Object
24
25
26
27
28
29
30
31
32
|
# File 'lib/pact_broker/client/versions.rb', line 24
def update options
body = options.select{ | key, v | [:repository_ref, :repository_url, :tags].include?(key)}
body[:tags] ||= []
(body[:tags] << options[:tag]) if options[:tag]
response = patch("#{version_base_url(options)}", body: body, headers: )
handle_response(response) do
true
end
end
|