Module: PactBroker::Api::PactBrokerUrls

Instance Method Summary collapse

Instance Method Details

#hal_browser_url(target_url) ⇒ Object



68
69
70
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 68

def hal_browser_url target_url
  "/hal-browser/browser.html#" + target_url
end

#latest_pact_url(base_url, pact) ⇒ Object



32
33
34
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 32

def latest_pact_url base_url, pact
  "#{pactigration_base_url(base_url, pact)}/latest"
end

#latest_pacts_url(base_url) ⇒ Object



36
37
38
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 36

def latest_pacts_url base_url
  "#{base_url}/pacts/latest"
end

#latest_version_url(base_url, pacticipant) ⇒ Object



15
16
17
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 15

def latest_version_url base_url, pacticipant
  "#{pacticipant_url(base_url, pacticipant)}/versions/latest"
end

#pact_url(base_url, pact) ⇒ Object



27
28
29
30
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 27

def pact_url base_url, pact
  representable_pact = representable_pact(pact)
  "#{pactigration_base_url(base_url, representable_pact)}/version/#{representable_pact.consumer.version.number}"
end

#pact_versions_url(consumer_name, provider_name, base_url) ⇒ Object



40
41
42
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 40

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



11
12
13
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 11

def pacticipant_url base_url, pacticipant
  "#{pacticipants_url(base_url)}/#{url_encode(pacticipant.name)}"
end

#pacticipants_url(base_url) ⇒ Object



7
8
9
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 7

def pacticipants_url base_url
  "#{base_url}/pacticipants"
end

#tag_url(base_url, tag) ⇒ Object



48
49
50
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 48

def tag_url base_url, tag
  "#{tags_url(base_url, tag.version)}/#{tag.name}"
end

#tags_url(base_url, version) ⇒ Object



44
45
46
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 44

def tags_url base_url, version
  "#{version_url(base_url, version)}/tags"
end

#url_encode(param) ⇒ Object



72
73
74
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 72

def url_encode param
  ERB::Util.url_encode param
end

#version_url(base_url, version) ⇒ Object



23
24
25
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 23

def version_url base_url, version
  "#{pacticipant_url(base_url, version.pacticipant)}/versions/#{version.number}"
end

#versions_url(base_url, pacticipant) ⇒ Object



19
20
21
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 19

def versions_url base_url, pacticipant
  "#{pacticipant_url(base_url, pacticipant)}/versions"
end

#webhook_execution_url(webhook, base_url) ⇒ Object



60
61
62
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 60

def webhook_execution_url webhook, base_url
  "#{base_url}/webhooks/#{webhook.uuid}/execute"
end

#webhook_url(uuid, base_url) ⇒ Object



56
57
58
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 56

def webhook_url uuid, base_url
  "#{base_url}/webhooks/#{uuid}"
end

#webhooks_for_pact_url(consumer, provider, base_url) ⇒ Object



64
65
66
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 64

def webhooks_for_pact_url consumer, provider, base_url
  "#{base_url}/webhooks/provider/#{provider.name}/consumer/#{consumer.name}"
end

#webhooks_url(base_url) ⇒ Object



52
53
54
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 52

def webhooks_url base_url
  "#{base_url}/webhooks"
end