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,272 @@
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 ScheduleABTestsRequest
11
+ # A/B test name.
12
+ attr_accessor :name
13
+
14
+ # A/B test variants.
15
+ attr_accessor :variants
16
+
17
+ # A/B test metrics involved in the test. Only these metrics will be considered when calculating results.
18
+ attr_accessor :metrics
19
+
20
+ attr_accessor :configuration
21
+
22
+ # Date and time when the A/B test is scheduled to start, in RFC 3339 format.
23
+ attr_accessor :scheduled_at
24
+
25
+ # End date and time of the A/B test, in RFC 3339 format.
26
+ attr_accessor :end_at
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :name => :name,
32
+ :variants => :variants,
33
+ :metrics => :metrics,
34
+ :configuration => :configuration,
35
+ :scheduled_at => :scheduledAt,
36
+ :end_at => :endAt
37
+ }
38
+ end
39
+
40
+ # Attribute type mapping.
41
+ def self.types_mapping
42
+ {
43
+ :name => :"String",
44
+ :variants => :"Array<AddABTestsVariant>",
45
+ :metrics => :"Array<CreateMetric>",
46
+ :configuration => :"ABTestConfiguration",
47
+ :scheduled_at => :"String",
48
+ :end_at => :"String"
49
+ }
50
+ end
51
+
52
+ # List of attributes with nullable: true
53
+ def self.openapi_nullable
54
+ Set.new(
55
+ []
56
+ )
57
+ end
58
+
59
+ # Initializes the object
60
+ # @param [Hash] attributes Model attributes in the form of hash
61
+ def initialize(attributes = {})
62
+ if (!attributes.is_a?(Hash))
63
+ raise(
64
+ ArgumentError,
65
+ "The input argument (attributes) must be a hash in `Algolia::ScheduleABTestsRequest` initialize method"
66
+ )
67
+ end
68
+
69
+ # check to see if the attribute exists and convert string to symbol for hash key
70
+ attributes = attributes.each_with_object({}) { |(k, v), h|
71
+ if (!self.class.attribute_map.key?(k.to_sym))
72
+ raise(
73
+ ArgumentError,
74
+ "`#{k}` is not a valid attribute in `Algolia::ScheduleABTestsRequest`. Please check the name to make sure it's valid. List of attributes: " +
75
+ self.class.attribute_map.keys.inspect
76
+ )
77
+ end
78
+
79
+ h[k.to_sym] = v
80
+ }
81
+
82
+ if attributes.key?(:name)
83
+ self.name = attributes[:name]
84
+ else
85
+ self.name = nil
86
+ end
87
+
88
+ if attributes.key?(:variants)
89
+ if (value = attributes[:variants]).is_a?(Array)
90
+ self.variants = value
91
+ end
92
+ else
93
+ self.variants = nil
94
+ end
95
+
96
+ if attributes.key?(:metrics)
97
+ if (value = attributes[:metrics]).is_a?(Array)
98
+ self.metrics = value
99
+ end
100
+ else
101
+ self.metrics = nil
102
+ end
103
+
104
+ if attributes.key?(:configuration)
105
+ self.configuration = attributes[:configuration]
106
+ end
107
+
108
+ if attributes.key?(:scheduled_at)
109
+ self.scheduled_at = attributes[:scheduled_at]
110
+ else
111
+ self.scheduled_at = nil
112
+ end
113
+
114
+ if attributes.key?(:end_at)
115
+ self.end_at = attributes[:end_at]
116
+ else
117
+ self.end_at = nil
118
+ end
119
+ end
120
+
121
+ # Checks equality by comparing each attribute.
122
+ # @param [Object] Object to be compared
123
+ def ==(other)
124
+ return true if self.equal?(other)
125
+ self.class == other.class &&
126
+ name == other.name &&
127
+ variants == other.variants &&
128
+ metrics == other.metrics &&
129
+ configuration == other.configuration &&
130
+ scheduled_at == other.scheduled_at &&
131
+ end_at == other.end_at
132
+ end
133
+
134
+ # @see the `==` method
135
+ # @param [Object] Object to be compared
136
+ def eql?(other)
137
+ self == other
138
+ end
139
+
140
+ # Calculates hash code according to all attributes.
141
+ # @return [Integer] Hash code
142
+ def hash
143
+ [name, variants, metrics, configuration, scheduled_at, end_at].hash
144
+ end
145
+
146
+ # Builds the object from hash
147
+ # @param [Hash] attributes Model attributes in the form of hash
148
+ # @return [Object] Returns the model itself
149
+ def self.build_from_hash(attributes)
150
+ return nil unless attributes.is_a?(Hash)
151
+ attributes = attributes.transform_keys(&:to_sym)
152
+ transformed_hash = {}
153
+ types_mapping.each_pair do |key, type|
154
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
155
+ transformed_hash[key.to_sym] = nil
156
+ elsif type =~ /\AArray<(.*)>/i
157
+ # check to ensure the input is an array given that the attribute
158
+ # is documented as an array but the input is not
159
+ if attributes[attribute_map[key]].is_a?(Array)
160
+ transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
161
+ _deserialize(::Regexp.last_match(1), v)
162
+ }
163
+ end
164
+ elsif !attributes[attribute_map[key]].nil?
165
+ transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
166
+ end
167
+ end
168
+
169
+ new(transformed_hash)
170
+ end
171
+
172
+ # Deserializes the data based on type
173
+ # @param string type Data type
174
+ # @param string value Value to be deserialized
175
+ # @return [Object] Deserialized data
176
+ def self._deserialize(type, value)
177
+ case type.to_sym
178
+ when :Time
179
+ Time.parse(value)
180
+ when :Date
181
+ Date.parse(value)
182
+ when :String
183
+ value.to_s
184
+ when :Integer
185
+ value.to_i
186
+ when :Float
187
+ value.to_f
188
+ when :Boolean
189
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
190
+ true
191
+ else
192
+ false
193
+ end
194
+
195
+ when :Object
196
+ # generic object (usually a Hash), return directly
197
+ value
198
+ when /\AArray<(?<inner_type>.+)>\z/
199
+ inner_type = Regexp.last_match[:inner_type]
200
+ value.map { |v| _deserialize(inner_type, v) }
201
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
202
+ k_type = Regexp.last_match[:k_type]
203
+ v_type = Regexp.last_match[:v_type]
204
+ {}.tap do |hash|
205
+ value.each do |k, v|
206
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
207
+ end
208
+ end
209
+ # model
210
+ else
211
+ # models (e.g. Pet) or oneOf
212
+ klass = Algolia::AbtestingV3.const_get(type)
213
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
214
+ .build_from_hash(value)
215
+ end
216
+ end
217
+
218
+ # Returns the string representation of the object
219
+ # @return [String] String presentation of the object
220
+ def to_s
221
+ to_hash.to_s
222
+ end
223
+
224
+ # to_body is an alias to to_hash (backward compatibility)
225
+ # @return [Hash] Returns the object in the form of hash
226
+ def to_body
227
+ to_hash
228
+ end
229
+
230
+ def to_json(*_args)
231
+ to_hash.to_json
232
+ end
233
+
234
+ # Returns the object in the form of hash
235
+ # @return [Hash] Returns the object in the form of hash
236
+ def to_hash
237
+ hash = {}
238
+ self.class.attribute_map.each_pair do |attr, param|
239
+ value = send(attr)
240
+ if value.nil?
241
+ is_nullable = self.class.openapi_nullable.include?(attr)
242
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
243
+ end
244
+
245
+ hash[param] = _to_hash(value)
246
+ end
247
+
248
+ hash
249
+ end
250
+
251
+ # Outputs non-array value in the form of hash
252
+ # For object, use to_hash. Otherwise, just return the value
253
+ # @param [Object] value Any valid value
254
+ # @return [Hash] Returns the value in the form of hash
255
+ def _to_hash(value)
256
+ if value.is_a?(Array)
257
+ value.compact.map { |v| _to_hash(v) }
258
+ elsif value.is_a?(Hash)
259
+ {}.tap do |hash|
260
+ value.each { |k, v| hash[k] = _to_hash(v) }
261
+ end
262
+ elsif value.respond_to?(:to_hash)
263
+ value.to_hash
264
+ else
265
+ value
266
+ end
267
+ end
268
+
269
+ end
270
+
271
+ end
272
+ end
@@ -0,0 +1,36 @@
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 Status
11
+ ACTIVE = "active".freeze
12
+ STOPPED = "stopped".freeze
13
+ EXPIRED = "expired".freeze
14
+ FAILED = "failed".freeze
15
+
16
+ def self.all_vars
17
+ @all_vars ||= [ACTIVE, STOPPED, EXPIRED, FAILED].freeze
18
+ end
19
+
20
+ # Builds the enum from string
21
+ # @param [String] The enum value in the form of the string
22
+ # @return [String] The enum value
23
+ def self.build_from_hash(value)
24
+ new.build_from_hash(value)
25
+ end
26
+
27
+ # Builds the enum from string
28
+ # @param [String] The enum value in the form of the string
29
+ # @return [String] The enum value
30
+ def build_from_hash(value)
31
+ return value if Status.all_vars.include?(value)
32
+ raise "Invalid ENUM value #{value} for class #Status"
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,225 @@
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 Timeseries
11
+ # Unique A/B test identifier.
12
+ attr_accessor :ab_test_id
13
+
14
+ # A/B test timeseries variants. The first variant is your _control_ index, typically your production index. All of the additional variants are indexes with changed settings that you want to test against the control.
15
+ attr_accessor :variants
16
+
17
+ # Attribute mapping from ruby-style variable name to JSON key.
18
+ def self.attribute_map
19
+ {
20
+ :ab_test_id => :abTestID,
21
+ :variants => :variants
22
+ }
23
+ end
24
+
25
+ # Attribute type mapping.
26
+ def self.types_mapping
27
+ {
28
+ :ab_test_id => :"Integer",
29
+ :variants => :"Array<TimeseriesVariant>"
30
+ }
31
+ end
32
+
33
+ # List of attributes with nullable: true
34
+ def self.openapi_nullable
35
+ Set.new(
36
+ []
37
+ )
38
+ end
39
+
40
+ # Initializes the object
41
+ # @param [Hash] attributes Model attributes in the form of hash
42
+ def initialize(attributes = {})
43
+ if (!attributes.is_a?(Hash))
44
+ raise(
45
+ ArgumentError,
46
+ "The input argument (attributes) must be a hash in `Algolia::Timeseries` initialize method"
47
+ )
48
+ end
49
+
50
+ # check to see if the attribute exists and convert string to symbol for hash key
51
+ attributes = attributes.each_with_object({}) { |(k, v), h|
52
+ if (!self.class.attribute_map.key?(k.to_sym))
53
+ raise(
54
+ ArgumentError,
55
+ "`#{k}` is not a valid attribute in `Algolia::Timeseries`. Please check the name to make sure it's valid. List of attributes: " +
56
+ self.class.attribute_map.keys.inspect
57
+ )
58
+ end
59
+
60
+ h[k.to_sym] = v
61
+ }
62
+
63
+ if attributes.key?(:ab_test_id)
64
+ self.ab_test_id = attributes[:ab_test_id]
65
+ else
66
+ self.ab_test_id = nil
67
+ end
68
+
69
+ if attributes.key?(:variants)
70
+ if (value = attributes[:variants]).is_a?(Array)
71
+ self.variants = value
72
+ end
73
+ else
74
+ self.variants = nil
75
+ end
76
+ end
77
+
78
+ # Checks equality by comparing each attribute.
79
+ # @param [Object] Object to be compared
80
+ def ==(other)
81
+ return true if self.equal?(other)
82
+ self.class == other.class &&
83
+ ab_test_id == other.ab_test_id &&
84
+ variants == other.variants
85
+ end
86
+
87
+ # @see the `==` method
88
+ # @param [Object] Object to be compared
89
+ def eql?(other)
90
+ self == other
91
+ end
92
+
93
+ # Calculates hash code according to all attributes.
94
+ # @return [Integer] Hash code
95
+ def hash
96
+ [ab_test_id, variants].hash
97
+ end
98
+
99
+ # Builds the object from hash
100
+ # @param [Hash] attributes Model attributes in the form of hash
101
+ # @return [Object] Returns the model itself
102
+ def self.build_from_hash(attributes)
103
+ return nil unless attributes.is_a?(Hash)
104
+ attributes = attributes.transform_keys(&:to_sym)
105
+ transformed_hash = {}
106
+ types_mapping.each_pair do |key, type|
107
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
108
+ transformed_hash[key.to_sym] = nil
109
+ elsif type =~ /\AArray<(.*)>/i
110
+ # check to ensure the input is an array given that the attribute
111
+ # is documented as an array but the input is not
112
+ if attributes[attribute_map[key]].is_a?(Array)
113
+ transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
114
+ _deserialize(::Regexp.last_match(1), v)
115
+ }
116
+ end
117
+ elsif !attributes[attribute_map[key]].nil?
118
+ transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
119
+ end
120
+ end
121
+
122
+ new(transformed_hash)
123
+ end
124
+
125
+ # Deserializes the data based on type
126
+ # @param string type Data type
127
+ # @param string value Value to be deserialized
128
+ # @return [Object] Deserialized data
129
+ def self._deserialize(type, value)
130
+ case type.to_sym
131
+ when :Time
132
+ Time.parse(value)
133
+ when :Date
134
+ Date.parse(value)
135
+ when :String
136
+ value.to_s
137
+ when :Integer
138
+ value.to_i
139
+ when :Float
140
+ value.to_f
141
+ when :Boolean
142
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
143
+ true
144
+ else
145
+ false
146
+ end
147
+
148
+ when :Object
149
+ # generic object (usually a Hash), return directly
150
+ value
151
+ when /\AArray<(?<inner_type>.+)>\z/
152
+ inner_type = Regexp.last_match[:inner_type]
153
+ value.map { |v| _deserialize(inner_type, v) }
154
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
155
+ k_type = Regexp.last_match[:k_type]
156
+ v_type = Regexp.last_match[:v_type]
157
+ {}.tap do |hash|
158
+ value.each do |k, v|
159
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
160
+ end
161
+ end
162
+ # model
163
+ else
164
+ # models (e.g. Pet) or oneOf
165
+ klass = Algolia::AbtestingV3.const_get(type)
166
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
167
+ .build_from_hash(value)
168
+ end
169
+ end
170
+
171
+ # Returns the string representation of the object
172
+ # @return [String] String presentation of the object
173
+ def to_s
174
+ to_hash.to_s
175
+ end
176
+
177
+ # to_body is an alias to to_hash (backward compatibility)
178
+ # @return [Hash] Returns the object in the form of hash
179
+ def to_body
180
+ to_hash
181
+ end
182
+
183
+ def to_json(*_args)
184
+ to_hash.to_json
185
+ end
186
+
187
+ # Returns the object in the form of hash
188
+ # @return [Hash] Returns the object in the form of hash
189
+ def to_hash
190
+ hash = {}
191
+ self.class.attribute_map.each_pair do |attr, param|
192
+ value = send(attr)
193
+ if value.nil?
194
+ is_nullable = self.class.openapi_nullable.include?(attr)
195
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
196
+ end
197
+
198
+ hash[param] = _to_hash(value)
199
+ end
200
+
201
+ hash
202
+ end
203
+
204
+ # Outputs non-array value in the form of hash
205
+ # For object, use to_hash. Otherwise, just return the value
206
+ # @param [Object] value Any valid value
207
+ # @return [Hash] Returns the value in the form of hash
208
+ def _to_hash(value)
209
+ if value.is_a?(Array)
210
+ value.compact.map { |v| _to_hash(v) }
211
+ elsif value.is_a?(Hash)
212
+ {}.tap do |hash|
213
+ value.each { |k, v| hash[k] = _to_hash(v) }
214
+ end
215
+ elsif value.respond_to?(:to_hash)
216
+ value.to_hash
217
+ else
218
+ value
219
+ end
220
+ end
221
+
222
+ end
223
+
224
+ end
225
+ end