Class: Dependabot::RegistryClient

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/dependabot/registry_client.rb

Class Method Summary collapse

Class Method Details

.clear_cache!Object



62
63
64
# File 'lib/dependabot/registry_client.rb', line 62

def self.clear_cache!
  @cached_errors = {}
end

.get(url:, headers: {}, options: {}) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/dependabot/registry_client.rb', line 27

def self.get(url:, headers: {}, options: {})
  raise T.must(cached_error_for(url)) if cached_error_for(url)

  Excon.get(
    url,
    idempotent: true,
    **SharedHelpers.excon_defaults({ headers: headers }.merge(options))
  )
rescue Excon::Error::Timeout => e
  cache_error(url, e)
  raise e
end

.head(url:, headers: {}, options: {}) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/dependabot/registry_client.rb', line 48

def self.head(url:, headers: {}, options: {})
  raise T.must(cached_error_for(url)) if cached_error_for(url)

  Excon.head(
    url,
    idempotent: true,
    **SharedHelpers.excon_defaults({ headers: headers }.merge(options))
  )
rescue Excon::Error::Timeout => e
  cache_error(url, e)
  raise e
end