debian-mirror-gitlab/lib/api/entities/snippet.rb

21 lines
516 B
Ruby
Raw Normal View History

2020-03-13 15:44:24 +05:30
# frozen_string_literal: true
module API
module Entities
2021-03-08 18:12:59 +05:30
class Snippet < BasicSnippet
2020-03-13 15:44:24 +05:30
expose :author, using: Entities::UserBasic
2020-05-24 23:13:21 +05:30
expose :file_name do |snippet|
snippet.file_name_on_repo || snippet.file_name
end
2021-01-03 14:25:43 +05:30
expose :files do |snippet, options|
2020-07-28 23:09:34 +05:30
snippet.list_files.map do |file|
{
path: file,
raw_url: Gitlab::UrlBuilder.build(snippet, file: file, ref: snippet.repository.root_ref)
}
end
end
2020-03-13 15:44:24 +05:30
end
end
end