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.
-
#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 |
#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
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 |
# File 'lib/api_config.rb', line 92 def self.from_json(json) 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] ) end |