gitlab-org--gitlab-foss/lib/api/gitignores.rb

30 lines
676 B
Ruby
Raw Normal View History

2016-04-29 10:25:03 -04:00
module API
class Gitignores < Grape::API
# Get the list of the available gitignore templates
#
# Example Request:
# GET /gitignores
get 'gitignores' do
present Gitlab::Gitignore.all, with: Entities::GitignoresList
end
# Get the text for a specific gitignore
#
# Parameters:
2016-05-13 11:57:03 -04:00
# name (required) - The name of a license
2016-04-29 10:25:03 -04:00
#
# Example Request:
2016-05-13 11:57:03 -04:00
# GET /gitignores/Elixir
2016-04-29 10:25:03 -04:00
#
2016-05-13 11:57:03 -04:00
get 'gitignores/:name' do
required_attributes! [:name]
2016-04-29 10:25:03 -04:00
2016-05-13 11:57:03 -04:00
gitignore = Gitlab::Gitignore.find(params[:name])
2016-04-29 10:25:03 -04:00
not_found!('.gitignore') unless gitignore
present gitignore, with: Entities::Gitignore
end
end
end