Module: PactBroker::Api::PactBrokerUrls

Instance Method Summary collapse

Instance Method Details

#hal_browser_url(target_url) ⇒ Object



112
113
114
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 112

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

#latest_pact_url(base_url, pact) ⇒ Object



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

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

#latest_pacts_url(base_url) ⇒ Object



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

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

#latest_verifications_for_consumer_version_url(version, base_url) ⇒ Object



84
85
86
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 84

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



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

#new_verification_url(params, number, base_url) ⇒ Object



66
67
68
69
70
71
72
73
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 66

def new_verification_url params, number, base_url
  [ base_url, 'pacts',
    'provider', url_encode(params[:provider_name]),
    'consumer', url_encode(params[:consumer_name]),
    'pact-version', params[:sha],
    'verification-results', number
  ].join('/')
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



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

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



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

def pact_version_url pact, base_url
  "#{pactigration_base_url(base_url, path)}/pact-version/#{pact.sha}"
end

#pact_versions_url(consumer_name, provider_name, base_url) ⇒ Object



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

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



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

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



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

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

#tag_url(base_url, tag) ⇒ Object



92
93
94
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 92

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

#tags_url(base_url, version) ⇒ Object



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

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

#url_encode(param) ⇒ Object



116
117
118
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 116

def url_encode param
  ERB::Util.url_encode param
end

#verification_publication_url(pact, base_url) ⇒ Object



88
89
90
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 88

def verification_publication_url pact, base_url
  "#{pactigration_base_url(base_url, pact)}/pact-version/#{pact.pact_version_sha}/verification-results"
end

#verification_url(verification, base_url) ⇒ Object



75
76
77
78
79
80
81
82
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 75

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

#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



104
105
106
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 104

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

#webhook_url(uuid, base_url) ⇒ Object



100
101
102
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 100

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

#webhooks_for_pact_url(consumer, provider, base_url) ⇒ Object



108
109
110
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 108

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



96
97
98
# File 'lib/pact_broker/api/pact_broker_urls.rb', line 96

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