Module: PactBroker::Api::PactBrokerUrls
- Extended by:
- PactBrokerUrls
- Included in:
- Decorators::BaseDecorator, Decorators::DashboardDecorator, Decorators::DashboardTextDecorator, Decorators::MatrixDecorator, Decorators::PactCollectionDecorator, PactBrokerUrls, Resources::BaseResource, UI::ViewDomain::IndexItem, UI::ViewDomain::MatrixLine, UI::ViewDomain::MatrixTag
- Defined in:
- lib/pact_broker/api/pact_broker_urls.rb
Instance Method Summary collapse
- #badge_url_for_latest_pact(pact, base_url = '') ⇒ Object
- #consumer_webhooks_url(consumer, base_url = '') ⇒ Object
- #hal_browser_url(target_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_untagged_pact_url(pact, base_url) ⇒ Object
- #latest_verifications_for_consumer_version_url(version, base_url) ⇒ Object
- #latest_version_url(base_url, pacticipant) ⇒ 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_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
- #previous_distinct_diff_url(pact, base_url) ⇒ Object
- #previous_distinct_pact_version_url(pact, base_url) ⇒ Object
- #provider_webhooks_url(provider, base_url = '') ⇒ Object
- #tag_url(base_url, tag) ⇒ Object
- #tags_url(base_url, version) ⇒ 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
- #triggered_webhook_logs_url(triggered_webhook, base_url) ⇒ Object
- #url_encode(param) ⇒ Object
- #verification_publication_url(pact, base_url) ⇒ 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
Instance Method Details
#badge_url_for_latest_pact(pact, base_url = '') ⇒ Object
195 196 197 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 195 def badge_url_for_latest_pact pact, base_url = '' "#{latest_pact_url(base_url, pact)}/badge.svg" end |
#consumer_webhooks_url(consumer, base_url = '') ⇒ Object
171 172 173 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 171 def consumer_webhooks_url consumer, base_url = '' "#{base_url}/webhooks/consumer/#{url_encode(consumer.name)}" end |
#hal_browser_url(target_url) ⇒ Object
203 204 205 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 203 def hal_browser_url target_url "/hal-browser/browser.html#" + target_url end |
#label_url(label, base_url) ⇒ Object
147 148 149 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 147 def label_url label, base_url "#{labels_url(label.pacticipant, base_url)}/#{label.name}" end |
#labels_url(pacticipant, base_url) ⇒ Object
151 152 153 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 151 def labels_url pacticipant, base_url "#{pacticipant_url(base_url, pacticipant)}/labels" end |
#latest_pact_url(base_url, pact) ⇒ Object
64 65 66 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 64 def latest_pact_url base_url, pact "#{pactigration_base_url(base_url, pact)}/latest" end |
#latest_pacts_url(base_url) ⇒ Object
72 73 74 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 72 def latest_pacts_url base_url "#{base_url}/pacts/latest" end |
#latest_untagged_pact_url(pact, base_url) ⇒ Object
68 69 70 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 68 def latest_untagged_pact_url pact, base_url "#{pactigration_base_url(base_url, pact)}/latest-untagged" end |
#latest_verifications_for_consumer_version_url(version, base_url) ⇒ Object
123 124 125 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 123 def latest_verifications_for_consumer_version_url version, base_url "#{base_url}/verification-results/consumer/#{url_encode(version.pacticipant.name)}/version/#{version.number}/latest" end |
#latest_version_url(base_url, pacticipant) ⇒ Object
27 28 29 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 27 def latest_version_url base_url, pacticipant "#{pacticipant_url(base_url, pacticipant)}/versions/latest" end |
#matrix_url_from_params(params, base_url = '') ⇒ Object
199 200 201 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 199 def matrix_url_from_params params, base_url = '' "#{base_url}/matrix/provider/#{url_encode(params.fetch(:provider_name))}/consumer/#{url_encode(params.fetch(:consumer_name))}" end |
#new_verification_url(pact, number, base_url) ⇒ Object
96 97 98 99 100 101 102 103 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 96 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
187 188 189 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 187 def pact_triggered_webhooks_url pact, base_url = '' "#{pact_url(base_url, pact)}/triggered-webhooks" end |
#pact_url(base_url, pact) ⇒ Object
49 50 51 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 49 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
57 58 59 60 61 62 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 57 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
53 54 55 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 53 def pact_version_url pact, base_url = '' "#{pactigration_base_url(base_url, pact)}/pact-version/#{pact.pact_version_sha}" end |
#pact_versions_url(consumer_name, provider_name, base_url) ⇒ Object
76 77 78 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 76 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
15 16 17 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 15 def pacticipant_url base_url, pacticipant "#{pacticipants_url(base_url)}/#{url_encode(pacticipant.name)}" end |
#pacticipant_url_from_params(params, base_url = '') ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 19 def pacticipant_url_from_params params, base_url = '' [ base_url, 'pacticipants', url_encode(params.fetch(:pacticipant_name)) ].join("/") end |
#pacticipants_url(base_url) ⇒ Object
11 12 13 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 11 def pacticipants_url base_url "#{base_url}/pacticipants" end |
#previous_distinct_diff_url(pact, base_url) ⇒ Object
80 81 82 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 80 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
88 89 90 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 88 def previous_distinct_pact_version_url pact, base_url pact_url(base_url, pact) + "/previous-distinct" end |
#provider_webhooks_url(provider, base_url = '') ⇒ Object
175 176 177 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 175 def provider_webhooks_url provider, base_url = '' "#{base_url}/webhooks/provider/#{url_encode(provider.name)}" end |
#tag_url(base_url, tag) ⇒ Object
135 136 137 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 135 def tag_url base_url, tag "#{(base_url, tag.version)}/#{tag.name}" end |
#tags_url(base_url, version) ⇒ Object
92 93 94 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 92 def base_url, version "#{version_url(base_url, version)}/tags" end |
#templated_diff_url(pact, base_url = '') ⇒ Object
84 85 86 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 84 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
143 144 145 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 143 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
139 140 141 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 139 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 |
#triggered_webhook_logs_url(triggered_webhook, base_url) ⇒ Object
191 192 193 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 191 def triggered_webhook_logs_url triggered_webhook, base_url "#{base_url}/webhooks/#{triggered_webhook.webhook_uuid}/trigger/#{triggered_webhook.trigger_uuid}/logs" end |
#url_encode(param) ⇒ Object
207 208 209 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 207 def url_encode param ERB::Util.url_encode param end |
#verification_publication_url(pact, base_url) ⇒ Object
131 132 133 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 131 def verification_publication_url pact, base_url "#{pactigration_base_url(base_url, pact)}/pact-version/#{pact.pact_version_sha}/verification-results" end |
#verification_triggered_webhooks_url(verification, base_url = '') ⇒ Object
127 128 129 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 127 def verification_triggered_webhooks_url verification, base_url = '' "#{verification_url(verification, base_url)}/triggered-webhooks" end |
#verification_url(verification, base_url = '') ⇒ Object
105 106 107 108 109 110 111 112 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 105 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
114 115 116 117 118 119 120 121 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 114 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
35 36 37 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 35 def version_url base_url, version "#{pacticipant_url(base_url, version.pacticipant)}/versions/#{version.number}" end |
#version_url_from_params(params, base_url = '') ⇒ Object
39 40 41 42 43 44 45 46 47 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 39 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
31 32 33 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 31 def versions_url base_url, pacticipant "#{pacticipant_url(base_url, pacticipant)}/versions" end |
#webhook_execution_url(webhook, base_url) ⇒ Object
163 164 165 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 163 def webhook_execution_url webhook, base_url "#{base_url}/webhooks/#{webhook.uuid}/execute" end |
#webhook_url(uuid, base_url) ⇒ Object
159 160 161 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 159 def webhook_url uuid, base_url "#{base_url}/webhooks/#{uuid}" end |
#webhooks_for_consumer_and_provider_url(consumer, provider, base_url = '') ⇒ Object
167 168 169 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 167 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
179 180 181 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 179 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
183 184 185 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 183 def webhooks_status_url consumer, provider, base_url = '' "#{webhooks_for_pact_url(consumer, provider, base_url)}/status" end |
#webhooks_url(base_url) ⇒ Object
155 156 157 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 155 def webhooks_url base_url "#{base_url}/webhooks" end |