class Opendistro::Client
Wrapper for the Opendistro
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/opendistro/client.rb, line 14 def inspect inspected = super inspected.sub! @password, only_show_last_four_chars(@password) if @password inspected end
only_show_last_four_chars(password)
click to toggle source
# File lib/opendistro/client.rb, line 28 def only_show_last_four_chars(password) "#{'*' * (password.size - 4)}#{password[-4..-1]}" 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/opendistro/client.rb, line 24 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