Module: Bundler::Security::Voting::Versions::Remote
- Defined in:
- lib/bundler/security/voting/versions/remote.rb
Overview
Module responsible for fetching safe/malicious votes for current or current/new versions of gems
Class Method Summary collapse
- .call(command, definition) ⇒ Object
-
.fetch_config ⇒ OpenStruct?
Fetch coditsu config file.
-
.payload(command, repository_id, definition) ⇒ Hash
Payload for differ bundler endpoint.
Class Method Details
.call(command, definition) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/bundler/security/voting/versions/remote.rb', line 21 def call(command, definition) config = fetch_config Request .call(config, payload(command, config&.repository_id, definition)) .then { |response| JSON.parse(response.body) } end |
.fetch_config ⇒ OpenStruct?
Fetch coditsu config file
48 49 50 51 52 53 54 |
# File 'lib/bundler/security/voting/versions/remote.rb', line 48 def fetch_config Config::Fetcher.call( File.('..', Bundler.bin_path) ) rescue Errors::MissingConfigurationFile nil end |
.payload(command, repository_id, definition) ⇒ Hash
Returns payload for differ bundler endpoint.
34 35 36 37 38 39 40 41 |
# File 'lib/bundler/security/voting/versions/remote.rb', line 34 def payload(command, repository_id, definition) Local.call(command, definition).each_with_object({}) do |(name, versions), hash| hash[:data] ||= {} hash[:data][:repository_id] = repository_id if repository_id hash[:data][:gems] ||= {} hash[:data][:gems][name] = versions end end |