algolia 3.2.2 → 3.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (151) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/Gemfile.lock +1 -1
  4. data/lib/algolia/api/usage_client.rb +2 -9
  5. data/lib/algolia/api_client.rb +1 -1
  6. data/lib/algolia/models/abtesting/ab_test.rb +0 -22
  7. data/lib/algolia/models/abtesting/add_ab_tests_variant.rb +5 -2
  8. data/lib/algolia/models/abtesting/minimum_detectable_effect.rb +0 -22
  9. data/lib/algolia/models/analytics/get_top_filter_for_attribute.rb +0 -22
  10. data/lib/algolia/models/analytics/get_top_filters_no_results_value.rb +0 -22
  11. data/lib/algolia/models/analytics/get_top_hits_response.rb +5 -2
  12. data/lib/algolia/models/analytics/get_top_searches_response.rb +5 -2
  13. data/lib/algolia/models/ingestion/auth_input.rb +5 -2
  14. data/lib/algolia/models/ingestion/auth_input_partial.rb +5 -2
  15. data/lib/algolia/models/ingestion/authentication.rb +0 -22
  16. data/lib/algolia/models/ingestion/authentication_create.rb +0 -22
  17. data/lib/algolia/models/ingestion/authentication_update.rb +0 -22
  18. data/lib/algolia/models/ingestion/destination.rb +0 -22
  19. data/lib/algolia/models/ingestion/destination_create.rb +0 -22
  20. data/lib/algolia/models/ingestion/destination_index_name.rb +0 -22
  21. data/lib/algolia/models/ingestion/destination_input.rb +5 -2
  22. data/lib/algolia/models/ingestion/destination_update.rb +0 -22
  23. data/lib/algolia/models/ingestion/docker_streams.rb +0 -22
  24. data/lib/algolia/models/ingestion/event.rb +0 -22
  25. data/lib/algolia/models/ingestion/mapping_input.rb +0 -22
  26. data/lib/algolia/models/ingestion/on_demand_trigger.rb +0 -22
  27. data/lib/algolia/models/ingestion/on_demand_trigger_input.rb +0 -22
  28. data/lib/algolia/models/ingestion/platform_with_none.rb +5 -2
  29. data/lib/algolia/models/ingestion/push_task_payload.rb +0 -22
  30. data/lib/algolia/models/ingestion/run.rb +0 -22
  31. data/lib/algolia/models/ingestion/run_source_payload.rb +0 -22
  32. data/lib/algolia/models/ingestion/schedule_trigger.rb +0 -22
  33. data/lib/algolia/models/ingestion/schedule_trigger_input.rb +0 -22
  34. data/lib/algolia/models/ingestion/source.rb +0 -22
  35. data/lib/algolia/models/ingestion/source_big_query.rb +0 -22
  36. data/lib/algolia/models/ingestion/source_create.rb +0 -22
  37. data/lib/algolia/models/ingestion/source_csv.rb +0 -22
  38. data/lib/algolia/models/ingestion/source_docker.rb +0 -22
  39. data/lib/algolia/models/ingestion/source_input.rb +5 -2
  40. data/lib/algolia/models/ingestion/source_json.rb +0 -22
  41. data/lib/algolia/models/ingestion/source_update_docker.rb +0 -22
  42. data/lib/algolia/models/ingestion/source_update_input.rb +5 -2
  43. data/lib/algolia/models/ingestion/streaming_trigger.rb +0 -22
  44. data/lib/algolia/models/ingestion/subscription_trigger.rb +0 -22
  45. data/lib/algolia/models/ingestion/task.rb +0 -22
  46. data/lib/algolia/models/ingestion/task_create.rb +0 -22
  47. data/lib/algolia/models/ingestion/task_create_trigger.rb +5 -2
  48. data/lib/algolia/models/ingestion/task_create_v1.rb +0 -22
  49. data/lib/algolia/models/ingestion/task_input.rb +5 -2
  50. data/lib/algolia/models/ingestion/task_v1.rb +0 -22
  51. data/lib/algolia/models/ingestion/trigger.rb +5 -2
  52. data/lib/algolia/models/insights/added_to_cart_object_ids.rb +0 -22
  53. data/lib/algolia/models/insights/added_to_cart_object_ids_after_search.rb +0 -22
  54. data/lib/algolia/models/insights/clicked_filters.rb +0 -22
  55. data/lib/algolia/models/insights/clicked_object_ids.rb +0 -22
  56. data/lib/algolia/models/insights/clicked_object_ids_after_search.rb +0 -22
  57. data/lib/algolia/models/insights/converted_filters.rb +0 -22
  58. data/lib/algolia/models/insights/converted_object_ids.rb +0 -22
  59. data/lib/algolia/models/insights/converted_object_ids_after_search.rb +0 -22
  60. data/lib/algolia/models/insights/discount.rb +5 -2
  61. data/lib/algolia/models/insights/events_items.rb +5 -2
  62. data/lib/algolia/models/insights/price.rb +5 -2
  63. data/lib/algolia/models/insights/purchased_object_ids.rb +0 -22
  64. data/lib/algolia/models/insights/purchased_object_ids_after_search.rb +0 -22
  65. data/lib/algolia/models/insights/value.rb +5 -2
  66. data/lib/algolia/models/insights/viewed_filters.rb +0 -22
  67. data/lib/algolia/models/insights/viewed_object_ids.rb +0 -22
  68. data/lib/algolia/models/monitoring/incident.rb +0 -22
  69. data/lib/algolia/models/monitoring/server.rb +0 -22
  70. data/lib/algolia/models/personalization/event_scoring.rb +0 -22
  71. data/lib/algolia/models/query-suggestions/languages.rb +5 -2
  72. data/lib/algolia/models/query-suggestions/log_file.rb +0 -22
  73. data/lib/algolia/models/recommend/around_precision.rb +5 -2
  74. data/lib/algolia/models/recommend/around_radius.rb +5 -2
  75. data/lib/algolia/models/recommend/boolean_string.rb +32 -0
  76. data/lib/algolia/models/recommend/bought_together_query.rb +0 -22
  77. data/lib/algolia/models/recommend/distinct.rb +5 -2
  78. data/lib/algolia/models/recommend/facet_filters.rb +5 -2
  79. data/lib/algolia/models/recommend/fallback_params.rb +0 -22
  80. data/lib/algolia/models/recommend/get_recommend_task_response.rb +0 -22
  81. data/lib/algolia/models/recommend/highlight_result.rb +5 -2
  82. data/lib/algolia/models/recommend/highlight_result_option.rb +0 -22
  83. data/lib/algolia/models/recommend/ignore_plurals.rb +7 -3
  84. data/lib/algolia/models/recommend/looking_similar_query.rb +0 -22
  85. data/lib/algolia/models/recommend/numeric_filters.rb +5 -2
  86. data/lib/algolia/models/recommend/optional_filters.rb +5 -2
  87. data/lib/algolia/models/recommend/re_ranking_apply_filter.rb +5 -2
  88. data/lib/algolia/models/recommend/recommendations_hit.rb +5 -2
  89. data/lib/algolia/models/recommend/recommendations_request.rb +5 -2
  90. data/lib/algolia/models/recommend/recommended_for_you_query.rb +0 -22
  91. data/lib/algolia/models/recommend/related_query.rb +0 -22
  92. data/lib/algolia/models/recommend/remove_stop_words.rb +5 -2
  93. data/lib/algolia/models/recommend/search_params.rb +0 -22
  94. data/lib/algolia/models/recommend/search_params_object.rb +0 -22
  95. data/lib/algolia/models/recommend/snippet_result.rb +5 -2
  96. data/lib/algolia/models/recommend/snippet_result_option.rb +0 -22
  97. data/lib/algolia/models/recommend/tag_filters.rb +5 -2
  98. data/lib/algolia/models/recommend/trending_facets_query.rb +0 -22
  99. data/lib/algolia/models/recommend/trending_items_query.rb +0 -22
  100. data/lib/algolia/models/recommend/typo_tolerance.rb +5 -2
  101. data/lib/algolia/models/recommend/value.rb +0 -22
  102. data/lib/algolia/models/search/around_precision.rb +5 -2
  103. data/lib/algolia/models/search/around_radius.rb +5 -2
  104. data/lib/algolia/models/search/attribute_to_update.rb +5 -2
  105. data/lib/algolia/models/search/automatic_facet_filters.rb +5 -2
  106. data/lib/algolia/models/search/batch_dictionary_entries_request.rb +0 -22
  107. data/lib/algolia/models/search/batch_request.rb +0 -22
  108. data/lib/algolia/models/search/boolean_string.rb +32 -0
  109. data/lib/algolia/models/search/browse_params.rb +5 -2
  110. data/lib/algolia/models/search/browse_params_object.rb +0 -22
  111. data/lib/algolia/models/search/built_in_operation.rb +0 -22
  112. data/lib/algolia/models/search/built_in_operation_value.rb +5 -2
  113. data/lib/algolia/models/search/condition.rb +0 -22
  114. data/lib/algolia/models/search/consequence_params.rb +0 -22
  115. data/lib/algolia/models/search/consequence_query.rb +5 -2
  116. data/lib/algolia/models/search/dictionary_entry.rb +0 -22
  117. data/lib/algolia/models/search/distinct.rb +5 -2
  118. data/lib/algolia/models/search/edit.rb +0 -22
  119. data/lib/algolia/models/search/facet_filters.rb +5 -2
  120. data/lib/algolia/models/search/get_task_response.rb +0 -22
  121. data/lib/algolia/models/search/highlight_result.rb +5 -2
  122. data/lib/algolia/models/search/highlight_result_option.rb +0 -22
  123. data/lib/algolia/models/search/ignore_plurals.rb +7 -3
  124. data/lib/algolia/models/search/index_settings.rb +0 -22
  125. data/lib/algolia/models/search/multiple_batch_request.rb +0 -22
  126. data/lib/algolia/models/search/numeric_filters.rb +5 -2
  127. data/lib/algolia/models/search/operation_index_params.rb +0 -22
  128. data/lib/algolia/models/search/optional_filters.rb +5 -2
  129. data/lib/algolia/models/search/promote.rb +5 -2
  130. data/lib/algolia/models/search/re_ranking_apply_filter.rb +5 -2
  131. data/lib/algolia/models/search/remove_stop_words.rb +5 -2
  132. data/lib/algolia/models/search/search_dictionary_entries_params.rb +0 -22
  133. data/lib/algolia/models/search/search_for_facets.rb +0 -22
  134. data/lib/algolia/models/search/search_for_hits.rb +0 -22
  135. data/lib/algolia/models/search/search_method_params.rb +0 -22
  136. data/lib/algolia/models/search/search_params.rb +5 -2
  137. data/lib/algolia/models/search/search_params_object.rb +0 -22
  138. data/lib/algolia/models/search/search_query.rb +5 -2
  139. data/lib/algolia/models/search/search_result.rb +5 -2
  140. data/lib/algolia/models/search/search_rules_params.rb +0 -22
  141. data/lib/algolia/models/search/search_synonyms_params.rb +0 -22
  142. data/lib/algolia/models/search/settings_response.rb +0 -22
  143. data/lib/algolia/models/search/snippet_result.rb +5 -2
  144. data/lib/algolia/models/search/snippet_result_option.rb +0 -22
  145. data/lib/algolia/models/search/synonym_hit.rb +0 -22
  146. data/lib/algolia/models/search/tag_filters.rb +5 -2
  147. data/lib/algolia/models/search/typo_tolerance.rb +5 -2
  148. data/lib/algolia/models/search/value.rb +0 -22
  149. data/lib/algolia/models/usage/statistic_value.rb +5 -2
  150. data/lib/algolia/version.rb +1 -1
  151. metadata +4 -2
@@ -81,13 +81,16 @@ module Algolia
81
81
  else
82
82
  const = Algolia::Recommend.const_get(klass)
83
83
  if const
84
- # nested oneOf model
85
84
  if const.respond_to?(:openapi_one_of)
85
+ # nested oneOf model
86
86
  model = const.build(data)
87
- else
87
+ elsif const.respond_to?(:acceptable_attributes)
88
88
  # raise if data contains keys that are not known to the model
89
89
  raise unless (data.keys - const.acceptable_attributes).empty?
90
90
  model = const.build_from_hash(data)
91
+ else
92
+ # maybe it's an enum
93
+ model = const.build_from_hash(data)
91
94
  end
92
95
 
93
96
  return model if model
@@ -217,28 +217,6 @@ module Algolia
217
217
 
218
218
  attr_accessor :re_ranking_apply_filter
219
219
 
220
- class EnumAttributeValidator
221
- attr_reader :datatype
222
- attr_reader :allowable_values
223
-
224
- def initialize(datatype, allowable_values)
225
- @allowable_values = allowable_values.map do |value|
226
- case datatype.to_s
227
- when /Integer/i
228
- value.to_i
229
- when /Float/i
230
- value.to_f
231
- else
232
- value
233
- end
234
- end
235
- end
236
-
237
- def valid?(value)
238
- !value || allowable_values.include?(value)
239
- end
240
- end
241
-
242
220
  # Attribute mapping from ruby-style variable name to JSON key.
243
221
  def self.attribute_map
244
222
  {
@@ -8,28 +8,6 @@ module Algolia
8
8
  class GetRecommendTaskResponse
9
9
  attr_accessor :status
10
10
 
11
- class EnumAttributeValidator
12
- attr_reader :datatype
13
- attr_reader :allowable_values
14
-
15
- def initialize(datatype, allowable_values)
16
- @allowable_values = allowable_values.map do |value|
17
- case datatype.to_s
18
- when /Integer/i
19
- value.to_i
20
- when /Float/i
21
- value.to_f
22
- else
23
- value
24
- end
25
- end
26
- end
27
-
28
- def valid?(value)
29
- !value || allowable_values.include?(value)
30
- end
31
- end
32
-
33
11
  # Attribute mapping from ruby-style variable name to JSON key.
34
12
  def self.attribute_map
35
13
  {
@@ -82,13 +82,16 @@ module Algolia
82
82
  else
83
83
  const = Algolia::Recommend.const_get(klass)
84
84
  if const
85
- # nested oneOf model
86
85
  if const.respond_to?(:openapi_one_of)
86
+ # nested oneOf model
87
87
  model = const.build(data)
88
- else
88
+ elsif const.respond_to?(:acceptable_attributes)
89
89
  # raise if data contains keys that are not known to the model
90
90
  raise unless (data.keys - const.acceptable_attributes).empty?
91
91
  model = const.build_from_hash(data)
92
+ else
93
+ # maybe it's an enum
94
+ model = const.build_from_hash(data)
92
95
  end
93
96
 
94
97
  return model if model
@@ -18,28 +18,6 @@ module Algolia
18
18
  # Whether the entire attribute value is highlighted.
19
19
  attr_accessor :fully_highlighted
20
20
 
21
- class EnumAttributeValidator
22
- attr_reader :datatype
23
- attr_reader :allowable_values
24
-
25
- def initialize(datatype, allowable_values)
26
- @allowable_values = allowable_values.map do |value|
27
- case datatype.to_s
28
- when /Integer/i
29
- value.to_i
30
- when /Float/i
31
- value.to_f
32
- else
33
- value
34
- end
35
- end
36
- end
37
-
38
- def valid?(value)
39
- !value || allowable_values.include?(value)
40
- end
41
- end
42
-
43
21
  # Attribute mapping from ruby-style variable name to JSON key.
44
22
  def self.attribute_map
45
23
  {
@@ -12,7 +12,8 @@ module Algolia
12
12
  def openapi_one_of
13
13
  [
14
14
  :"Array<SupportedLanguage>",
15
- :"Boolean"
15
+ :"Boolean",
16
+ :"BooleanString"
16
17
  ]
17
18
  end
18
19
 
@@ -81,13 +82,16 @@ module Algolia
81
82
  else
82
83
  const = Algolia::Recommend.const_get(klass)
83
84
  if const
84
- # nested oneOf model
85
85
  if const.respond_to?(:openapi_one_of)
86
+ # nested oneOf model
86
87
  model = const.build(data)
87
- else
88
+ elsif const.respond_to?(:acceptable_attributes)
88
89
  # raise if data contains keys that are not known to the model
89
90
  raise unless (data.keys - const.acceptable_attributes).empty?
90
91
  model = const.build_from_hash(data)
92
+ else
93
+ # maybe it's an enum
94
+ model = const.build_from_hash(data)
91
95
  end
92
96
 
93
97
  return model if model
@@ -24,28 +24,6 @@ module Algolia
24
24
 
25
25
  attr_accessor :fallback_parameters
26
26
 
27
- class EnumAttributeValidator
28
- attr_reader :datatype
29
- attr_reader :allowable_values
30
-
31
- def initialize(datatype, allowable_values)
32
- @allowable_values = allowable_values.map do |value|
33
- case datatype.to_s
34
- when /Integer/i
35
- value.to_i
36
- when /Float/i
37
- value.to_f
38
- else
39
- value
40
- end
41
- end
42
- end
43
-
44
- def valid?(value)
45
- !value || allowable_values.include?(value)
46
- end
47
- end
48
-
49
27
  # Attribute mapping from ruby-style variable name to JSON key.
50
28
  def self.attribute_map
51
29
  {
@@ -81,13 +81,16 @@ module Algolia
81
81
  else
82
82
  const = Algolia::Recommend.const_get(klass)
83
83
  if const
84
- # nested oneOf model
85
84
  if const.respond_to?(:openapi_one_of)
85
+ # nested oneOf model
86
86
  model = const.build(data)
87
- else
87
+ elsif const.respond_to?(:acceptable_attributes)
88
88
  # raise if data contains keys that are not known to the model
89
89
  raise unless (data.keys - const.acceptable_attributes).empty?
90
90
  model = const.build_from_hash(data)
91
+ else
92
+ # maybe it's an enum
93
+ model = const.build_from_hash(data)
91
94
  end
92
95
 
93
96
  return model if model
@@ -81,13 +81,16 @@ module Algolia
81
81
  else
82
82
  const = Algolia::Recommend.const_get(klass)
83
83
  if const
84
- # nested oneOf model
85
84
  if const.respond_to?(:openapi_one_of)
85
+ # nested oneOf model
86
86
  model = const.build(data)
87
- else
87
+ elsif const.respond_to?(:acceptable_attributes)
88
88
  # raise if data contains keys that are not known to the model
89
89
  raise unless (data.keys - const.acceptable_attributes).empty?
90
90
  model = const.build_from_hash(data)
91
+ else
92
+ # maybe it's an enum
93
+ model = const.build_from_hash(data)
91
94
  end
92
95
 
93
96
  return model if model
@@ -81,13 +81,16 @@ module Algolia
81
81
  else
82
82
  const = Algolia::Recommend.const_get(klass)
83
83
  if const
84
- # nested oneOf model
85
84
  if const.respond_to?(:openapi_one_of)
85
+ # nested oneOf model
86
86
  model = const.build(data)
87
- else
87
+ elsif const.respond_to?(:acceptable_attributes)
88
88
  # raise if data contains keys that are not known to the model
89
89
  raise unless (data.keys - const.acceptable_attributes).empty?
90
90
  model = const.build_from_hash(data)
91
+ else
92
+ # maybe it's an enum
93
+ model = const.build_from_hash(data)
91
94
  end
92
95
 
93
96
  return model if model
@@ -80,13 +80,16 @@ module Algolia
80
80
  else
81
81
  const = Algolia::Recommend.const_get(klass)
82
82
  if const
83
- # nested oneOf model
84
83
  if const.respond_to?(:openapi_one_of)
84
+ # nested oneOf model
85
85
  model = const.build(data)
86
- else
86
+ elsif const.respond_to?(:acceptable_attributes)
87
87
  # raise if data contains keys that are not known to the model
88
88
  raise unless (data.keys - const.acceptable_attributes).empty?
89
89
  model = const.build_from_hash(data)
90
+ else
91
+ # maybe it's an enum
92
+ model = const.build_from_hash(data)
90
93
  end
91
94
 
92
95
  return model if model
@@ -84,13 +84,16 @@ module Algolia
84
84
  else
85
85
  const = Algolia::Recommend.const_get(klass)
86
86
  if const
87
- # nested oneOf model
88
87
  if const.respond_to?(:openapi_one_of)
88
+ # nested oneOf model
89
89
  model = const.build(data)
90
- else
90
+ elsif const.respond_to?(:acceptable_attributes)
91
91
  # raise if data contains keys that are not known to the model
92
92
  raise unless (data.keys - const.acceptable_attributes).empty?
93
93
  model = const.build_from_hash(data)
94
+ else
95
+ # maybe it's an enum
96
+ model = const.build_from_hash(data)
94
97
  end
95
98
 
96
99
  return model if model
@@ -21,28 +21,6 @@ module Algolia
21
21
 
22
22
  attr_accessor :fallback_parameters
23
23
 
24
- class EnumAttributeValidator
25
- attr_reader :datatype
26
- attr_reader :allowable_values
27
-
28
- def initialize(datatype, allowable_values)
29
- @allowable_values = allowable_values.map do |value|
30
- case datatype.to_s
31
- when /Integer/i
32
- value.to_i
33
- when /Float/i
34
- value.to_f
35
- else
36
- value
37
- end
38
- end
39
- end
40
-
41
- def valid?(value)
42
- !value || allowable_values.include?(value)
43
- end
44
- end
45
-
46
24
  # Attribute mapping from ruby-style variable name to JSON key.
47
25
  def self.attribute_map
48
26
  {
@@ -24,28 +24,6 @@ module Algolia
24
24
 
25
25
  attr_accessor :fallback_parameters
26
26
 
27
- class EnumAttributeValidator
28
- attr_reader :datatype
29
- attr_reader :allowable_values
30
-
31
- def initialize(datatype, allowable_values)
32
- @allowable_values = allowable_values.map do |value|
33
- case datatype.to_s
34
- when /Integer/i
35
- value.to_i
36
- when /Float/i
37
- value.to_f
38
- else
39
- value
40
- end
41
- end
42
- end
43
-
44
- def valid?(value)
45
- !value || allowable_values.include?(value)
46
- end
47
- end
48
-
49
27
  # Attribute mapping from ruby-style variable name to JSON key.
50
28
  def self.attribute_map
51
29
  {
@@ -81,13 +81,16 @@ module Algolia
81
81
  else
82
82
  const = Algolia::Recommend.const_get(klass)
83
83
  if const
84
- # nested oneOf model
85
84
  if const.respond_to?(:openapi_one_of)
85
+ # nested oneOf model
86
86
  model = const.build(data)
87
- else
87
+ elsif const.respond_to?(:acceptable_attributes)
88
88
  # raise if data contains keys that are not known to the model
89
89
  raise unless (data.keys - const.acceptable_attributes).empty?
90
90
  model = const.build_from_hash(data)
91
+ else
92
+ # maybe it's an enum
93
+ model = const.build_from_hash(data)
91
94
  end
92
95
 
93
96
  return model if model
@@ -217,28 +217,6 @@ module Algolia
217
217
 
218
218
  attr_accessor :re_ranking_apply_filter
219
219
 
220
- class EnumAttributeValidator
221
- attr_reader :datatype
222
- attr_reader :allowable_values
223
-
224
- def initialize(datatype, allowable_values)
225
- @allowable_values = allowable_values.map do |value|
226
- case datatype.to_s
227
- when /Integer/i
228
- value.to_i
229
- when /Float/i
230
- value.to_f
231
- else
232
- value
233
- end
234
- end
235
- end
236
-
237
- def valid?(value)
238
- !value || allowable_values.include?(value)
239
- end
240
- end
241
-
242
220
  # Attribute mapping from ruby-style variable name to JSON key.
243
221
  def self.attribute_map
244
222
  {
@@ -218,28 +218,6 @@ module Algolia
218
218
 
219
219
  attr_accessor :re_ranking_apply_filter
220
220
 
221
- class EnumAttributeValidator
222
- attr_reader :datatype
223
- attr_reader :allowable_values
224
-
225
- def initialize(datatype, allowable_values)
226
- @allowable_values = allowable_values.map do |value|
227
- case datatype.to_s
228
- when /Integer/i
229
- value.to_i
230
- when /Float/i
231
- value.to_f
232
- else
233
- value
234
- end
235
- end
236
- end
237
-
238
- def valid?(value)
239
- !value || allowable_values.include?(value)
240
- end
241
- end
242
-
243
221
  # Attribute mapping from ruby-style variable name to JSON key.
244
222
  def self.attribute_map
245
223
  {
@@ -82,13 +82,16 @@ module Algolia
82
82
  else
83
83
  const = Algolia::Recommend.const_get(klass)
84
84
  if const
85
- # nested oneOf model
86
85
  if const.respond_to?(:openapi_one_of)
86
+ # nested oneOf model
87
87
  model = const.build(data)
88
- else
88
+ elsif const.respond_to?(:acceptable_attributes)
89
89
  # raise if data contains keys that are not known to the model
90
90
  raise unless (data.keys - const.acceptable_attributes).empty?
91
91
  model = const.build_from_hash(data)
92
+ else
93
+ # maybe it's an enum
94
+ model = const.build_from_hash(data)
92
95
  end
93
96
 
94
97
  return model if model
@@ -12,28 +12,6 @@ module Algolia
12
12
 
13
13
  attr_accessor :match_level
14
14
 
15
- class EnumAttributeValidator
16
- attr_reader :datatype
17
- attr_reader :allowable_values
18
-
19
- def initialize(datatype, allowable_values)
20
- @allowable_values = allowable_values.map do |value|
21
- case datatype.to_s
22
- when /Integer/i
23
- value.to_i
24
- when /Float/i
25
- value.to_f
26
- else
27
- value
28
- end
29
- end
30
- end
31
-
32
- def valid?(value)
33
- !value || allowable_values.include?(value)
34
- end
35
- end
36
-
37
15
  # Attribute mapping from ruby-style variable name to JSON key.
38
16
  def self.attribute_map
39
17
  {
@@ -81,13 +81,16 @@ module Algolia
81
81
  else
82
82
  const = Algolia::Recommend.const_get(klass)
83
83
  if const
84
- # nested oneOf model
85
84
  if const.respond_to?(:openapi_one_of)
85
+ # nested oneOf model
86
86
  model = const.build(data)
87
- else
87
+ elsif const.respond_to?(:acceptable_attributes)
88
88
  # raise if data contains keys that are not known to the model
89
89
  raise unless (data.keys - const.acceptable_attributes).empty?
90
90
  model = const.build_from_hash(data)
91
+ else
92
+ # maybe it's an enum
93
+ model = const.build_from_hash(data)
91
94
  end
92
95
 
93
96
  return model if model
@@ -24,28 +24,6 @@ module Algolia
24
24
 
25
25
  attr_accessor :fallback_parameters
26
26
 
27
- class EnumAttributeValidator
28
- attr_reader :datatype
29
- attr_reader :allowable_values
30
-
31
- def initialize(datatype, allowable_values)
32
- @allowable_values = allowable_values.map do |value|
33
- case datatype.to_s
34
- when /Integer/i
35
- value.to_i
36
- when /Float/i
37
- value.to_f
38
- else
39
- value
40
- end
41
- end
42
- end
43
-
44
- def valid?(value)
45
- !value || allowable_values.include?(value)
46
- end
47
- end
48
-
49
27
  # Attribute mapping from ruby-style variable name to JSON key.
50
28
  def self.attribute_map
51
29
  {
@@ -27,28 +27,6 @@ module Algolia
27
27
 
28
28
  attr_accessor :fallback_parameters
29
29
 
30
- class EnumAttributeValidator
31
- attr_reader :datatype
32
- attr_reader :allowable_values
33
-
34
- def initialize(datatype, allowable_values)
35
- @allowable_values = allowable_values.map do |value|
36
- case datatype.to_s
37
- when /Integer/i
38
- value.to_i
39
- when /Float/i
40
- value.to_f
41
- else
42
- value
43
- end
44
- end
45
- end
46
-
47
- def valid?(value)
48
- !value || allowable_values.include?(value)
49
- end
50
- end
51
-
52
30
  # Attribute mapping from ruby-style variable name to JSON key.
53
31
  def self.attribute_map
54
32
  {
@@ -81,13 +81,16 @@ module Algolia
81
81
  else
82
82
  const = Algolia::Recommend.const_get(klass)
83
83
  if const
84
- # nested oneOf model
85
84
  if const.respond_to?(:openapi_one_of)
85
+ # nested oneOf model
86
86
  model = const.build(data)
87
- else
87
+ elsif const.respond_to?(:acceptable_attributes)
88
88
  # raise if data contains keys that are not known to the model
89
89
  raise unless (data.keys - const.acceptable_attributes).empty?
90
90
  model = const.build_from_hash(data)
91
+ else
92
+ # maybe it's an enum
93
+ model = const.build_from_hash(data)
91
94
  end
92
95
 
93
96
  return model if model
@@ -14,28 +14,6 @@ module Algolia
14
14
  # Hide facet values.
15
15
  attr_accessor :hide
16
16
 
17
- class EnumAttributeValidator
18
- attr_reader :datatype
19
- attr_reader :allowable_values
20
-
21
- def initialize(datatype, allowable_values)
22
- @allowable_values = allowable_values.map do |value|
23
- case datatype.to_s
24
- when /Integer/i
25
- value.to_i
26
- when /Float/i
27
- value.to_f
28
- else
29
- value
30
- end
31
- end
32
- end
33
-
34
- def valid?(value)
35
- !value || allowable_values.include?(value)
36
- end
37
- end
38
-
39
17
  # Attribute mapping from ruby-style variable name to JSON key.
40
18
  def self.attribute_map
41
19
  {
@@ -81,13 +81,16 @@ module Algolia
81
81
  else
82
82
  const = Algolia::Search.const_get(klass)
83
83
  if const
84
- # nested oneOf model
85
84
  if const.respond_to?(:openapi_one_of)
85
+ # nested oneOf model
86
86
  model = const.build(data)
87
- else
87
+ elsif const.respond_to?(:acceptable_attributes)
88
88
  # raise if data contains keys that are not known to the model
89
89
  raise unless (data.keys - const.acceptable_attributes).empty?
90
90
  model = const.build_from_hash(data)
91
+ else
92
+ # maybe it's an enum
93
+ model = const.build_from_hash(data)
91
94
  end
92
95
 
93
96
  return model if model
@@ -81,13 +81,16 @@ module Algolia
81
81
  else
82
82
  const = Algolia::Search.const_get(klass)
83
83
  if const
84
- # nested oneOf model
85
84
  if const.respond_to?(:openapi_one_of)
85
+ # nested oneOf model
86
86
  model = const.build(data)
87
- else
87
+ elsif const.respond_to?(:acceptable_attributes)
88
88
  # raise if data contains keys that are not known to the model
89
89
  raise unless (data.keys - const.acceptable_attributes).empty?
90
90
  model = const.build_from_hash(data)
91
+ else
92
+ # maybe it's an enum
93
+ model = const.build_from_hash(data)
91
94
  end
92
95
 
93
96
  return model if model
@@ -80,13 +80,16 @@ module Algolia
80
80
  else
81
81
  const = Algolia::Search.const_get(klass)
82
82
  if const
83
- # nested oneOf model
84
83
  if const.respond_to?(:openapi_one_of)
84
+ # nested oneOf model
85
85
  model = const.build(data)
86
- else
86
+ elsif const.respond_to?(:acceptable_attributes)
87
87
  # raise if data contains keys that are not known to the model
88
88
  raise unless (data.keys - const.acceptable_attributes).empty?
89
89
  model = const.build_from_hash(data)
90
+ else
91
+ # maybe it's an enum
92
+ model = const.build_from_hash(data)
90
93
  end
91
94
 
92
95
  return model if model