From ec66f1b5ca20764abe21524792480755b614dbc7 Mon Sep 17 00:00:00 2001 From: Lee Tickett Date: Mon, 24 Jun 2019 12:18:40 +0000 Subject: Add name & search parameters to project environments API --- lib/api/environments.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib/api/environments.rb') diff --git a/lib/api/environments.rb b/lib/api/environments.rb index 6cd43923559..ec58b3b7bb9 100644 --- a/lib/api/environments.rb +++ b/lib/api/environments.rb @@ -18,11 +18,16 @@ module API end params do use :pagination + optional :name, type: String, desc: 'Returns the environment with this name' + optional :search, type: String, desc: 'Returns list of environments matching the search criteria' + mutually_exclusive :name, :search, message: 'cannot be used together' end get ':id/environments' do authorize! :read_environment, user_project - present paginate(user_project.environments), with: Entities::Environment, current_user: current_user + environments = ::EnvironmentsFinder.new(user_project, current_user, params).find + + present paginate(environments), with: Entities::Environment, current_user: current_user end desc 'Creates a new environment' do -- cgit v1.2.3