Class: Sonarqube::Client

Inherits:
API show all
Includes:
Groups, Permissions, Projects, QualityGates, Tokens, Users
Defined in:
lib/sonarqube/client.rb,
lib/sonarqube/client/users.rb,
lib/sonarqube/client/groups.rb,
lib/sonarqube/client/tokens.rb,
lib/sonarqube/client/projects.rb,
lib/sonarqube/client/permissions.rb,
lib/sonarqube/client/quality_gates.rb

Overview

Wrapper for the Sonarqube REST API.

Defined Under Namespace

Modules: Groups, Permissions, Projects, QualityGates, Tokens, Users

Constant Summary

Constants included from QualityGates

QualityGates::ALLOWED_METRICS, QualityGates::ALLOWED_OPERATORS

Instance Attribute Summary

Attributes inherited from Request

#endpoint, #private_token

Instance Method Summary collapse

Methods included from Users

#change_password_user, #create_user, #deactivate_user, #groups_user, #update_login_user, #update_user, #users_search

Methods included from Tokens

#create_token, #list_tokens, #revoke_token

Methods included from QualityGates

#create_quality_gate, #create_quality_gate_condition, #list_quality_gates, #set_default_quality_gate

Methods included from Projects

#create_project, #delete_project, #project_update_key, #project_update_visibility, #projects_bulk_delete, #projects_search

Methods included from Permissions

#add_group_to_template, #add_project_creator_to_template, #add_user_to_template, #apply_template, #bulk_apply_template, #create_template, #delete_template, #permission_add_group, #permission_add_user, #permission_list_group, #permission_remove_group, #remove_group_from_template

Methods included from Groups

#add_member, #create_group, #delete_group, #list_members, #remove_member, #search_groups, #update_group

Methods inherited from API

#initialize

Methods inherited from Request

decode, parse, #request_defaults, #validate

Constructor Details

This class inherits a constructor from Sonarqube::API

Instance Method Details

#inspectString

Text representation of the client, masking private token.

Returns:

  • (String)


19
20
21
22
23
# File 'lib/sonarqube/client.rb', line 19

def inspect
  inspected = super
  inspected.sub! @private_token, only_show_last_four_chars(@private_token) if @private_token
  inspected
end

#url_encode(url) ⇒ String

Utility method for URL encoding of a string. Copied from ruby-doc.org/stdlib-2.7.0/libdoc/erb/rdoc/ERB/Util.html

Returns:

  • (String)


29
30
31
# File 'lib/sonarqube/client.rb', line 29

def url_encode(url)
  url.to_s.b.gsub(/[^a-zA-Z0-9_\-.~]/n) { |m| sprintf('%%%02X', m.unpack1('C')) } # rubocop:disable Style/FormatString, Style/FormatStringToken
end