Class: Kameleoon::Targeting::ExclusiveExperimentCondition Private

Inherits:
Condition
  • Object
show all
Defined in:
lib/kameleoon/targeting/conditions/exclusive_experiment_condition.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

ExclusiveExperiment represents an instance of Exclusive Experiment condition in user account

Defined Under Namespace

Modules: CampaignType

Instance Attribute Summary

Attributes inherited from Condition

#id, #include, #type

Instance Method Summary collapse

Constructor Details

#initialize(json_condition) ⇒ ExclusiveExperimentCondition

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of ExclusiveExperimentCondition.



17
18
19
20
21
# File 'lib/kameleoon/targeting/conditions/exclusive_experiment_condition.rb', line 17

def initialize(json_condition)
  super(json_condition)

  @campaign_type = json_condition['campaignType']
end

Instance Method Details

#check(data) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/kameleoon/targeting/conditions/exclusive_experiment_condition.rb', line 23

def check(data)
  return false unless data.is_a?(ExclusiveExperimentInfo)

  case @campaign_type
  when CampaignType::EXPERIMENT
    return check_experiment(data)
  when CampaignType::PERSONALIZATION
    return check_personalization(data)
  when CampaignType::ANY
    return check_personalization(data) && check_experiment(data)
  end
  Logging::KameleoonLogger.error("Unexpected campaign type for '#{type}' condition: '#{@campaign_type}'")
  false
end