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.
- checksums.yaml +4 -4
- data/.openapi-generator/FILES +10 -167
- data/CHANGELOG.md +16 -0
- data/Gemfile.lock +4 -4
- data/lib/algolia/api/abtesting_client.rb +20 -20
- data/lib/algolia/api/analytics_client.rb +76 -76
- data/lib/algolia/api/personalization_client.rb +12 -12
- data/lib/algolia/api/recommend_client.rb +22 -22
- data/lib/algolia/api/search_client.rb +8 -8
- data/lib/algolia/api/usage_client.rb +329 -0
- data/lib/algolia/models/abtesting/ab_test.rb +41 -16
- data/lib/algolia/models/abtesting/ab_test_configuration.rb +217 -0
- data/lib/algolia/models/abtesting/ab_test_response.rb +2 -2
- data/lib/algolia/models/abtesting/ab_tests_variant.rb +21 -3
- data/lib/algolia/models/abtesting/ab_tests_variant_search_params.rb +21 -3
- data/lib/algolia/models/abtesting/add_ab_tests_request.rb +1 -1
- data/lib/algolia/models/abtesting/custom_search_params.rb +1 -1
- data/lib/algolia/models/abtesting/effect.rb +35 -0
- data/lib/algolia/models/abtesting/empty_search.rb +198 -0
- data/lib/algolia/models/abtesting/list_ab_tests_response.rb +1 -1
- data/lib/algolia/models/abtesting/minimum_detectable_effect.rb +247 -0
- data/lib/algolia/models/abtesting/outliers.rb +198 -0
- data/lib/algolia/models/abtesting/status.rb +35 -0
- data/lib/algolia/models/abtesting/variant.rb +31 -13
- data/lib/algolia/models/analytics/get_status_response.rb +1 -1
- data/lib/algolia/models/ingestion/auth_algolia_insights.rb +212 -0
- data/lib/algolia/models/{recommend/consequence_query_object.rb → ingestion/auth_algolia_insights_partial.rb} +21 -24
- data/lib/algolia/models/ingestion/auth_input.rb +1 -0
- data/lib/algolia/models/ingestion/auth_input_partial.rb +1 -0
- data/lib/algolia/models/ingestion/authentication_type.rb +2 -1
- data/lib/algolia/models/ingestion/destination_index_name.rb +1 -1
- data/lib/algolia/models/ingestion/shopify_input.rb +212 -0
- data/lib/algolia/models/ingestion/shopify_market.rb +227 -0
- data/lib/algolia/models/ingestion/shopify_metafield.rb +221 -0
- data/lib/algolia/models/ingestion/source_input.rb +2 -1
- data/lib/algolia/models/ingestion/source_shopify.rb +278 -0
- data/lib/algolia/models/{recommend/base_recommended_for_you_query_parameters.rb → ingestion/source_shopify_base.rb} +14 -14
- data/lib/algolia/models/ingestion/source_update_input.rb +2 -1
- data/lib/algolia/models/ingestion/source_update_shopify.rb +258 -0
- data/lib/algolia/models/ingestion/task_input.rb +1 -0
- data/lib/algolia/models/insights/added_to_cart_object_ids.rb +2 -2
- data/lib/algolia/models/insights/added_to_cart_object_ids_after_search.rb +2 -2
- data/lib/algolia/models/insights/clicked_filters.rb +2 -2
- data/lib/algolia/models/insights/clicked_object_ids.rb +2 -2
- data/lib/algolia/models/insights/clicked_object_ids_after_search.rb +2 -2
- data/lib/algolia/models/insights/converted_filters.rb +2 -2
- data/lib/algolia/models/insights/converted_object_ids.rb +2 -2
- data/lib/algolia/models/insights/converted_object_ids_after_search.rb +2 -2
- data/lib/algolia/models/insights/purchased_object_ids.rb +2 -2
- data/lib/algolia/models/insights/purchased_object_ids_after_search.rb +2 -2
- data/lib/algolia/models/insights/viewed_filters.rb +2 -2
- data/lib/algolia/models/insights/viewed_object_ids.rb +2 -2
- data/lib/algolia/models/monitoring/incidents_inner.rb +1 -1
- data/lib/algolia/models/monitoring/probes_metric.rb +1 -1
- data/lib/algolia/models/monitoring/time_inner.rb +1 -1
- data/lib/algolia/models/personalization/delete_user_profile_response.rb +2 -2
- data/lib/algolia/models/personalization/event_scoring.rb +25 -4
- data/lib/algolia/models/personalization/event_type.rb +34 -0
- data/lib/algolia/models/personalization/facet_scoring.rb +2 -2
- data/lib/algolia/models/personalization/get_user_token_response.rb +3 -3
- data/lib/algolia/models/personalization/personalization_strategy_params.rb +21 -3
- data/lib/algolia/models/query-suggestions/get_config_status200_response.rb +3 -3
- data/lib/algolia/models/query-suggestions/get_log_file200_response.rb +1 -1
- data/lib/algolia/models/query-suggestions/query_suggestions_configuration_response.rb +1 -1
- data/lib/algolia/models/query-suggestions/query_suggestions_configuration_with_index.rb +1 -1
- data/lib/algolia/models/query-suggestions/source_index.rb +1 -1
- data/lib/algolia/models/recommend/auto_facet_filter.rb +208 -0
- data/lib/algolia/models/recommend/base_recommend_request.rb +37 -8
- data/lib/algolia/models/recommend/base_search_params.rb +4 -4
- data/lib/algolia/models/recommend/base_search_params_without_query.rb +4 -4
- data/lib/algolia/models/recommend/bought_together_query.rb +319 -0
- data/lib/algolia/models/recommend/condition.rb +12 -62
- data/lib/algolia/models/recommend/consequence.rb +32 -54
- data/lib/algolia/models/recommend/deleted_at_response.rb +1 -1
- data/lib/algolia/models/recommend/{recommended_for_you_query_parameters.rb → fallback_params.rb} +17 -20
- data/lib/algolia/models/recommend/{edit_type.rb → fbt_model.rb} +5 -6
- data/lib/algolia/models/recommend/{base_trending_facets_query.rb → frequently_bought_together.rb} +20 -18
- data/lib/algolia/models/recommend/get_recommendations_params.rb +2 -2
- data/lib/algolia/models/recommend/{consequence_hide.rb → hide_consequence_object.rb} +4 -6
- data/lib/algolia/models/recommend/index_settings_as_search_params.rb +10 -10
- data/lib/algolia/models/recommend/{base_recommendations_query.rb → looking_similar.rb} +6 -15
- data/lib/algolia/models/recommend/{anchoring.rb → looking_similar_model.rb} +5 -8
- data/lib/algolia/models/recommend/looking_similar_query.rb +328 -0
- data/lib/algolia/models/recommend/{params.rb → params_consequence.rb} +26 -28
- data/lib/algolia/models/recommend/{promote_object_id.rb → promote_consequence_object.rb} +19 -9
- data/lib/algolia/models/recommend/re_ranking_apply_filter.rb +1 -1
- data/lib/algolia/models/recommend/{rule_response.rb → recommend_rule.rb} +13 -18
- data/lib/algolia/models/recommend/{rule_response_metadata.rb → recommend_rule_metadata.rb} +5 -4
- data/lib/algolia/models/recommend/recommendations_hits.rb +4 -24
- data/lib/algolia/models/recommend/recommendations_request.rb +3 -1
- data/lib/algolia/models/recommend/recommendations_results.rb +4 -24
- data/lib/algolia/models/recommend/{base_recommended_for_you_query.rb → recommended_for_you.rb} +5 -14
- data/lib/algolia/models/recommend/recommended_for_you_query.rb +36 -16
- data/lib/algolia/models/recommend/{recommendation_models.rb → related_model.rb} +4 -5
- data/lib/algolia/models/recommend/{edit.rb → related_products.rb} +27 -24
- data/lib/algolia/models/recommend/{recommendations_query.rb → related_query.rb} +40 -20
- data/lib/algolia/models/recommend/{consequence_params.rb → search_params.rb} +33 -52
- data/lib/algolia/models/recommend/search_params_object.rb +15 -14
- data/lib/algolia/models/recommend/search_recommend_rules_params.rb +58 -10
- data/lib/algolia/models/recommend/search_recommend_rules_response.rb +2 -2
- data/lib/algolia/models/recommend/trending_facet_hit.rb +2 -2
- data/lib/algolia/models/recommend/trending_facets.rb +243 -0
- data/lib/algolia/models/recommend/trending_facets_query.rb +51 -11
- data/lib/algolia/models/recommend/{base_trending_items_query.rb → trending_items.rb} +12 -15
- data/lib/algolia/models/recommend/trending_items_query.rb +43 -17
- data/lib/algolia/models/search/add_api_key_response.rb +1 -1
- data/lib/algolia/models/search/base_get_api_key_response.rb +1 -1
- data/lib/algolia/models/search/base_index_settings.rb +10 -10
- data/lib/algolia/models/search/base_search_params.rb +4 -4
- data/lib/algolia/models/search/base_search_params_without_query.rb +4 -4
- data/lib/algolia/models/search/browse_params_object.rb +14 -14
- data/lib/algolia/models/search/consequence_params.rb +14 -14
- data/lib/algolia/models/search/created_at_response.rb +1 -1
- data/lib/algolia/models/search/delete_api_key_response.rb +1 -1
- data/lib/algolia/models/search/delete_by_params.rb +2 -2
- data/lib/algolia/models/search/delete_source_response.rb +1 -1
- data/lib/algolia/models/search/deleted_at_response.rb +1 -1
- data/lib/algolia/models/search/fetched_index.rb +1 -1
- data/lib/algolia/models/search/get_api_key_response.rb +1 -1
- data/lib/algolia/models/search/index_settings.rb +20 -20
- data/lib/algolia/models/search/index_settings_as_search_params.rb +10 -10
- data/lib/algolia/models/search/log.rb +1 -1
- data/lib/algolia/models/search/multiple_batch_request.rb +1 -1
- data/lib/algolia/models/search/operation_index_params.rb +1 -1
- data/lib/algolia/models/search/re_ranking_apply_filter.rb +1 -1
- data/lib/algolia/models/search/remove_user_id_response.rb +1 -1
- data/lib/algolia/models/search/replace_source_response.rb +1 -1
- data/lib/algolia/models/search/save_object_response.rb +1 -1
- data/lib/algolia/models/search/save_synonym_response.rb +1 -1
- data/lib/algolia/models/search/search_for_facets.rb +15 -15
- data/lib/algolia/models/search/search_for_facets_options.rb +1 -1
- data/lib/algolia/models/search/search_for_hits.rb +15 -15
- data/lib/algolia/models/search/search_for_hits_options.rb +1 -1
- data/lib/algolia/models/search/search_params_object.rb +15 -14
- data/lib/algolia/models/search/search_user_ids_response.rb +1 -1
- data/lib/algolia/models/search/secured_api_key_restrictions.rb +1 -1
- data/lib/algolia/models/search/update_api_key_response.rb +1 -1
- data/lib/algolia/models/search/updated_at_response.rb +1 -1
- data/lib/algolia/models/search/updated_at_with_object_id_response.rb +1 -1
- data/lib/algolia/models/search/updated_rule_response.rb +1 -1
- data/lib/algolia/models/search/user_hit.rb +1 -1
- data/lib/algolia/models/search/user_id.rb +1 -1
- data/lib/algolia/models/usage/error_base.rb +205 -0
- data/lib/algolia/models/usage/get_usage200_response.rb +198 -0
- data/lib/algolia/models/usage/get_usage200_response_statistics_inner.rb +206 -0
- data/lib/algolia/models/usage/get_usage400_response.rb +198 -0
- data/lib/algolia/models/usage/get_usage400_response_error.rb +216 -0
- data/lib/algolia/models/usage/get_usage400_response_error_errors_inner.rb +225 -0
- data/lib/algolia/models/usage/granularity.rb +33 -0
- data/lib/algolia/models/usage/statistic.rb +116 -0
- data/lib/algolia/models/{recommend/promote.rb → usage/statistic_value.rb} +5 -5
- data/lib/algolia/version.rb +1 -1
- metadata +47 -25
- data/lib/algolia/models/recommend/automatic_facet_filter.rb +0 -220
- data/lib/algolia/models/recommend/automatic_facet_filters.rb +0 -97
- data/lib/algolia/models/recommend/consequence_query.rb +0 -97
- data/lib/algolia/models/recommend/promote_object_ids.rb +0 -228
@@ -0,0 +1,328 @@
|
|
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 LookingSimilarQuery
|
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
|
+
attr_accessor :fallback_parameters
|
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
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
50
|
+
def self.attribute_map
|
51
|
+
{
|
52
|
+
:index_name => :indexName,
|
53
|
+
:threshold => :threshold,
|
54
|
+
:max_recommendations => :maxRecommendations,
|
55
|
+
:query_parameters => :queryParameters,
|
56
|
+
:model => :model,
|
57
|
+
:object_id => :objectID,
|
58
|
+
:fallback_parameters => :fallbackParameters
|
59
|
+
}
|
60
|
+
end
|
61
|
+
|
62
|
+
# Returns all the JSON keys this model knows about
|
63
|
+
def self.acceptable_attributes
|
64
|
+
attribute_map.values
|
65
|
+
end
|
66
|
+
|
67
|
+
# Attribute type mapping.
|
68
|
+
def self.types_mapping
|
69
|
+
{
|
70
|
+
:index_name => :String,
|
71
|
+
:threshold => :Float,
|
72
|
+
:max_recommendations => :Integer,
|
73
|
+
:query_parameters => :SearchParams,
|
74
|
+
:model => :LookingSimilarModel,
|
75
|
+
:object_id => :String,
|
76
|
+
:fallback_parameters => :FallbackParams
|
77
|
+
}
|
78
|
+
end
|
79
|
+
|
80
|
+
# List of attributes with nullable: true
|
81
|
+
def self.openapi_nullable
|
82
|
+
Set.new([])
|
83
|
+
end
|
84
|
+
|
85
|
+
# List of class defined in allOf (OpenAPI v3)
|
86
|
+
def self.openapi_all_of
|
87
|
+
[
|
88
|
+
:BaseRecommendRequest,
|
89
|
+
:LookingSimilar
|
90
|
+
]
|
91
|
+
end
|
92
|
+
|
93
|
+
# Initializes the object
|
94
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
95
|
+
def initialize(attributes = {})
|
96
|
+
unless attributes.is_a?(Hash)
|
97
|
+
raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::LookingSimilarQuery` initialize method"
|
98
|
+
end
|
99
|
+
|
100
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
101
|
+
attributes = attributes.each_with_object({}) do |(k, v), h|
|
102
|
+
unless self.class.attribute_map.key?(k.to_sym)
|
103
|
+
raise ArgumentError,
|
104
|
+
"`#{k}` is not a valid attribute in `Algolia::LookingSimilarQuery`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
105
|
+
end
|
106
|
+
|
107
|
+
h[k.to_sym] = v
|
108
|
+
end
|
109
|
+
|
110
|
+
if attributes.key?(:index_name)
|
111
|
+
self.index_name = attributes[:index_name]
|
112
|
+
else
|
113
|
+
self.index_name = nil
|
114
|
+
end
|
115
|
+
|
116
|
+
if attributes.key?(:threshold)
|
117
|
+
self.threshold = attributes[:threshold]
|
118
|
+
else
|
119
|
+
self.threshold = nil
|
120
|
+
end
|
121
|
+
|
122
|
+
if attributes.key?(:max_recommendations)
|
123
|
+
self.max_recommendations = attributes[:max_recommendations]
|
124
|
+
end
|
125
|
+
|
126
|
+
if attributes.key?(:query_parameters)
|
127
|
+
self.query_parameters = attributes[:query_parameters]
|
128
|
+
end
|
129
|
+
|
130
|
+
if attributes.key?(:model)
|
131
|
+
self.model = attributes[:model]
|
132
|
+
else
|
133
|
+
self.model = nil
|
134
|
+
end
|
135
|
+
|
136
|
+
if attributes.key?(:object_id)
|
137
|
+
self.object_id = attributes[:object_id]
|
138
|
+
else
|
139
|
+
self.object_id = nil
|
140
|
+
end
|
141
|
+
|
142
|
+
if attributes.key?(:fallback_parameters)
|
143
|
+
self.fallback_parameters = attributes[:fallback_parameters]
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
# Custom attribute writer method with validation
|
148
|
+
# @param [Object] threshold Value to be assigned
|
149
|
+
def threshold=(threshold)
|
150
|
+
if threshold.nil?
|
151
|
+
raise ArgumentError, 'threshold cannot be nil'
|
152
|
+
end
|
153
|
+
|
154
|
+
if threshold > 100
|
155
|
+
raise ArgumentError, 'invalid value for "threshold", must be smaller than or equal to 100.'
|
156
|
+
end
|
157
|
+
|
158
|
+
if threshold < 0
|
159
|
+
raise ArgumentError, 'invalid value for "threshold", must be greater than or equal to 0.'
|
160
|
+
end
|
161
|
+
|
162
|
+
@threshold = threshold
|
163
|
+
end
|
164
|
+
|
165
|
+
# Custom attribute writer method with validation
|
166
|
+
# @param [Object] max_recommendations Value to be assigned
|
167
|
+
def max_recommendations=(max_recommendations)
|
168
|
+
if max_recommendations.nil?
|
169
|
+
raise ArgumentError, 'max_recommendations cannot be nil'
|
170
|
+
end
|
171
|
+
|
172
|
+
if max_recommendations > 1000
|
173
|
+
raise ArgumentError, 'invalid value for "max_recommendations", must be smaller than or equal to 1000.'
|
174
|
+
end
|
175
|
+
|
176
|
+
if max_recommendations < 1
|
177
|
+
raise ArgumentError, 'invalid value for "max_recommendations", must be greater than or equal to 1.'
|
178
|
+
end
|
179
|
+
|
180
|
+
@max_recommendations = max_recommendations
|
181
|
+
end
|
182
|
+
|
183
|
+
# Checks equality by comparing each attribute.
|
184
|
+
# @param [Object] Object to be compared
|
185
|
+
def ==(other)
|
186
|
+
return true if equal?(other)
|
187
|
+
|
188
|
+
self.class == other.class &&
|
189
|
+
index_name == other.index_name &&
|
190
|
+
threshold == other.threshold &&
|
191
|
+
max_recommendations == other.max_recommendations &&
|
192
|
+
query_parameters == other.query_parameters &&
|
193
|
+
model == other.model &&
|
194
|
+
object_id == other.object_id &&
|
195
|
+
fallback_parameters == other.fallback_parameters
|
196
|
+
end
|
197
|
+
|
198
|
+
# @see the `==` method
|
199
|
+
# @param [Object] Object to be compared
|
200
|
+
def eql?(other)
|
201
|
+
self == other
|
202
|
+
end
|
203
|
+
|
204
|
+
# Calculates hash code according to all attributes.
|
205
|
+
# @return [Integer] Hash code
|
206
|
+
def hash
|
207
|
+
[index_name, threshold, max_recommendations, query_parameters, model, object_id, fallback_parameters].hash
|
208
|
+
end
|
209
|
+
|
210
|
+
# Builds the object from hash
|
211
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
212
|
+
# @return [Object] Returns the model itself
|
213
|
+
def self.build_from_hash(attributes)
|
214
|
+
return nil unless attributes.is_a?(Hash)
|
215
|
+
|
216
|
+
attributes = attributes.transform_keys(&:to_sym)
|
217
|
+
transformed_hash = {}
|
218
|
+
types_mapping.each_pair do |key, type|
|
219
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
220
|
+
transformed_hash[key.to_sym] = nil
|
221
|
+
elsif type =~ /\AArray<(.*)>/i
|
222
|
+
# check to ensure the input is an array given that the attribute
|
223
|
+
# is documented as an array but the input is not
|
224
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
225
|
+
transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v| _deserialize(::Regexp.last_match(1), v) }
|
226
|
+
end
|
227
|
+
elsif !attributes[attribute_map[key]].nil?
|
228
|
+
transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
|
229
|
+
end
|
230
|
+
end
|
231
|
+
new(transformed_hash)
|
232
|
+
end
|
233
|
+
|
234
|
+
# Deserializes the data based on type
|
235
|
+
# @param string type Data type
|
236
|
+
# @param string value Value to be deserialized
|
237
|
+
# @return [Object] Deserialized data
|
238
|
+
def self._deserialize(type, value)
|
239
|
+
case type.to_sym
|
240
|
+
when :Time
|
241
|
+
Time.parse(value)
|
242
|
+
when :Date
|
243
|
+
Date.parse(value)
|
244
|
+
when :String
|
245
|
+
value.to_s
|
246
|
+
when :Integer
|
247
|
+
value.to_i
|
248
|
+
when :Float
|
249
|
+
value.to_f
|
250
|
+
when :Boolean
|
251
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
252
|
+
true
|
253
|
+
else
|
254
|
+
false
|
255
|
+
end
|
256
|
+
when :Object
|
257
|
+
# generic object (usually a Hash), return directly
|
258
|
+
value
|
259
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
260
|
+
inner_type = Regexp.last_match[:inner_type]
|
261
|
+
value.map { |v| _deserialize(inner_type, v) }
|
262
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
263
|
+
k_type = Regexp.last_match[:k_type]
|
264
|
+
v_type = Regexp.last_match[:v_type]
|
265
|
+
{}.tap do |hash|
|
266
|
+
value.each do |k, v|
|
267
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
268
|
+
end
|
269
|
+
end
|
270
|
+
else # model
|
271
|
+
# models (e.g. Pet) or oneOf
|
272
|
+
klass = Algolia::Recommend.const_get(type)
|
273
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
274
|
+
end
|
275
|
+
end
|
276
|
+
|
277
|
+
# Returns the string representation of the object
|
278
|
+
# @return [String] String presentation of the object
|
279
|
+
def to_s
|
280
|
+
to_hash.to_s
|
281
|
+
end
|
282
|
+
|
283
|
+
# to_body is an alias to to_hash (backward compatibility)
|
284
|
+
# @return [Hash] Returns the object in the form of hash
|
285
|
+
def to_body
|
286
|
+
to_hash
|
287
|
+
end
|
288
|
+
|
289
|
+
def to_json(*_args)
|
290
|
+
to_hash.to_json
|
291
|
+
end
|
292
|
+
|
293
|
+
# Returns the object in the form of hash
|
294
|
+
# @return [Hash] Returns the object in the form of hash
|
295
|
+
def to_hash
|
296
|
+
hash = {}
|
297
|
+
self.class.attribute_map.each_pair do |attr, param|
|
298
|
+
value = send(attr)
|
299
|
+
if value.nil?
|
300
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
301
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
302
|
+
end
|
303
|
+
|
304
|
+
hash[param] = _to_hash(value)
|
305
|
+
end
|
306
|
+
hash
|
307
|
+
end
|
308
|
+
|
309
|
+
# Outputs non-array value in the form of hash
|
310
|
+
# For object, use to_hash. Otherwise, just return the value
|
311
|
+
# @param [Object] value Any valid value
|
312
|
+
# @return [Hash] Returns the value in the form of hash
|
313
|
+
def _to_hash(value)
|
314
|
+
if value.is_a?(Array)
|
315
|
+
value.compact.map { |v| _to_hash(v) }
|
316
|
+
elsif value.is_a?(Hash)
|
317
|
+
{}.tap do |hash|
|
318
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
319
|
+
end
|
320
|
+
elsif value.respond_to? :to_hash
|
321
|
+
value.to_hash
|
322
|
+
else
|
323
|
+
value
|
324
|
+
end
|
325
|
+
end
|
326
|
+
end
|
327
|
+
end
|
328
|
+
end
|
@@ -5,23 +5,23 @@ require 'time'
|
|
5
5
|
|
6
6
|
module Algolia
|
7
7
|
module Recommend
|
8
|
-
#
|
9
|
-
class
|
10
|
-
|
11
|
-
|
8
|
+
# Filter or boost recommendations matching a facet filter.
|
9
|
+
class ParamsConsequence
|
10
|
+
# Filter recommendations that match or don't match the same `facet:facet_value` combination as the viewed item.
|
12
11
|
attr_accessor :automatic_facet_filters
|
13
12
|
|
14
|
-
|
13
|
+
# 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/).
|
14
|
+
attr_accessor :filters
|
15
15
|
|
16
|
-
|
16
|
+
# Filters to promote or demote records in the search results. Optional filters work like facet filters, but they don't exclude records from the search results. Records that match the optional filter rank before records that don't match. Matches with higher weights (`<score=N>`) rank before matches with lower weights. If you're using a negative filter `facet:-value`, matching records rank after records that don't match.
|
17
|
+
attr_accessor :optional_filters
|
17
18
|
|
18
19
|
# Attribute mapping from ruby-style variable name to JSON key.
|
19
20
|
def self.attribute_map
|
20
21
|
{
|
21
|
-
:query => :query,
|
22
22
|
:automatic_facet_filters => :automaticFacetFilters,
|
23
|
-
:
|
24
|
-
:
|
23
|
+
:filters => :filters,
|
24
|
+
:optional_filters => :optionalFilters
|
25
25
|
}
|
26
26
|
end
|
27
27
|
|
@@ -33,10 +33,9 @@ module Algolia
|
|
33
33
|
# Attribute type mapping.
|
34
34
|
def self.types_mapping
|
35
35
|
{
|
36
|
-
:
|
37
|
-
:
|
38
|
-
:
|
39
|
-
:rendering_content => :RenderingContent
|
36
|
+
:automatic_facet_filters => :'Array<AutoFacetFilter>',
|
37
|
+
:filters => :String,
|
38
|
+
:optional_filters => :'Array<String>'
|
40
39
|
}
|
41
40
|
end
|
42
41
|
|
@@ -49,33 +48,33 @@ module Algolia
|
|
49
48
|
# @param [Hash] attributes Model attributes in the form of hash
|
50
49
|
def initialize(attributes = {})
|
51
50
|
unless attributes.is_a?(Hash)
|
52
|
-
raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::
|
51
|
+
raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::ParamsConsequence` initialize method"
|
53
52
|
end
|
54
53
|
|
55
54
|
# check to see if the attribute exists and convert string to symbol for hash key
|
56
55
|
attributes = attributes.each_with_object({}) do |(k, v), h|
|
57
56
|
unless self.class.attribute_map.key?(k.to_sym)
|
58
57
|
raise ArgumentError,
|
59
|
-
"`#{k}` is not a valid attribute in `Algolia::
|
58
|
+
"`#{k}` is not a valid attribute in `Algolia::ParamsConsequence`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
60
59
|
end
|
61
60
|
|
62
61
|
h[k.to_sym] = v
|
63
62
|
end
|
64
63
|
|
65
|
-
if attributes.key?(:query)
|
66
|
-
self.query = attributes[:query]
|
67
|
-
end
|
68
|
-
|
69
64
|
if attributes.key?(:automatic_facet_filters)
|
70
|
-
|
65
|
+
if (value = attributes[:automatic_facet_filters]).is_a?(Array)
|
66
|
+
self.automatic_facet_filters = value
|
67
|
+
end
|
71
68
|
end
|
72
69
|
|
73
|
-
if attributes.key?(:
|
74
|
-
self.
|
70
|
+
if attributes.key?(:filters)
|
71
|
+
self.filters = attributes[:filters]
|
75
72
|
end
|
76
73
|
|
77
|
-
if attributes.key?(:
|
78
|
-
|
74
|
+
if attributes.key?(:optional_filters)
|
75
|
+
if (value = attributes[:optional_filters]).is_a?(Array)
|
76
|
+
self.optional_filters = value
|
77
|
+
end
|
79
78
|
end
|
80
79
|
end
|
81
80
|
|
@@ -85,10 +84,9 @@ module Algolia
|
|
85
84
|
return true if equal?(other)
|
86
85
|
|
87
86
|
self.class == other.class &&
|
88
|
-
query == other.query &&
|
89
87
|
automatic_facet_filters == other.automatic_facet_filters &&
|
90
|
-
|
91
|
-
|
88
|
+
filters == other.filters &&
|
89
|
+
optional_filters == other.optional_filters
|
92
90
|
end
|
93
91
|
|
94
92
|
# @see the `==` method
|
@@ -100,7 +98,7 @@ module Algolia
|
|
100
98
|
# Calculates hash code according to all attributes.
|
101
99
|
# @return [Integer] Hash code
|
102
100
|
def hash
|
103
|
-
[
|
101
|
+
[automatic_facet_filters, filters, optional_filters].hash
|
104
102
|
end
|
105
103
|
|
106
104
|
# Builds the object from hash
|
@@ -5,12 +5,12 @@ require 'time'
|
|
5
5
|
|
6
6
|
module Algolia
|
7
7
|
module Recommend
|
8
|
-
#
|
9
|
-
class
|
8
|
+
# Object ID and position of the recommendation you want to pin.
|
9
|
+
class PromoteConsequenceObject
|
10
10
|
# Unique record identifier.
|
11
11
|
attr_accessor :object_id
|
12
12
|
|
13
|
-
#
|
13
|
+
# Index in the list of recommendations where to place this item.
|
14
14
|
attr_accessor :position
|
15
15
|
|
16
16
|
# Attribute mapping from ruby-style variable name to JSON key.
|
@@ -43,14 +43,14 @@ module Algolia
|
|
43
43
|
# @param [Hash] attributes Model attributes in the form of hash
|
44
44
|
def initialize(attributes = {})
|
45
45
|
unless attributes.is_a?(Hash)
|
46
|
-
raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::
|
46
|
+
raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::PromoteConsequenceObject` initialize method"
|
47
47
|
end
|
48
48
|
|
49
49
|
# check to see if the attribute exists and convert string to symbol for hash key
|
50
50
|
attributes = attributes.each_with_object({}) do |(k, v), h|
|
51
51
|
unless self.class.attribute_map.key?(k.to_sym)
|
52
52
|
raise ArgumentError,
|
53
|
-
"`#{k}` is not a valid attribute in `Algolia::
|
53
|
+
"`#{k}` is not a valid attribute in `Algolia::PromoteConsequenceObject`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
54
54
|
end
|
55
55
|
|
56
56
|
h[k.to_sym] = v
|
@@ -58,17 +58,27 @@ module Algolia
|
|
58
58
|
|
59
59
|
if attributes.key?(:object_id)
|
60
60
|
self.object_id = attributes[:object_id]
|
61
|
-
else
|
62
|
-
self.object_id = nil
|
63
61
|
end
|
64
62
|
|
65
63
|
if attributes.key?(:position)
|
66
64
|
self.position = attributes[:position]
|
67
|
-
else
|
68
|
-
self.position = nil
|
69
65
|
end
|
70
66
|
end
|
71
67
|
|
68
|
+
# Custom attribute writer method with validation
|
69
|
+
# @param [Object] position Value to be assigned
|
70
|
+
def position=(position)
|
71
|
+
if position.nil?
|
72
|
+
raise ArgumentError, 'position cannot be nil'
|
73
|
+
end
|
74
|
+
|
75
|
+
if position < 0
|
76
|
+
raise ArgumentError, 'invalid value for "position", must be greater than or equal to 0.'
|
77
|
+
end
|
78
|
+
|
79
|
+
@position = position
|
80
|
+
end
|
81
|
+
|
72
82
|
# Checks equality by comparing each attribute.
|
73
83
|
# @param [Object] Object to be compared
|
74
84
|
def ==(other)
|
@@ -5,7 +5,7 @@ require 'time'
|
|
5
5
|
|
6
6
|
module Algolia
|
7
7
|
module Recommend
|
8
|
-
# Restrict [Dynamic Re-
|
8
|
+
# Restrict [Dynamic Re-Ranking](https://www.algolia.com/doc/guides/algolia-ai/re-ranking/) to records that match these filters.
|
9
9
|
module ReRankingApplyFilter
|
10
10
|
class << self
|
11
11
|
# List of class defined in oneOf (OpenAPI v3)
|
@@ -5,15 +5,14 @@ require 'time'
|
|
5
5
|
|
6
6
|
module Algolia
|
7
7
|
module Recommend
|
8
|
-
#
|
9
|
-
class
|
8
|
+
# Recommend rule.
|
9
|
+
class RecommendRule
|
10
10
|
attr_accessor :_metadata
|
11
11
|
|
12
|
-
# Unique identifier
|
12
|
+
# Unique identifier of a rule object.
|
13
13
|
attr_accessor :object_id
|
14
14
|
|
15
|
-
|
16
|
-
attr_accessor :conditions
|
15
|
+
attr_accessor :condition
|
17
16
|
|
18
17
|
attr_accessor :consequence
|
19
18
|
|
@@ -28,7 +27,7 @@ module Algolia
|
|
28
27
|
{
|
29
28
|
:_metadata => :_metadata,
|
30
29
|
:object_id => :objectID,
|
31
|
-
:
|
30
|
+
:condition => :condition,
|
32
31
|
:consequence => :consequence,
|
33
32
|
:description => :description,
|
34
33
|
:enabled => :enabled
|
@@ -43,9 +42,9 @@ module Algolia
|
|
43
42
|
# Attribute type mapping.
|
44
43
|
def self.types_mapping
|
45
44
|
{
|
46
|
-
:_metadata => :
|
45
|
+
:_metadata => :RecommendRuleMetadata,
|
47
46
|
:object_id => :String,
|
48
|
-
:
|
47
|
+
:condition => :Condition,
|
49
48
|
:consequence => :Consequence,
|
50
49
|
:description => :String,
|
51
50
|
:enabled => :Boolean
|
@@ -61,14 +60,14 @@ module Algolia
|
|
61
60
|
# @param [Hash] attributes Model attributes in the form of hash
|
62
61
|
def initialize(attributes = {})
|
63
62
|
unless attributes.is_a?(Hash)
|
64
|
-
raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::
|
63
|
+
raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::RecommendRule` initialize method"
|
65
64
|
end
|
66
65
|
|
67
66
|
# check to see if the attribute exists and convert string to symbol for hash key
|
68
67
|
attributes = attributes.each_with_object({}) do |(k, v), h|
|
69
68
|
unless self.class.attribute_map.key?(k.to_sym)
|
70
69
|
raise ArgumentError,
|
71
|
-
"`#{k}` is not a valid attribute in `Algolia::
|
70
|
+
"`#{k}` is not a valid attribute in `Algolia::RecommendRule`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
72
71
|
end
|
73
72
|
|
74
73
|
h[k.to_sym] = v
|
@@ -80,14 +79,10 @@ module Algolia
|
|
80
79
|
|
81
80
|
if attributes.key?(:object_id)
|
82
81
|
self.object_id = attributes[:object_id]
|
83
|
-
else
|
84
|
-
self.object_id = nil
|
85
82
|
end
|
86
83
|
|
87
|
-
if attributes.key?(:
|
88
|
-
|
89
|
-
self.conditions = value
|
90
|
-
end
|
84
|
+
if attributes.key?(:condition)
|
85
|
+
self.condition = attributes[:condition]
|
91
86
|
end
|
92
87
|
|
93
88
|
if attributes.key?(:consequence)
|
@@ -111,7 +106,7 @@ module Algolia
|
|
111
106
|
self.class == other.class &&
|
112
107
|
_metadata == other._metadata &&
|
113
108
|
object_id == other.object_id &&
|
114
|
-
|
109
|
+
condition == other.condition &&
|
115
110
|
consequence == other.consequence &&
|
116
111
|
description == other.description &&
|
117
112
|
enabled == other.enabled
|
@@ -126,7 +121,7 @@ module Algolia
|
|
126
121
|
# Calculates hash code according to all attributes.
|
127
122
|
# @return [Integer] Hash code
|
128
123
|
def hash
|
129
|
-
[_metadata, object_id,
|
124
|
+
[_metadata, object_id, condition, consequence, description, enabled].hash
|
130
125
|
end
|
131
126
|
|
132
127
|
# Builds the object from hash
|
@@ -5,8 +5,9 @@ require 'time'
|
|
5
5
|
|
6
6
|
module Algolia
|
7
7
|
module Recommend
|
8
|
-
|
9
|
-
|
8
|
+
# Rule metadata.
|
9
|
+
class RecommendRuleMetadata
|
10
|
+
# Date and time when the object was updated, in RFC 3339 format.
|
10
11
|
attr_accessor :last_update
|
11
12
|
|
12
13
|
# Attribute mapping from ruby-style variable name to JSON key.
|
@@ -37,14 +38,14 @@ module Algolia
|
|
37
38
|
# @param [Hash] attributes Model attributes in the form of hash
|
38
39
|
def initialize(attributes = {})
|
39
40
|
unless attributes.is_a?(Hash)
|
40
|
-
raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::
|
41
|
+
raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::RecommendRuleMetadata` initialize method"
|
41
42
|
end
|
42
43
|
|
43
44
|
# check to see if the attribute exists and convert string to symbol for hash key
|
44
45
|
attributes = attributes.each_with_object({}) do |(k, v), h|
|
45
46
|
unless self.class.attribute_map.key?(k.to_sym)
|
46
47
|
raise ArgumentError,
|
47
|
-
"`#{k}` is not a valid attribute in `Algolia::
|
48
|
+
"`#{k}` is not a valid attribute in `Algolia::RecommendRuleMetadata`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
48
49
|
end
|
49
50
|
|
50
51
|
h[k.to_sym] = v
|