algolia 3.5.0 → 3.5.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (132) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +18 -0
  3. data/Gemfile.lock +1 -1
  4. data/lib/algolia/api/abtesting_client.rb +17 -16
  5. data/lib/algolia/api/analytics_client.rb +173 -333
  6. data/lib/algolia/api/ingestion_client.rb +40 -200
  7. data/lib/algolia/api/insights_client.rb +18 -32
  8. data/lib/algolia/api/monitoring_client.rb +33 -25
  9. data/lib/algolia/api/personalization_client.rb +16 -8
  10. data/lib/algolia/api/query_suggestions_client.rb +17 -9
  11. data/lib/algolia/api/recommend_client.rb +17 -9
  12. data/lib/algolia/api/search_client.rb +63 -110
  13. data/lib/algolia/configuration.rb +16 -1
  14. data/lib/algolia/models/abtesting/ab_test_configuration.rb +0 -2
  15. data/lib/algolia/models/abtesting/ab_tests_variant.rb +0 -18
  16. data/lib/algolia/models/abtesting/ab_tests_variant_search_params.rb +0 -18
  17. data/lib/algolia/models/abtesting/add_ab_tests_request.rb +0 -18
  18. data/lib/algolia/models/abtesting/minimum_detectable_effect.rb +0 -18
  19. data/lib/algolia/models/abtesting/schedule_ab_tests_request.rb +0 -18
  20. data/lib/algolia/models/abtesting/variant.rb +0 -20
  21. data/lib/algolia/models/analytics/click_position.rb +0 -32
  22. data/lib/algolia/models/analytics/daily_add_to_cart_rates.rb +0 -28
  23. data/lib/algolia/models/analytics/daily_average_clicks.rb +0 -24
  24. data/lib/algolia/models/analytics/daily_click_through_rates.rb +0 -28
  25. data/lib/algolia/models/analytics/daily_conversion_rates.rb +0 -28
  26. data/lib/algolia/models/analytics/daily_no_click_rates.rb +0 -32
  27. data/lib/algolia/models/analytics/daily_no_results_rates.rb +0 -18
  28. data/lib/algolia/models/analytics/daily_purchase_rates.rb +0 -14
  29. data/lib/algolia/models/analytics/daily_searches_no_clicks.rb +0 -14
  30. data/lib/algolia/models/analytics/daily_searches_no_results.rb +0 -14
  31. data/lib/algolia/models/analytics/get_add_to_cart_rate_response.rb +0 -28
  32. data/lib/algolia/models/analytics/get_average_click_position_response.rb +0 -24
  33. data/lib/algolia/models/analytics/get_click_positions_response.rb +0 -18
  34. data/lib/algolia/models/analytics/get_click_through_rate_response.rb +0 -28
  35. data/lib/algolia/models/analytics/get_conversion_rate_response.rb +0 -28
  36. data/lib/algolia/models/analytics/get_no_click_rate_response.rb +0 -32
  37. data/lib/algolia/models/analytics/get_no_results_rate_response.rb +0 -18
  38. data/lib/algolia/models/analytics/get_purchase_rate_response.rb +0 -14
  39. data/lib/algolia/models/analytics/top_hit_with_analytics.rb +0 -56
  40. data/lib/algolia/models/analytics/top_hit_with_revenue_analytics.rb +0 -98
  41. data/lib/algolia/models/analytics/top_search_with_analytics.rb +0 -90
  42. data/lib/algolia/models/analytics/top_search_with_revenue_analytics.rb +0 -132
  43. data/lib/algolia/models/ingestion/event.rb +1 -25
  44. data/lib/algolia/models/ingestion/pagination.rb +0 -60
  45. data/lib/algolia/models/ingestion/run.rb +0 -18
  46. data/lib/algolia/models/ingestion/source_csv.rb +0 -21
  47. data/lib/algolia/models/ingestion/task.rb +0 -18
  48. data/lib/algolia/models/ingestion/task_create.rb +0 -18
  49. data/lib/algolia/models/ingestion/task_create_v1.rb +0 -18
  50. data/lib/algolia/models/ingestion/task_update.rb +0 -18
  51. data/lib/algolia/models/ingestion/task_update_v1.rb +0 -18
  52. data/lib/algolia/models/ingestion/task_v1.rb +0 -18
  53. data/lib/algolia/models/ingestion/transformation.rb +1 -1
  54. data/lib/algolia/models/ingestion/transformation_create.rb +1 -1
  55. data/lib/algolia/models/insights/added_to_cart_object_ids.rb +0 -123
  56. data/lib/algolia/models/insights/added_to_cart_object_ids_after_search.rb +0 -149
  57. data/lib/algolia/models/insights/clicked_filters.rb +0 -105
  58. data/lib/algolia/models/insights/clicked_object_ids.rb +0 -105
  59. data/lib/algolia/models/insights/clicked_object_ids_after_search.rb +0 -149
  60. data/lib/algolia/models/insights/converted_filters.rb +0 -105
  61. data/lib/algolia/models/insights/converted_object_ids.rb +0 -105
  62. data/lib/algolia/models/insights/converted_object_ids_after_search.rb +0 -131
  63. data/lib/algolia/models/insights/insights_events.rb +0 -18
  64. data/lib/algolia/models/insights/object_data_after_search.rb +0 -26
  65. data/lib/algolia/models/insights/purchased_object_ids.rb +0 -123
  66. data/lib/algolia/models/insights/purchased_object_ids_after_search.rb +0 -123
  67. data/lib/algolia/models/insights/viewed_filters.rb +0 -105
  68. data/lib/algolia/models/insights/viewed_object_ids.rb +0 -105
  69. data/lib/algolia/models/personalization/personalization_strategy_params.rb +0 -18
  70. data/lib/algolia/models/query-suggestions/configuration.rb +0 -17
  71. data/lib/algolia/models/query-suggestions/configuration_response.rb +0 -17
  72. data/lib/algolia/models/query-suggestions/configuration_with_index.rb +0 -17
  73. data/lib/algolia/models/query-suggestions/source_index.rb +0 -28
  74. data/lib/algolia/models/recommend/banner_image.rb +4 -2
  75. data/lib/algolia/models/recommend/bought_together_query.rb +0 -36
  76. data/lib/algolia/models/recommend/condition.rb +0 -15
  77. data/lib/algolia/models/recommend/consequence.rb +0 -28
  78. data/lib/algolia/models/recommend/fallback_params.rb +3 -95
  79. data/lib/algolia/models/recommend/looking_similar_query.rb +0 -36
  80. data/lib/algolia/models/recommend/promote_consequence_object.rb +0 -14
  81. data/lib/algolia/models/recommend/ranking_info.rb +0 -112
  82. data/lib/algolia/models/recommend/recommend_hit.rb +0 -20
  83. data/lib/algolia/models/recommend/recommend_search_params.rb +3 -95
  84. data/lib/algolia/models/recommend/recommendations_results.rb +13 -61
  85. data/lib/algolia/models/recommend/recommended_for_you_query.rb +0 -36
  86. data/lib/algolia/models/recommend/related_query.rb +0 -36
  87. data/lib/algolia/models/recommend/search_recommend_rules_params.rb +2 -52
  88. data/lib/algolia/models/recommend/search_recommend_rules_response.rb +0 -14
  89. data/lib/algolia/models/recommend/trending_facet_hit.rb +0 -20
  90. data/lib/algolia/models/recommend/trending_facets_query.rb +0 -36
  91. data/lib/algolia/models/recommend/trending_items_query.rb +0 -36
  92. data/lib/algolia/models/recommend/widgets.rb +5 -2
  93. data/lib/algolia/models/search/banner_image.rb +4 -2
  94. data/lib/algolia/models/search/browse_params_object.rb +1 -129
  95. data/lib/algolia/models/search/browse_response.rb +13 -61
  96. data/lib/algolia/models/search/condition.rb +0 -15
  97. data/lib/algolia/models/search/consequence.rb +0 -28
  98. data/lib/algolia/models/search/consequence_params.rb +1 -129
  99. data/lib/algolia/models/search/get_api_key_response.rb +2 -0
  100. data/lib/algolia/models/search/get_objects_response.rb +0 -2
  101. data/lib/algolia/models/search/index_settings.rb +3 -81
  102. data/lib/algolia/models/search/log.rb +0 -34
  103. data/lib/algolia/models/search/promote_object_ids.rb +0 -14
  104. data/lib/algolia/models/search/ranking_info.rb +0 -112
  105. data/lib/algolia/models/search/rule.rb +0 -18
  106. data/lib/algolia/models/search/search_dictionary_entries_params.rb +0 -32
  107. data/lib/algolia/models/search/search_dictionary_entries_response.rb +1 -15
  108. data/lib/algolia/models/search/search_for_facet_values_request.rb +0 -14
  109. data/lib/algolia/models/search/search_for_facets.rb +1 -129
  110. data/lib/algolia/models/search/search_for_hits.rb +1 -129
  111. data/lib/algolia/models/search/search_params_object.rb +1 -129
  112. data/lib/algolia/models/search/search_response.rb +13 -61
  113. data/lib/algolia/models/search/search_rules_params.rb +2 -34
  114. data/lib/algolia/models/search/search_synonyms_params.rb +0 -32
  115. data/lib/algolia/models/search/search_user_ids_params.rb +0 -32
  116. data/lib/algolia/models/search/search_user_ids_response.rb +1 -33
  117. data/lib/algolia/models/search/settings_response.rb +3 -81
  118. data/lib/algolia/models/search/user_hit.rb +0 -15
  119. data/lib/algolia/models/search/user_id.rb +0 -15
  120. data/lib/algolia/models/search/widgets.rb +5 -2
  121. data/lib/algolia/user_agent.rb +8 -2
  122. data/lib/algolia/version.rb +1 -1
  123. metadata +2 -11
  124. data/lib/algolia/models/query-suggestions/base_query_suggestions_configuration_response.rb +0 -230
  125. data/lib/algolia/models/query-suggestions/base_query_suggestions_configuration_with_index.rb +0 -212
  126. data/lib/algolia/models/query-suggestions/get_config_status200_response.rb +0 -252
  127. data/lib/algolia/models/query-suggestions/get_log_file200_response.rb +0 -263
  128. data/lib/algolia/models/query-suggestions/query_suggestions_configuration.rb +0 -276
  129. data/lib/algolia/models/query-suggestions/query_suggestions_configuration_response.rb +0 -316
  130. data/lib/algolia/models/query-suggestions/query_suggestions_configuration_with_index.rb +0 -295
  131. data/lib/algolia/models/recommend/banners.rb +0 -209
  132. data/lib/algolia/models/search/banners.rb +0 -209
@@ -1,212 +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 QuerySuggestions
8
- class BaseQuerySuggestionsConfigurationWithIndex
9
- # Query Suggestions index name.
10
- attr_accessor :index_name
11
-
12
- # Attribute mapping from ruby-style variable name to JSON key.
13
- def self.attribute_map
14
- {
15
- :index_name => :indexName
16
- }
17
- end
18
-
19
- # Returns all the JSON keys this model knows about
20
- def self.acceptable_attributes
21
- attribute_map.values
22
- end
23
-
24
- # Attribute type mapping.
25
- def self.types_mapping
26
- {
27
- :index_name => :String
28
- }
29
- end
30
-
31
- # List of attributes with nullable: true
32
- def self.openapi_nullable
33
- Set.new([])
34
- end
35
-
36
- # Initializes the object
37
- # @param [Hash] attributes Model attributes in the form of hash
38
- def initialize(attributes = {})
39
- unless attributes.is_a?(Hash)
40
- raise(
41
- ArgumentError,
42
- "The input argument (attributes) must be a hash in `Algolia::BaseQuerySuggestionsConfigurationWithIndex` initialize method"
43
- )
44
- end
45
-
46
- # check to see if the attribute exists and convert string to symbol for hash key
47
- attributes = attributes.each_with_object({}) do |(k, v), h|
48
- unless self.class.attribute_map.key?(k.to_sym)
49
- raise(
50
- ArgumentError,
51
- "`#{k}` is not a valid attribute in `Algolia::BaseQuerySuggestionsConfigurationWithIndex`. Please check the name to make sure it's valid. List of attributes: " +
52
- self.class.attribute_map.keys.inspect
53
- )
54
- end
55
-
56
- h[k.to_sym] = v
57
- end
58
-
59
- if attributes.key?(:index_name)
60
- self.index_name = attributes[:index_name]
61
- else
62
- self.index_name = nil
63
- end
64
- end
65
-
66
- # Checks equality by comparing each attribute.
67
- # @param [Object] Object to be compared
68
- def ==(other)
69
- return true if equal?(other)
70
-
71
- self.class == other.class &&
72
- index_name == other.index_name
73
- end
74
-
75
- # @see the `==` method
76
- # @param [Object] Object to be compared
77
- def eql?(other)
78
- self == other
79
- end
80
-
81
- # Calculates hash code according to all attributes.
82
- # @return [Integer] Hash code
83
- def hash
84
- [index_name].hash
85
- end
86
-
87
- # Builds the object from hash
88
- # @param [Hash] attributes Model attributes in the form of hash
89
- # @return [Object] Returns the model itself
90
- def self.build_from_hash(attributes)
91
- return nil unless attributes.is_a?(Hash)
92
-
93
- attributes = attributes.transform_keys(&:to_sym)
94
- transformed_hash = {}
95
- types_mapping.each_pair do |key, type|
96
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
97
- transformed_hash[key.to_sym] = nil
98
- elsif type =~ /\AArray<(.*)>/i
99
- # check to ensure the input is an array given that the attribute
100
- # is documented as an array but the input is not
101
- if attributes[attribute_map[key]].is_a?(Array)
102
- transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
103
- _deserialize(::Regexp.last_match(1), v)
104
- }
105
- end
106
- elsif !attributes[attribute_map[key]].nil?
107
- transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
108
- end
109
- end
110
-
111
- new(transformed_hash)
112
- end
113
-
114
- # Deserializes the data based on type
115
- # @param string type Data type
116
- # @param string value Value to be deserialized
117
- # @return [Object] Deserialized data
118
- def self._deserialize(type, value)
119
- case type.to_sym
120
- when :Time
121
- Time.parse(value)
122
- when :Date
123
- Date.parse(value)
124
- when :String
125
- value.to_s
126
- when :Integer
127
- value.to_i
128
- when :Float
129
- value.to_f
130
- when :Boolean
131
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
132
- true
133
- else
134
- false
135
- end
136
-
137
- when :Object
138
- # generic object (usually a Hash), return directly
139
- value
140
- when /\AArray<(?<inner_type>.+)>\z/
141
- inner_type = Regexp.last_match[:inner_type]
142
- value.map { |v| _deserialize(inner_type, v) }
143
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
144
- k_type = Regexp.last_match[:k_type]
145
- v_type = Regexp.last_match[:v_type]
146
- {}.tap do |hash|
147
- value.each do |k, v|
148
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
149
- end
150
- end
151
- # model
152
- else
153
- # models (e.g. Pet) or oneOf
154
- klass = Algolia::QuerySuggestions.const_get(type)
155
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
156
- .build_from_hash(value)
157
- end
158
- end
159
-
160
- # Returns the string representation of the object
161
- # @return [String] String presentation of the object
162
- def to_s
163
- to_hash.to_s
164
- end
165
-
166
- # to_body is an alias to to_hash (backward compatibility)
167
- # @return [Hash] Returns the object in the form of hash
168
- def to_body
169
- to_hash
170
- end
171
-
172
- def to_json(*_args)
173
- to_hash.to_json
174
- end
175
-
176
- # Returns the object in the form of hash
177
- # @return [Hash] Returns the object in the form of hash
178
- def to_hash
179
- hash = {}
180
- self.class.attribute_map.each_pair do |attr, param|
181
- value = send(attr)
182
- if value.nil?
183
- is_nullable = self.class.openapi_nullable.include?(attr)
184
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
185
- end
186
-
187
- hash[param] = _to_hash(value)
188
- end
189
-
190
- hash
191
- end
192
-
193
- # Outputs non-array value in the form of hash
194
- # For object, use to_hash. Otherwise, just return the value
195
- # @param [Object] value Any valid value
196
- # @return [Hash] Returns the value in the form of hash
197
- def _to_hash(value)
198
- if value.is_a?(Array)
199
- value.compact.map { |v| _to_hash(v) }
200
- elsif value.is_a?(Hash)
201
- {}.tap do |hash|
202
- value.each { |k, v| hash[k] = _to_hash(v) }
203
- end
204
- elsif value.respond_to?(:to_hash)
205
- value.to_hash
206
- else
207
- value
208
- end
209
- end
210
- end
211
- end
212
- end
@@ -1,252 +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 QuerySuggestions
8
- class GetConfigStatus200Response
9
- # Name of the Query Suggestions index (case-sensitive).
10
- attr_accessor :index_name
11
-
12
- # Whether the creation or update of the Query Suggestions index is in progress.
13
- attr_accessor :is_running
14
-
15
- # Date and time when the Query Suggestions index was last built, in RFC 3339 format.
16
- attr_accessor :last_built_at
17
-
18
- # Date and time when the Query Suggestions index was last updated successfully.
19
- attr_accessor :last_successful_built_at
20
-
21
- # Duration of the last successful build in seconds.
22
- attr_accessor :last_successful_build_duration
23
-
24
- # Attribute mapping from ruby-style variable name to JSON key.
25
- def self.attribute_map
26
- {
27
- :index_name => :indexName,
28
- :is_running => :isRunning,
29
- :last_built_at => :lastBuiltAt,
30
- :last_successful_built_at => :lastSuccessfulBuiltAt,
31
- :last_successful_build_duration => :lastSuccessfulBuildDuration
32
- }
33
- end
34
-
35
- # Returns all the JSON keys this model knows about
36
- def self.acceptable_attributes
37
- attribute_map.values
38
- end
39
-
40
- # Attribute type mapping.
41
- def self.types_mapping
42
- {
43
- :index_name => :"String",
44
- :is_running => :"Boolean",
45
- :last_built_at => :"String",
46
- :last_successful_built_at => :"String",
47
- :last_successful_build_duration => :"String"
48
- }
49
- end
50
-
51
- # List of attributes with nullable: true
52
- def self.openapi_nullable
53
- Set.new(
54
- []
55
- )
56
- end
57
-
58
- # Initializes the object
59
- # @param [Hash] attributes Model attributes in the form of hash
60
- def initialize(attributes = {})
61
- if (!attributes.is_a?(Hash))
62
- raise(
63
- ArgumentError,
64
- "The input argument (attributes) must be a hash in `Algolia::GetConfigStatus200Response` initialize method"
65
- )
66
- end
67
-
68
- # check to see if the attribute exists and convert string to symbol for hash key
69
- attributes = attributes.each_with_object({}) { |(k, v), h|
70
- if (!self.class.attribute_map.key?(k.to_sym))
71
- raise(
72
- ArgumentError,
73
- "`#{k}` is not a valid attribute in `Algolia::GetConfigStatus200Response`. Please check the name to make sure it's valid. List of attributes: " +
74
- self.class.attribute_map.keys.inspect
75
- )
76
- end
77
-
78
- h[k.to_sym] = v
79
- }
80
-
81
- if attributes.key?(:index_name)
82
- self.index_name = attributes[:index_name]
83
- end
84
-
85
- if attributes.key?(:is_running)
86
- self.is_running = attributes[:is_running]
87
- end
88
-
89
- if attributes.key?(:last_built_at)
90
- self.last_built_at = attributes[:last_built_at]
91
- end
92
-
93
- if attributes.key?(:last_successful_built_at)
94
- self.last_successful_built_at = attributes[:last_successful_built_at]
95
- end
96
-
97
- if attributes.key?(:last_successful_build_duration)
98
- self.last_successful_build_duration = attributes[:last_successful_build_duration]
99
- end
100
- end
101
-
102
- # Checks equality by comparing each attribute.
103
- # @param [Object] Object to be compared
104
- def ==(other)
105
- return true if self.equal?(other)
106
- self.class == other.class &&
107
- index_name == other.index_name &&
108
- is_running == other.is_running &&
109
- last_built_at == other.last_built_at &&
110
- last_successful_built_at == other.last_successful_built_at &&
111
- last_successful_build_duration == other.last_successful_build_duration
112
- end
113
-
114
- # @see the `==` method
115
- # @param [Object] Object to be compared
116
- def eql?(other)
117
- self == other
118
- end
119
-
120
- # Calculates hash code according to all attributes.
121
- # @return [Integer] Hash code
122
- def hash
123
- [index_name, is_running, last_built_at, last_successful_built_at, last_successful_build_duration].hash
124
- end
125
-
126
- # Builds the object from hash
127
- # @param [Hash] attributes Model attributes in the form of hash
128
- # @return [Object] Returns the model itself
129
- def self.build_from_hash(attributes)
130
- return nil unless attributes.is_a?(Hash)
131
- attributes = attributes.transform_keys(&:to_sym)
132
- transformed_hash = {}
133
- types_mapping.each_pair do |key, type|
134
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
135
- transformed_hash[key.to_sym] = nil
136
- elsif type =~ /\AArray<(.*)>/i
137
- # check to ensure the input is an array given that the attribute
138
- # is documented as an array but the input is not
139
- if attributes[attribute_map[key]].is_a?(Array)
140
- transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
141
- _deserialize(::Regexp.last_match(1), v)
142
- }
143
- end
144
- elsif !attributes[attribute_map[key]].nil?
145
- transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
146
- end
147
- end
148
-
149
- new(transformed_hash)
150
- end
151
-
152
- # Deserializes the data based on type
153
- # @param string type Data type
154
- # @param string value Value to be deserialized
155
- # @return [Object] Deserialized data
156
- def self._deserialize(type, value)
157
- case type.to_sym
158
- when :Time
159
- Time.parse(value)
160
- when :Date
161
- Date.parse(value)
162
- when :String
163
- value.to_s
164
- when :Integer
165
- value.to_i
166
- when :Float
167
- value.to_f
168
- when :Boolean
169
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
170
- true
171
- else
172
- false
173
- end
174
-
175
- when :Object
176
- # generic object (usually a Hash), return directly
177
- value
178
- when /\AArray<(?<inner_type>.+)>\z/
179
- inner_type = Regexp.last_match[:inner_type]
180
- value.map { |v| _deserialize(inner_type, v) }
181
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
182
- k_type = Regexp.last_match[:k_type]
183
- v_type = Regexp.last_match[:v_type]
184
- {}.tap do |hash|
185
- value.each do |k, v|
186
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
187
- end
188
- end
189
- # model
190
- else
191
- # models (e.g. Pet) or oneOf
192
- klass = Algolia::QuerySuggestions.const_get(type)
193
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
194
- .build_from_hash(value)
195
- end
196
- end
197
-
198
- # Returns the string representation of the object
199
- # @return [String] String presentation of the object
200
- def to_s
201
- to_hash.to_s
202
- end
203
-
204
- # to_body is an alias to to_hash (backward compatibility)
205
- # @return [Hash] Returns the object in the form of hash
206
- def to_body
207
- to_hash
208
- end
209
-
210
- def to_json(*_args)
211
- to_hash.to_json
212
- end
213
-
214
- # Returns the object in the form of hash
215
- # @return [Hash] Returns the object in the form of hash
216
- def to_hash
217
- hash = {}
218
- self.class.attribute_map.each_pair do |attr, param|
219
- value = send(attr)
220
- if value.nil?
221
- is_nullable = self.class.openapi_nullable.include?(attr)
222
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
223
- end
224
-
225
- hash[param] = _to_hash(value)
226
- end
227
-
228
- hash
229
- end
230
-
231
- # Outputs non-array value in the form of hash
232
- # For object, use to_hash. Otherwise, just return the value
233
- # @param [Object] value Any valid value
234
- # @return [Hash] Returns the value in the form of hash
235
- def _to_hash(value)
236
- if value.is_a?(Array)
237
- value.compact.map { |v| _to_hash(v) }
238
- elsif value.is_a?(Hash)
239
- {}.tap do |hash|
240
- value.each { |k, v| hash[k] = _to_hash(v) }
241
- end
242
- elsif value.respond_to?(:to_hash)
243
- value.to_hash
244
- else
245
- value
246
- end
247
- end
248
-
249
- end
250
-
251
- end
252
- end