Sha256: e209358567ca6f4169aee7eb9c1d32a0f7655671516e32702871be3edfa7892c

Contents?: true

Size: 880 Bytes

Versions: 2

Compression:

Stored size: 880 Bytes

Contents

require "rack"
require "webmock"

require "pipekit/webmock/request_signature_snippet"

module Pipekit
  module WebMock
    class UnregisteredPipedriveRequestError < StandardError
      WebMockNetConnectNotAllowedError = ::WebMock::NetConnectNotAllowedError unless const_defined?(:WebMockNetConnectNotAllowedError)

      def initialize(request_signature)
        request_signature_snippet = RequestSignatureSnippet.new(request_signature)

        return WebMockNetConnectNotAllowedError.new(request_signature) unless request_signature_snippet.pipedrive_request?
        text = [
          "Unregistered request to Pipedrive: #{request_signature}",
          "with params:",
          request_signature_snippet.params,
          "and body:",
          request_signature_snippet.body,
          "="*60
        ].compact.join("\n\n")

        super(text)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pipekit-webmock-0.3.0 lib/pipekit/webmock/errors.rb
pipekit-webmock-0.2.0 lib/pipekit/webmock/errors.rb