Module: PactBroker::Api::PactBrokerUrls
- Extended by:
- PactBrokerUrls
- Includes:
- Logging, Pacts::Metadata
- Included in:
- Decorators::BaseDecorator, Decorators::DashboardDecorator, Decorators::DashboardTextDecorator, Decorators::IntegrationDecorator, Decorators::MatrixDecorator, Decorators::PactCollectionDecorator, PactBrokerUrls, Resources::DefaultBaseResource, UI::ViewDomain::IndexItem, UI::ViewDomain::MatrixBranch, UI::ViewDomain::MatrixDeployedVersion, UI::ViewDomain::MatrixLine, UI::ViewDomain::MatrixReleasedVersion, UI::ViewDomain::MatrixTag
- Defined in:
- lib/pact_broker/api/pact_broker_urls.rb
Constant Summary
Pacts::Metadata::MAPPINGS
Instance Method Summary
collapse
-
#append_query_if_present(url, query) ⇒ Object
-
#badge_url_for_latest_pact(pact, base_url = "") ⇒ Object
-
#branch_version_url(branch_version, base_url = "") ⇒ Object
-
#consumer_webhooks_url(consumer, base_url = "") ⇒ Object
-
#currently_deployed_versions_for_environment_url(environment, base_url = "") ⇒ Object
-
#currently_supported_versions_for_environment_url(environment, base_url = "") ⇒ Object
-
#dashboard_url_for_integration(consumer_name, provider_name, base_url = "") ⇒ Object
-
#decode_pact_metadata(metadata) ⇒ Object
-
#deployed_version_url(deployed_version, base_url = "") ⇒ Object
-
#deployed_versions_for_version_and_environment_url(version, environment, base_url = "") ⇒ Object
-
#encode_metadata(metadata) ⇒ Object
-
#environment_url(environment, base_url = "") ⇒ Object
-
#environments_url(base_url = "") ⇒ Object
-
#group_url(pacticipant_name, base_url = "") ⇒ Object
-
#hal_browser_url(target_url, base_url = "") ⇒ Object
-
#integration_url(consumer_name, provider_name, base_url = "") ⇒ Object
-
#label_url(label, base_url) ⇒ Object
-
#labels_url(pacticipant, base_url) ⇒ Object
-
#latest_pact_url(base_url, pact) ⇒ Object
-
#latest_pacts_url(base_url) ⇒ Object
-
#latest_tagged_pact_url(pact, tag_name, base_url) ⇒ Object
-
#latest_untagged_pact_url(pact, base_url) ⇒ Object
-
#latest_verification_for_pact_url(pact, base_url, permalink = true) ⇒ Object
-
#latest_verifications_for_consumer_version_url(version, base_url) ⇒ Object
-
#latest_version_url(base_url, pacticipant) ⇒ Object
-
#matrix_badge_url_for_selectors(consumer_selector, provider_selector, base_url = "") ⇒ Object
-
#matrix_for_pact_url(pact, base_url = "") ⇒ Object
-
#matrix_for_pacticipant_version_url(version, base_url = "") ⇒ Object
-
#matrix_url(consumer_name, provider_name, _base_url = "") ⇒ Object
-
#matrix_url_from_params(params, base_url = "") ⇒ Object
-
#new_verification_url(pact, number, base_url) ⇒ Object
-
#pact_triggered_webhooks_url(pact, base_url = "") ⇒ Object
-
#pact_url(base_url, pact) ⇒ Object
-
#pact_url_from_params(base_url, params) ⇒ Object
-
#pact_version_url(pact, base_url = "") ⇒ Object
-
#pact_version_url_with_metadata(pact, metadata, base_url = "") ⇒ Object
-
#pact_version_url_with_webhook_metadata(pact, base_url = "") ⇒ Object
-
#pact_versions_for_branch_url(consumer_name, provider_name, branch_name, base_url = "") ⇒ Object
-
#pact_versions_url(consumer_name, provider_name, base_url = "") ⇒ Object
-
#pacticipant_url(base_url, pacticipant) ⇒ Object
-
#pacticipant_url_from_params(params, base_url = "") ⇒ Object
-
#pacticipants_url(base_url) ⇒ Object
-
#pacticipants_with_label_url(base_url, label_name) ⇒ Object
-
#previous_distinct_diff_url(pact, base_url) ⇒ Object
-
#previous_distinct_pact_version_url(pact, base_url) ⇒ Object
-
#provider_webhooks_url(provider, base_url = "") ⇒ Object
-
#record_undeployment_url(deployed_version, base_url = "") ⇒ Object
-
#released_version_url(released_version, base_url = "") ⇒ Object
-
#released_versions_for_version_and_environment_url(version, environment, base_url = "") ⇒ Object
-
#tag_url(base_url, tag) ⇒ Object
-
#tagged_pact_versions_url(consumer_name, provider_name, tag, base_url = "") ⇒ Object
-
#tags_url(base_url, version) ⇒ Object
-
#templated_branch_version_url_for_pacticipant(pacticipant_name, base_url = "") ⇒ Object
-
#templated_can_i_deploy_badge_url(pacticipant_name, base_url = "") ⇒ Object
-
#templated_can_i_deploy_url(pacticipant_name, base_url = "") ⇒ Object
-
#templated_diff_url(pact, base_url = "") ⇒ Object
-
#templated_label_url_for_pacticipant(pacticipant_name, base_url = "") ⇒ Object
-
#templated_tag_url_for_pacticipant(pacticipant_name, base_url = "") ⇒ Object
-
#templated_version_url_for_pacticipant(pacticipant_name, base_url = "") ⇒ Object
-
#triggered_webhook_logs_url(triggered_webhook, base_url) ⇒ Object
-
#url_encode(param) ⇒ Object
-
#verification_publication_url(pact, base_url, metadata = "") ⇒ Object
-
#verification_triggered_webhooks_url(verification, base_url = "") ⇒ Object
-
#verification_url(verification, base_url = "") ⇒ Object
-
#verification_url_from_params(params, base_url = "") ⇒ Object
-
#version_url(base_url, version) ⇒ Object
-
#version_url_from_params(params, base_url = "") ⇒ Object
-
#versions_url(base_url, pacticipant) ⇒ Object
-
#webhook_execution_url(webhook, base_url) ⇒ Object
-
#webhook_url(uuid, base_url) ⇒ Object
-
#webhooks_for_consumer_and_provider_url(consumer, provider, base_url = "") ⇒ Object
-
#webhooks_for_pact_url(consumer, provider, base_url = "") ⇒ Object
-
#webhooks_status_url(consumer, provider, base_url = "") ⇒ Object
-
#webhooks_url(base_url) ⇒ Object
Methods included from Logging
included, #log_error, #log_with_tag
#build_metadata_for_latest_pact, #build_metadata_for_pact_for_verification, #build_metadata_for_webhook_triggered_by_pact_publication, #parse_hash, #parse_metadata, #parse_object
Instance Method Details
#append_query_if_present(url, query) ⇒ Object
369
370
371
372
373
374
375
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 369
def append_query_if_present(url, query)
if query && query.size > 0
url + "?#{query}"
else
url
end
end
|
#badge_url_for_latest_pact(pact, base_url = "") ⇒ Object
286
287
288
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 286
def badge_url_for_latest_pact pact, base_url = ""
"#{latest_pact_url(base_url, pact)}/badge.svg"
end
|
#branch_version_url(branch_version, base_url = "") ⇒ Object
210
211
212
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 210
def branch_version_url(branch_version, base_url = "")
"#{pacticipant_url(base_url, branch_version.pacticipant)}/branches/#{url_encode(branch_version.branch_name)}/versions/#{url_encode(branch_version.version_number)}"
end
|
#consumer_webhooks_url(consumer, base_url = "") ⇒ Object
262
263
264
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 262
def consumer_webhooks_url consumer, base_url = ""
"#{base_url}/webhooks/consumer/#{url_encode(consumer.name)}"
end
|
#currently_deployed_versions_for_environment_url(environment, base_url = "") ⇒ Object
337
338
339
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 337
def currently_deployed_versions_for_environment_url(environment, base_url = "")
"#{base_url}/environments/#{environment.uuid}/deployed-versions/currently-deployed"
end
|
#currently_supported_versions_for_environment_url(environment, base_url = "") ⇒ Object
341
342
343
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 341
def currently_supported_versions_for_environment_url(environment, base_url = "")
"#{base_url}/environments/#{environment.uuid}/released-versions/currently-supported"
end
|
#dashboard_url_for_integration(consumer_name, provider_name, base_url = "") ⇒ Object
130
131
132
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 130
def dashboard_url_for_integration consumer_name, provider_name, base_url = ""
"#{base_url}/dashboard/provider/#{url_encode(provider_name)}/consumer/#{url_encode(consumer_name)}"
end
|
83
84
85
86
87
88
89
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 83
def decode_pact_metadata(metadata)
if metadata && metadata != ""
parse_nested_metadata_query(base64_decode_metadata(metadata))
else
{}
end
end
|
#deployed_version_url(deployed_version, base_url = "") ⇒ Object
353
354
355
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 353
def deployed_version_url(deployed_version, base_url = "")
"#{base_url}/deployed-versions/#{deployed_version.uuid}"
end
|
#deployed_versions_for_version_and_environment_url(version, environment, base_url = "") ⇒ Object
333
334
335
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 333
def deployed_versions_for_version_and_environment_url(version, environment, base_url = "")
"#{version_url(base_url, version)}/deployed-versions/environment/#{environment.uuid}"
end
|
79
80
81
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 79
def encode_metadata(metadata)
Base64.urlsafe_encode64(Rack::Utils.build_nested_query(metadata), padding: false)
end
|
#environment_url(environment, base_url = "") ⇒ Object
329
330
331
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 329
def environment_url(environment, base_url = "")
"#{environments_url(base_url)}/#{environment.uuid}"
end
|
#environments_url(base_url = "") ⇒ Object
325
326
327
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 325
def environments_url(base_url = "")
"#{base_url}/environments"
end
|
#group_url(pacticipant_name, base_url = "") ⇒ Object
321
322
323
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 321
def group_url(pacticipant_name, base_url = "")
"#{base_url}/pacticipants/#{url_encode(pacticipant_name)}"
end
|
#hal_browser_url(target_url, base_url = "") ⇒ Object
361
362
363
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 361
def hal_browser_url target_url, base_url = ""
"#{base_url}/hal-browser/browser.html#" + target_url
end
|
#integration_url(consumer_name, provider_name, base_url = "") ⇒ Object
126
127
128
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 126
def integration_url consumer_name, provider_name, base_url = ""
"#{base_url}/integrations/provider/#{url_encode(provider_name)}/consumer/#{url_encode(consumer_name)}"
end
|
#label_url(label, base_url) ⇒ Object
238
239
240
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 238
def label_url label, base_url
"#{labels_url(label.pacticipant, base_url)}/#{url_encode(label.name)}"
end
|
#labels_url(pacticipant, base_url) ⇒ Object
242
243
244
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 242
def labels_url pacticipant, base_url
"#{pacticipant_url(base_url, pacticipant)}/labels"
end
|
#latest_pact_url(base_url, pact) ⇒ Object
98
99
100
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 98
def latest_pact_url base_url, pact
"#{pactigration_base_url(base_url, pact)}/latest"
end
|
#latest_pacts_url(base_url) ⇒ Object
110
111
112
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 110
def latest_pacts_url base_url
"#{base_url}/pacts/latest"
end
|
#latest_tagged_pact_url(pact, tag_name, base_url) ⇒ Object
106
107
108
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 106
def latest_tagged_pact_url pact, tag_name, base_url
"#{latest_pact_url(base_url, pact)}/#{url_encode(tag_name)}"
end
|
#latest_untagged_pact_url(pact, base_url) ⇒ Object
102
103
104
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 102
def latest_untagged_pact_url pact, base_url
"#{pactigration_base_url(base_url, pact)}/latest-untagged"
end
|
#latest_verification_for_pact_url(pact, base_url, permalink = true) ⇒ Object
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 181
def latest_verification_for_pact_url pact, base_url, permalink = true
if permalink
verification_url_from_params(
{
provider_name: provider_name(pact),
consumer_name: consumer_name(pact),
pact_version_sha: pact.pact_version_sha,
verification_number: "latest"
},
base_url
)
else
pact_url(base_url, pact) + "/verification-results/latest"
end
end
|
#latest_verifications_for_consumer_version_url(version, base_url) ⇒ Object
177
178
179
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 177
def latest_verifications_for_consumer_version_url version, base_url
"#{base_url}/verification-results/consumer/#{url_encode(version.pacticipant.name)}/version/#{url_encode(version.number)}/latest"
end
|
#latest_version_url(base_url, pacticipant) ⇒ Object
37
38
39
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 37
def latest_version_url base_url, pacticipant
"#{pacticipant_url(base_url, pacticipant)}/versions/latest"
end
|
#matrix_badge_url_for_selectors(consumer_selector, provider_selector, base_url = "") ⇒ Object
294
295
296
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 294
def matrix_badge_url_for_selectors consumer_selector, provider_selector, base_url = ""
"#{base_url}/matrix/provider/#{url_encode(provider_selector.pacticipant_name)}/latest/#{url_encode(provider_selector.tag)}/consumer/#{url_encode(consumer_selector.pacticipant_name)}/latest/#{url_encode(consumer_selector.tag)}/badge.svg"
end
|
#matrix_for_pact_url(pact, base_url = "") ⇒ Object
306
307
308
309
310
311
312
313
314
315
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 306
def matrix_for_pact_url(pact, base_url = "")
query = {
q: [
{ pacticipant: pact.consumer_name, version: pact.consumer_version_number },
{ pacticipant: pact.provider_name, latest: true }
],
latestby: "cvpv"
}
"#{base_url}/matrix?#{Rack::Utils.build_nested_query(query)}"
end
|
#matrix_for_pacticipant_version_url(version, base_url = "") ⇒ Object
298
299
300
301
302
303
304
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 298
def matrix_for_pacticipant_version_url(version, base_url = "")
query = {
q: [{ pacticipant: version.pacticipant.name, version: version.number }],
latestby: "cvpv"
}
"#{base_url}/matrix?#{Rack::Utils.build_nested_query(query)}"
end
|
#matrix_url(consumer_name, provider_name, _base_url = "") ⇒ Object
290
291
292
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 290
def matrix_url consumer_name, provider_name, _base_url = ""
"/matrix/provider/#{url_encode(provider_name)}/consumer/#{url_encode(consumer_name)}"
end
|
#matrix_url_from_params(params, base_url = "") ⇒ Object
317
318
319
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 317
def matrix_url_from_params params, base_url = ""
matrix_url(params.fetch(:consumer_name), params.fetch(:provider_name), base_url)
end
|
#new_verification_url(pact, number, base_url) ⇒ Object
150
151
152
153
154
155
156
157
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 150
def new_verification_url pact, number, base_url
[ base_url, "pacts",
"provider", url_encode(pact.provider_name),
"consumer", url_encode(pact.consumer_name),
"pact-version", pact.pact_version_sha,
"verification-results", number
].join("/")
end
|
#pact_triggered_webhooks_url(pact, base_url = "") ⇒ Object
278
279
280
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 278
def pact_triggered_webhooks_url pact, base_url = ""
"#{pact_url(base_url, pact)}/triggered-webhooks"
end
|
#pact_url(base_url, pact) ⇒ Object
59
60
61
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 59
def pact_url base_url, pact
"#{pactigration_base_url(base_url, pact)}/version/#{url_encode(pact.consumer_version_number)}"
end
|
#pact_url_from_params(base_url, params) ⇒ Object
91
92
93
94
95
96
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 91
def pact_url_from_params base_url, params
[ base_url, "pacts",
"provider", url_encode(params[:provider_name]),
"consumer", url_encode(params[:consumer_name]),
"version", url_encode(params[:consumer_version_number]) ].join("/")
end
|
#pact_version_url(pact, base_url = "") ⇒ Object
63
64
65
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 63
def pact_version_url pact, base_url = ""
"#{pactigration_base_url(base_url, pact)}/pact-version/#{pact.pact_version_sha}"
end
|
67
68
69
70
71
72
73
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 67
def pact_version_url_with_metadata pact, metadata, base_url = ""
if metadata && metadata.any?
"#{pact_version_url(pact, base_url)}/metadata/#{encode_metadata(metadata)}"
else
pact_version_url(pact, base_url)
end
end
|
75
76
77
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 75
def pact_version_url_with_webhook_metadata pact, base_url = ""
pact_version_url_with_metadata(pact, build_metadata_for_webhook_triggered_by_pact_publication(pact), base_url)
end
|
#pact_versions_for_branch_url(consumer_name, provider_name, branch_name, base_url = "") ⇒ Object
122
123
124
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 122
def pact_versions_for_branch_url consumer_name, provider_name, branch_name, base_url = ""
"#{base_url}/pacts/provider/#{url_encode(provider_name)}/consumer/#{url_encode(consumer_name)}/branch/#{url_encode(branch_name)}"
end
|
#pact_versions_url(consumer_name, provider_name, base_url = "") ⇒ Object
114
115
116
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 114
def pact_versions_url consumer_name, provider_name, base_url = ""
"#{base_url}/pacts/provider/#{url_encode(provider_name)}/consumer/#{url_encode(consumer_name)}/versions"
end
|
#pacticipant_url(base_url, pacticipant) ⇒ Object
21
22
23
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 21
def pacticipant_url base_url, pacticipant
"#{pacticipants_url(base_url)}/#{url_encode(pacticipant.name)}"
end
|
#pacticipant_url_from_params(params, base_url = "") ⇒ Object
29
30
31
32
33
34
35
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 29
def pacticipant_url_from_params params, base_url = ""
[
base_url,
"pacticipants",
url_encode(params.fetch(:pacticipant_name))
].join("/")
end
|
#pacticipants_url(base_url) ⇒ Object
17
18
19
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 17
def pacticipants_url base_url
"#{base_url}/pacticipants"
end
|
#pacticipants_with_label_url(base_url, label_name) ⇒ Object
25
26
27
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 25
def pacticipants_with_label_url base_url, label_name
"#{pacticipants_url(base_url)}/label/#{url_encode(label_name)}"
end
|
#previous_distinct_diff_url(pact, base_url) ⇒ Object
134
135
136
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 134
def previous_distinct_diff_url pact, base_url
pact_url(base_url, pact) + "/diff/previous-distinct"
end
|
#previous_distinct_pact_version_url(pact, base_url) ⇒ Object
142
143
144
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 142
def previous_distinct_pact_version_url pact, base_url
pact_url(base_url, pact) + "/previous-distinct"
end
|
#provider_webhooks_url(provider, base_url = "") ⇒ Object
266
267
268
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 266
def provider_webhooks_url provider, base_url = ""
"#{base_url}/webhooks/provider/#{url_encode(provider.name)}"
end
|
#record_undeployment_url(deployed_version, base_url = "") ⇒ Object
345
346
347
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 345
def record_undeployment_url(deployed_version, base_url = "")
"#{deployed_version_url(deployed_version, base_url)}/record-undeployment"
end
|
#released_version_url(released_version, base_url = "") ⇒ Object
357
358
359
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 357
def released_version_url(released_version, base_url = "")
"#{base_url}/released-versions/#{released_version.uuid}"
end
|
#released_versions_for_version_and_environment_url(version, environment, base_url = "") ⇒ Object
349
350
351
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 349
def released_versions_for_version_and_environment_url(version, environment, base_url = "")
"#{version_url(base_url, version)}/released-versions/environment/#{environment.uuid}"
end
|
#tag_url(base_url, tag) ⇒ Object
206
207
208
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 206
def tag_url base_url, tag
"#{tags_url(base_url, tag.version)}/#{url_encode(tag.name)}"
end
|
#tagged_pact_versions_url(consumer_name, provider_name, tag, base_url = "") ⇒ Object
118
119
120
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 118
def tagged_pact_versions_url consumer_name, provider_name, tag, base_url = ""
"#{base_url}/pacts/provider/#{url_encode(provider_name)}/consumer/#{url_encode(consumer_name)}/tag/#{url_encode(tag)}"
end
|
146
147
148
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 146
def tags_url base_url, version
"#{version_url(base_url, version)}/tags"
end
|
#templated_branch_version_url_for_pacticipant(pacticipant_name, base_url = "") ⇒ Object
218
219
220
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 218
def templated_branch_version_url_for_pacticipant pacticipant_name, base_url = ""
pacticipant_url_from_params({ pacticipant_name: pacticipant_name }, base_url) + "/branches/{branch}/versions/{version}"
end
|
#templated_can_i_deploy_badge_url(pacticipant_name, base_url = "") ⇒ Object
234
235
236
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 234
def templated_can_i_deploy_badge_url pacticipant_name, base_url = ""
templated_can_i_deploy_url(pacticipant_name, base_url) + "/badge"
end
|
#templated_can_i_deploy_url(pacticipant_name, base_url = "") ⇒ Object
230
231
232
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 230
def templated_can_i_deploy_url pacticipant_name, base_url = ""
pacticipant_url_from_params({ pacticipant_name: pacticipant_name }, base_url) + "/latest-version/{tag}/can-i-deploy/to/{environmentTag}"
end
|
#templated_diff_url(pact, base_url = "") ⇒ Object
138
139
140
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 138
def templated_diff_url pact, base_url = ""
pact_version_url(pact, base_url) + "/diff/pact-version/{pactVersion}"
end
|
#templated_label_url_for_pacticipant(pacticipant_name, base_url = "") ⇒ Object
226
227
228
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 226
def templated_label_url_for_pacticipant pacticipant_name, base_url = ""
pacticipant_url_from_params({ pacticipant_name: pacticipant_name }, base_url) + "/labels/{label}"
end
|
#templated_tag_url_for_pacticipant(pacticipant_name, base_url = "") ⇒ Object
214
215
216
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 214
def templated_tag_url_for_pacticipant pacticipant_name, base_url = ""
pacticipant_url_from_params({ pacticipant_name: pacticipant_name }, base_url) + "/versions/{version}/tags/{tag}"
end
|
#templated_version_url_for_pacticipant(pacticipant_name, base_url = "") ⇒ Object
222
223
224
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 222
def templated_version_url_for_pacticipant pacticipant_name, base_url = ""
pacticipant_url_from_params({ pacticipant_name: pacticipant_name }, base_url) + "/versions/{version}"
end
|
#triggered_webhook_logs_url(triggered_webhook, base_url) ⇒ Object
282
283
284
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 282
def triggered_webhook_logs_url triggered_webhook, base_url
"#{base_url}/triggered-webhooks/#{triggered_webhook.uuid}/logs"
end
|
#url_encode(param) ⇒ Object
365
366
367
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 365
def url_encode param
ERB::Util.url_encode param
end
|
#verification_publication_url(pact, base_url, metadata = "") ⇒ Object
201
202
203
204
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 201
def verification_publication_url pact, base_url, metadata = ""
metadata_part = metadata ? "/metadata/#{metadata}" : ""
"#{pactigration_base_url(base_url, pact)}/pact-version/#{pact.pact_version_sha}#{metadata_part}/verification-results"
end
|
#verification_triggered_webhooks_url(verification, base_url = "") ⇒ Object
197
198
199
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 197
def verification_triggered_webhooks_url verification, base_url = ""
"#{verification_url(verification, base_url)}/triggered-webhooks"
end
|
#verification_url(verification, base_url = "") ⇒ Object
159
160
161
162
163
164
165
166
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 159
def verification_url verification, base_url = ""
[ base_url, "pacts",
"provider", url_encode(verification.provider_name),
"consumer", url_encode(verification.consumer_name),
"pact-version", verification.pact_version_sha,
"verification-results", verification.number
].join("/")
end
|
#verification_url_from_params(params, base_url = "") ⇒ Object
168
169
170
171
172
173
174
175
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 168
def verification_url_from_params params, base_url = ""
[ base_url, "pacts",
"provider", url_encode(params.fetch(:provider_name)),
"consumer", url_encode(params.fetch(:consumer_name)),
"pact-version", params.fetch(:pact_version_sha),
"verification-results", params.fetch(:verification_number)
].join("/")
end
|
#version_url(base_url, version) ⇒ Object
45
46
47
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 45
def version_url base_url, version
"#{pacticipant_url(base_url, version.pacticipant)}/versions/#{url_encode(version.number)}"
end
|
#version_url_from_params(params, base_url = "") ⇒ Object
49
50
51
52
53
54
55
56
57
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 49
def version_url_from_params params, base_url = ""
[
base_url,
"pacticipants",
url_encode(params.fetch(:pacticipant_name)),
"versions",
url_encode(params.fetch(:version_number)),
].join("/")
end
|
#versions_url(base_url, pacticipant) ⇒ Object
41
42
43
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 41
def versions_url base_url, pacticipant
"#{pacticipant_url(base_url, pacticipant)}/versions"
end
|
#webhook_execution_url(webhook, base_url) ⇒ Object
254
255
256
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 254
def webhook_execution_url webhook, base_url
"#{base_url}/webhooks/#{webhook.uuid}/execute"
end
|
#webhook_url(uuid, base_url) ⇒ Object
250
251
252
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 250
def webhook_url uuid, base_url
"#{base_url}/webhooks/#{uuid}"
end
|
#webhooks_for_consumer_and_provider_url(consumer, provider, base_url = "") ⇒ Object
258
259
260
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 258
def webhooks_for_consumer_and_provider_url consumer, provider, base_url = ""
"#{base_url}/webhooks/provider/#{url_encode(provider.name)}/consumer/#{url_encode(consumer.name)}"
end
|
#webhooks_for_pact_url(consumer, provider, base_url = "") ⇒ Object
270
271
272
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 270
def webhooks_for_pact_url consumer, provider, base_url = ""
"#{base_url}/pacts/provider/#{url_encode(provider.name)}/consumer/#{url_encode(consumer.name)}/webhooks"
end
|
#webhooks_status_url(consumer, provider, base_url = "") ⇒ Object
274
275
276
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 274
def webhooks_status_url consumer, provider, base_url = ""
"#{webhooks_for_pact_url(consumer, provider, base_url)}/status"
end
|
#webhooks_url(base_url) ⇒ Object
246
247
248
|
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 246
def webhooks_url base_url
"#{base_url}/webhooks"
end
|