Class: Dependabot::RegistryClient

Inherits:
Object
  • Object
show all
Defined in:
lib/dependabot/registry_client.rb

Class Method Summary collapse

Class Method Details

.clear_cache!Object



42
43
44
# File 'lib/dependabot/registry_client.rb', line 42

def self.clear_cache!
  @cached_errors = {}
end

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



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/dependabot/registry_client.rb', line 16

def self.get(url:, headers: {}, options: {})
  raise 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



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

def self.head(url:, headers: {}, options: {})
  raise 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