@@ -84,7 +84,7 @@ def host
8484 # If +allowed_push_host+ metadata is present, then it will only allow that host.
8585
8686 def rubygems_api_request ( method , path , host = nil , allowed_push_host = nil , scope : nil , credentials : { } , &block )
87- require "net/http"
87+ require_relative "net/http"
8888
8989 self . host = host if host
9090 unless self . host
@@ -119,7 +119,7 @@ def rubygems_api_request(method, path, host = nil, allowed_push_host = nil, scop
119119 end
120120
121121 def mfa_unauthorized? ( response )
122- response . is_a? ( Net ::HTTPUnauthorized ) && response . body . start_with? ( "You have enabled multifactor authentication" )
122+ response . is_a? ( Gem :: Net ::HTTPUnauthorized ) && response . body . start_with? ( "You have enabled multifactor authentication" )
123123 end
124124
125125 def update_scope ( scope )
@@ -208,13 +208,13 @@ def verify_api_key(key)
208208
209209 def with_response ( response , error_prefix = nil )
210210 case response
211- when Net ::HTTPSuccess then
211+ when Gem :: Net ::HTTPSuccess then
212212 if block_given?
213213 yield response
214214 else
215215 say clean_text ( response . body )
216216 end
217- when Net ::HTTPPermanentRedirect , Net ::HTTPRedirection then
217+ when Gem :: Net ::HTTPPermanentRedirect , Gem :: Net ::HTTPRedirection then
218218 message = "The request has redirected permanently to #{ response [ "location" ] } . Please check your defined push host URL."
219219 message = "#{ error_prefix } : #{ message } " if error_prefix
220220
@@ -244,7 +244,7 @@ def set_api_key(host, key)
244244 private
245245
246246 def request_with_otp ( method , uri , &block )
247- request_method = Net ::HTTP . const_get method . to_s . capitalize
247+ request_method = Gem :: Net ::HTTP . const_get method . to_s . capitalize
248248
249249 Gem ::RemoteFetcher . fetcher . request ( uri , request_method ) do |req |
250250 req [ "OTP" ] = otp if otp
@@ -297,7 +297,7 @@ def webauthn_verification_url(credentials)
297297 request . basic_auth credentials [ :email ] , credentials [ :password ]
298298 end
299299 end
300- response . is_a? ( Net ::HTTPSuccess ) ? response . body : nil
300+ response . is_a? ( Gem :: Net ::HTTPSuccess ) ? response . body : nil
301301 end
302302
303303 def pretty_host ( host )
@@ -366,6 +366,6 @@ def get_key_name(scope)
366366 end
367367
368368 def api_key_forbidden? ( response )
369- response . is_a? ( Net ::HTTPForbidden ) && response . body . start_with? ( "The API key doesn't have access" )
369+ response . is_a? ( Gem :: Net ::HTTPForbidden ) && response . body . start_with? ( "The API key doesn't have access" )
370370 end
371371end
0 commit comments