Module: LaunchDarkly::DataSystem::DataSourceBuilderCommon

Included in:
FDv1PollingDataSourceBuilder, PollingDataSourceBuilder, StreamingDataSourceBuilder
Defined in:
lib/ldclient-rb/data_system/data_source_builder_common.rb

Overview

Common HTTP configuration methods shared by all data source builders.

This module is included by PollingDataSourceBuilder, FDv1PollingDataSourceBuilder, and StreamingDataSourceBuilder to provide a consistent set of HTTP connection settings.

Each builder that includes this module must define a +DEFAULT_BASE_URI+ constant which is used as the fallback when #base_uri has not been called.

Instance Method Summary collapse

Instance Method Details

#base_uri(uri) ⇒ self

Sets the base URI for HTTP requests.

Use this to point the SDK at a Relay Proxy instance or any other URI that implements the corresponding LaunchDarkly API.

Parameters:

Returns:

  • (self)

    the builder, for chaining



27
28
29
30
# File 'lib/ldclient-rb/data_system/data_source_builder_common.rb', line 27

def base_uri(uri)
  @base_uri = uri
  self
end

#connect_timeout(timeout) ⇒ self

Sets the connect timeout for HTTP connections.

Parameters:

  • timeout (Float)

    Timeout in seconds

Returns:

  • (self)

    the builder, for chaining



60
61
62
63
# File 'lib/ldclient-rb/data_system/data_source_builder_common.rb', line 60

def connect_timeout(timeout)
  @connect_timeout = timeout
  self
end

#read_timeout(timeout) ⇒ self

Sets the read timeout for HTTP connections.

Parameters:

  • timeout (Float)

    Timeout in seconds

Returns:

  • (self)

    the builder, for chaining



49
50
51
52
# File 'lib/ldclient-rb/data_system/data_source_builder_common.rb', line 49

def read_timeout(timeout)
  @read_timeout = timeout
  self
end

#socket_factory(factory) ⇒ self

Sets a custom socket factory for HTTP connections.

Parameters:

  • factory (#open)

    A socket factory that responds to +open+

Returns:

  • (self)

    the builder, for chaining



38
39
40
41
# File 'lib/ldclient-rb/data_system/data_source_builder_common.rb', line 38

def socket_factory(factory)
  @socket_factory = factory
  self
end