Class: EppoClient::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/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: 'https://eppo.cloud/api') ⇒ Config

Returns a new instance of Config.



11
12
13
14
15
# File 'lib/config.rb', line 11

def initialize(api_key, assignment_logger: AssignmentLogger.new, base_url: 'https://eppo.cloud/api')
  @api_key = api_key
  @assignment_logger = assignment_logger
  @base_url = base_url
end

Instance Attribute Details

#api_keyObject (readonly)

Returns the value of attribute api_key.



9
10
11
# File 'lib/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/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/config.rb', line 9

def base_url
  @base_url
end

Instance Method Details

#inspectObject

Hide instance variables (specifically api_key) from logs



22
23
24
# File 'lib/config.rb', line 22

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

#validateObject



17
18
19
# File 'lib/config.rb', line 17

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