Sha256: c36c8fbe8d1bc96bdb9fcea4dd23a7be65e7c010d184c534c5caa900c19282fb

Contents?: true

Size: 1.32 KB

Versions: 11

Compression:

Stored size: 1.32 KB

Contents

# frozen_string_literal: true

module Datadog
  module Core
    module Telemetry
      module Http
        # Module for base HTTP response
        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 code
            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
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
datadog-2.9.0 lib/datadog/core/telemetry/http/response.rb
datadog-2.8.0 lib/datadog/core/telemetry/http/response.rb
datadog-2.7.1 lib/datadog/core/telemetry/http/response.rb
datadog-2.7.0 lib/datadog/core/telemetry/http/response.rb
datadog-2.6.0 lib/datadog/core/telemetry/http/response.rb
datadog-2.5.0 lib/datadog/core/telemetry/http/response.rb
datadog-2.4.0 lib/datadog/core/telemetry/http/response.rb
datadog-2.3.0 lib/datadog/core/telemetry/http/response.rb
datadog-2.2.0 lib/datadog/core/telemetry/http/response.rb
datadog-2.1.0 lib/datadog/core/telemetry/http/response.rb
datadog-2.0.0 lib/datadog/core/telemetry/http/response.rb