Sha256: 991c2d090479cdff92808505654418474a619f2c676d25a6996d52e4802cc6d1
Contents?: true
Size: 1.41 KB
Versions: 4
Compression:
Stored size: 1.41 KB
Contents
# frozen_string_literal: true require 'json' module Diffend # Module responsible for fetching diffend verdict on local context module RequestVerdict # Exceptions that we handle when there is a resolve issue RESOLVE_EXCEPTIONS = [ Bundler::GemNotFound, Bundler::GitError, Bundler::PermissionError, Bundler::VersionConflict ].freeze class << self # @param config [Diffend::Config] # @param definition [Bundler::Definition] definition for your source def call(config, definition) payload = Diffend::LocalContext.call(config, definition) response = Diffend::Request.call( build_request_object(config, payload) ) JSON.parse(response.body) rescue *RESOLVE_EXCEPTIONS raise ::Diffend::Errors::DependenciesResolveException rescue StandardError => e Diffend::HandleErrors::Report.call( exception: e, payload: payload || {}, config: config, message: :unhandled_exception, report: true ) end # @param config [Diffend::Config] # @param payload [Hash] # # @return [Diffend::RequestObject] def build_request_object(config, payload) Diffend::RequestObject.new( config: config, url: config.commands_url, payload: payload, request_method: :post ) end end end end
Version data entries
4 entries across 4 versions & 2 rubygems