Class: Optimizely::Decide::OptimizelyDecision
- Inherits:
-
Object
- Object
- Optimizely::Decide::OptimizelyDecision
- Defined in:
- lib/optimizely/decide/optimizely_decision.rb
Instance Attribute Summary collapse
-
#enabled ⇒ Object
readonly
Returns the value of attribute enabled.
-
#flag_key ⇒ Object
readonly
Returns the value of attribute flag_key.
-
#reasons ⇒ Object
readonly
Returns the value of attribute reasons.
-
#rule_key ⇒ Object
readonly
Returns the value of attribute rule_key.
-
#user_context ⇒ Object
readonly
Returns the value of attribute user_context.
-
#variables ⇒ Object
readonly
Returns the value of attribute variables.
-
#variation_key ⇒ Object
readonly
Returns the value of attribute variation_key.
Instance Method Summary collapse
- #as_json ⇒ Object
-
#initialize(variation_key: nil, enabled: nil, variables: nil, rule_key: nil, flag_key: nil, user_context: nil, reasons: nil) ⇒ OptimizelyDecision
constructor
A new instance of OptimizelyDecision.
- #to_json(*args) ⇒ Object
Constructor Details
#initialize(variation_key: nil, enabled: nil, variables: nil, rule_key: nil, flag_key: nil, user_context: nil, reasons: nil) ⇒ OptimizelyDecision
Returns a new instance of OptimizelyDecision.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/optimizely/decide/optimizely_decision.rb', line 25 def initialize( variation_key: nil, enabled: nil, variables: nil, rule_key: nil, flag_key: nil, user_context: nil, reasons: nil ) @variation_key = variation_key @enabled = enabled || false @variables = variables || {} @rule_key = rule_key @flag_key = flag_key @user_context = user_context @reasons = reasons || [] end |
Instance Attribute Details
#enabled ⇒ Object (readonly)
Returns the value of attribute enabled.
23 24 25 |
# File 'lib/optimizely/decide/optimizely_decision.rb', line 23 def enabled @enabled end |
#flag_key ⇒ Object (readonly)
Returns the value of attribute flag_key.
23 24 25 |
# File 'lib/optimizely/decide/optimizely_decision.rb', line 23 def flag_key @flag_key end |
#reasons ⇒ Object (readonly)
Returns the value of attribute reasons.
23 24 25 |
# File 'lib/optimizely/decide/optimizely_decision.rb', line 23 def reasons @reasons end |
#rule_key ⇒ Object (readonly)
Returns the value of attribute rule_key.
23 24 25 |
# File 'lib/optimizely/decide/optimizely_decision.rb', line 23 def rule_key @rule_key end |
#user_context ⇒ Object (readonly)
Returns the value of attribute user_context.
23 24 25 |
# File 'lib/optimizely/decide/optimizely_decision.rb', line 23 def user_context @user_context end |
#variables ⇒ Object (readonly)
Returns the value of attribute variables.
23 24 25 |
# File 'lib/optimizely/decide/optimizely_decision.rb', line 23 def variables @variables end |
#variation_key ⇒ Object (readonly)
Returns the value of attribute variation_key.
23 24 25 |
# File 'lib/optimizely/decide/optimizely_decision.rb', line 23 def variation_key @variation_key end |
Instance Method Details
#as_json ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/optimizely/decide/optimizely_decision.rb', line 43 def as_json { variation_key: @variation_key, enabled: @enabled, variables: @variables, rule_key: @rule_key, flag_key: @flag_key, user_context: @user_context.as_json, reasons: @reasons } end |
#to_json(*args) ⇒ Object
55 56 57 |
# File 'lib/optimizely/decide/optimizely_decision.rb', line 55 def to_json(*args) as_json.to_json(*args) end |