Module: Kameleoon::Targeting::ConditionFactory Private

Included in:
TreeBuilder
Defined in:
lib/kameleoon/targeting/condition_factory.rb

Overview

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

Module for create different targeting conditions

Instance Method Summary collapse

Instance Method Details

#get_condition(condition_json) ⇒ 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.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/kameleoon/targeting/condition_factory.rb', line 18

def get_condition(condition_json)
  case condition_json['targetingType']
  when ConditionType::CUSTOM_DATUM
    CustomDatum.new(condition_json)
  when ConditionType::TARGET_EXPERIMENT
    TargetExperiment.new(condition_json)
  when ConditionType::EXCLUSIVE_EXPERIMENT
    ExclusiveExperiment.new(condition_json)
  when ConditionType::PAGE_URL
    PageUrlCondition.new(condition_json)
  when ConditionType::PAGE_TITLE
    PageTitleCondition.new(condition_json)
  when ConditionType::VISITOR_CODE
    VisitorCodeCondition.new(condition_json)
  when ConditionType::DEVICE_TYPE
    DeviceCondition.new(condition_json)
  when ConditionType::CONVERSIONS
    ConversionCondition.new(condition_json)
  when ConditionType::BROWSER
    BrowserCondition.new(condition_json)
  when ConditionType::SDK_LANGUAGE
    SdkLanguageCondition.new(condition_json)
  else
    UnknownCondition.new(condition_json)
  end
end