Class: Dependabot::Bundler::Package::PackageDetailsFetcher

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Includes:
UpdateChecker::SharedBundlerHelpers
Defined in:
lib/dependabot/bundler/package/package_details_fetcher.rb

Constant Summary collapse

RELEASES_URL =
"%s/api/v1/versions/%s.json"
GEM_URL =
"%s/gems/%s.gem"
PACKAGE_TYPE =
"gem"
PACKAGE_LANGUAGE =
"ruby"
APPLICATION_JSON =
"application/json"
RUBYGEMS =
"rubygems"
GIT =
"git"
OTHER =
"other"

Constants included from UpdateChecker::SharedBundlerHelpers

UpdateChecker::SharedBundlerHelpers::GIT_REF_REGEX, UpdateChecker::SharedBundlerHelpers::GIT_REGEX, UpdateChecker::SharedBundlerHelpers::PATH_REGEX, UpdateChecker::SharedBundlerHelpers::RETRYABLE_ERRORS, UpdateChecker::SharedBundlerHelpers::RETRYABLE_PRIVATE_REGISTRY_ERRORS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from UpdateChecker::SharedBundlerHelpers

#base_directory, #gemfile, #handle_bundler_errors, #in_a_native_bundler_context, #inaccessible_git_dependencies, #jfrog_source, #lockfile, #private_registry_credentials, #retryable_error?, #write_temporary_dependency_files

Constructor Details

#initialize(dependency:, dependency_files:, credentials:) ⇒ PackageDetailsFetcher



40
41
42
43
44
45
46
47
48
# File 'lib/dependabot/bundler/package/package_details_fetcher.rb', line 40

def initialize(dependency:, dependency_files:, credentials:)
  @dependency = dependency
  @dependency_files = dependency_files
  @credentials = credentials

  @source_type = T.let(nil, T.nilable(String))
  @options = T.let({}, T::Hash[Symbol, T.untyped])
  @repo_contents_path = T.let(nil, T.nilable(String))
end

Instance Attribute Details

#credentialsObject (readonly)

Returns the value of attribute credentials.



57
58
59
# File 'lib/dependabot/bundler/package/package_details_fetcher.rb', line 57

def credentials
  @credentials
end

#dependencyObject (readonly)

Returns the value of attribute dependency.



51
52
53
# File 'lib/dependabot/bundler/package/package_details_fetcher.rb', line 51

def dependency
  @dependency
end

#dependency_filesObject (readonly)

Returns the value of attribute dependency_files.



54
55
56
# File 'lib/dependabot/bundler/package/package_details_fetcher.rb', line 54

def dependency_files
  @dependency_files
end

#optionsObject (readonly)

Returns the value of attribute options.



60
61
62
# File 'lib/dependabot/bundler/package/package_details_fetcher.rb', line 60

def options
  @options
end

#repo_contents_pathObject (readonly)

Returns the value of attribute repo_contents_path.



63
64
65
# File 'lib/dependabot/bundler/package/package_details_fetcher.rb', line 63

def repo_contents_path
  @repo_contents_path
end

Instance Method Details

#fetchObject



66
67
68
69
70
71
72
73
# File 'lib/dependabot/bundler/package/package_details_fetcher.rb', line 66

def fetch
  case source_type
  when GIT, OTHER
    package_details([])
  else
    rubygems_versions
  end
end