algolia 3.0.0.beta.11 → 3.0.0.beta.12

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