algolia 3.0.0.alpha.16 → 3.0.0.alpha.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (157) hide show
  1. checksums.yaml +4 -4
  2. data/.openapi-generator/FILES +10 -167
  3. data/CHANGELOG.md +16 -0
  4. data/Gemfile.lock +4 -4
  5. data/lib/algolia/api/abtesting_client.rb +20 -20
  6. data/lib/algolia/api/analytics_client.rb +76 -76
  7. data/lib/algolia/api/personalization_client.rb +12 -12
  8. data/lib/algolia/api/recommend_client.rb +22 -22
  9. data/lib/algolia/api/search_client.rb +8 -8
  10. data/lib/algolia/api/usage_client.rb +329 -0
  11. data/lib/algolia/models/abtesting/ab_test.rb +41 -16
  12. data/lib/algolia/models/abtesting/ab_test_configuration.rb +217 -0
  13. data/lib/algolia/models/abtesting/ab_test_response.rb +2 -2
  14. data/lib/algolia/models/abtesting/ab_tests_variant.rb +21 -3
  15. data/lib/algolia/models/abtesting/ab_tests_variant_search_params.rb +21 -3
  16. data/lib/algolia/models/abtesting/add_ab_tests_request.rb +1 -1
  17. data/lib/algolia/models/abtesting/custom_search_params.rb +1 -1
  18. data/lib/algolia/models/abtesting/effect.rb +35 -0
  19. data/lib/algolia/models/abtesting/empty_search.rb +198 -0
  20. data/lib/algolia/models/abtesting/list_ab_tests_response.rb +1 -1
  21. data/lib/algolia/models/abtesting/minimum_detectable_effect.rb +247 -0
  22. data/lib/algolia/models/abtesting/outliers.rb +198 -0
  23. data/lib/algolia/models/abtesting/status.rb +35 -0
  24. data/lib/algolia/models/abtesting/variant.rb +31 -13
  25. data/lib/algolia/models/analytics/get_status_response.rb +1 -1
  26. data/lib/algolia/models/ingestion/auth_algolia_insights.rb +212 -0
  27. data/lib/algolia/models/{recommend/consequence_query_object.rb → ingestion/auth_algolia_insights_partial.rb} +21 -24
  28. data/lib/algolia/models/ingestion/auth_input.rb +1 -0
  29. data/lib/algolia/models/ingestion/auth_input_partial.rb +1 -0
  30. data/lib/algolia/models/ingestion/authentication_type.rb +2 -1
  31. data/lib/algolia/models/ingestion/destination_index_name.rb +1 -1
  32. data/lib/algolia/models/ingestion/shopify_input.rb +212 -0
  33. data/lib/algolia/models/ingestion/shopify_market.rb +227 -0
  34. data/lib/algolia/models/ingestion/shopify_metafield.rb +221 -0
  35. data/lib/algolia/models/ingestion/source_input.rb +2 -1
  36. data/lib/algolia/models/ingestion/source_shopify.rb +278 -0
  37. data/lib/algolia/models/{recommend/base_recommended_for_you_query_parameters.rb → ingestion/source_shopify_base.rb} +14 -14
  38. data/lib/algolia/models/ingestion/source_update_input.rb +2 -1
  39. data/lib/algolia/models/ingestion/source_update_shopify.rb +258 -0
  40. data/lib/algolia/models/ingestion/task_input.rb +1 -0
  41. data/lib/algolia/models/insights/added_to_cart_object_ids.rb +2 -2
  42. data/lib/algolia/models/insights/added_to_cart_object_ids_after_search.rb +2 -2
  43. data/lib/algolia/models/insights/clicked_filters.rb +2 -2
  44. data/lib/algolia/models/insights/clicked_object_ids.rb +2 -2
  45. data/lib/algolia/models/insights/clicked_object_ids_after_search.rb +2 -2
  46. data/lib/algolia/models/insights/converted_filters.rb +2 -2
  47. data/lib/algolia/models/insights/converted_object_ids.rb +2 -2
  48. data/lib/algolia/models/insights/converted_object_ids_after_search.rb +2 -2
  49. data/lib/algolia/models/insights/purchased_object_ids.rb +2 -2
  50. data/lib/algolia/models/insights/purchased_object_ids_after_search.rb +2 -2
  51. data/lib/algolia/models/insights/viewed_filters.rb +2 -2
  52. data/lib/algolia/models/insights/viewed_object_ids.rb +2 -2
  53. data/lib/algolia/models/monitoring/incidents_inner.rb +1 -1
  54. data/lib/algolia/models/monitoring/probes_metric.rb +1 -1
  55. data/lib/algolia/models/monitoring/time_inner.rb +1 -1
  56. data/lib/algolia/models/personalization/delete_user_profile_response.rb +2 -2
  57. data/lib/algolia/models/personalization/event_scoring.rb +25 -4
  58. data/lib/algolia/models/personalization/event_type.rb +34 -0
  59. data/lib/algolia/models/personalization/facet_scoring.rb +2 -2
  60. data/lib/algolia/models/personalization/get_user_token_response.rb +3 -3
  61. data/lib/algolia/models/personalization/personalization_strategy_params.rb +21 -3
  62. data/lib/algolia/models/query-suggestions/get_config_status200_response.rb +3 -3
  63. data/lib/algolia/models/query-suggestions/get_log_file200_response.rb +1 -1
  64. data/lib/algolia/models/query-suggestions/query_suggestions_configuration_response.rb +1 -1
  65. data/lib/algolia/models/query-suggestions/query_suggestions_configuration_with_index.rb +1 -1
  66. data/lib/algolia/models/query-suggestions/source_index.rb +1 -1
  67. data/lib/algolia/models/recommend/auto_facet_filter.rb +208 -0
  68. data/lib/algolia/models/recommend/base_recommend_request.rb +37 -8
  69. data/lib/algolia/models/recommend/base_search_params.rb +4 -4
  70. data/lib/algolia/models/recommend/base_search_params_without_query.rb +4 -4
  71. data/lib/algolia/models/recommend/bought_together_query.rb +319 -0
  72. data/lib/algolia/models/recommend/condition.rb +12 -62
  73. data/lib/algolia/models/recommend/consequence.rb +32 -54
  74. data/lib/algolia/models/recommend/deleted_at_response.rb +1 -1
  75. data/lib/algolia/models/recommend/{recommended_for_you_query_parameters.rb → fallback_params.rb} +17 -20
  76. data/lib/algolia/models/recommend/{edit_type.rb → fbt_model.rb} +5 -6
  77. data/lib/algolia/models/recommend/{base_trending_facets_query.rb → frequently_bought_together.rb} +20 -18
  78. data/lib/algolia/models/recommend/get_recommendations_params.rb +2 -2
  79. data/lib/algolia/models/recommend/{consequence_hide.rb → hide_consequence_object.rb} +4 -6
  80. data/lib/algolia/models/recommend/index_settings_as_search_params.rb +10 -10
  81. data/lib/algolia/models/recommend/{base_recommendations_query.rb → looking_similar.rb} +6 -15
  82. data/lib/algolia/models/recommend/{anchoring.rb → looking_similar_model.rb} +5 -8
  83. data/lib/algolia/models/recommend/looking_similar_query.rb +328 -0
  84. data/lib/algolia/models/recommend/{params.rb → params_consequence.rb} +26 -28
  85. data/lib/algolia/models/recommend/{promote_object_id.rb → promote_consequence_object.rb} +19 -9
  86. data/lib/algolia/models/recommend/re_ranking_apply_filter.rb +1 -1
  87. data/lib/algolia/models/recommend/{rule_response.rb → recommend_rule.rb} +13 -18
  88. data/lib/algolia/models/recommend/{rule_response_metadata.rb → recommend_rule_metadata.rb} +5 -4
  89. data/lib/algolia/models/recommend/recommendations_hits.rb +4 -24
  90. data/lib/algolia/models/recommend/recommendations_request.rb +3 -1
  91. data/lib/algolia/models/recommend/recommendations_results.rb +4 -24
  92. data/lib/algolia/models/recommend/{base_recommended_for_you_query.rb → recommended_for_you.rb} +5 -14
  93. data/lib/algolia/models/recommend/recommended_for_you_query.rb +36 -16
  94. data/lib/algolia/models/recommend/{recommendation_models.rb → related_model.rb} +4 -5
  95. data/lib/algolia/models/recommend/{edit.rb → related_products.rb} +27 -24
  96. data/lib/algolia/models/recommend/{recommendations_query.rb → related_query.rb} +40 -20
  97. data/lib/algolia/models/recommend/{consequence_params.rb → search_params.rb} +33 -52
  98. data/lib/algolia/models/recommend/search_params_object.rb +15 -14
  99. data/lib/algolia/models/recommend/search_recommend_rules_params.rb +58 -10
  100. data/lib/algolia/models/recommend/search_recommend_rules_response.rb +2 -2
  101. data/lib/algolia/models/recommend/trending_facet_hit.rb +2 -2
  102. data/lib/algolia/models/recommend/trending_facets.rb +243 -0
  103. data/lib/algolia/models/recommend/trending_facets_query.rb +51 -11
  104. data/lib/algolia/models/recommend/{base_trending_items_query.rb → trending_items.rb} +12 -15
  105. data/lib/algolia/models/recommend/trending_items_query.rb +43 -17
  106. data/lib/algolia/models/search/add_api_key_response.rb +1 -1
  107. data/lib/algolia/models/search/base_get_api_key_response.rb +1 -1
  108. data/lib/algolia/models/search/base_index_settings.rb +10 -10
  109. data/lib/algolia/models/search/base_search_params.rb +4 -4
  110. data/lib/algolia/models/search/base_search_params_without_query.rb +4 -4
  111. data/lib/algolia/models/search/browse_params_object.rb +14 -14
  112. data/lib/algolia/models/search/consequence_params.rb +14 -14
  113. data/lib/algolia/models/search/created_at_response.rb +1 -1
  114. data/lib/algolia/models/search/delete_api_key_response.rb +1 -1
  115. data/lib/algolia/models/search/delete_by_params.rb +2 -2
  116. data/lib/algolia/models/search/delete_source_response.rb +1 -1
  117. data/lib/algolia/models/search/deleted_at_response.rb +1 -1
  118. data/lib/algolia/models/search/fetched_index.rb +1 -1
  119. data/lib/algolia/models/search/get_api_key_response.rb +1 -1
  120. data/lib/algolia/models/search/index_settings.rb +20 -20
  121. data/lib/algolia/models/search/index_settings_as_search_params.rb +10 -10
  122. data/lib/algolia/models/search/log.rb +1 -1
  123. data/lib/algolia/models/search/multiple_batch_request.rb +1 -1
  124. data/lib/algolia/models/search/operation_index_params.rb +1 -1
  125. data/lib/algolia/models/search/re_ranking_apply_filter.rb +1 -1
  126. data/lib/algolia/models/search/remove_user_id_response.rb +1 -1
  127. data/lib/algolia/models/search/replace_source_response.rb +1 -1
  128. data/lib/algolia/models/search/save_object_response.rb +1 -1
  129. data/lib/algolia/models/search/save_synonym_response.rb +1 -1
  130. data/lib/algolia/models/search/search_for_facets.rb +15 -15
  131. data/lib/algolia/models/search/search_for_facets_options.rb +1 -1
  132. data/lib/algolia/models/search/search_for_hits.rb +15 -15
  133. data/lib/algolia/models/search/search_for_hits_options.rb +1 -1
  134. data/lib/algolia/models/search/search_params_object.rb +15 -14
  135. data/lib/algolia/models/search/search_user_ids_response.rb +1 -1
  136. data/lib/algolia/models/search/secured_api_key_restrictions.rb +1 -1
  137. data/lib/algolia/models/search/update_api_key_response.rb +1 -1
  138. data/lib/algolia/models/search/updated_at_response.rb +1 -1
  139. data/lib/algolia/models/search/updated_at_with_object_id_response.rb +1 -1
  140. data/lib/algolia/models/search/updated_rule_response.rb +1 -1
  141. data/lib/algolia/models/search/user_hit.rb +1 -1
  142. data/lib/algolia/models/search/user_id.rb +1 -1
  143. data/lib/algolia/models/usage/error_base.rb +205 -0
  144. data/lib/algolia/models/usage/get_usage200_response.rb +198 -0
  145. data/lib/algolia/models/usage/get_usage200_response_statistics_inner.rb +206 -0
  146. data/lib/algolia/models/usage/get_usage400_response.rb +198 -0
  147. data/lib/algolia/models/usage/get_usage400_response_error.rb +216 -0
  148. data/lib/algolia/models/usage/get_usage400_response_error_errors_inner.rb +225 -0
  149. data/lib/algolia/models/usage/granularity.rb +33 -0
  150. data/lib/algolia/models/usage/statistic.rb +116 -0
  151. data/lib/algolia/models/{recommend/promote.rb → usage/statistic_value.rb} +5 -5
  152. data/lib/algolia/version.rb +1 -1
  153. metadata +47 -25
  154. data/lib/algolia/models/recommend/automatic_facet_filter.rb +0 -220
  155. data/lib/algolia/models/recommend/automatic_facet_filters.rb +0 -97
  156. data/lib/algolia/models/recommend/consequence_query.rb +0 -97
  157. data/lib/algolia/models/recommend/promote_object_ids.rb +0 -228
@@ -0,0 +1,319 @@
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 BoughtTogetherQuery
9
+ # Index name (case-sensitive).
10
+ attr_accessor :index_name
11
+
12
+ # Minimum score a recommendation must have to be included in the response.
13
+ attr_accessor :threshold
14
+
15
+ # Maximum number of recommendations to retrieve. By default, all recommendations are returned and no fallback request is made. Depending on the available recommendations and the other request parameters, the actual number of recommendations may be lower than this value.
16
+ attr_accessor :max_recommendations
17
+
18
+ attr_accessor :query_parameters
19
+
20
+ attr_accessor :model
21
+
22
+ # Unique record identifier.
23
+ attr_accessor :object_id
24
+
25
+ class EnumAttributeValidator
26
+ attr_reader :datatype
27
+ attr_reader :allowable_values
28
+
29
+ def initialize(datatype, allowable_values)
30
+ @allowable_values = allowable_values.map do |value|
31
+ case datatype.to_s
32
+ when /Integer/i
33
+ value.to_i
34
+ when /Float/i
35
+ value.to_f
36
+ else
37
+ value
38
+ end
39
+ end
40
+ end
41
+
42
+ def valid?(value)
43
+ !value || allowable_values.include?(value)
44
+ end
45
+ end
46
+
47
+ # Attribute mapping from ruby-style variable name to JSON key.
48
+ def self.attribute_map
49
+ {
50
+ :index_name => :indexName,
51
+ :threshold => :threshold,
52
+ :max_recommendations => :maxRecommendations,
53
+ :query_parameters => :queryParameters,
54
+ :model => :model,
55
+ :object_id => :objectID
56
+ }
57
+ end
58
+
59
+ # Returns all the JSON keys this model knows about
60
+ def self.acceptable_attributes
61
+ attribute_map.values
62
+ end
63
+
64
+ # Attribute type mapping.
65
+ def self.types_mapping
66
+ {
67
+ :index_name => :String,
68
+ :threshold => :Float,
69
+ :max_recommendations => :Integer,
70
+ :query_parameters => :SearchParams,
71
+ :model => :FbtModel,
72
+ :object_id => :String
73
+ }
74
+ end
75
+
76
+ # List of attributes with nullable: true
77
+ def self.openapi_nullable
78
+ Set.new([])
79
+ end
80
+
81
+ # List of class defined in allOf (OpenAPI v3)
82
+ def self.openapi_all_of
83
+ [
84
+ :BaseRecommendRequest,
85
+ :FrequentlyBoughtTogether
86
+ ]
87
+ end
88
+
89
+ # Initializes the object
90
+ # @param [Hash] attributes Model attributes in the form of hash
91
+ def initialize(attributes = {})
92
+ unless attributes.is_a?(Hash)
93
+ raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::BoughtTogetherQuery` initialize method"
94
+ end
95
+
96
+ # check to see if the attribute exists and convert string to symbol for hash key
97
+ attributes = attributes.each_with_object({}) do |(k, v), h|
98
+ unless self.class.attribute_map.key?(k.to_sym)
99
+ raise ArgumentError,
100
+ "`#{k}` is not a valid attribute in `Algolia::BoughtTogetherQuery`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
101
+ end
102
+
103
+ h[k.to_sym] = v
104
+ end
105
+
106
+ if attributes.key?(:index_name)
107
+ self.index_name = attributes[:index_name]
108
+ else
109
+ self.index_name = nil
110
+ end
111
+
112
+ if attributes.key?(:threshold)
113
+ self.threshold = attributes[:threshold]
114
+ else
115
+ self.threshold = nil
116
+ end
117
+
118
+ if attributes.key?(:max_recommendations)
119
+ self.max_recommendations = attributes[:max_recommendations]
120
+ end
121
+
122
+ if attributes.key?(:query_parameters)
123
+ self.query_parameters = attributes[:query_parameters]
124
+ end
125
+
126
+ if attributes.key?(:model)
127
+ self.model = attributes[:model]
128
+ else
129
+ self.model = nil
130
+ end
131
+
132
+ if attributes.key?(:object_id)
133
+ self.object_id = attributes[:object_id]
134
+ else
135
+ self.object_id = nil
136
+ end
137
+ end
138
+
139
+ # Custom attribute writer method with validation
140
+ # @param [Object] threshold Value to be assigned
141
+ def threshold=(threshold)
142
+ if threshold.nil?
143
+ raise ArgumentError, 'threshold cannot be nil'
144
+ end
145
+
146
+ if threshold > 100
147
+ raise ArgumentError, 'invalid value for "threshold", must be smaller than or equal to 100.'
148
+ end
149
+
150
+ if threshold < 0
151
+ raise ArgumentError, 'invalid value for "threshold", must be greater than or equal to 0.'
152
+ end
153
+
154
+ @threshold = threshold
155
+ end
156
+
157
+ # Custom attribute writer method with validation
158
+ # @param [Object] max_recommendations Value to be assigned
159
+ def max_recommendations=(max_recommendations)
160
+ if max_recommendations.nil?
161
+ raise ArgumentError, 'max_recommendations cannot be nil'
162
+ end
163
+
164
+ if max_recommendations > 1000
165
+ raise ArgumentError, 'invalid value for "max_recommendations", must be smaller than or equal to 1000.'
166
+ end
167
+
168
+ if max_recommendations < 1
169
+ raise ArgumentError, 'invalid value for "max_recommendations", must be greater than or equal to 1.'
170
+ end
171
+
172
+ @max_recommendations = max_recommendations
173
+ end
174
+
175
+ # Checks equality by comparing each attribute.
176
+ # @param [Object] Object to be compared
177
+ def ==(other)
178
+ return true if equal?(other)
179
+
180
+ self.class == other.class &&
181
+ index_name == other.index_name &&
182
+ threshold == other.threshold &&
183
+ max_recommendations == other.max_recommendations &&
184
+ query_parameters == other.query_parameters &&
185
+ model == other.model &&
186
+ object_id == other.object_id
187
+ end
188
+
189
+ # @see the `==` method
190
+ # @param [Object] Object to be compared
191
+ def eql?(other)
192
+ self == other
193
+ end
194
+
195
+ # Calculates hash code according to all attributes.
196
+ # @return [Integer] Hash code
197
+ def hash
198
+ [index_name, threshold, max_recommendations, query_parameters, model, object_id].hash
199
+ end
200
+
201
+ # Builds the object from hash
202
+ # @param [Hash] attributes Model attributes in the form of hash
203
+ # @return [Object] Returns the model itself
204
+ def self.build_from_hash(attributes)
205
+ return nil unless attributes.is_a?(Hash)
206
+
207
+ attributes = attributes.transform_keys(&:to_sym)
208
+ transformed_hash = {}
209
+ types_mapping.each_pair do |key, type|
210
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
211
+ transformed_hash[key.to_sym] = nil
212
+ elsif type =~ /\AArray<(.*)>/i
213
+ # check to ensure the input is an array given that the attribute
214
+ # is documented as an array but the input is not
215
+ if attributes[attribute_map[key]].is_a?(Array)
216
+ transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v| _deserialize(::Regexp.last_match(1), v) }
217
+ end
218
+ elsif !attributes[attribute_map[key]].nil?
219
+ transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
220
+ end
221
+ end
222
+ new(transformed_hash)
223
+ end
224
+
225
+ # Deserializes the data based on type
226
+ # @param string type Data type
227
+ # @param string value Value to be deserialized
228
+ # @return [Object] Deserialized data
229
+ def self._deserialize(type, value)
230
+ case type.to_sym
231
+ when :Time
232
+ Time.parse(value)
233
+ when :Date
234
+ Date.parse(value)
235
+ when :String
236
+ value.to_s
237
+ when :Integer
238
+ value.to_i
239
+ when :Float
240
+ value.to_f
241
+ when :Boolean
242
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
243
+ true
244
+ else
245
+ false
246
+ end
247
+ when :Object
248
+ # generic object (usually a Hash), return directly
249
+ value
250
+ when /\AArray<(?<inner_type>.+)>\z/
251
+ inner_type = Regexp.last_match[:inner_type]
252
+ value.map { |v| _deserialize(inner_type, v) }
253
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
254
+ k_type = Regexp.last_match[:k_type]
255
+ v_type = Regexp.last_match[:v_type]
256
+ {}.tap do |hash|
257
+ value.each do |k, v|
258
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
259
+ end
260
+ end
261
+ else # model
262
+ # models (e.g. Pet) or oneOf
263
+ klass = Algolia::Recommend.const_get(type)
264
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
265
+ end
266
+ end
267
+
268
+ # Returns the string representation of the object
269
+ # @return [String] String presentation of the object
270
+ def to_s
271
+ to_hash.to_s
272
+ end
273
+
274
+ # to_body is an alias to to_hash (backward compatibility)
275
+ # @return [Hash] Returns the object in the form of hash
276
+ def to_body
277
+ to_hash
278
+ end
279
+
280
+ def to_json(*_args)
281
+ to_hash.to_json
282
+ end
283
+
284
+ # Returns the object in the form of hash
285
+ # @return [Hash] Returns the object in the form of hash
286
+ def to_hash
287
+ hash = {}
288
+ self.class.attribute_map.each_pair do |attr, param|
289
+ value = send(attr)
290
+ if value.nil?
291
+ is_nullable = self.class.openapi_nullable.include?(attr)
292
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
293
+ end
294
+
295
+ hash[param] = _to_hash(value)
296
+ end
297
+ hash
298
+ end
299
+
300
+ # Outputs non-array value in the form of hash
301
+ # For object, use to_hash. Otherwise, just return the value
302
+ # @param [Object] value Any valid value
303
+ # @return [Hash] Returns the value in the form of hash
304
+ def _to_hash(value)
305
+ if value.is_a?(Array)
306
+ value.compact.map { |v| _to_hash(v) }
307
+ elsif value.is_a?(Hash)
308
+ {}.tap do |hash|
309
+ value.each { |k, v| hash[k] = _to_hash(v) }
310
+ end
311
+ elsif value.respond_to? :to_hash
312
+ value.to_hash
313
+ else
314
+ value
315
+ end
316
+ end
317
+ end
318
+ end
319
+ end
@@ -5,51 +5,19 @@ require 'time'
5
5
 
6
6
  module Algolia
7
7
  module Recommend
8
+ # Condition that triggers the rule. If not specified, the rule is triggered for all recommendations.
8
9
  class Condition
9
- # Query pattern that triggers the rule. You can use either a literal string, or a special pattern `{facet:ATTRIBUTE}`, where `ATTRIBUTE` is a facet name. The rule is triggered if the query matches the literal string or a value of the specified facet. For example, with `pattern: {facet:genre}`, the rule is triggered when users search for a genre, such as \"comedy\".
10
- attr_accessor :pattern
11
-
12
- attr_accessor :anchoring
13
-
14
- # Whether the pattern should match plurals, synonyms, and typos.
15
- attr_accessor :alternatives
10
+ # Filter expression to only include items that match the filter criteria in the response. You can use these filter expressions: - **Numeric filters.** `<facet> <op> <number>`, where `<op>` is one of `<`, `<=`, `=`, `!=`, `>`, `>=`. - **Ranges.** `<facet>:<lower> TO <upper>` where `<lower>` and `<upper>` are the lower and upper limits of the range (inclusive). - **Facet filters.** `<facet>:<value>` where `<facet>` is a facet attribute (case-sensitive) and `<value>` a facet value. - **Tag filters.** `_tags:<value>` or just `<value>` (case-sensitive). - **Boolean filters.** `<facet>: true | false`. You can combine filters with `AND`, `OR`, and `NOT` operators with the following restrictions: - You can only combine filters of the same type with `OR`. **Not supported:** `facet:value OR num > 3`. - You can't use `NOT` with combinations of filters. **Not supported:** `NOT(facet:value OR facet:value)` - You can't combine conjunctions (`AND`) with `OR`. **Not supported:** `facet:value OR (facet:value AND facet:value)` Use quotes around your filters, if the facet attribute name or facet value has spaces, keywords (`OR`, `AND`, `NOT`), or quotes. If a facet attribute is an array, the filter matches if it matches at least one element of the array. For more information, see [Filters](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/).
11
+ attr_accessor :filters
16
12
 
17
13
  # An additional restriction that only triggers the rule, when the search has the same value as `ruleContexts` parameter. For example, if `context: mobile`, the rule is only triggered when the search request has a matching `ruleContexts: mobile`. A rule context must only contain alphanumeric characters.
18
14
  attr_accessor :context
19
15
 
20
- # Filters that trigger the rule. You can add add filters using the syntax `facet:value` so that the rule is triggered, when the specific filter is selected. You can use `filters` on its own or combine it with the `pattern` parameter.
21
- attr_accessor :filters
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
16
  # Attribute mapping from ruby-style variable name to JSON key.
46
17
  def self.attribute_map
47
18
  {
48
- :pattern => :pattern,
49
- :anchoring => :anchoring,
50
- :alternatives => :alternatives,
51
- :context => :context,
52
- :filters => :filters
19
+ :filters => :filters,
20
+ :context => :context
53
21
  }
54
22
  end
55
23
 
@@ -61,11 +29,8 @@ module Algolia
61
29
  # Attribute type mapping.
62
30
  def self.types_mapping
63
31
  {
64
- :pattern => :String,
65
- :anchoring => :Anchoring,
66
- :alternatives => :Boolean,
67
- :context => :String,
68
- :filters => :String
32
+ :filters => :String,
33
+ :context => :String
69
34
  }
70
35
  end
71
36
 
@@ -91,25 +56,13 @@ module Algolia
91
56
  h[k.to_sym] = v
92
57
  end
93
58
 
94
- if attributes.key?(:pattern)
95
- self.pattern = attributes[:pattern]
96
- end
97
-
98
- if attributes.key?(:anchoring)
99
- self.anchoring = attributes[:anchoring]
100
- end
101
-
102
- if attributes.key?(:alternatives)
103
- self.alternatives = attributes[:alternatives]
59
+ if attributes.key?(:filters)
60
+ self.filters = attributes[:filters]
104
61
  end
105
62
 
106
63
  if attributes.key?(:context)
107
64
  self.context = attributes[:context]
108
65
  end
109
-
110
- if attributes.key?(:filters)
111
- self.filters = attributes[:filters]
112
- end
113
66
  end
114
67
 
115
68
  # Custom attribute writer method with validation
@@ -133,11 +86,8 @@ module Algolia
133
86
  return true if equal?(other)
134
87
 
135
88
  self.class == other.class &&
136
- pattern == other.pattern &&
137
- anchoring == other.anchoring &&
138
- alternatives == other.alternatives &&
139
- context == other.context &&
140
- filters == other.filters
89
+ filters == other.filters &&
90
+ context == other.context
141
91
  end
142
92
 
143
93
  # @see the `==` method
@@ -149,7 +99,7 @@ module Algolia
149
99
  # Calculates hash code according to all attributes.
150
100
  # @return [Integer] Hash code
151
101
  def hash
152
- [pattern, anchoring, alternatives, context, filters].hash
102
+ [filters, context].hash
153
103
  end
154
104
 
155
105
  # Builds the object from hash
@@ -5,30 +5,22 @@ require 'time'
5
5
 
6
6
  module Algolia
7
7
  module Recommend
8
- # Effect of the rule. For more information, see [Consequences](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/#consequences).
8
+ # Effect of the rule.
9
9
  class Consequence
10
- attr_accessor :params
10
+ # Exclude items from recommendations.
11
+ attr_accessor :hide
11
12
 
12
- # Records you want to pin to a specific position in the search results. You can promote up to 300 records, either individually, or as groups of up to 100 records each.
13
+ # Place items at specific positions in the list of recommendations.
13
14
  attr_accessor :promote
14
15
 
15
- # Whether promoted records must match an active filter for the consequence to be applied. This ensures that user actions (filtering the search) are given a higher precendence. For example, if you promote a record with the `color: red` attribute, and the user filters the search for `color: blue`, the \"red\" record won't be shown.
16
- attr_accessor :filter_promotes
17
-
18
- # Records you want to hide from the search results.
19
- attr_accessor :hide
20
-
21
- # A JSON object with custom data that will be appended to the `userData` array in the response. This object isn't interpreted by the API and is limited to 1&nbsp;kB of minified JSON.
22
- attr_accessor :user_data
16
+ attr_accessor :params
23
17
 
24
18
  # Attribute mapping from ruby-style variable name to JSON key.
25
19
  def self.attribute_map
26
20
  {
27
- :params => :params,
28
- :promote => :promote,
29
- :filter_promotes => :filterPromotes,
30
21
  :hide => :hide,
31
- :user_data => :userData
22
+ :promote => :promote,
23
+ :params => :params
32
24
  }
33
25
  end
34
26
 
@@ -40,19 +32,15 @@ module Algolia
40
32
  # Attribute type mapping.
41
33
  def self.types_mapping
42
34
  {
43
- :params => :ConsequenceParams,
44
- :promote => :'Array<Promote>',
45
- :filter_promotes => :Boolean,
46
- :hide => :'Array<ConsequenceHide>',
47
- :user_data => :Object
35
+ :hide => :'Array<HideConsequenceObject>',
36
+ :promote => :'Array<PromoteConsequenceObject>',
37
+ :params => :ParamsConsequence
48
38
  }
49
39
  end
50
40
 
51
41
  # List of attributes with nullable: true
52
42
  def self.openapi_nullable
53
- Set.new([
54
- :user_data
55
- ])
43
+ Set.new([])
56
44
  end
57
45
 
58
46
  # Initializes the object
@@ -72,8 +60,10 @@ module Algolia
72
60
  h[k.to_sym] = v
73
61
  end
74
62
 
75
- if attributes.key?(:params)
76
- self.params = attributes[:params]
63
+ if attributes.key?(:hide)
64
+ if (value = attributes[:hide]).is_a?(Array)
65
+ self.hide = value
66
+ end
77
67
  end
78
68
 
79
69
  if attributes.key?(:promote)
@@ -82,19 +72,23 @@ module Algolia
82
72
  end
83
73
  end
84
74
 
85
- if attributes.key?(:filter_promotes)
86
- self.filter_promotes = attributes[:filter_promotes]
75
+ if attributes.key?(:params)
76
+ self.params = attributes[:params]
87
77
  end
78
+ end
88
79
 
89
- if attributes.key?(:hide)
90
- if (value = attributes[:hide]).is_a?(Array)
91
- self.hide = value
92
- end
80
+ # Custom attribute writer method with validation
81
+ # @param [Object] hide Value to be assigned
82
+ def hide=(hide)
83
+ if hide.nil?
84
+ raise ArgumentError, 'hide cannot be nil'
93
85
  end
94
86
 
95
- if attributes.key?(:user_data)
96
- self.user_data = attributes[:user_data]
87
+ if hide.length < 1
88
+ raise ArgumentError, 'invalid value for "hide", number of items must be greater than or equal to 1.'
97
89
  end
90
+
91
+ @hide = hide
98
92
  end
99
93
 
100
94
  # Custom attribute writer method with validation
@@ -104,38 +98,22 @@ module Algolia
104
98
  raise ArgumentError, 'promote cannot be nil'
105
99
  end
106
100
 
107
- if promote.length > 300
108
- raise ArgumentError, 'invalid value for "promote", number of items must be less than or equal to 300.'
101
+ if promote.length < 1
102
+ raise ArgumentError, 'invalid value for "promote", number of items must be greater than or equal to 1.'
109
103
  end
110
104
 
111
105
  @promote = promote
112
106
  end
113
107
 
114
- # Custom attribute writer method with validation
115
- # @param [Object] hide Value to be assigned
116
- def hide=(hide)
117
- if hide.nil?
118
- raise ArgumentError, 'hide cannot be nil'
119
- end
120
-
121
- if hide.length > 50
122
- raise ArgumentError, 'invalid value for "hide", number of items must be less than or equal to 50.'
123
- end
124
-
125
- @hide = hide
126
- end
127
-
128
108
  # Checks equality by comparing each attribute.
129
109
  # @param [Object] Object to be compared
130
110
  def ==(other)
131
111
  return true if equal?(other)
132
112
 
133
113
  self.class == other.class &&
134
- params == other.params &&
135
- promote == other.promote &&
136
- filter_promotes == other.filter_promotes &&
137
114
  hide == other.hide &&
138
- user_data == other.user_data
115
+ promote == other.promote &&
116
+ params == other.params
139
117
  end
140
118
 
141
119
  # @see the `==` method
@@ -147,7 +125,7 @@ module Algolia
147
125
  # Calculates hash code according to all attributes.
148
126
  # @return [Integer] Hash code
149
127
  def hash
150
- [params, promote, filter_promotes, hide, user_data].hash
128
+ [hide, promote, params].hash
151
129
  end
152
130
 
153
131
  # Builds the object from hash
@@ -10,7 +10,7 @@ module Algolia
10
10
  # Unique identifier of a task. A successful API response means that a task was added to a queue. It might not run immediately. You can check the task's progress with the [`task` operation](#tag/Indices/operation/getTask) and this `taskID`.
11
11
  attr_accessor :task_id
12
12
 
13
- # Timestamp of deletion in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format.
13
+ # Date and time when the object was deleted, in RFC 3339 format.
14
14
  attr_accessor :deleted_at
15
15
 
16
16
  # Attribute mapping from ruby-style variable name to JSON key.