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