module Kameleoon::ClientFactory

Constants

CONFIGURATION_UPDATE_INTERVAL
CONFIG_PATH
DEFAULT_TIMEOUT

Public Class Methods

create(site_code, blocking = false, config_path = CONFIG_PATH, client_id = nil, client_secret = nil) click to toggle source

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.

@param [String] site_code Site code @param [Boolean] blocking - optional, default is false

@return [Kameleoon::Client]

# 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