Module: PactBroker::Api::PactBrokerUrls
- Extended by:
- PactBrokerUrls
- Included in:
- Decorators::BaseDecorator, Decorators::DashboardDecorator, Decorators::DashboardTextDecorator, Decorators::IntegrationDecorator, 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
- #build_webhook_metadata(pact) ⇒ Object
- #consumer_webhooks_url(consumer, base_url = '') ⇒ Object
- #dashboard_url_for_integration(consumer_name, provider_name, base_url = "") ⇒ Object
- #group_url(pacticipant_name, base_url = '') ⇒ Object
- #hal_browser_url(target_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) ⇒ Object
- #latest_verifications_for_consumer_version_url(version, base_url) ⇒ Object
- #latest_version_url(base_url, pacticipant) ⇒ 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, 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
- #parse_webhook_metadata(metadata) ⇒ 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, 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
Instance Method Details
#badge_url_for_latest_pact(pact, base_url = '') ⇒ Object
237 238 239 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 237 def badge_url_for_latest_pact pact, base_url = '' "#{latest_pact_url(base_url, pact)}/badge.svg" end |
#build_webhook_metadata(pact) ⇒ Object
61 62 63 64 65 66 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 61 def (pact) Base64.strict_encode64(Rack::Utils.build_nested_query( consumer_version_number: pact.consumer_version_number, consumer_version_tags: pact.consumer_version_tag_names )) end |
#consumer_webhooks_url(consumer, base_url = '') ⇒ Object
213 214 215 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 213 def consumer_webhooks_url consumer, base_url = '' "#{base_url}/webhooks/consumer/#{url_encode(consumer.name)}" end |
#dashboard_url_for_integration(consumer_name, provider_name, base_url = "") ⇒ Object
109 110 111 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 109 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 |
#group_url(pacticipant_name, base_url = '') ⇒ Object
249 250 251 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 249 def group_url(pacticipant_name, base_url = '') "#{base_url}/groups/#{pacticipant_name}" end |
#hal_browser_url(target_url) ⇒ Object
253 254 255 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 253 def hal_browser_url target_url "/hal-browser/browser.html#" + target_url end |
#integration_url(consumer_name, provider_name, base_url = "") ⇒ Object
105 106 107 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 105 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
189 190 191 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 189 def label_url label, base_url "#{labels_url(label.pacticipant, base_url)}/#{label.name}" end |
#labels_url(pacticipant, base_url) ⇒ Object
193 194 195 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 193 def labels_url pacticipant, base_url "#{pacticipant_url(base_url, pacticipant)}/labels" end |
#latest_pact_url(base_url, pact) ⇒ Object
85 86 87 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 85 def latest_pact_url base_url, pact "#{pactigration_base_url(base_url, pact)}/latest" end |
#latest_pacts_url(base_url) ⇒ Object
97 98 99 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 97 def latest_pacts_url base_url "#{base_url}/pacts/latest" end |
#latest_tagged_pact_url(pact, tag_name, base_url) ⇒ Object
93 94 95 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 93 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
89 90 91 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 89 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) ⇒ Object
160 161 162 163 164 165 166 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 160 def latest_verification_for_pact_url pact, base_url verification_url_from_params( provider_name: pact.provider_name, consumer_name: pact.consumer_name, pact_version_sha: pact.pact_version_sha, verification_number: 'latest') end |
#latest_verifications_for_consumer_version_url(version, base_url) ⇒ Object
156 157 158 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 156 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(consumer_name, provider_name, base_url = '') ⇒ Object
241 242 243 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 241 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
245 246 247 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 245 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
129 130 131 132 133 134 135 136 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 129 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
229 230 231 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 229 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
78 79 80 81 82 83 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 78 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_version_url_with_metadata(pact, base_url = '') ⇒ Object
57 58 59 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 57 def pact, base_url = '' "#{pactigration_base_url(base_url, pact)}/pact-version/#{pact.pact_version_sha}/metadata/#{(pact)}" end |
#pact_versions_url(consumer_name, provider_name, base_url = "") ⇒ Object
101 102 103 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 101 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 |
#parse_webhook_metadata(metadata) ⇒ Object
68 69 70 71 72 73 74 75 76 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 68 def () if Rack::Utils.parse_nested_query(Base64.strict_decode64()).each_with_object({}) do | (k, v), new_hash | new_hash[k.to_sym] = v end else {} end end |
#previous_distinct_diff_url(pact, base_url) ⇒ Object
113 114 115 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 113 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
121 122 123 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 121 def previous_distinct_pact_version_url pact, base_url pact_url(base_url, pact) + "/previous-distinct" end |
#provider_webhooks_url(provider, base_url = '') ⇒ Object
217 218 219 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 217 def provider_webhooks_url provider, base_url = '' "#{base_url}/webhooks/provider/#{url_encode(provider.name)}" end |
#tag_url(base_url, tag) ⇒ Object
177 178 179 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 177 def tag_url base_url, tag "#{(base_url, tag.version)}/#{tag.name}" end |
#tags_url(base_url, version) ⇒ Object
125 126 127 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 125 def base_url, version "#{version_url(base_url, version)}/tags" end |
#templated_diff_url(pact, base_url = '') ⇒ Object
117 118 119 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 117 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
185 186 187 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 185 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
181 182 183 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 181 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
233 234 235 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 233 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
257 258 259 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 257 def url_encode param ERB::Util.url_encode param end |
#verification_publication_url(pact, base_url, metadata = "") ⇒ Object
172 173 174 175 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 172 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
168 169 170 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 168 def verification_triggered_webhooks_url verification, base_url = '' "#{verification_url(verification, base_url)}/triggered-webhooks" end |
#verification_url(verification, base_url = '') ⇒ Object
138 139 140 141 142 143 144 145 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 138 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
147 148 149 150 151 152 153 154 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 147 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
205 206 207 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 205 def webhook_execution_url webhook, base_url "#{base_url}/webhooks/#{webhook.uuid}/execute" end |
#webhook_url(uuid, base_url) ⇒ Object
201 202 203 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 201 def webhook_url uuid, base_url "#{base_url}/webhooks/#{uuid}" end |
#webhooks_for_consumer_and_provider_url(consumer, provider, base_url = '') ⇒ Object
209 210 211 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 209 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
221 222 223 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 221 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
225 226 227 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 225 def webhooks_status_url consumer, provider, base_url = '' "#{webhooks_for_pact_url(consumer, provider, base_url)}/status" end |
#webhooks_url(base_url) ⇒ Object
197 198 199 |
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 197 def webhooks_url base_url "#{base_url}/webhooks" end |