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



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

def self.clear_cache!
  @cached_errors = {}
end

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



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

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



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

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