algolia 3.22.1 → 3.24.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 (52) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/release.yml +1 -1
  3. data/CHANGELOG.md +11 -0
  4. data/Gemfile.lock +1 -1
  5. data/lib/algolia/api/abtesting_v3_client.rb +638 -0
  6. data/lib/algolia/models/abtesting/ab_test.rb +13 -1
  7. data/lib/algolia/models/abtesting-v3/ab_test.rb +323 -0
  8. data/lib/algolia/models/abtesting-v3/ab_test_configuration.rb +230 -0
  9. data/lib/algolia/models/abtesting-v3/ab_test_response.rb +235 -0
  10. data/lib/algolia/models/abtesting-v3/ab_tests_variant.rb +233 -0
  11. data/lib/algolia/models/abtesting-v3/ab_tests_variant_search_params.rb +259 -0
  12. data/lib/algolia/models/abtesting-v3/add_ab_tests_request.rb +260 -0
  13. data/lib/algolia/models/abtesting-v3/add_ab_tests_variant.rb +109 -0
  14. data/lib/algolia/models/abtesting-v3/create_metric.rb +222 -0
  15. data/lib/algolia/models/abtesting-v3/direction.rb +34 -0
  16. data/lib/algolia/models/abtesting-v3/effect_metric.rb +37 -0
  17. data/lib/algolia/models/abtesting-v3/empty_search_filter.rb +220 -0
  18. data/lib/algolia/models/abtesting-v3/error_base.rb +209 -0
  19. data/lib/algolia/models/abtesting-v3/error_correction_type.rb +34 -0
  20. data/lib/algolia/models/abtesting-v3/estimate_ab_test_request.rb +224 -0
  21. data/lib/algolia/models/abtesting-v3/estimate_ab_test_response.rb +221 -0
  22. data/lib/algolia/models/abtesting-v3/estimate_configuration.rb +223 -0
  23. data/lib/algolia/models/abtesting-v3/filter_effects.rb +218 -0
  24. data/lib/algolia/models/abtesting-v3/list_ab_tests_response.rb +239 -0
  25. data/lib/algolia/models/abtesting-v3/metric_date.rb +221 -0
  26. data/lib/algolia/models/abtesting-v3/metric_metadata.rb +220 -0
  27. data/lib/algolia/models/abtesting-v3/metric_name.rb +63 -0
  28. data/lib/algolia/models/abtesting-v3/metric_result.rb +315 -0
  29. data/lib/algolia/models/abtesting-v3/metrics_filter.rb +244 -0
  30. data/lib/algolia/models/abtesting-v3/minimum_detectable_effect.rb +223 -0
  31. data/lib/algolia/models/abtesting-v3/outliers_filter.rb +220 -0
  32. data/lib/algolia/models/abtesting-v3/schedule_ab_test_response.rb +211 -0
  33. data/lib/algolia/models/abtesting-v3/schedule_ab_tests_request.rb +272 -0
  34. data/lib/algolia/models/abtesting-v3/status.rb +36 -0
  35. data/lib/algolia/models/abtesting-v3/timeseries.rb +225 -0
  36. data/lib/algolia/models/abtesting-v3/timeseries_variant.rb +210 -0
  37. data/lib/algolia/models/abtesting-v3/variant.rb +275 -0
  38. data/lib/algolia/models/abtesting-v3/variant_metadata.rb +209 -0
  39. data/lib/algolia/models/composition/hit.rb +13 -4
  40. data/lib/algolia/models/composition/hit_metadata.rb +210 -0
  41. data/lib/algolia/models/composition/params.rb +2 -1
  42. data/lib/algolia/models/recommend/fallback_params.rb +26 -26
  43. data/lib/algolia/models/recommend/recommend_search_params.rb +26 -26
  44. data/lib/algolia/models/search/browse_params_object.rb +26 -26
  45. data/lib/algolia/models/search/consequence_params.rb +26 -26
  46. data/lib/algolia/models/search/index_settings.rb +18 -18
  47. data/lib/algolia/models/search/search_for_facets.rb +26 -26
  48. data/lib/algolia/models/search/search_for_hits.rb +26 -26
  49. data/lib/algolia/models/search/search_params_object.rb +26 -26
  50. data/lib/algolia/models/search/settings_response.rb +18 -18
  51. data/lib/algolia/version.rb +1 -1
  52. metadata +35 -1
@@ -30,6 +30,9 @@ module Algolia
30
30
  # End date and time of the A/B test, in RFC 3339 format.
31
31
  attr_accessor :end_at
32
32
 
33
+ # Date and time when the A/B test was stopped, in RFC 3339 format.
34
+ attr_accessor :stopped_at
35
+
33
36
  # A/B test name.
34
37
  attr_accessor :name
35
38
 
@@ -52,6 +55,7 @@ module Algolia
52
55
  :updated_at => :updatedAt,
53
56
  :created_at => :createdAt,
54
57
  :end_at => :endAt,
58
+ :stopped_at => :stoppedAt,
55
59
  :name => :name,
56
60
  :status => :status,
57
61
  :variants => :variants,
@@ -71,6 +75,7 @@ module Algolia
71
75
  :updated_at => :"String",
72
76
  :created_at => :"String",
73
77
  :end_at => :"String",
78
+ :stopped_at => :"String",
74
79
  :name => :"String",
75
80
  :status => :"Status",
76
81
  :variants => :"Array<Variant>",
@@ -86,7 +91,8 @@ module Algolia
86
91
  :conversion_significance,
87
92
  :add_to_cart_significance,
88
93
  :purchase_significance,
89
- :revenue_significance
94
+ :revenue_significance,
95
+ :stopped_at
90
96
  ]
91
97
  )
92
98
  end
@@ -157,6 +163,10 @@ module Algolia
157
163
  self.end_at = nil
158
164
  end
159
165
 
166
+ if attributes.key?(:stopped_at)
167
+ self.stopped_at = attributes[:stopped_at]
168
+ end
169
+
160
170
  if attributes.key?(:name)
161
171
  self.name = attributes[:name]
162
172
  else
@@ -196,6 +206,7 @@ module Algolia
196
206
  updated_at == other.updated_at &&
197
207
  created_at == other.created_at &&
198
208
  end_at == other.end_at &&
209
+ stopped_at == other.stopped_at &&
199
210
  name == other.name &&
200
211
  status == other.status &&
201
212
  variants == other.variants &&
@@ -221,6 +232,7 @@ module Algolia
221
232
  updated_at,
222
233
  created_at,
223
234
  end_at,
235
+ stopped_at,
224
236
  name,
225
237
  status,
226
238
  variants,
@@ -0,0 +1,323 @@
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 ABTest
11
+ # Unique A/B test identifier.
12
+ attr_accessor :ab_test_id
13
+
14
+ # Date and time when the A/B test was last updated, in RFC 3339 format.
15
+ attr_accessor :updated_at
16
+
17
+ # Date and time when the A/B test was created, in RFC 3339 format.
18
+ attr_accessor :created_at
19
+
20
+ # End date and time of the A/B test, in RFC 3339 format.
21
+ attr_accessor :end_at
22
+
23
+ # Date and time when the A/B test was stopped, in RFC 3339 format.
24
+ attr_accessor :stopped_at
25
+
26
+ # A/B test name.
27
+ attr_accessor :name
28
+
29
+ attr_accessor :status
30
+
31
+ # A/B test 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.
32
+ attr_accessor :variants
33
+
34
+ attr_accessor :configuration
35
+
36
+ # Unique migrated A/B test identifier.
37
+ attr_accessor :migrated_ab_test_id
38
+
39
+ # Attribute mapping from ruby-style variable name to JSON key.
40
+ def self.attribute_map
41
+ {
42
+ :ab_test_id => :abTestID,
43
+ :updated_at => :updatedAt,
44
+ :created_at => :createdAt,
45
+ :end_at => :endAt,
46
+ :stopped_at => :stoppedAt,
47
+ :name => :name,
48
+ :status => :status,
49
+ :variants => :variants,
50
+ :configuration => :configuration,
51
+ :migrated_ab_test_id => :migratedAbTestID
52
+ }
53
+ end
54
+
55
+ # Attribute type mapping.
56
+ def self.types_mapping
57
+ {
58
+ :ab_test_id => :"Integer",
59
+ :updated_at => :"String",
60
+ :created_at => :"String",
61
+ :end_at => :"String",
62
+ :stopped_at => :"String",
63
+ :name => :"String",
64
+ :status => :"Status",
65
+ :variants => :"Array<Variant>",
66
+ :configuration => :"ABTestConfiguration",
67
+ :migrated_ab_test_id => :"Integer"
68
+ }
69
+ end
70
+
71
+ # List of attributes with nullable: true
72
+ def self.openapi_nullable
73
+ Set.new(
74
+ [
75
+ :stopped_at
76
+ ]
77
+ )
78
+ end
79
+
80
+ # Initializes the object
81
+ # @param [Hash] attributes Model attributes in the form of hash
82
+ def initialize(attributes = {})
83
+ if (!attributes.is_a?(Hash))
84
+ raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::ABTest` initialize method"
85
+ end
86
+
87
+ # check to see if the attribute exists and convert string to symbol for hash key
88
+ attributes = attributes.each_with_object({}) { |(k, v), h|
89
+ if (!self.class.attribute_map.key?(k.to_sym))
90
+ raise(
91
+ ArgumentError,
92
+ "`#{k}` is not a valid attribute in `Algolia::ABTest`. Please check the name to make sure it's valid. List of attributes: " +
93
+ self.class.attribute_map.keys.inspect
94
+ )
95
+ end
96
+
97
+ h[k.to_sym] = v
98
+ }
99
+
100
+ if attributes.key?(:ab_test_id)
101
+ self.ab_test_id = attributes[:ab_test_id]
102
+ else
103
+ self.ab_test_id = nil
104
+ end
105
+
106
+ if attributes.key?(:updated_at)
107
+ self.updated_at = attributes[:updated_at]
108
+ else
109
+ self.updated_at = nil
110
+ end
111
+
112
+ if attributes.key?(:created_at)
113
+ self.created_at = attributes[:created_at]
114
+ else
115
+ self.created_at = nil
116
+ end
117
+
118
+ if attributes.key?(:end_at)
119
+ self.end_at = attributes[:end_at]
120
+ else
121
+ self.end_at = nil
122
+ end
123
+
124
+ if attributes.key?(:stopped_at)
125
+ self.stopped_at = attributes[:stopped_at]
126
+ end
127
+
128
+ if attributes.key?(:name)
129
+ self.name = attributes[:name]
130
+ else
131
+ self.name = nil
132
+ end
133
+
134
+ if attributes.key?(:status)
135
+ self.status = attributes[:status]
136
+ else
137
+ self.status = nil
138
+ end
139
+
140
+ if attributes.key?(:variants)
141
+ if (value = attributes[:variants]).is_a?(Array)
142
+ self.variants = value
143
+ end
144
+ else
145
+ self.variants = nil
146
+ end
147
+
148
+ if attributes.key?(:configuration)
149
+ self.configuration = attributes[:configuration]
150
+ end
151
+
152
+ if attributes.key?(:migrated_ab_test_id)
153
+ self.migrated_ab_test_id = attributes[:migrated_ab_test_id]
154
+ end
155
+ end
156
+
157
+ # Checks equality by comparing each attribute.
158
+ # @param [Object] Object to be compared
159
+ def ==(other)
160
+ return true if self.equal?(other)
161
+ self.class == other.class &&
162
+ ab_test_id == other.ab_test_id &&
163
+ updated_at == other.updated_at &&
164
+ created_at == other.created_at &&
165
+ end_at == other.end_at &&
166
+ stopped_at == other.stopped_at &&
167
+ name == other.name &&
168
+ status == other.status &&
169
+ variants == other.variants &&
170
+ configuration == other.configuration &&
171
+ migrated_ab_test_id == other.migrated_ab_test_id
172
+ end
173
+
174
+ # @see the `==` method
175
+ # @param [Object] Object to be compared
176
+ def eql?(other)
177
+ self == other
178
+ end
179
+
180
+ # Calculates hash code according to all attributes.
181
+ # @return [Integer] Hash code
182
+ def hash
183
+ [
184
+ ab_test_id,
185
+ updated_at,
186
+ created_at,
187
+ end_at,
188
+ stopped_at,
189
+ name,
190
+ status,
191
+ variants,
192
+ configuration,
193
+ migrated_ab_test_id
194
+ ].hash
195
+ end
196
+
197
+ # Builds the object from hash
198
+ # @param [Hash] attributes Model attributes in the form of hash
199
+ # @return [Object] Returns the model itself
200
+ def self.build_from_hash(attributes)
201
+ return nil unless attributes.is_a?(Hash)
202
+ attributes = attributes.transform_keys(&:to_sym)
203
+ transformed_hash = {}
204
+ types_mapping.each_pair do |key, type|
205
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
206
+ transformed_hash[key.to_sym] = nil
207
+ elsif type =~ /\AArray<(.*)>/i
208
+ # check to ensure the input is an array given that the attribute
209
+ # is documented as an array but the input is not
210
+ if attributes[attribute_map[key]].is_a?(Array)
211
+ transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
212
+ _deserialize(::Regexp.last_match(1), v)
213
+ }
214
+ end
215
+ elsif !attributes[attribute_map[key]].nil?
216
+ transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
217
+ end
218
+ end
219
+
220
+ new(transformed_hash)
221
+ end
222
+
223
+ # Deserializes the data based on type
224
+ # @param string type Data type
225
+ # @param string value Value to be deserialized
226
+ # @return [Object] Deserialized data
227
+ def self._deserialize(type, value)
228
+ case type.to_sym
229
+ when :Time
230
+ Time.parse(value)
231
+ when :Date
232
+ Date.parse(value)
233
+ when :String
234
+ value.to_s
235
+ when :Integer
236
+ value.to_i
237
+ when :Float
238
+ value.to_f
239
+ when :Boolean
240
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
241
+ true
242
+ else
243
+ false
244
+ end
245
+
246
+ when :Object
247
+ # generic object (usually a Hash), return directly
248
+ value
249
+ when /\AArray<(?<inner_type>.+)>\z/
250
+ inner_type = Regexp.last_match[:inner_type]
251
+ value.map { |v| _deserialize(inner_type, v) }
252
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
253
+ k_type = Regexp.last_match[:k_type]
254
+ v_type = Regexp.last_match[:v_type]
255
+ {}.tap do |hash|
256
+ value.each do |k, v|
257
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
258
+ end
259
+ end
260
+ # model
261
+ else
262
+ # models (e.g. Pet) or oneOf
263
+ klass = Algolia::AbtestingV3.const_get(type)
264
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
265
+ .build_from_hash(value)
266
+ end
267
+ end
268
+
269
+ # Returns the string representation of the object
270
+ # @return [String] String presentation of the object
271
+ def to_s
272
+ to_hash.to_s
273
+ end
274
+
275
+ # to_body is an alias to to_hash (backward compatibility)
276
+ # @return [Hash] Returns the object in the form of hash
277
+ def to_body
278
+ to_hash
279
+ end
280
+
281
+ def to_json(*_args)
282
+ to_hash.to_json
283
+ end
284
+
285
+ # Returns the object in the form of hash
286
+ # @return [Hash] Returns the object in the form of hash
287
+ def to_hash
288
+ hash = {}
289
+ self.class.attribute_map.each_pair do |attr, param|
290
+ value = send(attr)
291
+ if value.nil?
292
+ is_nullable = self.class.openapi_nullable.include?(attr)
293
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
294
+ end
295
+
296
+ hash[param] = _to_hash(value)
297
+ end
298
+
299
+ hash
300
+ end
301
+
302
+ # Outputs non-array value in the form of hash
303
+ # For object, use to_hash. Otherwise, just return the value
304
+ # @param [Object] value Any valid value
305
+ # @return [Hash] Returns the value in the form of hash
306
+ def _to_hash(value)
307
+ if value.is_a?(Array)
308
+ value.compact.map { |v| _to_hash(v) }
309
+ elsif value.is_a?(Hash)
310
+ {}.tap do |hash|
311
+ value.each { |k, v| hash[k] = _to_hash(v) }
312
+ end
313
+ elsif value.respond_to?(:to_hash)
314
+ value.to_hash
315
+ else
316
+ value
317
+ end
318
+ end
319
+
320
+ end
321
+
322
+ end
323
+ end
@@ -0,0 +1,230 @@
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
+ # A/B test configuration.
11
+ class ABTestConfiguration
12
+ attr_accessor :minimum_detectable_effect
13
+
14
+ # List of metric filters applied to the test population.
15
+ attr_accessor :filters
16
+
17
+ attr_accessor :error_correction
18
+
19
+ # Attribute mapping from ruby-style variable name to JSON key.
20
+ def self.attribute_map
21
+ {
22
+ :minimum_detectable_effect => :minimumDetectableEffect,
23
+ :filters => :filters,
24
+ :error_correction => :errorCorrection
25
+ }
26
+ end
27
+
28
+ # Attribute type mapping.
29
+ def self.types_mapping
30
+ {
31
+ :minimum_detectable_effect => :"MinimumDetectableEffect",
32
+ :filters => :"Array<MetricsFilter>",
33
+ :error_correction => :"ErrorCorrectionType"
34
+ }
35
+ end
36
+
37
+ # List of attributes with nullable: true
38
+ def self.openapi_nullable
39
+ Set.new(
40
+ []
41
+ )
42
+ end
43
+
44
+ # Initializes the object
45
+ # @param [Hash] attributes Model attributes in the form of hash
46
+ def initialize(attributes = {})
47
+ if (!attributes.is_a?(Hash))
48
+ raise(
49
+ ArgumentError,
50
+ "The input argument (attributes) must be a hash in `Algolia::ABTestConfiguration` initialize method"
51
+ )
52
+ end
53
+
54
+ # check to see if the attribute exists and convert string to symbol for hash key
55
+ attributes = attributes.each_with_object({}) { |(k, v), h|
56
+ if (!self.class.attribute_map.key?(k.to_sym))
57
+ raise(
58
+ ArgumentError,
59
+ "`#{k}` is not a valid attribute in `Algolia::ABTestConfiguration`. Please check the name to make sure it's valid. List of attributes: " +
60
+ self.class.attribute_map.keys.inspect
61
+ )
62
+ end
63
+
64
+ h[k.to_sym] = v
65
+ }
66
+
67
+ if attributes.key?(:minimum_detectable_effect)
68
+ self.minimum_detectable_effect = attributes[:minimum_detectable_effect]
69
+ end
70
+
71
+ if attributes.key?(:filters)
72
+ if (value = attributes[:filters]).is_a?(Array)
73
+ self.filters = value
74
+ end
75
+ end
76
+
77
+ if attributes.key?(:error_correction)
78
+ self.error_correction = attributes[:error_correction]
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
+ minimum_detectable_effect == other.minimum_detectable_effect &&
88
+ filters == other.filters &&
89
+ error_correction == other.error_correction
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
+ [minimum_detectable_effect, filters, error_correction].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::AbtestingV3.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
+
227
+ end
228
+
229
+ end
230
+ end