Class: Bundler::Alive::Client::GemsApiClient

Inherits:
Object
  • Object
show all
Defined in:
lib/bundler/alive/client/gems_api_client.rb

Overview

RubyGems.org API Client

Defined Under Namespace

Classes: NotFound

Instance Method Summary collapse

Constructor Details

#initialize(config_path: nil, follow_redirect: false) ⇒ GemApiClient

A new instance of GemApiClient

Parameters:

  • :config_path (String)
  • :follow_redirect (Boolean)

    Follow redirect URL in gems



30
31
32
33
34
35
36
# File 'lib/bundler/alive/client/gems_api_client.rb', line 30

def initialize(config_path: nil, follow_redirect: false)
  @error_messages = []
  @config_gems = get_config_gems(config_path)
  @follow_redirect = follow_redirect

  freeze
end

Instance Method Details

#gems_api_response(gem_names) ⇒ Client::GemsApiResponse

Gets gems from RubyGems.org

Parameters:

  • gem_names (Array<String>)

Returns:



45
46
47
48
49
50
51
52
53
54
55
# File 'lib/bundler/alive/client/gems_api_client.rb', line 45

def gems_api_response(gem_names)
  urls = service_with_urls(gem_names)
  $stdout.puts <<~MESSAGE

    Get all source code repository URLs of gems are done!
  MESSAGE
  Client::GemsApiResponse.new(
    service_with_urls: urls,
    error_messages: error_messages
  )
end