From 6f3ae2f060aca4794d25de766caf2934105677aa Mon Sep 17 00:00:00 2001 From: Mariani Lucas Date: Tue, 8 Sep 2020 19:57:01 -0300 Subject: [PATCH 1/2] Fix groups parameter validation --- lib/sonarqube/client/groups.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/sonarqube/client/groups.rb b/lib/sonarqube/client/groups.rb index 0c913a5..15a263c 100644 --- a/lib/sonarqube/client/groups.rb +++ b/lib/sonarqube/client/groups.rb @@ -79,7 +79,7 @@ class Sonarqube::Client # @option options [String] :name Optional name of group. # @return [Sonarqube::ObjectifiedHash] def add_member(id = nil, login = nil, options = {}) - raise ArgumentError, 'Missing required parameters' if id.nil? || login.nil? + raise ArgumentError, 'Missing required parameters' if id.nil? && login.nil? post('/api/user_groups/add_user', body: { id: id, login: login }.merge!(options)) end @@ -97,7 +97,7 @@ class Sonarqube::Client # @option options [String] :name Optional name of group. # @return [Sonarqube::ObjectifiedHash] def remove_member(id = nil, login = nil, options = {}) - raise ArgumentError, 'Missing required parameters' if id.nil? || login.nil? + raise ArgumentError, 'Missing required parameters' if id.nil? && login.nil? post('/api/user_groups/remove_user', body: { id: id, login: login }.merge!(options)) end From 98f4cf6a697b062f78bc11340e5e1af5680e1dc1 Mon Sep 17 00:00:00 2001 From: Mariani Lucas Date: Tue, 8 Sep 2020 20:01:03 -0300 Subject: [PATCH 2/2] Bump fix version --- CHANGELOG.md | 5 +++++ README.md | 2 +- docs/client/groups.markdown | 2 +- lib/sonarqube/version.rb | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f3a759..b4ad721 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ Please see: https://github.com/psyreactor/sonarqube-ruby/releases +### 1.2.1 (08/09/2020) + +- Fix + * Fix groups parameter validation + ### 1.2.0 (03/09/2020) - New features diff --git a/README.md b/README.md index 8319d7b..4e6c20d 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ [documentation](https://www.rubydoc.info/gems/sonarqube/frames) Sonarqube is a Ruby wrapper and CLI for the Sonarqube API -As of version `1.2.0` this gem only supports Sonarqube 7.9. +As of version `1.2.1` this gem only supports Sonarqube 7.9. ## Installation diff --git a/docs/client/groups.markdown b/docs/client/groups.markdown index 7896adb..d2947aa 100644 --- a/docs/client/groups.markdown +++ b/docs/client/groups.markdown @@ -63,7 +63,7 @@ group = Sonarqube.add_member('AXQRcKrW9pRiZzanEJ2E', 'test-user') # => # true -group = Sonarqube.add_member('AXQRcKrW9pRiZzanEJ2E', 'test-user', {name: 'sonar-groups'}) +group = Sonarqube.add_member(nil, 'test-user', {name: 'sonar-groups'}) # => # true diff --git a/lib/sonarqube/version.rb b/lib/sonarqube/version.rb index 534bab2..aa86a51 100644 --- a/lib/sonarqube/version.rb +++ b/lib/sonarqube/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Sonarqube - VERSION = '1.2.0' + VERSION = '1.2.1' end