Method: Featureflow::PollingClient#initialize

Defined in:
lib/featureflow/polling_client.rb

#initialize(url, api_key, options = {}) ⇒ PollingClient

Returns a new instance of PollingClient.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/featureflow/polling_client.rb', line 12

def initialize(url, api_key, options = {})
  @etag = ''
  @url = url
  @api_key = api_key
  @options = DEFAULT_OPTIONS.merge(options)
  @features = {}

  load_features

  @thread = Thread.new do
    loop do
      sleep @options[:poll_interval]
      load_features
    end
  end
end