Class: Statsig::APICondition
- Inherits:
-
Object
- Object
- Statsig::APICondition
- Defined in:
- lib/api_config.rb
Instance Attribute Summary collapse
-
#additional_values ⇒ Object
Returns the value of attribute additional_values.
-
#field ⇒ Object
Returns the value of attribute field.
-
#hash ⇒ Object
Returns the value of attribute hash.
-
#id_type ⇒ Object
Returns the value of attribute id_type.
-
#operator ⇒ Object
Returns the value of attribute operator.
-
#target_value ⇒ Object
Returns the value of attribute target_value.
-
#type ⇒ Object
Returns the value of attribute type.
Class Method Summary collapse
Instance Attribute Details
#additional_values ⇒ Object
Returns the value of attribute additional_values.
90 91 92 |
# File 'lib/api_config.rb', line 90 def additional_values @additional_values end |
#field ⇒ Object
Returns the value of attribute field.
90 91 92 |
# File 'lib/api_config.rb', line 90 def field @field end |
#hash ⇒ Object
Returns the value of attribute hash.
90 91 92 |
# File 'lib/api_config.rb', line 90 def hash @hash end |
#id_type ⇒ Object
Returns the value of attribute id_type.
90 91 92 |
# File 'lib/api_config.rb', line 90 def id_type @id_type end |
#operator ⇒ Object
Returns the value of attribute operator.
90 91 92 |
# File 'lib/api_config.rb', line 90 def operator @operator end |
#target_value ⇒ Object
Returns the value of attribute target_value.
90 91 92 |
# File 'lib/api_config.rb', line 90 def target_value @target_value end |
#type ⇒ Object
Returns the value of attribute type.
90 91 92 |
# File 'lib/api_config.rb', line 90 def type @type end |
Class Method Details
.from_json(json) ⇒ Object
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/api_config.rb', line 91 def self.from_json(json) hash = Statsig::HashUtils.md5(json.to_s).to_sym return Statsig::Memo.for_global(:api_condition_from_json, hash) do operator = json[:operator] unless operator.nil? operator = operator&.downcase&.to_sym unless Const::SUPPORTED_OPERATORS.include?(operator) raise UnsupportedConfigException end end type = json[:type] unless type.nil? type = type&.downcase&.to_sym unless Const::SUPPORTED_CONDITION_TYPES.include?(type) raise UnsupportedConfigException end end new( type: json[:type], target_value: json[:targetValue], operator: json[:operator], field: json[:field], additional_values: json[:additionalValues], id_type: json[:idType], hash: hash ) end end |