Sha256: bce9de5063163f0e8226b0760032ed856524f35093cefbc5210fbd07cab8c555

Contents?: true

Size: 1.18 KB

Versions: 27

Compression:

Stored size: 1.18 KB

Contents

# frozen_string_literal: true

module Datadog
  module Core
    module Transport
      # Defines abstract response for transport operations
      module Response
        def payload
          nil
        end

        def ok?
          nil
        end

        def unsupported?
          nil
        end

        def not_found?
          nil
        end

        def client_error?
          nil
        end

        def server_error?
          nil
        end

        def internal_error?
          nil
        end

        def inspect
          "#{self.class} ok?:#{ok?} unsupported?:#{unsupported?}, " \
            "not_found?:#{not_found?}, client_error?:#{client_error?}, " \
            "server_error?:#{server_error?}, internal_error?:#{internal_error?}, " \
            "payload:#{payload}"
        end
      end

      # A generic error response for internal errors
      class InternalErrorResponse
        include Response

        attr_reader :error

        def initialize(error)
          @error = error
        end

        def internal_error?
          true
        end

        def inspect
          "#{super}, error_type:#{error.class} error:#{error}"
        end
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 2 rubygems

Version Path
datadog-2.9.0 lib/datadog/core/transport/response.rb
datadog-2.8.0 lib/datadog/core/transport/response.rb
datadog-2.7.1 lib/datadog/core/transport/response.rb
datadog-2.7.0 lib/datadog/core/transport/response.rb
datadog-2.6.0 lib/datadog/core/transport/response.rb
datadog-2.5.0 lib/datadog/core/transport/response.rb
datadog-2.4.0 lib/datadog/core/transport/response.rb
datadog-2.3.0 lib/datadog/core/transport/response.rb
datadog-2.2.0 lib/datadog/core/transport/response.rb
ddtrace-1.23.3 lib/datadog/core/transport/response.rb
ddtrace-1.23.2 lib/datadog/core/transport/response.rb
datadog-2.1.0 lib/datadog/core/transport/response.rb
datadog-2.0.0 lib/datadog/core/transport/response.rb
ddtrace-1.23.1 lib/datadog/core/transport/response.rb
datadog-2.0.0.beta2 lib/datadog/core/transport/response.rb
ddtrace-1.22.0 lib/datadog/core/transport/response.rb
datadog-2.0.0.beta1 lib/datadog/core/transport/response.rb
ddtrace-1.21.1 lib/datadog/core/transport/response.rb
ddtrace-1.21.0 lib/datadog/core/transport/response.rb
ddtrace-1.20.0 lib/datadog/core/transport/response.rb