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::BaseResource, UI::ViewDomain::IndexItem, UI::ViewDomain::IndexItemBranchHead, UI::ViewDomain::IndexItemProviderBranchHead, 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
Constants included from Pacts::Metadata
Instance Method Summary collapse
- #append_query_if_present(url, query) ⇒ Object
- #badge_url_for_latest_pact(pact, base_url = "") ⇒ Object
- #branch_url(branch, base_url = "") ⇒ Object
- #branch_version_url(branch_version, base_url = "") ⇒ Object
- #branch_versions_url(branch, 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_for_branch_url(branch, 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_version_with_consumer_version_metadata_url(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_branches_url(pacticipant, 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_branch_to_environment_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, #measure_info
Methods included from Pacts::Metadata
#build_metadata_for_consumer_version_number, #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
409 410 411 412 413 414 415 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 409 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
326 327 328 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 326 def badge_url_for_latest_pact pact, base_url = "" "#{latest_pact_url(base_url, pact)}/badge.svg" end |
#branch_url(branch, base_url = "") ⇒ Object
230 231 232 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 230 def branch_url(branch, base_url = "") "#{pacticipant_branches_url(branch.pacticipant, base_url)}/#{url_encode(branch.name)}" end |
#branch_version_url(branch_version, base_url = "") ⇒ Object
242 243 244 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 242 def branch_version_url(branch_version, base_url = "") "#{branch_versions_url(branch_version.branch, base_url)}/#{url_encode(branch_version.version_number)}" end |
#branch_versions_url(branch, base_url = "") ⇒ Object
238 239 240 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 238 def branch_versions_url(branch, base_url = "") "#{branch_url(branch, base_url)}/versions" end |
#consumer_webhooks_url(consumer, base_url = "") ⇒ Object
302 303 304 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 302 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
377 378 379 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 377 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
381 382 383 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 381 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
134 135 136 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 134 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 |
#decode_pact_metadata(metadata) ⇒ Object
87 88 89 90 91 92 93 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 87 def () if && != "" (()) else {} end end |
#deployed_version_url(deployed_version, base_url = "") ⇒ Object
393 394 395 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 393 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
373 374 375 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 373 def deployed_versions_for_version_and_environment_url(version, environment, base_url = "") "#{version_url(base_url, version)}/deployed-versions/environment/#{environment.uuid}" end |
#encode_metadata(metadata) ⇒ Object
83 84 85 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 83 def () Base64.urlsafe_encode64(Rack::Utils.build_nested_query(), padding: false) end |
#environment_url(environment, base_url = "") ⇒ Object
369 370 371 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 369 def environment_url(environment, base_url = "") "#{environments_url(base_url)}/#{environment.uuid}" end |
#environments_url(base_url = "") ⇒ Object
365 366 367 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 365 def environments_url(base_url = "") "#{base_url}/environments" end |
#group_url(pacticipant_name, base_url = "") ⇒ Object
361 362 363 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 361 def group_url(pacticipant_name, base_url = "") "#{base_url}/pacticipants/#{url_encode(pacticipant_name)}" end |
#hal_browser_url(target_url, base_url = "") ⇒ Object
401 402 403 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 401 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
130 131 132 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 130 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
278 279 280 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 278 def label_url label, base_url "#{labels_url(label.pacticipant, base_url)}/#{url_encode(label.name)}" end |
#labels_url(pacticipant, base_url) ⇒ Object
282 283 284 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 282 def labels_url pacticipant, base_url "#{pacticipant_url(base_url, pacticipant)}/labels" end |
#latest_pact_url(base_url, pact) ⇒ Object
102 103 104 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 102 def latest_pact_url base_url, pact "#{pactigration_base_url(base_url, pact)}/latest" end |
#latest_pacts_url(base_url) ⇒ Object
114 115 116 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 114 def latest_pacts_url base_url "#{base_url}/pacts/latest" end |
#latest_tagged_pact_url(pact, tag_name, base_url) ⇒ Object
110 111 112 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 110 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
106 107 108 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 106 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
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 201 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
197 198 199 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 197 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_for_branch_url(branch, base_url = "") ⇒ Object
246 247 248 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 246 def latest_version_for_branch_url(branch, base_url = "") "#{branch_url(branch, base_url)}/latest-version" 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
334 335 336 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 334 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
346 347 348 349 350 351 352 353 354 355 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 346 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
338 339 340 341 342 343 344 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 338 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
330 331 332 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 330 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
357 358 359 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 357 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
154 155 156 157 158 159 160 161 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 154 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
318 319 320 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 318 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
95 96 97 98 99 100 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 95 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 |
#pact_version_url_with_metadata(pact, metadata, base_url = "") ⇒ Object
71 72 73 74 75 76 77 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 71 def pact, , base_url = "" if && .any? "#{pact_version_url(pact, base_url)}/metadata/#{()}" else pact_version_url(pact, base_url) end end |
#pact_version_url_with_webhook_metadata(pact, base_url = "") ⇒ Object
79 80 81 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 79 def pact, base_url = "" (pact, (pact), base_url) end |
#pact_version_with_consumer_version_metadata_url(pact, base_url = "") ⇒ Object
67 68 69 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 67 def pact, base_url = "" "#{pactigration_base_url(base_url, pact)}/pact-version/#{pact.pact_version_sha}/metadata/#{((pact.consumer_version_number))}" end |
#pact_versions_for_branch_url(consumer_name, provider_name, branch_name, base_url = "") ⇒ Object
126 127 128 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 126 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
118 119 120 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 118 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_branches_url(pacticipant, base_url = "") ⇒ Object
234 235 236 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 234 def pacticipant_branches_url(pacticipant, base_url = "") "#{pacticipant_url(base_url, pacticipant)}/branches" 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
138 139 140 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 138 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
146 147 148 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 146 def previous_distinct_pact_version_url pact, base_url pact_url(base_url, pact) + "/previous-distinct" end |
#provider_webhooks_url(provider, base_url = "") ⇒ Object
306 307 308 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 306 def provider_webhooks_url provider, base_url = "" "#{base_url}/webhooks/provider/#{url_encode(provider.name)}" end |
#record_undeployment_url(deployed_version, base_url = "") ⇒ Object
385 386 387 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 385 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
397 398 399 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 397 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
389 390 391 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 389 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
226 227 228 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 226 def tag_url base_url, tag "#{(base_url, tag.version)}/#{url_encode(tag.name)}" end |
#tagged_pact_versions_url(consumer_name, provider_name, tag, base_url = "") ⇒ Object
122 123 124 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 122 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 |
#tags_url(base_url, version) ⇒ Object
150 151 152 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 150 def base_url, version "#{version_url(base_url, version)}/tags" end |
#templated_branch_version_url_for_pacticipant(pacticipant_name, base_url = "") ⇒ Object
254 255 256 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 254 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
270 271 272 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 270 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_branch_to_environment_badge_url(pacticipant_name, base_url = "") ⇒ Object
274 275 276 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 274 def templated_can_i_deploy_branch_to_environment_badge_url pacticipant_name, base_url = "" pacticipant_url_from_params({ pacticipant_name: pacticipant_name }, base_url) + "/branches/{branch}/latest-version/can-i-deploy/to-environment/{environment}/badge" end |
#templated_can_i_deploy_url(pacticipant_name, base_url = "") ⇒ Object
266 267 268 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 266 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
142 143 144 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 142 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
262 263 264 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 262 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
250 251 252 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 250 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
258 259 260 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 258 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
322 323 324 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 322 def triggered_webhook_logs_url triggered_webhook, base_url "#{base_url}/triggered-webhooks/#{triggered_webhook.uuid}/logs" end |
#url_encode(param) ⇒ Object
405 406 407 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 405 def url_encode param ERB::Util.url_encode param end |
#verification_publication_url(pact, base_url, metadata = "") ⇒ Object
221 222 223 224 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 221 def verification_publication_url pact, base_url, = "" = ? "/metadata/#{}" : "" "#{pactigration_base_url(base_url, pact)}/pact-version/#{pact.pact_version_sha}#{}/verification-results" end |
#verification_triggered_webhooks_url(verification, base_url = "") ⇒ Object
217 218 219 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 217 def verification_triggered_webhooks_url verification, base_url = "" "#{verification_url(verification, base_url)}/triggered-webhooks" end |
#verification_url(verification, base_url = "") ⇒ Object
163 164 165 166 167 168 169 170 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 163 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
172 173 174 175 176 177 178 179 180 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 172 def verification_url_from_params params, base_url = "" if params[:consumer_version_number] = ((params[:consumer_version_number])) [ base_url, "pacts", "provider", url_encode(params.fetch(:provider_name)), "consumer", url_encode(params.fetch(:consumer_name)), "pact-version", params.fetch(:pact_version_sha), "metadata", , "verification-results", params.fetch(:verification_number) ].join("/") else [ 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 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
294 295 296 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 294 def webhook_execution_url webhook, base_url "#{base_url}/webhooks/#{webhook.uuid}/execute" end |
#webhook_url(uuid, base_url = "") ⇒ Object
290 291 292 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 290 def webhook_url uuid, base_url = "" "#{base_url}/webhooks/#{uuid}" end |
#webhooks_for_consumer_and_provider_url(consumer, provider, base_url = "") ⇒ Object
298 299 300 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 298 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
310 311 312 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 310 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
314 315 316 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 314 def webhooks_status_url consumer, provider, base_url = "" "#{webhooks_for_pact_url(consumer, provider, base_url)}/status" end |
#webhooks_url(base_url) ⇒ Object
286 287 288 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 286 def webhooks_url base_url "#{base_url}/webhooks" end |