blob: 02cecffd4dff94592cb93fc6822518e23eedfaf6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# frozen_string_literal: true
module QA
module Runtime
module Fixtures
include Support::Api
TemplateNotFoundError = Class.new(RuntimeError)
def fetch_template_from_api(api_path, key)
request = Runtime::API::Request.new(api_client, "/templates/#{api_path}/#{key}")
response = get(request.url)
unless response.code == HTTP_STATUS_OK
raise TemplateNotFoundError, "Template at #{request.mask_url} could not be found (#{response.code}): `#{response}`."
end
parse_body(response)[:content]
end
private
def api_client
@api_client ||= Runtime::API::Client.new(:gitlab)
end
end
end
end
|