Class: Featureflip::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/featureflip/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sdk_key: nil, base_url: "https://eval.featureflip.io", streaming: true, poll_interval: 30, flush_interval: 30, flush_batch_size: 100, init_timeout: 10, connect_timeout: 5, read_timeout: 10, max_stream_retries: 5, send_events: true, logger: nil) ⇒ Config

Returns a new instance of Config.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/featureflip/config.rb', line 7

def initialize(
  sdk_key: nil,
  base_url: "https://eval.featureflip.io",
  streaming: true,
  poll_interval: 30,
  flush_interval: 30,
  flush_batch_size: 100,
  init_timeout: 10,
  connect_timeout: 5,
  read_timeout: 10,
  max_stream_retries: 5,
  send_events: true,
  logger: nil
)
  @sdk_key = sdk_key
  @base_url = base_url
  @streaming = streaming
  @poll_interval = poll_interval
  @flush_interval = flush_interval
  @flush_batch_size = flush_batch_size
  @init_timeout = init_timeout
  @connect_timeout = connect_timeout
  @read_timeout = read_timeout
  @max_stream_retries = max_stream_retries
  @send_events = send_events
  @logger = logger || default_logger

  validate!
end

Instance Attribute Details

#base_urlObject

Returns the value of attribute base_url.



3
4
5
# File 'lib/featureflip/config.rb', line 3

def base_url
  @base_url
end

#connect_timeoutObject

Returns the value of attribute connect_timeout.



3
4
5
# File 'lib/featureflip/config.rb', line 3

def connect_timeout
  @connect_timeout
end

#flush_batch_sizeObject

Returns the value of attribute flush_batch_size.



3
4
5
# File 'lib/featureflip/config.rb', line 3

def flush_batch_size
  @flush_batch_size
end

#flush_intervalObject

Returns the value of attribute flush_interval.



3
4
5
# File 'lib/featureflip/config.rb', line 3

def flush_interval
  @flush_interval
end

#init_timeoutObject

Returns the value of attribute init_timeout.



3
4
5
# File 'lib/featureflip/config.rb', line 3

def init_timeout
  @init_timeout
end

#loggerObject

Returns the value of attribute logger.



3
4
5
# File 'lib/featureflip/config.rb', line 3

def logger
  @logger
end

#max_stream_retriesObject

Returns the value of attribute max_stream_retries.



3
4
5
# File 'lib/featureflip/config.rb', line 3

def max_stream_retries
  @max_stream_retries
end

#poll_intervalObject

Returns the value of attribute poll_interval.



3
4
5
# File 'lib/featureflip/config.rb', line 3

def poll_interval
  @poll_interval
end

#read_timeoutObject

Returns the value of attribute read_timeout.



3
4
5
# File 'lib/featureflip/config.rb', line 3

def read_timeout
  @read_timeout
end

#sdk_keyObject

Returns the value of attribute sdk_key.



3
4
5
# File 'lib/featureflip/config.rb', line 3

def sdk_key
  @sdk_key
end

#send_eventsObject

Returns the value of attribute send_events.



3
4
5
# File 'lib/featureflip/config.rb', line 3

def send_events
  @send_events
end

#streamingObject

Returns the value of attribute streaming.



3
4
5
# File 'lib/featureflip/config.rb', line 3

def streaming
  @streaming
end

Instance Method Details

#validate!Object



37
38
39
40
# File 'lib/featureflip/config.rb', line 37

def validate!
  finalize!
  validate_positive_fields!
end