class Gitlab::Client
Wrapper for the Gitlab
REST API.
Public Instance Methods
inspect()
click to toggle source
Text representation of the client, masking private token.
@return [String]
Calls superclass method
# File lib/gitlab/client.rb, line 74 def inspect inspected = super inspected.sub! @private_token, only_show_last_four_chars(@private_token) if @private_token inspected end
url_encode(url)
click to toggle source
Utility method for URL encoding of a string. Copied from ruby-doc.org/stdlib-2.7.0/libdoc/erb/rdoc/ERB/Util.html
@return [String]
# File lib/gitlab/client.rb, line 84 def url_encode(url) url.to_s.b.gsub(/[^a-zA-Z0-9_\-.~]/n) { |m| sprintf('%%%02X', m.unpack1('C')) } # rubocop:disable Style/FormatString end
Private Instance Methods
only_show_last_four_chars(token)
click to toggle source
# File lib/gitlab/client.rb, line 90 def only_show_last_four_chars(token) "#{'*' * (token.size - 4)}#{token[-4..-1]}" end