Class: Kameleoon::DataManager::AssignedVariation
- Inherits:
-
Kameleoon::DuplicationUnsafeData
- Object
- Kameleoon::Data
- Kameleoon::DuplicationUnsafeData
- Kameleoon::DataManager::AssignedVariation
- Defined in:
- lib/kameleoon/data/manager/assigned_variation.rb
Overview
AssignedVariation represents a variation assigned to a visitor.
Constant Summary collapse
- EVENT_TYPE =
'experiment'
Instance Attribute Summary collapse
-
#assignment_time ⇒ Object
readonly
Returns the value of attribute assignment_time.
-
#experiment_id ⇒ Object
readonly
Returns the value of attribute experiment_id.
-
#rule_type ⇒ Object
readonly
Returns the value of attribute rule_type.
-
#variation_id ⇒ Object
readonly
Returns the value of attribute variation_id.
Attributes inherited from Kameleoon::Data
Instance Method Summary collapse
-
#initialize(experiment_id, variation_id, rule_type = Kameleoon::Configuration::RuleType::UNKNOWN, assignment_time: nil) ⇒ AssignedVariation
constructor
A new instance of AssignedVariation.
- #obtain_full_post_text_line ⇒ Object
- #to_s ⇒ Object
- #valid?(respool_time) ⇒ Boolean
Methods inherited from Kameleoon::Data
#mark_as_sent, #mark_as_transmitting, #mark_as_unsent, #sent, #transmitting, #unsent
Constructor Details
#initialize(experiment_id, variation_id, rule_type = Kameleoon::Configuration::RuleType::UNKNOWN, assignment_time: nil) ⇒ AssignedVariation
Returns a new instance of AssignedVariation.
21 22 23 24 25 26 27 28 29 |
# File 'lib/kameleoon/data/manager/assigned_variation.rb', line 21 def initialize( experiment_id, variation_id, rule_type = Kameleoon::Configuration::RuleType::UNKNOWN, assignment_time: nil ) super(DataType::ASSIGNED_VARIATION) @experiment_id = experiment_id @variation_id = variation_id @rule_type = rule_type @assignment_time = assignment_time || Time.new.to_i end |
Instance Attribute Details
#assignment_time ⇒ Object (readonly)
Returns the value of attribute assignment_time.
14 15 16 |
# File 'lib/kameleoon/data/manager/assigned_variation.rb', line 14 def assignment_time @assignment_time end |
#experiment_id ⇒ Object (readonly)
Returns the value of attribute experiment_id.
14 15 16 |
# File 'lib/kameleoon/data/manager/assigned_variation.rb', line 14 def experiment_id @experiment_id end |
#rule_type ⇒ Object (readonly)
Returns the value of attribute rule_type.
14 15 16 |
# File 'lib/kameleoon/data/manager/assigned_variation.rb', line 14 def rule_type @rule_type end |
#variation_id ⇒ Object (readonly)
Returns the value of attribute variation_id.
14 15 16 |
# File 'lib/kameleoon/data/manager/assigned_variation.rb', line 14 def variation_id @variation_id end |
Instance Method Details
#obtain_full_post_text_line ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'lib/kameleoon/data/manager/assigned_variation.rb', line 31 def obtain_full_post_text_line params = { eventType: EVENT_TYPE, id: @experiment_id, variationId: @variation_id, nonce: nonce } Kameleoon::Network::UriHelper.encode_query(params) end |
#to_s ⇒ Object
16 17 18 19 |
# File 'lib/kameleoon/data/manager/assigned_variation.rb', line 16 def to_s "AssignedVariation{experiment_id:#{@experiment_id},variation_id:#{@variation_id}," \ "assignment_time:#{@assignment_time},rule_type:#{@rule_type}}" end |
#valid?(respool_time) ⇒ Boolean
41 42 43 |
# File 'lib/kameleoon/data/manager/assigned_variation.rb', line 41 def valid?(respool_time) respool_time.nil? || (@assignment_time >= respool_time) end |