Module: PactBroker::Api::PactBrokerUrls

Instance Method Summary collapse

Instance Method Details

#hal_browser_url(target_url) ⇒ Object



75
76
77
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 75

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

#latest_pact_url(base_url, pact) ⇒ Object



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

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

#latest_pacts_url(base_url) ⇒ Object



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

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_url_from_params(base_url, params) ⇒ Object



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

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_versions_url(consumer_name, provider_name, base_url) ⇒ Object



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

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



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

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

#tags_url(base_url, version) ⇒ Object



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

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

#url_encode(param) ⇒ Object



79
80
81
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 79

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



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

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

#webhook_url(uuid, base_url) ⇒ Object



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

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

#webhooks_for_pact_url(consumer, provider, base_url) ⇒ Object



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

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

#webhooks_url(base_url) ⇒ Object



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

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