Skip to content

Commit 063ee0e

Browse files
docs(abtests): Added documentation for featureFilters configuration i… (generated)
algolia/api-clients-automation#5688 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Samy Kettani <[email protected]>
1 parent 42914e5 commit 063ee0e

File tree

3 files changed

+248
-2
lines changed

3 files changed

+248
-2
lines changed

lib/algolia/models/abtesting/ab_test_configuration.rb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ module Algolia
99
module Abtesting
1010
# A/B test configuration.
1111
class ABTestConfiguration
12+
attr_accessor :feature_filters
13+
1214
attr_accessor :outliers
1315

1416
attr_accessor :empty_search
@@ -18,6 +20,7 @@ class ABTestConfiguration
1820
# Attribute mapping from ruby-style variable name to JSON key.
1921
def self.attribute_map
2022
{
23+
:feature_filters => :featureFilters,
2124
:outliers => :outliers,
2225
:empty_search => :emptySearch,
2326
:minimum_detectable_effect => :minimumDetectableEffect
@@ -27,6 +30,7 @@ def self.attribute_map
2730
# Attribute type mapping.
2831
def self.types_mapping
2932
{
33+
:feature_filters => :"FeatureFilters",
3034
:outliers => :"Outliers",
3135
:empty_search => :"EmptySearch",
3236
:minimum_detectable_effect => :"MinimumDetectableEffect"
@@ -63,6 +67,10 @@ def initialize(attributes = {})
6367
h[k.to_sym] = v
6468
}
6569

70+
if attributes.key?(:feature_filters)
71+
self.feature_filters = attributes[:feature_filters]
72+
end
73+
6674
if attributes.key?(:outliers)
6775
self.outliers = attributes[:outliers]
6876
end
@@ -81,6 +89,7 @@ def initialize(attributes = {})
8189
def ==(other)
8290
return true if self.equal?(other)
8391
self.class == other.class &&
92+
feature_filters == other.feature_filters &&
8493
outliers == other.outliers &&
8594
empty_search == other.empty_search &&
8695
minimum_detectable_effect == other.minimum_detectable_effect
@@ -95,7 +104,7 @@ def eql?(other)
95104
# Calculates hash code according to all attributes.
96105
# @return [Integer] Hash code
97106
def hash
98-
[outliers, empty_search, minimum_detectable_effect].hash
107+
[feature_filters, outliers, empty_search, minimum_detectable_effect].hash
99108
end
100109

101110
# Builds the object from hash

lib/algolia/models/abtesting/estimate_configuration.rb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ module Algolia
99
module Abtesting
1010
# A/B test configuration for estimating the sample size and duration using minimum detectable effect.
1111
class EstimateConfiguration
12+
attr_accessor :feature_filters
13+
1214
attr_accessor :outliers
1315

1416
attr_accessor :empty_search
@@ -18,6 +20,7 @@ class EstimateConfiguration
1820
# Attribute mapping from ruby-style variable name to JSON key.
1921
def self.attribute_map
2022
{
23+
:feature_filters => :featureFilters,
2124
:outliers => :outliers,
2225
:empty_search => :emptySearch,
2326
:minimum_detectable_effect => :minimumDetectableEffect
@@ -27,6 +30,7 @@ def self.attribute_map
2730
# Attribute type mapping.
2831
def self.types_mapping
2932
{
33+
:feature_filters => :"FeatureFilters",
3034
:outliers => :"Outliers",
3135
:empty_search => :"EmptySearch",
3236
:minimum_detectable_effect => :"MinimumDetectableEffect"
@@ -63,6 +67,10 @@ def initialize(attributes = {})
6367
h[k.to_sym] = v
6468
}
6569

70+
if attributes.key?(:feature_filters)
71+
self.feature_filters = attributes[:feature_filters]
72+
end
73+
6674
if attributes.key?(:outliers)
6775
self.outliers = attributes[:outliers]
6876
end
@@ -83,6 +91,7 @@ def initialize(attributes = {})
8391
def ==(other)
8492
return true if self.equal?(other)
8593
self.class == other.class &&
94+
feature_filters == other.feature_filters &&
8695
outliers == other.outliers &&
8796
empty_search == other.empty_search &&
8897
minimum_detectable_effect == other.minimum_detectable_effect
@@ -97,7 +106,7 @@ def eql?(other)
97106
# Calculates hash code according to all attributes.
98107
# @return [Integer] Hash code
99108
def hash
100-
[outliers, empty_search, minimum_detectable_effect].hash
109+
[feature_filters, outliers, empty_search, minimum_detectable_effect].hash
101110
end
102111

103112
# Builds the object from hash
Lines changed: 228 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,228 @@
1+
# frozen_string_literal: true
2+
3+
# Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
4+
5+
require "date"
6+
require "time"
7+
8+
module Algolia
9+
module Abtesting
10+
# Configuration of feature-based filters applied to the A/B test population.
11+
class FeatureFilters
12+
# Whether to apply Dynamic Re-Ranking feature filters.
13+
attr_accessor :dynamic_re_ranking
14+
15+
# Whether to apply AI Personalization feature filters.
16+
attr_accessor :ai_perso
17+
18+
# Whether to apply Multi-Signal Re-Ranking feature filters.
19+
attr_accessor :multi_signal_ranking
20+
21+
# Attribute mapping from ruby-style variable name to JSON key.
22+
def self.attribute_map
23+
{
24+
:dynamic_re_ranking => :dynamicReRanking,
25+
:ai_perso => :aiPerso,
26+
:multi_signal_ranking => :multiSignalRanking
27+
}
28+
end
29+
30+
# Attribute type mapping.
31+
def self.types_mapping
32+
{
33+
:dynamic_re_ranking => :"Boolean",
34+
:ai_perso => :"Boolean",
35+
:multi_signal_ranking => :"Boolean"
36+
}
37+
end
38+
39+
# List of attributes with nullable: true
40+
def self.openapi_nullable
41+
Set.new(
42+
[]
43+
)
44+
end
45+
46+
# Initializes the object
47+
# @param [Hash] attributes Model attributes in the form of hash
48+
def initialize(attributes = {})
49+
if (!attributes.is_a?(Hash))
50+
raise(
51+
ArgumentError,
52+
"The input argument (attributes) must be a hash in `Algolia::FeatureFilters` initialize method"
53+
)
54+
end
55+
56+
# check to see if the attribute exists and convert string to symbol for hash key
57+
attributes = attributes.each_with_object({}) { |(k, v), h|
58+
if (!self.class.attribute_map.key?(k.to_sym))
59+
raise(
60+
ArgumentError,
61+
"`#{k}` is not a valid attribute in `Algolia::FeatureFilters`. Please check the name to make sure it's valid. List of attributes: " +
62+
self.class.attribute_map.keys.inspect
63+
)
64+
end
65+
66+
h[k.to_sym] = v
67+
}
68+
69+
if attributes.key?(:dynamic_re_ranking)
70+
self.dynamic_re_ranking = attributes[:dynamic_re_ranking]
71+
end
72+
73+
if attributes.key?(:ai_perso)
74+
self.ai_perso = attributes[:ai_perso]
75+
end
76+
77+
if attributes.key?(:multi_signal_ranking)
78+
self.multi_signal_ranking = attributes[:multi_signal_ranking]
79+
end
80+
end
81+
82+
# Checks equality by comparing each attribute.
83+
# @param [Object] Object to be compared
84+
def ==(other)
85+
return true if self.equal?(other)
86+
self.class == other.class &&
87+
dynamic_re_ranking == other.dynamic_re_ranking &&
88+
ai_perso == other.ai_perso &&
89+
multi_signal_ranking == other.multi_signal_ranking
90+
end
91+
92+
# @see the `==` method
93+
# @param [Object] Object to be compared
94+
def eql?(other)
95+
self == other
96+
end
97+
98+
# Calculates hash code according to all attributes.
99+
# @return [Integer] Hash code
100+
def hash
101+
[dynamic_re_ranking, ai_perso, multi_signal_ranking].hash
102+
end
103+
104+
# Builds the object from hash
105+
# @param [Hash] attributes Model attributes in the form of hash
106+
# @return [Object] Returns the model itself
107+
def self.build_from_hash(attributes)
108+
return nil unless attributes.is_a?(Hash)
109+
attributes = attributes.transform_keys(&:to_sym)
110+
transformed_hash = {}
111+
types_mapping.each_pair do |key, type|
112+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
113+
transformed_hash[key.to_sym] = nil
114+
elsif type =~ /\AArray<(.*)>/i
115+
# check to ensure the input is an array given that the attribute
116+
# is documented as an array but the input is not
117+
if attributes[attribute_map[key]].is_a?(Array)
118+
transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
119+
_deserialize(::Regexp.last_match(1), v)
120+
}
121+
end
122+
elsif !attributes[attribute_map[key]].nil?
123+
transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
124+
end
125+
end
126+
127+
new(transformed_hash)
128+
end
129+
130+
# Deserializes the data based on type
131+
# @param string type Data type
132+
# @param string value Value to be deserialized
133+
# @return [Object] Deserialized data
134+
def self._deserialize(type, value)
135+
case type.to_sym
136+
when :Time
137+
Time.parse(value)
138+
when :Date
139+
Date.parse(value)
140+
when :String
141+
value.to_s
142+
when :Integer
143+
value.to_i
144+
when :Float
145+
value.to_f
146+
when :Boolean
147+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
148+
true
149+
else
150+
false
151+
end
152+
153+
when :Object
154+
# generic object (usually a Hash), return directly
155+
value
156+
when /\AArray<(?<inner_type>.+)>\z/
157+
inner_type = Regexp.last_match[:inner_type]
158+
value.map { |v| _deserialize(inner_type, v) }
159+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
160+
k_type = Regexp.last_match[:k_type]
161+
v_type = Regexp.last_match[:v_type]
162+
{}.tap do |hash|
163+
value.each do |k, v|
164+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
165+
end
166+
end
167+
# model
168+
else
169+
# models (e.g. Pet) or oneOf
170+
klass = Algolia::Abtesting.const_get(type)
171+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
172+
.build_from_hash(value)
173+
end
174+
end
175+
176+
# Returns the string representation of the object
177+
# @return [String] String presentation of the object
178+
def to_s
179+
to_hash.to_s
180+
end
181+
182+
# to_body is an alias to to_hash (backward compatibility)
183+
# @return [Hash] Returns the object in the form of hash
184+
def to_body
185+
to_hash
186+
end
187+
188+
def to_json(*_args)
189+
to_hash.to_json
190+
end
191+
192+
# Returns the object in the form of hash
193+
# @return [Hash] Returns the object in the form of hash
194+
def to_hash
195+
hash = {}
196+
self.class.attribute_map.each_pair do |attr, param|
197+
value = send(attr)
198+
if value.nil?
199+
is_nullable = self.class.openapi_nullable.include?(attr)
200+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
201+
end
202+
203+
hash[param] = _to_hash(value)
204+
end
205+
206+
hash
207+
end
208+
209+
# Outputs non-array value in the form of hash
210+
# For object, use to_hash. Otherwise, just return the value
211+
# @param [Object] value Any valid value
212+
# @return [Hash] Returns the value in the form of hash
213+
def _to_hash(value)
214+
if value.is_a?(Array)
215+
value.compact.map { |v| _to_hash(v) }
216+
elsif value.is_a?(Hash)
217+
{}.tap do |hash|
218+
value.each { |k, v| hash[k] = _to_hash(v) }
219+
end
220+
elsif value.respond_to?(:to_hash)
221+
value.to_hash
222+
else
223+
value
224+
end
225+
end
226+
end
227+
end
228+
end

0 commit comments

Comments
 (0)