Class: EppoClient::Config

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

Overview

The class for configuring the Eppo client singleton

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key, assignment_logger: AssignmentLogger.new, base_url: EppoClient::Core::DEFAULT_BASE_URL, poll_interval_seconds: EppoClient::Core::DEFAULT_POLL_INTERVAL_SECONDS, poll_jitter_seconds: EppoClient::Core::DEFAULT_POLL_JITTER_SECONDS, initial_configuration: nil, log_level: nil) ⇒ Config

Returns a new instance of Config.



11
12
13
14
15
16
17
18
# File 'lib/eppo_client/config.rb', line 11

def initialize(api_key, assignment_logger: AssignmentLogger.new, base_url: EppoClient::Core::DEFAULT_BASE_URL, poll_interval_seconds: EppoClient::Core::DEFAULT_POLL_INTERVAL_SECONDS, poll_jitter_seconds: EppoClient::Core::DEFAULT_POLL_JITTER_SECONDS, initial_configuration: nil, log_level: nil)
  @api_key = api_key
  @assignment_logger = assignment_logger
  @base_url = base_url
  @poll_interval_seconds = poll_interval_seconds
  @poll_jitter_seconds = poll_jitter_seconds
  @log_level = log_level
end

Instance Attribute Details

#api_keyObject (readonly)

Returns the value of attribute api_key.



9
10
11
# File 'lib/eppo_client/config.rb', line 9

def api_key
  @api_key
end

#assignment_loggerObject (readonly)

Returns the value of attribute assignment_logger.



9
10
11
# File 'lib/eppo_client/config.rb', line 9

def assignment_logger
  @assignment_logger
end

#base_urlObject (readonly)

Returns the value of attribute base_url.



9
10
11
# File 'lib/eppo_client/config.rb', line 9

def base_url
  @base_url
end

#log_levelObject (readonly)

Returns the value of attribute log_level.



9
10
11
# File 'lib/eppo_client/config.rb', line 9

def log_level
  @log_level
end

#poll_interval_secondsObject (readonly)

Returns the value of attribute poll_interval_seconds.



9
10
11
# File 'lib/eppo_client/config.rb', line 9

def poll_interval_seconds
  @poll_interval_seconds
end

#poll_jitter_secondsObject (readonly)

Returns the value of attribute poll_jitter_seconds.



9
10
11
# File 'lib/eppo_client/config.rb', line 9

def poll_jitter_seconds
  @poll_jitter_seconds
end

Instance Method Details

#inspectObject

Hide instance variables (specifically api_key) from logs



25
26
27
# File 'lib/eppo_client/config.rb', line 25

def inspect
  "#<EppoClient::Config:#{object_id}>"
end

#validateObject



20
21
22
# File 'lib/eppo_client/config.rb', line 20

def validate
  EppoClient.validate_not_blank("api_key", @api_key)
end