BigW Consortium Gitlab

gitignores.rb 676 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
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:
15
    #   name (required) - The name of a license
16 17
    #
    # Example Request:
18
    #   GET /gitignores/Elixir
19
    #
20 21
    get 'gitignores/:name' do
      required_attributes! [:name]
22

23
      gitignore = Gitlab::Gitignore.find(params[:name])
24 25 26 27 28 29
      not_found!('.gitignore') unless gitignore

      present gitignore, with: Entities::Gitignore
    end
  end
end