Class: Datadog::Core::Transport::HTTP::API::Instance
- Inherits:
-
Object
- Object
- Datadog::Core::Transport::HTTP::API::Instance
- Defined in:
- lib/datadog/core/transport/http/api/instance.rb
Overview
An API configured with adapter and routes
Direct Known Subclasses
Remote::Transport::HTTP::API::Instance, DI::Transport::HTTP::Diagnostics::API::Instance, DI::Transport::HTTP::Input::API::Instance, Tracing::Transport::HTTP::Traces::API::Instance
Defined Under Namespace
Classes: EndpointNotSupportedError
Instance Attribute Summary collapse
-
#adapter ⇒ Object
readonly
Returns the value of attribute adapter.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#spec ⇒ Object
readonly
Returns the value of attribute spec.
Instance Method Summary collapse
- #call(env) ⇒ Object
- #encoder ⇒ Object
-
#initialize(spec, adapter, options = {}) ⇒ Instance
constructor
A new instance of Instance.
Constructor Details
permalink #initialize(spec, adapter, options = {}) ⇒ Instance
Returns a new instance of Instance.
32 33 34 35 36 |
# File 'lib/datadog/core/transport/http/api/instance.rb', line 32 def initialize(spec, adapter, = {}) @spec = spec @adapter = adapter @headers = .fetch(:headers, {}) end |
Instance Attribute Details
permalink #adapter ⇒ Object (readonly)
Returns the value of attribute adapter.
27 28 29 |
# File 'lib/datadog/core/transport/http/api/instance.rb', line 27 def adapter @adapter end |
permalink #headers ⇒ Object (readonly)
Returns the value of attribute headers.
27 28 29 |
# File 'lib/datadog/core/transport/http/api/instance.rb', line 27 def headers @headers end |
permalink #spec ⇒ Object (readonly)
Returns the value of attribute spec.
27 28 29 |
# File 'lib/datadog/core/transport/http/api/instance.rb', line 27 def spec @spec end |
Instance Method Details
permalink #call(env) ⇒ Object
[View source]
42 43 44 45 46 47 48 |
# File 'lib/datadog/core/transport/http/api/instance.rb', line 42 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 |
permalink #encoder ⇒ Object
[View source]
38 39 40 |
# File 'lib/datadog/core/transport/http/api/instance.rb', line 38 def encoder spec.encoder end |