Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# optly.rb
require 'singleton'
require 'logger'
require 'optimizely/optimizely_factory'
class Optly
include Singleton
def initialize
sdk_key = '<Your_SDK_Key>'
logger = Optimizely::SimpleLogger.new(Logger::INFO)
config_manager = Optimizely::HTTPProjectConfigManager.new(
sdk_key: sdk_key,
polling_interval: 10,
blocking_timeout: 10,
logger: logger,
)
@client = Optimizely::OptimizelyFactory.custom_instance(
sdk_key, # sdk_key
nil, # datafile
nil, # event_dispatcher
logger, # logger
nil, # error_handler
false, # skip_json_validation
nil, # user_profile_service
config_manager, # config_manager
nil # notification_center
)
end
def client
@client
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment