From 9becc0829fabf64bd6e5e88a61efa2586227f3fb Mon Sep 17 00:00:00 2001 From: Roger Ostrander Date: Tue, 5 Mar 2019 16:45:57 -0500 Subject: [PATCH 1/2] Add options to runner_jobs --- lib/gitlab/client/runners.rb | 6 ++++-- spec/gitlab/client/runners_spec.rb | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/gitlab/client/runners.rb b/lib/gitlab/client/runners.rb index 056a7f656..3349a0cf4 100644 --- a/lib/gitlab/client/runners.rb +++ b/lib/gitlab/client/runners.rb @@ -79,9 +79,11 @@ def delete_runner(id) # Gitlab.runner_jobs(1) # # @param [Integer] id The ID of a runner. + # @param [Hash] options A customizable set of options. + # @option options [String] :status Status of the job; one of: running, success, failed, canceled # @return [Array] - def runner_jobs(runner_id) - get("/runners/#{url_encode runner_id}/jobs") + def runner_jobs(runner_id, options={}) + get("/runners/#{url_encode runner_id}/jobs", query: options) end # List all runners (specific and shared) available in the project. Shared runners are listed if at least one shared runner is defined and shared runners usage is enabled in the project's settings. diff --git a/spec/gitlab/client/runners_spec.rb b/spec/gitlab/client/runners_spec.rb index c28b07938..14392e6bd 100644 --- a/spec/gitlab/client/runners_spec.rb +++ b/spec/gitlab/client/runners_spec.rb @@ -132,12 +132,12 @@ describe '.runner_jobs' do before do - stub_get('/runners/1/jobs', 'runner_jobs') - @jobs = Gitlab.runner_jobs(1) + stub_get('/runners/1/jobs?status=running', 'runner_jobs') + @jobs = Gitlab.runner_jobs(1, status: :running) end it 'gets the correct resource' do - expect(a_get('/runners/1/jobs')).to have_been_made + expect(a_get('/runners/1/jobs').with(query: { status: :running })).to have_been_made end end From cbcdaf132729dd7f332dcdd7629a17b986254256 Mon Sep 17 00:00:00 2001 From: Roger Ostrander Date: Tue, 5 Mar 2019 16:58:02 -0500 Subject: [PATCH 2/2] Whitespace cleanup --- lib/gitlab/client/runners.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/gitlab/client/runners.rb b/lib/gitlab/client/runners.rb index 3349a0cf4..a8976af59 100644 --- a/lib/gitlab/client/runners.rb +++ b/lib/gitlab/client/runners.rb @@ -82,7 +82,7 @@ def delete_runner(id) # @param [Hash] options A customizable set of options. # @option options [String] :status Status of the job; one of: running, success, failed, canceled # @return [Array] - def runner_jobs(runner_id, options={}) + def runner_jobs(runner_id, options = {}) get("/runners/#{url_encode runner_id}/jobs", query: options) end