Class: VWO::ProjectConfigManager

Inherits:
Object
  • Object
show all
Includes:
Common::CampaignUtils, Common::Enums
Defined in:
lib/vwo/project_config_manager.rb

Constant Summary

Constants included from Common::CONSTANTS

Common::CONSTANTS::API_VERSION, Common::CONSTANTS::HTTPS_PROTOCOL, Common::CONSTANTS::HTTP_PROTOCOL, Common::CONSTANTS::LIBRARY_PATH, Common::CONSTANTS::MAX_TRAFFIC_PERCENT, Common::CONSTANTS::MAX_TRAFFIC_VALUE, Common::CONSTANTS::PLATFORM, Common::CONSTANTS::SDK_VERSION, Common::CONSTANTS::SEED_VALUE, Common::CONSTANTS::STATUS_RUNNING, Common::CONSTANTS::URL_NAMESPACE

Instance Method Summary collapse

Methods included from Common::CampaignUtils

#get_campaign, #get_campaign_goal, #set_variation_allocation

Constructor Details

#initialize(settings_file) ⇒ ProjectConfigManager

ProjectConfigManager init method to load and set project config data.



20
21
22
23
# File 'lib/vwo/project_config_manager.rb', line 20

def initialize(settings_file)
  @settings_file = JSON.parse(settings_file)
  @logger = VWO::CustomLogger.get_instance
end

Instance Method Details

#get_settings_fileObject



36
37
38
# File 'lib/vwo/project_config_manager.rb', line 36

def get_settings_file
  @settings_file
end

#process_settings_fileObject

Processes the settings_file, assigns variation allocation range



26
27
28
29
30
31
32
33
34
# File 'lib/vwo/project_config_manager.rb', line 26

def process_settings_file
  (@settings_file['campaigns'] || []).each do |campaign|
    set_variation_allocation(campaign)
  end
  @logger.log(
    LogLevelEnum::DEBUG,
    format(LogMessageEnum::DebugMessages::SETTINGS_FILE_PROCESSED, file: FileNameEnum::ProjectConfigManager)
  )
end