Method: Match::Storage::GitLab::Client#files

Defined in:
match/lib/match/storage/gitlab/client.rb

#filesObject



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'match/lib/match/storage/gitlab/client.rb', line 40

def files
  @files ||= begin
    url = URI.parse(base_url)
    # 100 is maximum number of Secure files available on Gitlab https://docs.gitlab.com/ee/api/secure_files.html
    url.query = [url.query, "per_page=100"].compact.join('&')

    request = Net::HTTP::Get.new(url.request_uri)

    res = execute_request(url, request)

    data = []

    JSON.parse(res.body).each do |file|
      data << SecureFile.new(client: self, file: file)
    end

    data
  end
end