Class: Gemsmith::Authenticators::RubyGems

Inherits:
Object
  • Object
show all
Defined in:
lib/gemsmith/authenticators/ruby_gems.rb

Overview

An authenticator for retrieving RubyGems authorization.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(login, password) ⇒ RubyGems

Returns a new instance of RubyGems.



14
15
16
17
18
19
# File 'lib/gemsmith/authenticators/ruby_gems.rb', line 14

def initialize , password
  @login = 
  @password = password
  @uri = URI.parse self.class.url
  configure_client
end

Class Method Details

.urlObject



10
11
12
# File 'lib/gemsmith/authenticators/ruby_gems.rb', line 10

def self.url
  "https://rubygems.org/api/v1/api_key"
end

Instance Method Details

#authorizationObject



21
22
23
24
25
26
# File 'lib/gemsmith/authenticators/ruby_gems.rb', line 21

def authorization
  request = Net::HTTP::Get.new uri.request_uri
  request.basic_auth , password
  response = client.request request
  String response.body
end