Sha256: 113cf50f1eb5333745e3ecd6910112352ab74fc973260bc87932636948096eaf
Contents?: true
Size: 907 Bytes
Versions: 3
Compression:
Stored size: 907 Bytes
Contents
# frozen_string_literal: true require "net/http" require "uri" require "openssl" module Gemsmith module Authenticators # An authenticator for retrieving RubyGems authorization. class RubyGems def self.url "https://rubygems.org/api/v1/api_key" end def initialize login, password @login = login @password = password @uri = URI.parse self.class.url configure_client end def authorization request = Net::HTTP::Get.new uri.request_uri request.basic_auth login, password response = client.request request String response.body end private attr_reader :login, :password, :uri, :client def configure_client @client = Net::HTTP.new uri.host, uri.port @client.use_ssl = true @client.verify_mode = OpenSSL::SSL::VERIFY_PEER end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
gemsmith-9.5.0 | lib/gemsmith/authenticators/ruby_gems.rb |
gemsmith-9.4.0 | lib/gemsmith/authenticators/ruby_gems.rb |
gemsmith-9.3.0 | lib/gemsmith/authenticators/ruby_gems.rb |