Class: LaunchDarkly::Impl::DataSource::Requestor Private
- Inherits:
-
Object
- Object
- LaunchDarkly::Impl::DataSource::Requestor
- Defined in:
- lib/ldclient-rb/impl/data_source/requestor.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Defined Under Namespace
Classes: CacheEntry
Instance Method Summary collapse
-
#initialize(sdk_key, config) ⇒ Requestor
constructor
private
A new instance of Requestor.
- #request_all_data ⇒ Object private
-
#request_all_data_with_headers ⇒ Array(Hash, HTTP::Headers)
private
Requests the full data set, also returning the headers of the response it was retrieved from.
- #stop ⇒ Object private
Constructor Details
#initialize(sdk_key, config) ⇒ Requestor
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Requestor.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/ldclient-rb/impl/data_source/requestor.rb', line 27 def initialize(sdk_key, config) @sdk_key = sdk_key @config = config @http_config = DataSystem::HttpConfigOptions.new( base_uri: config.base_uri, socket_factory: config.socket_factory, read_timeout: config.read_timeout, connect_timeout: config.connect_timeout ) @http_client = Impl::Util.new_http_client(@http_config) .use(:auto_inflate) .headers("Accept-Encoding" => "gzip") @cache = @config.cache_store end |
Instance Method Details
#request_all_data ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
42 43 44 |
# File 'lib/ldclient-rb/impl/data_source/requestor.rb', line 42 def request_all_data() request_all_data_with_headers.first end |
#request_all_data_with_headers ⇒ Array(Hash, HTTP::Headers)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Requests the full data set, also returning the headers of the response it was retrieved from.
51 52 53 54 55 |
# File 'lib/ldclient-rb/impl/data_source/requestor.rb', line 51 def request_all_data_with_headers body, headers = make_request("/sdk/latest-all") all_data = JSON.parse(body, symbolize_names: true) [Impl::Model.make_all_store_data(all_data, @config.logger), headers] end |
#stop ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
57 58 59 60 61 62 |
# File 'lib/ldclient-rb/impl/data_source/requestor.rb', line 57 def stop begin @http_client.close rescue end end |