algolia 3.0.0.beta.10 → 3.0.0.beta.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +19 -0
  3. data/Gemfile.lock +2 -2
  4. data/lib/algolia/api/ingestion_client.rb +912 -359
  5. data/lib/algolia/api/query_suggestions_client.rb +4 -10
  6. data/lib/algolia/api/search_client.rb +4 -4
  7. data/lib/algolia/api/usage_client.rb +4 -4
  8. data/lib/algolia/error.rb +10 -0
  9. data/lib/algolia/logger_helper.rb +11 -2
  10. data/lib/algolia/models/abtesting/{filter_effects_empty_search.rb → empty_search_filter.rb} +3 -3
  11. data/lib/algolia/models/abtesting/filter_effects.rb +2 -2
  12. data/lib/algolia/models/abtesting/{filter_effects_outliers.rb → outliers_filter.rb} +3 -3
  13. data/lib/algolia/models/analytics/{click_positions_inner.rb → click_position.rb} +3 -3
  14. data/lib/algolia/models/analytics/get_click_positions_response.rb +1 -1
  15. data/lib/algolia/models/analytics/top_search_with_analytics.rb +1 -1
  16. data/lib/algolia/models/analytics/top_search_with_revenue_analytics.rb +1 -1
  17. data/lib/algolia/models/ingestion/action.rb +45 -0
  18. data/lib/algolia/models/{search/search_for_hits_options.rb → ingestion/batch_request.rb} +22 -20
  19. data/lib/algolia/models/ingestion/{source_shopify_base.rb → batch_write_params.rb} +14 -12
  20. data/lib/algolia/models/ingestion/docker_streams_input.rb +1 -0
  21. data/lib/algolia/models/{recommend/recommendations_hits.rb → ingestion/list_tasks_response_v1.rb} +26 -14
  22. data/lib/algolia/models/ingestion/task.rb +30 -9
  23. data/lib/algolia/models/ingestion/task_create.rb +11 -12
  24. data/lib/algolia/models/{search/search_for_facets_options.rb → ingestion/task_create_v1.rb} +86 -51
  25. data/lib/algolia/models/ingestion/task_update.rb +8 -7
  26. data/lib/algolia/models/{search/browse_pagination.rb → ingestion/task_update_v1.rb} +50 -55
  27. data/lib/algolia/models/{recommend/looking_similar.rb → ingestion/task_v1.rb} +147 -30
  28. data/lib/algolia/models/ingestion/{transformation_try_response_error.rb → transformation_error.rb} +3 -3
  29. data/lib/algolia/models/ingestion/transformation_try_response.rb +1 -1
  30. data/lib/algolia/models/monitoring/{incidents_inner.rb → incident_entry.rb} +3 -3
  31. data/lib/algolia/models/monitoring/{indexing_time_response_metrics.rb → indexing_metric.rb} +3 -3
  32. data/lib/algolia/models/monitoring/indexing_time_response.rb +1 -1
  33. data/lib/algolia/models/monitoring/infrastructure_response.rb +1 -1
  34. data/lib/algolia/models/monitoring/{latency_response_metrics.rb → latency_metric.rb} +3 -3
  35. data/lib/algolia/models/monitoring/latency_response.rb +1 -1
  36. data/lib/algolia/models/monitoring/{infrastructure_response_metrics.rb → metrics.rb} +3 -6
  37. data/lib/algolia/models/monitoring/{time_inner.rb → time_entry.rb} +3 -3
  38. data/lib/algolia/models/{recommend/trending_items.rb → query-suggestions/config_status.rb} +46 -58
  39. data/lib/algolia/models/{recommend/related_products.rb → query-suggestions/log_file.rb} +36 -32
  40. data/lib/algolia/models/recommend/around_precision.rb +1 -1
  41. data/lib/algolia/models/recommend/fallback_params.rb +1 -1
  42. data/lib/algolia/models/recommend/{around_precision_from_value_inner.rb → range.rb} +3 -6
  43. data/lib/algolia/models/recommend/recommend_rule.rb +1 -1
  44. data/lib/algolia/models/recommend/{redirect_rule_index_metadata_data.rb → redirect_rule_index_data.rb} +3 -3
  45. data/lib/algolia/models/recommend/redirect_rule_index_metadata.rb +1 -1
  46. data/lib/algolia/models/recommend/{recommend_rule_metadata.rb → rule_metadata.rb} +3 -3
  47. data/lib/algolia/models/recommend/search_params.rb +1 -1
  48. data/lib/algolia/models/recommend/search_params_object.rb +1 -1
  49. data/lib/algolia/models/search/around_precision.rb +1 -1
  50. data/lib/algolia/models/search/browse_params_object.rb +1 -1
  51. data/lib/algolia/models/search/built_in_operation.rb +1 -2
  52. data/lib/algolia/models/search/built_in_operation_value.rb +105 -0
  53. data/lib/algolia/models/search/consequence_params.rb +1 -1
  54. data/lib/algolia/models/search/dictionary_entry.rb +0 -2
  55. data/lib/algolia/models/search/index_settings.rb +2 -2
  56. data/lib/algolia/models/search/{around_precision_from_value_inner.rb → range.rb} +3 -6
  57. data/lib/algolia/models/search/{redirect_rule_index_metadata_data.rb → redirect_rule_index_data.rb} +3 -3
  58. data/lib/algolia/models/search/redirect_rule_index_metadata.rb +1 -1
  59. data/lib/algolia/models/search/search_for_facets.rb +1 -1
  60. data/lib/algolia/models/search/search_for_hits.rb +1 -1
  61. data/lib/algolia/models/search/search_params_object.rb +1 -1
  62. data/lib/algolia/models/search/search_params_string.rb +1 -0
  63. data/lib/algolia/models/search/{index_settings_as_search_params.rb → settings_response.rb} +251 -11
  64. data/lib/algolia/models/usage/{get_usage400_response_error_errors_inner.rb → error_item.rb} +3 -3
  65. data/lib/algolia/models/usage/{get_usage400_response_error.rb → forbidden_error.rb} +4 -4
  66. data/lib/algolia/models/usage/{get_usage200_response.rb → index_usage.rb} +4 -4
  67. data/lib/algolia/models/usage/invalid_request_error.rb +231 -0
  68. data/lib/algolia/models/usage/{get_usage200_response_statistics_inner.rb → statistic_entry.rb} +3 -3
  69. data/lib/algolia/transport/transport.rb +8 -2
  70. data/lib/algolia/version.rb +1 -1
  71. metadata +32 -63
  72. data/lib/algolia/models/abtesting/custom_search_params.rb +0 -214
  73. data/lib/algolia/models/abtesting/error_base.rb +0 -212
  74. data/lib/algolia/models/analytics/error_base.rb +0 -212
  75. data/lib/algolia/models/ingestion/error_base.rb +0 -212
  76. data/lib/algolia/models/insights/error_base.rb +0 -212
  77. data/lib/algolia/models/monitoring/error_base.rb +0 -212
  78. data/lib/algolia/models/monitoring/get_servers403_response.rb +0 -211
  79. data/lib/algolia/models/personalization/error_base.rb +0 -212
  80. data/lib/algolia/models/query-suggestions/app_id.rb +0 -209
  81. data/lib/algolia/models/query-suggestions/error_base.rb +0 -212
  82. data/lib/algolia/models/recommend/base_recommend_request.rb +0 -281
  83. data/lib/algolia/models/recommend/base_search_params.rb +0 -635
  84. data/lib/algolia/models/recommend/base_search_params_without_query.rb +0 -616
  85. data/lib/algolia/models/recommend/base_search_response.rb +0 -499
  86. data/lib/algolia/models/recommend/error_base.rb +0 -212
  87. data/lib/algolia/models/recommend/frequently_bought_together.rb +0 -247
  88. data/lib/algolia/models/recommend/index_settings_as_search_params.rb +0 -788
  89. data/lib/algolia/models/recommend/recommended_for_you.rb +0 -244
  90. data/lib/algolia/models/recommend/search_pagination.rb +0 -282
  91. data/lib/algolia/models/recommend/search_params_query.rb +0 -212
  92. data/lib/algolia/models/recommend/trending_facets.rb +0 -258
  93. data/lib/algolia/models/search/base_get_api_key_response.rb +0 -224
  94. data/lib/algolia/models/search/base_index_settings.rb +0 -426
  95. data/lib/algolia/models/search/base_search_params.rb +0 -635
  96. data/lib/algolia/models/search/base_search_params_without_query.rb +0 -616
  97. data/lib/algolia/models/search/base_search_response.rb +0 -499
  98. data/lib/algolia/models/search/cursor.rb +0 -209
  99. data/lib/algolia/models/search/error_base.rb +0 -212
  100. data/lib/algolia/models/search/params.rb +0 -236
  101. data/lib/algolia/models/search/search_hits.rb +0 -240
  102. data/lib/algolia/models/search/search_pagination.rb +0 -282
  103. data/lib/algolia/models/search/search_params_query.rb +0 -212
  104. data/lib/algolia/models/usage/error_base.rb +0 -212
  105. data/lib/algolia/models/usage/get_usage400_response.rb +0 -213
@@ -1,244 +0,0 @@
1
- # 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.
2
-
3
- require "date"
4
- require "time"
5
-
6
- module Algolia
7
- module Recommend
8
- class RecommendedForYou
9
- attr_accessor :model
10
-
11
- attr_accessor :fallback_parameters
12
-
13
- class EnumAttributeValidator
14
- attr_reader :datatype
15
- attr_reader :allowable_values
16
-
17
- def initialize(datatype, allowable_values)
18
- @allowable_values = allowable_values.map do |value|
19
- case datatype.to_s
20
- when /Integer/i
21
- value.to_i
22
- when /Float/i
23
- value.to_f
24
- else
25
- value
26
- end
27
- end
28
- end
29
-
30
- def valid?(value)
31
- !value || allowable_values.include?(value)
32
- end
33
- end
34
-
35
- # Attribute mapping from ruby-style variable name to JSON key.
36
- def self.attribute_map
37
- {
38
- :model => :model,
39
- :fallback_parameters => :fallbackParameters
40
- }
41
- end
42
-
43
- # Returns all the JSON keys this model knows about
44
- def self.acceptable_attributes
45
- attribute_map.values
46
- end
47
-
48
- # Attribute type mapping.
49
- def self.types_mapping
50
- {
51
- :model => :"RecommendedForYouModel",
52
- :fallback_parameters => :"FallbackParams"
53
- }
54
- end
55
-
56
- # List of attributes with nullable: true
57
- def self.openapi_nullable
58
- Set.new(
59
- []
60
- )
61
- end
62
-
63
- # Initializes the object
64
- # @param [Hash] attributes Model attributes in the form of hash
65
- def initialize(attributes = {})
66
- if (!attributes.is_a?(Hash))
67
- raise(
68
- ArgumentError,
69
- "The input argument (attributes) must be a hash in `Algolia::RecommendedForYou` initialize method"
70
- )
71
- end
72
-
73
- # check to see if the attribute exists and convert string to symbol for hash key
74
- attributes = attributes.each_with_object({}) { |(k, v), h|
75
- if (!self.class.attribute_map.key?(k.to_sym))
76
- raise(
77
- ArgumentError,
78
- "`#{k}` is not a valid attribute in `Algolia::RecommendedForYou`. Please check the name to make sure it's valid. List of attributes: " +
79
- self.class.attribute_map.keys.inspect
80
- )
81
- end
82
-
83
- h[k.to_sym] = v
84
- }
85
-
86
- if attributes.key?(:model)
87
- self.model = attributes[:model]
88
- else
89
- self.model = nil
90
- end
91
-
92
- if attributes.key?(:fallback_parameters)
93
- self.fallback_parameters = attributes[:fallback_parameters]
94
- end
95
- end
96
-
97
- # Checks equality by comparing each attribute.
98
- # @param [Object] Object to be compared
99
- def ==(other)
100
- return true if self.equal?(other)
101
- self.class == other.class &&
102
- model == other.model &&
103
- fallback_parameters == other.fallback_parameters
104
- end
105
-
106
- # @see the `==` method
107
- # @param [Object] Object to be compared
108
- def eql?(other)
109
- self == other
110
- end
111
-
112
- # Calculates hash code according to all attributes.
113
- # @return [Integer] Hash code
114
- def hash
115
- [model, fallback_parameters].hash
116
- end
117
-
118
- # Builds the object from hash
119
- # @param [Hash] attributes Model attributes in the form of hash
120
- # @return [Object] Returns the model itself
121
- def self.build_from_hash(attributes)
122
- return nil unless attributes.is_a?(Hash)
123
- attributes = attributes.transform_keys(&:to_sym)
124
- transformed_hash = {}
125
- types_mapping.each_pair do |key, type|
126
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
127
- transformed_hash[key.to_sym] = nil
128
- elsif type =~ /\AArray<(.*)>/i
129
- # check to ensure the input is an array given that the attribute
130
- # is documented as an array but the input is not
131
- if attributes[attribute_map[key]].is_a?(Array)
132
- transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
133
- _deserialize(::Regexp.last_match(1), v)
134
- }
135
- end
136
- elsif !attributes[attribute_map[key]].nil?
137
- transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
138
- end
139
- end
140
-
141
- new(transformed_hash)
142
- end
143
-
144
- # Deserializes the data based on type
145
- # @param string type Data type
146
- # @param string value Value to be deserialized
147
- # @return [Object] Deserialized data
148
- def self._deserialize(type, value)
149
- case type.to_sym
150
- when :Time
151
- Time.parse(value)
152
- when :Date
153
- Date.parse(value)
154
- when :String
155
- value.to_s
156
- when :Integer
157
- value.to_i
158
- when :Float
159
- value.to_f
160
- when :Boolean
161
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
162
- true
163
- else
164
- false
165
- end
166
-
167
- when :Object
168
- # generic object (usually a Hash), return directly
169
- value
170
- when /\AArray<(?<inner_type>.+)>\z/
171
- inner_type = Regexp.last_match[:inner_type]
172
- value.map { |v| _deserialize(inner_type, v) }
173
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
174
- k_type = Regexp.last_match[:k_type]
175
- v_type = Regexp.last_match[:v_type]
176
- {}.tap do |hash|
177
- value.each do |k, v|
178
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
179
- end
180
- end
181
- # model
182
- else
183
- # models (e.g. Pet) or oneOf
184
- klass = Algolia::Recommend.const_get(type)
185
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
186
- .build_from_hash(value)
187
- end
188
- end
189
-
190
- # Returns the string representation of the object
191
- # @return [String] String presentation of the object
192
- def to_s
193
- to_hash.to_s
194
- end
195
-
196
- # to_body is an alias to to_hash (backward compatibility)
197
- # @return [Hash] Returns the object in the form of hash
198
- def to_body
199
- to_hash
200
- end
201
-
202
- def to_json(*_args)
203
- to_hash.to_json
204
- end
205
-
206
- # Returns the object in the form of hash
207
- # @return [Hash] Returns the object in the form of hash
208
- def to_hash
209
- hash = {}
210
- self.class.attribute_map.each_pair do |attr, param|
211
- value = send(attr)
212
- if value.nil?
213
- is_nullable = self.class.openapi_nullable.include?(attr)
214
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
215
- end
216
-
217
- hash[param] = _to_hash(value)
218
- end
219
-
220
- hash
221
- end
222
-
223
- # Outputs non-array value in the form of hash
224
- # For object, use to_hash. Otherwise, just return the value
225
- # @param [Object] value Any valid value
226
- # @return [Hash] Returns the value in the form of hash
227
- def _to_hash(value)
228
- if value.is_a?(Array)
229
- value.compact.map { |v| _to_hash(v) }
230
- elsif value.is_a?(Hash)
231
- {}.tap do |hash|
232
- value.each { |k, v| hash[k] = _to_hash(v) }
233
- end
234
- elsif value.respond_to?(:to_hash)
235
- value.to_hash
236
- else
237
- value
238
- end
239
- end
240
-
241
- end
242
-
243
- end
244
- end
@@ -1,282 +0,0 @@
1
- # 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.
2
-
3
- require "date"
4
- require "time"
5
-
6
- module Algolia
7
- module Recommend
8
- class SearchPagination
9
- # Page of search results to retrieve.
10
- attr_accessor :page
11
-
12
- # Number of results (hits).
13
- attr_accessor :nb_hits
14
-
15
- # Number of pages of results.
16
- attr_accessor :nb_pages
17
-
18
- # Number of hits per page.
19
- attr_accessor :hits_per_page
20
-
21
- # Attribute mapping from ruby-style variable name to JSON key.
22
- def self.attribute_map
23
- {
24
- :page => :page,
25
- :nb_hits => :nbHits,
26
- :nb_pages => :nbPages,
27
- :hits_per_page => :hitsPerPage
28
- }
29
- end
30
-
31
- # Returns all the JSON keys this model knows about
32
- def self.acceptable_attributes
33
- attribute_map.values
34
- end
35
-
36
- # Attribute type mapping.
37
- def self.types_mapping
38
- {
39
- :page => :"Integer",
40
- :nb_hits => :"Integer",
41
- :nb_pages => :"Integer",
42
- :hits_per_page => :"Integer"
43
- }
44
- end
45
-
46
- # List of attributes with nullable: true
47
- def self.openapi_nullable
48
- Set.new(
49
- []
50
- )
51
- end
52
-
53
- # Initializes the object
54
- # @param [Hash] attributes Model attributes in the form of hash
55
- def initialize(attributes = {})
56
- if (!attributes.is_a?(Hash))
57
- raise(
58
- ArgumentError,
59
- "The input argument (attributes) must be a hash in `Algolia::SearchPagination` initialize method"
60
- )
61
- end
62
-
63
- # check to see if the attribute exists and convert string to symbol for hash key
64
- attributes = attributes.each_with_object({}) { |(k, v), h|
65
- if (!self.class.attribute_map.key?(k.to_sym))
66
- raise(
67
- ArgumentError,
68
- "`#{k}` is not a valid attribute in `Algolia::SearchPagination`. Please check the name to make sure it's valid. List of attributes: " +
69
- self.class.attribute_map.keys.inspect
70
- )
71
- end
72
-
73
- h[k.to_sym] = v
74
- }
75
-
76
- if attributes.key?(:page)
77
- self.page = attributes[:page]
78
- else
79
- self.page = nil
80
- end
81
-
82
- if attributes.key?(:nb_hits)
83
- self.nb_hits = attributes[:nb_hits]
84
- else
85
- self.nb_hits = nil
86
- end
87
-
88
- if attributes.key?(:nb_pages)
89
- self.nb_pages = attributes[:nb_pages]
90
- else
91
- self.nb_pages = nil
92
- end
93
-
94
- if attributes.key?(:hits_per_page)
95
- self.hits_per_page = attributes[:hits_per_page]
96
- else
97
- self.hits_per_page = nil
98
- end
99
- end
100
-
101
- # Custom attribute writer method with validation
102
- # @param [Object] page Value to be assigned
103
- def page=(page)
104
- if page.nil?
105
- raise ArgumentError, "page cannot be nil"
106
- end
107
-
108
- if page < 0
109
- raise ArgumentError, "invalid value for \"page\", must be greater than or equal to 0."
110
- end
111
-
112
- @page = page
113
- end
114
-
115
- # Custom attribute writer method with validation
116
- # @param [Object] hits_per_page Value to be assigned
117
- def hits_per_page=(hits_per_page)
118
- if hits_per_page.nil?
119
- raise ArgumentError, "hits_per_page cannot be nil"
120
- end
121
-
122
- if hits_per_page > 1000
123
- raise ArgumentError, "invalid value for \"hits_per_page\", must be smaller than or equal to 1000."
124
- end
125
-
126
- if hits_per_page < 1
127
- raise ArgumentError, "invalid value for \"hits_per_page\", must be greater than or equal to 1."
128
- end
129
-
130
- @hits_per_page = hits_per_page
131
- end
132
-
133
- # Checks equality by comparing each attribute.
134
- # @param [Object] Object to be compared
135
- def ==(other)
136
- return true if self.equal?(other)
137
- self.class == other.class &&
138
- page == other.page &&
139
- nb_hits == other.nb_hits &&
140
- nb_pages == other.nb_pages &&
141
- hits_per_page == other.hits_per_page
142
- end
143
-
144
- # @see the `==` method
145
- # @param [Object] Object to be compared
146
- def eql?(other)
147
- self == other
148
- end
149
-
150
- # Calculates hash code according to all attributes.
151
- # @return [Integer] Hash code
152
- def hash
153
- [page, nb_hits, nb_pages, hits_per_page].hash
154
- end
155
-
156
- # Builds the object from hash
157
- # @param [Hash] attributes Model attributes in the form of hash
158
- # @return [Object] Returns the model itself
159
- def self.build_from_hash(attributes)
160
- return nil unless attributes.is_a?(Hash)
161
- attributes = attributes.transform_keys(&:to_sym)
162
- transformed_hash = {}
163
- types_mapping.each_pair do |key, type|
164
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
165
- transformed_hash[key.to_sym] = nil
166
- elsif type =~ /\AArray<(.*)>/i
167
- # check to ensure the input is an array given that the attribute
168
- # is documented as an array but the input is not
169
- if attributes[attribute_map[key]].is_a?(Array)
170
- transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
171
- _deserialize(::Regexp.last_match(1), v)
172
- }
173
- end
174
- elsif !attributes[attribute_map[key]].nil?
175
- transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
176
- end
177
- end
178
-
179
- new(transformed_hash)
180
- end
181
-
182
- # Deserializes the data based on type
183
- # @param string type Data type
184
- # @param string value Value to be deserialized
185
- # @return [Object] Deserialized data
186
- def self._deserialize(type, value)
187
- case type.to_sym
188
- when :Time
189
- Time.parse(value)
190
- when :Date
191
- Date.parse(value)
192
- when :String
193
- value.to_s
194
- when :Integer
195
- value.to_i
196
- when :Float
197
- value.to_f
198
- when :Boolean
199
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
200
- true
201
- else
202
- false
203
- end
204
-
205
- when :Object
206
- # generic object (usually a Hash), return directly
207
- value
208
- when /\AArray<(?<inner_type>.+)>\z/
209
- inner_type = Regexp.last_match[:inner_type]
210
- value.map { |v| _deserialize(inner_type, v) }
211
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
212
- k_type = Regexp.last_match[:k_type]
213
- v_type = Regexp.last_match[:v_type]
214
- {}.tap do |hash|
215
- value.each do |k, v|
216
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
217
- end
218
- end
219
- # model
220
- else
221
- # models (e.g. Pet) or oneOf
222
- klass = Algolia::Recommend.const_get(type)
223
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
224
- .build_from_hash(value)
225
- end
226
- end
227
-
228
- # Returns the string representation of the object
229
- # @return [String] String presentation of the object
230
- def to_s
231
- to_hash.to_s
232
- end
233
-
234
- # to_body is an alias to to_hash (backward compatibility)
235
- # @return [Hash] Returns the object in the form of hash
236
- def to_body
237
- to_hash
238
- end
239
-
240
- def to_json(*_args)
241
- to_hash.to_json
242
- end
243
-
244
- # Returns the object in the form of hash
245
- # @return [Hash] Returns the object in the form of hash
246
- def to_hash
247
- hash = {}
248
- self.class.attribute_map.each_pair do |attr, param|
249
- value = send(attr)
250
- if value.nil?
251
- is_nullable = self.class.openapi_nullable.include?(attr)
252
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
253
- end
254
-
255
- hash[param] = _to_hash(value)
256
- end
257
-
258
- hash
259
- end
260
-
261
- # Outputs non-array value in the form of hash
262
- # For object, use to_hash. Otherwise, just return the value
263
- # @param [Object] value Any valid value
264
- # @return [Hash] Returns the value in the form of hash
265
- def _to_hash(value)
266
- if value.is_a?(Array)
267
- value.compact.map { |v| _to_hash(v) }
268
- elsif value.is_a?(Hash)
269
- {}.tap do |hash|
270
- value.each { |k, v| hash[k] = _to_hash(v) }
271
- end
272
- elsif value.respond_to?(:to_hash)
273
- value.to_hash
274
- else
275
- value
276
- end
277
- end
278
-
279
- end
280
-
281
- end
282
- end