class SonarQube::Issues::Issues
Public Class Methods
new(connector)
click to toggle source
Constructor
@param [RestClient::Resource] connector The rest-client resource object
# File lib/sonarqube-client/issues.rb, line 27 def initialize connector @connector=connector end
Public Instance Methods
add_comment(key, comment='')
click to toggle source
Add a comment to an issue
@param [String] key The issue key @param [String] comment (optional, the default value is an empty string) The comment we want to add. @return [JSON] A JSON object, containing all the issues.
# File lib/sonarqube-client/issues.rb, line 67 def add_comment key, comment='' JSON.parse(@connector[@@endpoint + "add_comment?format=json,issue=#{key},text=#{comment}"].get) end
assign(issue, username='')
click to toggle source
Assigns an issue to a user
@param [String] issue The issue key @param [String] username The username (login) of the assignee @return [A JSON object, containing all the issues.
# File lib/sonarqube-client/issues.rb, line 77 def assign issue, username='' JSON.parse(@connector[@@endpoint + "assign?issue=#{issue},assignee=#{username}"].get) end
changelog(key)
click to toggle source
Returns the changelog of an issue
@param [String] key The issue key. @return [JSON] A JSON object, containing all the changelog.
# File lib/sonarqube-client/issues.rb, line 96 def changelog key JSON.parse(@connector[@@endpoint + "changelog?format=json,issue=#{key}"].get) end
get()
click to toggle source
Returns all issues
@return [JSON] A JSON object, containing all the issues.
# File lib/sonarqube-client/issues.rb, line 104 def get JSON.parse(@connector[@@endpoint + 'search'].get) end
get_committers(search_string)
click to toggle source
Returns scm users (usernames or emails) that have authored code with issues
@param [String] search_string A string that will be used to search (regex match equivalent to /.\*search_string.\*/) for authors usernames or emails (e.g. for git it'll be used to search for what's configured in user.name or user.email). @return [JSON] A JSON object, containing all the authors.
# File lib/sonarqube-client/issues.rb, line 87 def get_committers search_string JSON.parse(@connector[@@endpoint + "authors?ps=2147483647&q=#{search_string}"].get) end
in_past(date)
click to toggle source
Returns all issues created between the current date/time and the amount of days/time provided
@param [String] date A string representation of a date or datetime in ISO format, that specifies how far back from the current date/time we want to look for new issues (example: 2015-01-01 or 2015-01-01T11:01:01+0100) @return [JSON] A JSON object, containing all the issues created in the previous time/days specified.
# File lib/sonarqube-client/issues.rb, line 57 def in_past date JSON.parse(@connector[@@endpoint + "search?createdInLast=#{date}"].get) end
older_than(date)
click to toggle source
Search for issues older than a date/datetime
@param [String] date A string representation of a date or datetime in ISO format (example: 2015-01-01 or 2015-01-01T11:01:01+0100) @return A JSON object, containing all the issues created after the given date.
# File lib/sonarqube-client/issues.rb, line 46 def older_than date JSON.parse(@connector[@@endpoint + "search?createdBefore=#{date}"].get) end
search_by_name(names)
click to toggle source
Search for issues by name
@param names The key or keys (comma-separated list) to be used in the search @return A JSON object, containing all the issues found.
# File lib/sonarqube-client/issues.rb, line 36 def search_by_name names JSON.parse(@connector[@@endpoint + "search?componentKeys=#{names}"].get) end