Module: PactBroker::Api::PactBrokerUrls

Instance Method Summary collapse

Instance Method Details

#hal_browser_url(target_url) ⇒ Object



82
83
84
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 82

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

#latest_pact_url(base_url, pact) ⇒ Object



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

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

#latest_pacts_url(base_url) ⇒ Object



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

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
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 27

def pact_url base_url, pact
  "#{pactigration_base_url(base_url, pact)}/version/#{pact.consumer_version_number}"
end

#pact_url_from_params(base_url, params) ⇒ Object



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

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



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

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

#previous_distinct_diff_url(pact, base_url) ⇒ Object



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

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



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

def previous_distinct_pact_version_url pact, base_url
  pact_url(base_url, pact) + "/previous-distinct"
end

#tag_url(base_url, tag) ⇒ Object



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

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

#tags_url(base_url, version) ⇒ Object



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

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

#url_encode(param) ⇒ Object



86
87
88
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 86

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



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

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

#webhook_url(uuid, base_url) ⇒ Object



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

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

#webhooks_for_pact_url(consumer, provider, base_url) ⇒ Object



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

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

#webhooks_url(base_url) ⇒ Object



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

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