Class: Datadog::Core::Remote::Transport::HTTP::Config::API::Endpoint

Inherits:
Transport::HTTP::API::Endpoint show all
Defined in:
lib/datadog/core/remote/transport/http/config.rb

Overview

Endpoint for remote configuration

Constant Summary collapse

HEADER_CONTENT_TYPE =
'Content-Type'

Instance Attribute Summary collapse

Attributes inherited from Transport::HTTP::API::Endpoint

#path, #verb

Instance Method Summary collapse

Constructor Details

#initialize(path, encoder) ⇒ Endpoint

Returns a new instance of Endpoint.



249
250
251
252
# File 'lib/datadog/core/remote/transport/http/config.rb', line 249

def initialize(path, encoder)
  super(:post, path)
  @encoder = encoder
end

Instance Attribute Details

#encoderObject (readonly)

Returns the value of attribute encoder.



247
248
249
# File 'lib/datadog/core/remote/transport/http/config.rb', line 247

def encoder
  @encoder
end

Instance Method Details

#call(env, &block) ⇒ Object



254
255
256
257
258
259
260
261
262
263
264
265
266
# File 'lib/datadog/core/remote/transport/http/config.rb', line 254

def call(env, &block)
  # Encode body & type
  env.headers[HEADER_CONTENT_TYPE] = encoder.content_type
  env.body = env.request.parcel.data

  # Query for response
  http_response = super(env, &block)

  response_options = {}

  # Build and return a response
  Config::Response.new(http_response, response_options)
end