class Gems::APIKeyAuthenticator
Authenticator for RubyGems API key authentication @api private
Attributes
Public Class Methods
Initialize a new APIKeyAuthenticator
@api private @param key [String] the API key @return [APIKeyAuthenticator] a new instance @example Create an API key authenticator
authenticator = Gems::APIKeyAuthenticator.new(key: "rubygems_701243f217cdf23b1370c7b66b65ca97")
# File lib/gems/api_key_authenticator.rb, line 23 def initialize(key:) @key = key end
Public Instance Methods
Generate the authentication headers for a request
@api private @param _request [Net::HTTPRequest] the HTTP request @return [Hash{String => String}] the authentication headers with the API key @example Generate an API key authentication header
authenticator.header(request)
# File lib/gems/api_key_authenticator.rb, line 34 def header(_request) {AUTHENTICATION_HEADER => key} end