Sha256: 05929985455150b50091dd024d9e4a59437a0c332aeed761f54176b40c5ceaaf

Contents?: true

Size: 926 Bytes

Versions: 24

Compression:

Stored size: 926 Bytes

Contents

# frozen_string_literal: true

module Datadog
  module Core
    module Remote
      module Transport
        module HTTP
          module API
            # An API configured with adapter and routes
            class Instance
              attr_reader \
                :adapter,
                :headers,
                :spec

              def initialize(spec, adapter, options = {})
                @spec = spec
                @adapter = adapter
                @headers = options.fetch(:headers, {})
              end

              def encoder
                spec.encoder
              end

              def call(env)
                # Add headers to request env, unless empty.
                env.headers.merge!(headers) unless headers.empty?

                # Send request env to the adapter.
                adapter.call(env)
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 2 rubygems

Version Path
datadog-2.7.0 lib/datadog/core/remote/transport/http/api/instance.rb
datadog-2.6.0 lib/datadog/core/remote/transport/http/api/instance.rb
datadog-2.5.0 lib/datadog/core/remote/transport/http/api/instance.rb
datadog-2.4.0 lib/datadog/core/remote/transport/http/api/instance.rb
datadog-2.3.0 lib/datadog/core/remote/transport/http/api/instance.rb
datadog-2.2.0 lib/datadog/core/remote/transport/http/api/instance.rb
ddtrace-1.23.3 lib/datadog/core/remote/transport/http/api/instance.rb
ddtrace-1.23.2 lib/datadog/core/remote/transport/http/api/instance.rb
datadog-2.1.0 lib/datadog/core/remote/transport/http/api/instance.rb
datadog-2.0.0 lib/datadog/core/remote/transport/http/api/instance.rb
ddtrace-1.23.1 lib/datadog/core/remote/transport/http/api/instance.rb
datadog-2.0.0.beta2 lib/datadog/core/remote/transport/http/api/instance.rb
ddtrace-1.22.0 lib/datadog/core/remote/transport/http/api/instance.rb
datadog-2.0.0.beta1 lib/datadog/core/remote/transport/http/api/instance.rb
ddtrace-1.21.1 lib/datadog/core/remote/transport/http/api/instance.rb
ddtrace-1.21.0 lib/datadog/core/remote/transport/http/api/instance.rb
ddtrace-1.20.0 lib/datadog/core/remote/transport/http/api/instance.rb
ddtrace-1.19.0 lib/datadog/core/remote/transport/http/api/instance.rb
ddtrace-1.18.0 lib/datadog/core/remote/transport/http/api/instance.rb
ddtrace-1.17.0 lib/datadog/core/remote/transport/http/api/instance.rb