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.



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/kameleoon/targeting/condition_factory.rb', line 29

def get_condition(condition_json)
  case condition_json['targetingType']
  when ConditionType::CUSTOM_DATUM
    CustomDatum.new(condition_json)
  when ConditionType::TARGET_FEATURE_FLAG
    TargetFeatureFlagCondition.new(condition_json)
  when ConditionType::EXCLUSIVE_FEATURE_FLAG
    ExclusiveFeatureFlagCondition.new(condition_json)
  when ConditionType::PAGE_URL
    PageUrlCondition.new(condition_json)
  when ConditionType::PAGE_VIEWS
    PageViewNumberCondition.new(condition_json)
  when ConditionType::PREVIOUS_PAGE
    PreviousPageCondition.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)
  when ConditionType::GEOLOCATION
    GeolocationCondition.new(condition_json)
  when ConditionType::OPERATING_SYSTEM
    OperatingSystemCondition.new(condition_json)
  when ConditionType::COOKIE
    CookieCondition.new(condition_json)
  when ConditionType::SEGMENT
    SegmentCondition.new(condition_json)
  when ConditionType::VISITS
    VisitNumberTotalCondition.new(condition_json)
  when ConditionType::SAME_DAY_VISITS
    VisitNumberTodayCondition.new(condition_json)
  when ConditionType::NEW_VISITORS
    VisitorNewReturnCondition.new(condition_json)
  when ConditionType::FIRST_VISIT, ConditionType::LAST_VISIT
    TimeElapsedSinceVisitCondition.new(condition_json)
  when ConditionType::HEAT_SLICE
    KcsHeatRangeCondition.new(condition_json)
  else
    UnknownCondition.new(condition_json)
  end
end