2013-11-15 08:24:10 -05:00
|
|
|
module API
|
|
|
|
# namespaces API
|
|
|
|
class Namespaces < Grape::API
|
|
|
|
before {
|
|
|
|
authenticate!
|
|
|
|
authenticated_as_admin!
|
|
|
|
}
|
|
|
|
|
|
|
|
resource :namespaces do
|
|
|
|
# Get a namespaces list
|
|
|
|
#
|
|
|
|
# Example Request:
|
|
|
|
# GET /namespaces
|
|
|
|
get do
|
2013-12-14 08:43:48 -05:00
|
|
|
@namespaces = Namespace.all
|
2013-11-15 08:24:10 -05:00
|
|
|
@namespaces = @namespaces.search(params[:search]) if params[:search].present?
|
|
|
|
@namespaces = paginate @namespaces
|
|
|
|
|
|
|
|
present @namespaces, with: Entities::Namespace
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|