algolia 3.22.1 → 3.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/release.yml +1 -1
  3. data/CHANGELOG.md +5 -0
  4. data/Gemfile.lock +1 -1
  5. data/lib/algolia/api/abtesting_v3_client.rb +638 -0
  6. data/lib/algolia/models/abtesting-v3/ab_test.rb +300 -0
  7. data/lib/algolia/models/abtesting-v3/ab_test_configuration.rb +230 -0
  8. data/lib/algolia/models/abtesting-v3/ab_test_response.rb +235 -0
  9. data/lib/algolia/models/abtesting-v3/ab_tests_variant.rb +233 -0
  10. data/lib/algolia/models/abtesting-v3/ab_tests_variant_search_params.rb +259 -0
  11. data/lib/algolia/models/abtesting-v3/add_ab_tests_request.rb +260 -0
  12. data/lib/algolia/models/abtesting-v3/add_ab_tests_variant.rb +109 -0
  13. data/lib/algolia/models/abtesting-v3/create_metric.rb +222 -0
  14. data/lib/algolia/models/abtesting-v3/direction.rb +34 -0
  15. data/lib/algolia/models/abtesting-v3/effect_metric.rb +37 -0
  16. data/lib/algolia/models/abtesting-v3/empty_search_filter.rb +220 -0
  17. data/lib/algolia/models/abtesting-v3/error_base.rb +209 -0
  18. data/lib/algolia/models/abtesting-v3/error_correction_type.rb +34 -0
  19. data/lib/algolia/models/abtesting-v3/estimate_ab_test_request.rb +224 -0
  20. data/lib/algolia/models/abtesting-v3/estimate_ab_test_response.rb +221 -0
  21. data/lib/algolia/models/abtesting-v3/estimate_configuration.rb +223 -0
  22. data/lib/algolia/models/abtesting-v3/filter_effects.rb +218 -0
  23. data/lib/algolia/models/abtesting-v3/list_ab_tests_response.rb +239 -0
  24. data/lib/algolia/models/abtesting-v3/metric_date.rb +221 -0
  25. data/lib/algolia/models/abtesting-v3/metric_metadata.rb +220 -0
  26. data/lib/algolia/models/abtesting-v3/metric_name.rb +63 -0
  27. data/lib/algolia/models/abtesting-v3/metric_result.rb +315 -0
  28. data/lib/algolia/models/abtesting-v3/metrics_filter.rb +244 -0
  29. data/lib/algolia/models/abtesting-v3/minimum_detectable_effect.rb +223 -0
  30. data/lib/algolia/models/abtesting-v3/outliers_filter.rb +220 -0
  31. data/lib/algolia/models/abtesting-v3/schedule_ab_test_response.rb +211 -0
  32. data/lib/algolia/models/abtesting-v3/schedule_ab_tests_request.rb +272 -0
  33. data/lib/algolia/models/abtesting-v3/status.rb +36 -0
  34. data/lib/algolia/models/abtesting-v3/timeseries.rb +225 -0
  35. data/lib/algolia/models/abtesting-v3/timeseries_variant.rb +210 -0
  36. data/lib/algolia/models/abtesting-v3/variant.rb +275 -0
  37. data/lib/algolia/models/abtesting-v3/variant_metadata.rb +209 -0
  38. data/lib/algolia/version.rb +1 -1
  39. metadata +34 -1
@@ -0,0 +1,235 @@
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 AbtestingV3
10
+ class ABTestResponse
11
+ # Index name of the A/B test variant (case-sensitive).
12
+ attr_accessor :index
13
+
14
+ # Unique A/B test identifier.
15
+ attr_accessor :ab_test_id
16
+
17
+ # Unique identifier of a task. A successful API response means that a task was added to a queue. It might not run immediately. You can check the task's progress with the [`task` operation](#tag/Indices/operation/getTask) and this `taskID`.
18
+ attr_accessor :task_id
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :index => :index,
24
+ :ab_test_id => :abTestID,
25
+ :task_id => :taskID
26
+ }
27
+ end
28
+
29
+ # Attribute type mapping.
30
+ def self.types_mapping
31
+ {
32
+ :index => :"String",
33
+ :ab_test_id => :"Integer",
34
+ :task_id => :"Integer"
35
+ }
36
+ end
37
+
38
+ # List of attributes with nullable: true
39
+ def self.openapi_nullable
40
+ Set.new(
41
+ []
42
+ )
43
+ end
44
+
45
+ # Initializes the object
46
+ # @param [Hash] attributes Model attributes in the form of hash
47
+ def initialize(attributes = {})
48
+ if (!attributes.is_a?(Hash))
49
+ raise(
50
+ ArgumentError,
51
+ "The input argument (attributes) must be a hash in `Algolia::ABTestResponse` initialize method"
52
+ )
53
+ end
54
+
55
+ # check to see if the attribute exists and convert string to symbol for hash key
56
+ attributes = attributes.each_with_object({}) { |(k, v), h|
57
+ if (!self.class.attribute_map.key?(k.to_sym))
58
+ raise(
59
+ ArgumentError,
60
+ "`#{k}` is not a valid attribute in `Algolia::ABTestResponse`. Please check the name to make sure it's valid. List of attributes: " +
61
+ self.class.attribute_map.keys.inspect
62
+ )
63
+ end
64
+
65
+ h[k.to_sym] = v
66
+ }
67
+
68
+ if attributes.key?(:index)
69
+ self.index = attributes[:index]
70
+ else
71
+ self.index = nil
72
+ end
73
+
74
+ if attributes.key?(:ab_test_id)
75
+ self.ab_test_id = attributes[:ab_test_id]
76
+ else
77
+ self.ab_test_id = nil
78
+ end
79
+
80
+ if attributes.key?(:task_id)
81
+ self.task_id = attributes[:task_id]
82
+ else
83
+ self.task_id = nil
84
+ end
85
+ end
86
+
87
+ # Checks equality by comparing each attribute.
88
+ # @param [Object] Object to be compared
89
+ def ==(other)
90
+ return true if self.equal?(other)
91
+ self.class == other.class &&
92
+ index == other.index &&
93
+ ab_test_id == other.ab_test_id &&
94
+ task_id == other.task_id
95
+ end
96
+
97
+ # @see the `==` method
98
+ # @param [Object] Object to be compared
99
+ def eql?(other)
100
+ self == other
101
+ end
102
+
103
+ # Calculates hash code according to all attributes.
104
+ # @return [Integer] Hash code
105
+ def hash
106
+ [index, ab_test_id, task_id].hash
107
+ end
108
+
109
+ # Builds the object from hash
110
+ # @param [Hash] attributes Model attributes in the form of hash
111
+ # @return [Object] Returns the model itself
112
+ def self.build_from_hash(attributes)
113
+ return nil unless attributes.is_a?(Hash)
114
+ attributes = attributes.transform_keys(&:to_sym)
115
+ transformed_hash = {}
116
+ types_mapping.each_pair do |key, type|
117
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
118
+ transformed_hash[key.to_sym] = nil
119
+ elsif type =~ /\AArray<(.*)>/i
120
+ # check to ensure the input is an array given that the attribute
121
+ # is documented as an array but the input is not
122
+ if attributes[attribute_map[key]].is_a?(Array)
123
+ transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
124
+ _deserialize(::Regexp.last_match(1), v)
125
+ }
126
+ end
127
+ elsif !attributes[attribute_map[key]].nil?
128
+ transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
129
+ end
130
+ end
131
+
132
+ new(transformed_hash)
133
+ end
134
+
135
+ # Deserializes the data based on type
136
+ # @param string type Data type
137
+ # @param string value Value to be deserialized
138
+ # @return [Object] Deserialized data
139
+ def self._deserialize(type, value)
140
+ case type.to_sym
141
+ when :Time
142
+ Time.parse(value)
143
+ when :Date
144
+ Date.parse(value)
145
+ when :String
146
+ value.to_s
147
+ when :Integer
148
+ value.to_i
149
+ when :Float
150
+ value.to_f
151
+ when :Boolean
152
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
153
+ true
154
+ else
155
+ false
156
+ end
157
+
158
+ when :Object
159
+ # generic object (usually a Hash), return directly
160
+ value
161
+ when /\AArray<(?<inner_type>.+)>\z/
162
+ inner_type = Regexp.last_match[:inner_type]
163
+ value.map { |v| _deserialize(inner_type, v) }
164
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
165
+ k_type = Regexp.last_match[:k_type]
166
+ v_type = Regexp.last_match[:v_type]
167
+ {}.tap do |hash|
168
+ value.each do |k, v|
169
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
170
+ end
171
+ end
172
+ # model
173
+ else
174
+ # models (e.g. Pet) or oneOf
175
+ klass = Algolia::AbtestingV3.const_get(type)
176
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
177
+ .build_from_hash(value)
178
+ end
179
+ end
180
+
181
+ # Returns the string representation of the object
182
+ # @return [String] String presentation of the object
183
+ def to_s
184
+ to_hash.to_s
185
+ end
186
+
187
+ # to_body is an alias to to_hash (backward compatibility)
188
+ # @return [Hash] Returns the object in the form of hash
189
+ def to_body
190
+ to_hash
191
+ end
192
+
193
+ def to_json(*_args)
194
+ to_hash.to_json
195
+ end
196
+
197
+ # Returns the object in the form of hash
198
+ # @return [Hash] Returns the object in the form of hash
199
+ def to_hash
200
+ hash = {}
201
+ self.class.attribute_map.each_pair do |attr, param|
202
+ value = send(attr)
203
+ if value.nil?
204
+ is_nullable = self.class.openapi_nullable.include?(attr)
205
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
206
+ end
207
+
208
+ hash[param] = _to_hash(value)
209
+ end
210
+
211
+ hash
212
+ end
213
+
214
+ # Outputs non-array value in the form of hash
215
+ # For object, use to_hash. Otherwise, just return the value
216
+ # @param [Object] value Any valid value
217
+ # @return [Hash] Returns the value in the form of hash
218
+ def _to_hash(value)
219
+ if value.is_a?(Array)
220
+ value.compact.map { |v| _to_hash(v) }
221
+ elsif value.is_a?(Hash)
222
+ {}.tap do |hash|
223
+ value.each { |k, v| hash[k] = _to_hash(v) }
224
+ end
225
+ elsif value.respond_to?(:to_hash)
226
+ value.to_hash
227
+ else
228
+ value
229
+ end
230
+ end
231
+
232
+ end
233
+
234
+ end
235
+ end
@@ -0,0 +1,233 @@
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 AbtestingV3
10
+ class AbTestsVariant
11
+ # Index name of the A/B test variant (case-sensitive).
12
+ attr_accessor :index
13
+
14
+ # Percentage of search requests each variant receives.
15
+ attr_accessor :traffic_percentage
16
+
17
+ # Description for this variant.
18
+ attr_accessor :description
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :index => :index,
24
+ :traffic_percentage => :trafficPercentage,
25
+ :description => :description
26
+ }
27
+ end
28
+
29
+ # Attribute type mapping.
30
+ def self.types_mapping
31
+ {
32
+ :index => :"String",
33
+ :traffic_percentage => :"Integer",
34
+ :description => :"String"
35
+ }
36
+ end
37
+
38
+ # List of attributes with nullable: true
39
+ def self.openapi_nullable
40
+ Set.new(
41
+ []
42
+ )
43
+ end
44
+
45
+ # Initializes the object
46
+ # @param [Hash] attributes Model attributes in the form of hash
47
+ def initialize(attributes = {})
48
+ if (!attributes.is_a?(Hash))
49
+ raise(
50
+ ArgumentError,
51
+ "The input argument (attributes) must be a hash in `Algolia::AbTestsVariant` initialize method"
52
+ )
53
+ end
54
+
55
+ # check to see if the attribute exists and convert string to symbol for hash key
56
+ attributes = attributes.each_with_object({}) { |(k, v), h|
57
+ if (!self.class.attribute_map.key?(k.to_sym))
58
+ raise(
59
+ ArgumentError,
60
+ "`#{k}` is not a valid attribute in `Algolia::AbTestsVariant`. Please check the name to make sure it's valid. List of attributes: " +
61
+ self.class.attribute_map.keys.inspect
62
+ )
63
+ end
64
+
65
+ h[k.to_sym] = v
66
+ }
67
+
68
+ if attributes.key?(:index)
69
+ self.index = attributes[:index]
70
+ else
71
+ self.index = nil
72
+ end
73
+
74
+ if attributes.key?(:traffic_percentage)
75
+ self.traffic_percentage = attributes[:traffic_percentage]
76
+ else
77
+ self.traffic_percentage = nil
78
+ end
79
+
80
+ if attributes.key?(:description)
81
+ self.description = attributes[:description]
82
+ end
83
+ end
84
+
85
+ # Checks equality by comparing each attribute.
86
+ # @param [Object] Object to be compared
87
+ def ==(other)
88
+ return true if self.equal?(other)
89
+ self.class == other.class &&
90
+ index == other.index &&
91
+ traffic_percentage == other.traffic_percentage &&
92
+ description == other.description
93
+ end
94
+
95
+ # @see the `==` method
96
+ # @param [Object] Object to be compared
97
+ def eql?(other)
98
+ self == other
99
+ end
100
+
101
+ # Calculates hash code according to all attributes.
102
+ # @return [Integer] Hash code
103
+ def hash
104
+ [index, traffic_percentage, description].hash
105
+ end
106
+
107
+ # Builds the object from hash
108
+ # @param [Hash] attributes Model attributes in the form of hash
109
+ # @return [Object] Returns the model itself
110
+ def self.build_from_hash(attributes)
111
+ return nil unless attributes.is_a?(Hash)
112
+ attributes = attributes.transform_keys(&:to_sym)
113
+ transformed_hash = {}
114
+ types_mapping.each_pair do |key, type|
115
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
116
+ transformed_hash[key.to_sym] = nil
117
+ elsif type =~ /\AArray<(.*)>/i
118
+ # check to ensure the input is an array given that the attribute
119
+ # is documented as an array but the input is not
120
+ if attributes[attribute_map[key]].is_a?(Array)
121
+ transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
122
+ _deserialize(::Regexp.last_match(1), v)
123
+ }
124
+ end
125
+ elsif !attributes[attribute_map[key]].nil?
126
+ transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
127
+ end
128
+ end
129
+
130
+ new(transformed_hash)
131
+ end
132
+
133
+ # Deserializes the data based on type
134
+ # @param string type Data type
135
+ # @param string value Value to be deserialized
136
+ # @return [Object] Deserialized data
137
+ def self._deserialize(type, value)
138
+ case type.to_sym
139
+ when :Time
140
+ Time.parse(value)
141
+ when :Date
142
+ Date.parse(value)
143
+ when :String
144
+ value.to_s
145
+ when :Integer
146
+ value.to_i
147
+ when :Float
148
+ value.to_f
149
+ when :Boolean
150
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
151
+ true
152
+ else
153
+ false
154
+ end
155
+
156
+ when :Object
157
+ # generic object (usually a Hash), return directly
158
+ value
159
+ when /\AArray<(?<inner_type>.+)>\z/
160
+ inner_type = Regexp.last_match[:inner_type]
161
+ value.map { |v| _deserialize(inner_type, v) }
162
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
163
+ k_type = Regexp.last_match[:k_type]
164
+ v_type = Regexp.last_match[:v_type]
165
+ {}.tap do |hash|
166
+ value.each do |k, v|
167
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
168
+ end
169
+ end
170
+ # model
171
+ else
172
+ # models (e.g. Pet) or oneOf
173
+ klass = Algolia::AbtestingV3.const_get(type)
174
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
175
+ .build_from_hash(value)
176
+ end
177
+ end
178
+
179
+ # Returns the string representation of the object
180
+ # @return [String] String presentation of the object
181
+ def to_s
182
+ to_hash.to_s
183
+ end
184
+
185
+ # to_body is an alias to to_hash (backward compatibility)
186
+ # @return [Hash] Returns the object in the form of hash
187
+ def to_body
188
+ to_hash
189
+ end
190
+
191
+ def to_json(*_args)
192
+ to_hash.to_json
193
+ end
194
+
195
+ # Returns the object in the form of hash
196
+ # @return [Hash] Returns the object in the form of hash
197
+ def to_hash
198
+ hash = {}
199
+ self.class.attribute_map.each_pair do |attr, param|
200
+ value = send(attr)
201
+ if value.nil?
202
+ is_nullable = self.class.openapi_nullable.include?(attr)
203
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
204
+ end
205
+
206
+ hash[param] = _to_hash(value)
207
+ end
208
+
209
+ hash
210
+ end
211
+
212
+ # Outputs non-array value in the form of hash
213
+ # For object, use to_hash. Otherwise, just return the value
214
+ # @param [Object] value Any valid value
215
+ # @return [Hash] Returns the value in the form of hash
216
+ def _to_hash(value)
217
+ if value.is_a?(Array)
218
+ value.compact.map { |v| _to_hash(v) }
219
+ elsif value.is_a?(Hash)
220
+ {}.tap do |hash|
221
+ value.each { |k, v| hash[k] = _to_hash(v) }
222
+ end
223
+ elsif value.respond_to?(:to_hash)
224
+ value.to_hash
225
+ else
226
+ value
227
+ end
228
+ end
229
+
230
+ end
231
+
232
+ end
233
+ end