Module: Kameleoon::ClientFactory

Defined in:
lib/kameleoon/factory.rb

Constant Summary collapse

CONFIGURATION_UPDATE_INTERVAL =
'60m'
CONFIG_PATH =
"/etc/kameleoon/client-ruby.yaml"
DEFAULT_TIMEOUT =

milli-seconds

2000

Class Method Summary collapse

Class Method Details

.create(site_code, blocking = false, config_path = CONFIG_PATH, client_id = nil, client_secret = nil) ⇒ Kameleoon::Client

Create a kameleoon client object, each call create a new client. The starting point for using the SDK is the initialization step. All interaction with the SDK is done through an object of the Kameleoon::Client class, therefore you need to create this object via Kameleoon::ClientFactory create static method.

Parameters:

  • site_code (String)

    Site code

  • blocking (Boolean) (defaults to: false)
    • optional, default is false

Returns:



18
19
20
21
22
23
24
# File 'lib/kameleoon/factory.rb', line 18

def self.create(site_code, blocking = false, config_path = CONFIG_PATH, client_id = nil, client_secret = nil)
  client = Client.new(site_code, config_path, blocking, CONFIGURATION_UPDATE_INTERVAL, DEFAULT_TIMEOUT, client_id, client_secret)
  client.send(:log, "Warning: you are using the blocking mode") if blocking
  client.send(:log, "Client created with site code: " + site_code.to_s)
  client.send(:fetch_configuration)
  client
end