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
@@ -8,18 +8,10 @@ module Algolia
|
|
8
8
|
class RecommendationsHits
|
9
9
|
attr_accessor :hits
|
10
10
|
|
11
|
-
# Search query.
|
12
|
-
attr_accessor :query
|
13
|
-
|
14
|
-
# URL-encoded string of all search parameters.
|
15
|
-
attr_accessor :params
|
16
|
-
|
17
11
|
# Attribute mapping from ruby-style variable name to JSON key.
|
18
12
|
def self.attribute_map
|
19
13
|
{
|
20
|
-
:hits => :hits
|
21
|
-
:query => :query,
|
22
|
-
:params => :params
|
14
|
+
:hits => :hits
|
23
15
|
}
|
24
16
|
end
|
25
17
|
|
@@ -31,9 +23,7 @@ module Algolia
|
|
31
23
|
# Attribute type mapping.
|
32
24
|
def self.types_mapping
|
33
25
|
{
|
34
|
-
:hits => :'Array<RecommendationsHit>'
|
35
|
-
:query => :String,
|
36
|
-
:params => :String
|
26
|
+
:hits => :'Array<RecommendationsHit>'
|
37
27
|
}
|
38
28
|
end
|
39
29
|
|
@@ -66,14 +56,6 @@ module Algolia
|
|
66
56
|
else
|
67
57
|
self.hits = nil
|
68
58
|
end
|
69
|
-
|
70
|
-
if attributes.key?(:query)
|
71
|
-
self.query = attributes[:query]
|
72
|
-
end
|
73
|
-
|
74
|
-
if attributes.key?(:params)
|
75
|
-
self.params = attributes[:params]
|
76
|
-
end
|
77
59
|
end
|
78
60
|
|
79
61
|
# Checks equality by comparing each attribute.
|
@@ -82,9 +64,7 @@ module Algolia
|
|
82
64
|
return true if equal?(other)
|
83
65
|
|
84
66
|
self.class == other.class &&
|
85
|
-
hits == other.hits
|
86
|
-
query == other.query &&
|
87
|
-
params == other.params
|
67
|
+
hits == other.hits
|
88
68
|
end
|
89
69
|
|
90
70
|
# @see the `==` method
|
@@ -96,7 +76,7 @@ module Algolia
|
|
96
76
|
# Calculates hash code according to all attributes.
|
97
77
|
# @return [Integer] Hash code
|
98
78
|
def hash
|
99
|
-
[hits
|
79
|
+
[hits].hash
|
100
80
|
end
|
101
81
|
|
102
82
|
# Builds the object from hash
|
@@ -10,8 +10,10 @@ module Algolia
|
|
10
10
|
# List of class defined in oneOf (OpenAPI v3)
|
11
11
|
def openapi_one_of
|
12
12
|
[
|
13
|
-
:
|
13
|
+
:BoughtTogetherQuery,
|
14
|
+
:LookingSimilarQuery,
|
14
15
|
:RecommendedForYouQuery,
|
16
|
+
:RelatedQuery,
|
15
17
|
:TrendingFacetsQuery,
|
16
18
|
:TrendingItemsQuery
|
17
19
|
]
|
@@ -89,12 +89,6 @@ module Algolia
|
|
89
89
|
|
90
90
|
attr_accessor :hits
|
91
91
|
|
92
|
-
# Search query.
|
93
|
-
attr_accessor :query
|
94
|
-
|
95
|
-
# URL-encoded string of all search parameters.
|
96
|
-
attr_accessor :params
|
97
|
-
|
98
92
|
# Attribute mapping from ruby-style variable name to JSON key.
|
99
93
|
def self.attribute_map
|
100
94
|
{
|
@@ -126,9 +120,7 @@ module Algolia
|
|
126
120
|
:server_used => :serverUsed,
|
127
121
|
:user_data => :userData,
|
128
122
|
:query_id => :queryID,
|
129
|
-
:hits => :hits
|
130
|
-
:query => :query,
|
131
|
-
:params => :params
|
123
|
+
:hits => :hits
|
132
124
|
}
|
133
125
|
end
|
134
126
|
|
@@ -168,9 +160,7 @@ module Algolia
|
|
168
160
|
:server_used => :String,
|
169
161
|
:user_data => :Object,
|
170
162
|
:query_id => :String,
|
171
|
-
:hits => :'Array<RecommendationsHit>'
|
172
|
-
:query => :String,
|
173
|
-
:params => :String
|
163
|
+
:hits => :'Array<RecommendationsHit>'
|
174
164
|
}
|
175
165
|
end
|
176
166
|
|
@@ -337,14 +327,6 @@ module Algolia
|
|
337
327
|
else
|
338
328
|
self.hits = nil
|
339
329
|
end
|
340
|
-
|
341
|
-
if attributes.key?(:query)
|
342
|
-
self.query = attributes[:query]
|
343
|
-
end
|
344
|
-
|
345
|
-
if attributes.key?(:params)
|
346
|
-
self.params = attributes[:params]
|
347
|
-
end
|
348
330
|
end
|
349
331
|
|
350
332
|
# Custom attribute writer method with validation
|
@@ -442,9 +424,7 @@ module Algolia
|
|
442
424
|
server_used == other.server_used &&
|
443
425
|
user_data == other.user_data &&
|
444
426
|
query_id == other.query_id &&
|
445
|
-
hits == other.hits
|
446
|
-
query == other.query &&
|
447
|
-
params == other.params
|
427
|
+
hits == other.hits
|
448
428
|
end
|
449
429
|
|
450
430
|
# @see the `==` method
|
@@ -457,7 +437,7 @@ module Algolia
|
|
457
437
|
# @return [Integer] Hash code
|
458
438
|
def hash
|
459
439
|
[ab_test_id, ab_test_variant_id, around_lat_lng, automatic_radius, exhaustive, exhaustive_facets_count, exhaustive_nb_hits, exhaustive_typo, facets, facets_stats,
|
460
|
-
hits_per_page, index, index_used, message, nb_hits, nb_pages, nb_sorted_hits, page, parsed_query, processing_time_ms, processing_timings_ms, query_after_removal, redirect, rendering_content, server_time_ms, server_used, user_data, query_id, hits
|
440
|
+
hits_per_page, index, index_used, message, nb_hits, nb_pages, nb_sorted_hits, page, parsed_query, processing_time_ms, processing_timings_ms, query_after_removal, redirect, rendering_content, server_time_ms, server_used, user_data, query_id, hits].hash
|
461
441
|
end
|
462
442
|
|
463
443
|
# Builds the object from hash
|
data/lib/algolia/models/recommend/{base_recommended_for_you_query.rb → recommended_for_you.rb}
RENAMED
@@ -5,11 +5,9 @@ require 'time'
|
|
5
5
|
|
6
6
|
module Algolia
|
7
7
|
module Recommend
|
8
|
-
class
|
8
|
+
class RecommendedForYou
|
9
9
|
attr_accessor :model
|
10
10
|
|
11
|
-
attr_accessor :query_parameters
|
12
|
-
|
13
11
|
attr_accessor :fallback_parameters
|
14
12
|
|
15
13
|
class EnumAttributeValidator
|
@@ -38,7 +36,6 @@ module Algolia
|
|
38
36
|
def self.attribute_map
|
39
37
|
{
|
40
38
|
:model => :model,
|
41
|
-
:query_parameters => :queryParameters,
|
42
39
|
:fallback_parameters => :fallbackParameters
|
43
40
|
}
|
44
41
|
end
|
@@ -52,8 +49,7 @@ module Algolia
|
|
52
49
|
def self.types_mapping
|
53
50
|
{
|
54
51
|
:model => :RecommendedForYouModel,
|
55
|
-
:
|
56
|
-
:fallback_parameters => :RecommendedForYouQueryParameters
|
52
|
+
:fallback_parameters => :FallbackParams
|
57
53
|
}
|
58
54
|
end
|
59
55
|
|
@@ -66,14 +62,14 @@ module Algolia
|
|
66
62
|
# @param [Hash] attributes Model attributes in the form of hash
|
67
63
|
def initialize(attributes = {})
|
68
64
|
unless attributes.is_a?(Hash)
|
69
|
-
raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::
|
65
|
+
raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::RecommendedForYou` initialize method"
|
70
66
|
end
|
71
67
|
|
72
68
|
# check to see if the attribute exists and convert string to symbol for hash key
|
73
69
|
attributes = attributes.each_with_object({}) do |(k, v), h|
|
74
70
|
unless self.class.attribute_map.key?(k.to_sym)
|
75
71
|
raise ArgumentError,
|
76
|
-
"`#{k}` is not a valid attribute in `Algolia::
|
72
|
+
"`#{k}` is not a valid attribute in `Algolia::RecommendedForYou`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
77
73
|
end
|
78
74
|
|
79
75
|
h[k.to_sym] = v
|
@@ -85,10 +81,6 @@ module Algolia
|
|
85
81
|
self.model = nil
|
86
82
|
end
|
87
83
|
|
88
|
-
if attributes.key?(:query_parameters)
|
89
|
-
self.query_parameters = attributes[:query_parameters]
|
90
|
-
end
|
91
|
-
|
92
84
|
if attributes.key?(:fallback_parameters)
|
93
85
|
self.fallback_parameters = attributes[:fallback_parameters]
|
94
86
|
end
|
@@ -101,7 +93,6 @@ module Algolia
|
|
101
93
|
|
102
94
|
self.class == other.class &&
|
103
95
|
model == other.model &&
|
104
|
-
query_parameters == other.query_parameters &&
|
105
96
|
fallback_parameters == other.fallback_parameters
|
106
97
|
end
|
107
98
|
|
@@ -114,7 +105,7 @@ module Algolia
|
|
114
105
|
# Calculates hash code according to all attributes.
|
115
106
|
# @return [Integer] Hash code
|
116
107
|
def hash
|
117
|
-
[model,
|
108
|
+
[model, fallback_parameters].hash
|
118
109
|
end
|
119
110
|
|
120
111
|
# Builds the object from hash
|
@@ -6,19 +6,19 @@ require 'time'
|
|
6
6
|
module Algolia
|
7
7
|
module Recommend
|
8
8
|
class RecommendedForYouQuery
|
9
|
-
# Index name.
|
9
|
+
# Index name (case-sensitive).
|
10
10
|
attr_accessor :index_name
|
11
11
|
|
12
|
-
#
|
12
|
+
# Minimum score a recommendation must have to be included in the response.
|
13
13
|
attr_accessor :threshold
|
14
14
|
|
15
|
-
# Maximum number of recommendations to retrieve.
|
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
16
|
attr_accessor :max_recommendations
|
17
17
|
|
18
|
-
attr_accessor :model
|
19
|
-
|
20
18
|
attr_accessor :query_parameters
|
21
19
|
|
20
|
+
attr_accessor :model
|
21
|
+
|
22
22
|
attr_accessor :fallback_parameters
|
23
23
|
|
24
24
|
class EnumAttributeValidator
|
@@ -49,8 +49,8 @@ module Algolia
|
|
49
49
|
:index_name => :indexName,
|
50
50
|
:threshold => :threshold,
|
51
51
|
:max_recommendations => :maxRecommendations,
|
52
|
-
:model => :model,
|
53
52
|
:query_parameters => :queryParameters,
|
53
|
+
:model => :model,
|
54
54
|
:fallback_parameters => :fallbackParameters
|
55
55
|
}
|
56
56
|
end
|
@@ -64,11 +64,11 @@ module Algolia
|
|
64
64
|
def self.types_mapping
|
65
65
|
{
|
66
66
|
:index_name => :String,
|
67
|
-
:threshold => :
|
67
|
+
:threshold => :Float,
|
68
68
|
:max_recommendations => :Integer,
|
69
|
+
:query_parameters => :SearchParams,
|
69
70
|
:model => :RecommendedForYouModel,
|
70
|
-
:
|
71
|
-
:fallback_parameters => :RecommendedForYouQueryParameters
|
71
|
+
:fallback_parameters => :FallbackParams
|
72
72
|
}
|
73
73
|
end
|
74
74
|
|
@@ -81,7 +81,7 @@ module Algolia
|
|
81
81
|
def self.openapi_all_of
|
82
82
|
[
|
83
83
|
:BaseRecommendRequest,
|
84
|
-
:
|
84
|
+
:RecommendedForYou
|
85
85
|
]
|
86
86
|
end
|
87
87
|
|
@@ -110,22 +110,24 @@ module Algolia
|
|
110
110
|
|
111
111
|
if attributes.key?(:threshold)
|
112
112
|
self.threshold = attributes[:threshold]
|
113
|
+
else
|
114
|
+
self.threshold = nil
|
113
115
|
end
|
114
116
|
|
115
117
|
if attributes.key?(:max_recommendations)
|
116
118
|
self.max_recommendations = attributes[:max_recommendations]
|
117
119
|
end
|
118
120
|
|
121
|
+
if attributes.key?(:query_parameters)
|
122
|
+
self.query_parameters = attributes[:query_parameters]
|
123
|
+
end
|
124
|
+
|
119
125
|
if attributes.key?(:model)
|
120
126
|
self.model = attributes[:model]
|
121
127
|
else
|
122
128
|
self.model = nil
|
123
129
|
end
|
124
130
|
|
125
|
-
if attributes.key?(:query_parameters)
|
126
|
-
self.query_parameters = attributes[:query_parameters]
|
127
|
-
end
|
128
|
-
|
129
131
|
if attributes.key?(:fallback_parameters)
|
130
132
|
self.fallback_parameters = attributes[:fallback_parameters]
|
131
133
|
end
|
@@ -149,6 +151,24 @@ module Algolia
|
|
149
151
|
@threshold = threshold
|
150
152
|
end
|
151
153
|
|
154
|
+
# Custom attribute writer method with validation
|
155
|
+
# @param [Object] max_recommendations Value to be assigned
|
156
|
+
def max_recommendations=(max_recommendations)
|
157
|
+
if max_recommendations.nil?
|
158
|
+
raise ArgumentError, 'max_recommendations cannot be nil'
|
159
|
+
end
|
160
|
+
|
161
|
+
if max_recommendations > 1000
|
162
|
+
raise ArgumentError, 'invalid value for "max_recommendations", must be smaller than or equal to 1000.'
|
163
|
+
end
|
164
|
+
|
165
|
+
if max_recommendations < 1
|
166
|
+
raise ArgumentError, 'invalid value for "max_recommendations", must be greater than or equal to 1.'
|
167
|
+
end
|
168
|
+
|
169
|
+
@max_recommendations = max_recommendations
|
170
|
+
end
|
171
|
+
|
152
172
|
# Checks equality by comparing each attribute.
|
153
173
|
# @param [Object] Object to be compared
|
154
174
|
def ==(other)
|
@@ -158,8 +178,8 @@ module Algolia
|
|
158
178
|
index_name == other.index_name &&
|
159
179
|
threshold == other.threshold &&
|
160
180
|
max_recommendations == other.max_recommendations &&
|
161
|
-
model == other.model &&
|
162
181
|
query_parameters == other.query_parameters &&
|
182
|
+
model == other.model &&
|
163
183
|
fallback_parameters == other.fallback_parameters
|
164
184
|
end
|
165
185
|
|
@@ -172,7 +192,7 @@ module Algolia
|
|
172
192
|
# Calculates hash code according to all attributes.
|
173
193
|
# @return [Integer] Hash code
|
174
194
|
def hash
|
175
|
-
[index_name, threshold, max_recommendations,
|
195
|
+
[index_name, threshold, max_recommendations, query_parameters, model, fallback_parameters].hash
|
176
196
|
end
|
177
197
|
|
178
198
|
# Builds the object from hash
|
@@ -5,12 +5,11 @@ require 'time'
|
|
5
5
|
|
6
6
|
module Algolia
|
7
7
|
module Recommend
|
8
|
-
class
|
8
|
+
class RelatedModel
|
9
9
|
RELATED_PRODUCTS = "related-products".freeze
|
10
|
-
BOUGHT_TOGETHER = "bought-together".freeze
|
11
10
|
|
12
11
|
def self.all_vars
|
13
|
-
@all_vars ||= [RELATED_PRODUCTS
|
12
|
+
@all_vars ||= [RELATED_PRODUCTS].freeze
|
14
13
|
end
|
15
14
|
|
16
15
|
# Builds the enum from string
|
@@ -24,9 +23,9 @@ module Algolia
|
|
24
23
|
# @param [String] The enum value in the form of the string
|
25
24
|
# @return [String] The enum value
|
26
25
|
def build_from_hash(value)
|
27
|
-
return value if
|
26
|
+
return value if RelatedModel.all_vars.include?(value)
|
28
27
|
|
29
|
-
raise "Invalid ENUM value #{value} for class #
|
28
|
+
raise "Invalid ENUM value #{value} for class #RelatedModel"
|
30
29
|
end
|
31
30
|
end
|
32
31
|
end
|
@@ -5,14 +5,13 @@ require 'time'
|
|
5
5
|
|
6
6
|
module Algolia
|
7
7
|
module Recommend
|
8
|
-
class
|
9
|
-
attr_accessor :
|
8
|
+
class RelatedProducts
|
9
|
+
attr_accessor :model
|
10
10
|
|
11
|
-
#
|
12
|
-
attr_accessor :
|
11
|
+
# Unique record identifier.
|
12
|
+
attr_accessor :object_id
|
13
13
|
|
14
|
-
|
15
|
-
attr_accessor :insert
|
14
|
+
attr_accessor :fallback_parameters
|
16
15
|
|
17
16
|
class EnumAttributeValidator
|
18
17
|
attr_reader :datatype
|
@@ -39,9 +38,9 @@ module Algolia
|
|
39
38
|
# Attribute mapping from ruby-style variable name to JSON key.
|
40
39
|
def self.attribute_map
|
41
40
|
{
|
42
|
-
:
|
43
|
-
:
|
44
|
-
:
|
41
|
+
:model => :model,
|
42
|
+
:object_id => :objectID,
|
43
|
+
:fallback_parameters => :fallbackParameters
|
45
44
|
}
|
46
45
|
end
|
47
46
|
|
@@ -53,9 +52,9 @@ module Algolia
|
|
53
52
|
# Attribute type mapping.
|
54
53
|
def self.types_mapping
|
55
54
|
{
|
56
|
-
:
|
57
|
-
:
|
58
|
-
:
|
55
|
+
:model => :RelatedModel,
|
56
|
+
:object_id => :String,
|
57
|
+
:fallback_parameters => :FallbackParams
|
59
58
|
}
|
60
59
|
end
|
61
60
|
|
@@ -68,29 +67,33 @@ module Algolia
|
|
68
67
|
# @param [Hash] attributes Model attributes in the form of hash
|
69
68
|
def initialize(attributes = {})
|
70
69
|
unless attributes.is_a?(Hash)
|
71
|
-
raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::
|
70
|
+
raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::RelatedProducts` initialize method"
|
72
71
|
end
|
73
72
|
|
74
73
|
# check to see if the attribute exists and convert string to symbol for hash key
|
75
74
|
attributes = attributes.each_with_object({}) do |(k, v), h|
|
76
75
|
unless self.class.attribute_map.key?(k.to_sym)
|
77
76
|
raise ArgumentError,
|
78
|
-
"`#{k}` is not a valid attribute in `Algolia::
|
77
|
+
"`#{k}` is not a valid attribute in `Algolia::RelatedProducts`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
79
78
|
end
|
80
79
|
|
81
80
|
h[k.to_sym] = v
|
82
81
|
end
|
83
82
|
|
84
|
-
if attributes.key?(:
|
85
|
-
self.
|
83
|
+
if attributes.key?(:model)
|
84
|
+
self.model = attributes[:model]
|
85
|
+
else
|
86
|
+
self.model = nil
|
86
87
|
end
|
87
88
|
|
88
|
-
if attributes.key?(:
|
89
|
-
self.
|
89
|
+
if attributes.key?(:object_id)
|
90
|
+
self.object_id = attributes[:object_id]
|
91
|
+
else
|
92
|
+
self.object_id = nil
|
90
93
|
end
|
91
94
|
|
92
|
-
if attributes.key?(:
|
93
|
-
self.
|
95
|
+
if attributes.key?(:fallback_parameters)
|
96
|
+
self.fallback_parameters = attributes[:fallback_parameters]
|
94
97
|
end
|
95
98
|
end
|
96
99
|
|
@@ -100,9 +103,9 @@ module Algolia
|
|
100
103
|
return true if equal?(other)
|
101
104
|
|
102
105
|
self.class == other.class &&
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
+
model == other.model &&
|
107
|
+
object_id == other.object_id &&
|
108
|
+
fallback_parameters == other.fallback_parameters
|
106
109
|
end
|
107
110
|
|
108
111
|
# @see the `==` method
|
@@ -114,7 +117,7 @@ module Algolia
|
|
114
117
|
# Calculates hash code according to all attributes.
|
115
118
|
# @return [Integer] Hash code
|
116
119
|
def hash
|
117
|
-
[
|
120
|
+
[model, object_id, fallback_parameters].hash
|
118
121
|
end
|
119
122
|
|
120
123
|
# Builds the object from hash
|
@@ -5,23 +5,23 @@ require 'time'
|
|
5
5
|
|
6
6
|
module Algolia
|
7
7
|
module Recommend
|
8
|
-
class
|
9
|
-
# Index name.
|
8
|
+
class RelatedQuery
|
9
|
+
# Index name (case-sensitive).
|
10
10
|
attr_accessor :index_name
|
11
11
|
|
12
|
-
#
|
12
|
+
# Minimum score a recommendation must have to be included in the response.
|
13
13
|
attr_accessor :threshold
|
14
14
|
|
15
|
-
# Maximum number of recommendations to retrieve.
|
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
16
|
attr_accessor :max_recommendations
|
17
17
|
|
18
|
+
attr_accessor :query_parameters
|
19
|
+
|
18
20
|
attr_accessor :model
|
19
21
|
|
20
22
|
# Unique record identifier.
|
21
23
|
attr_accessor :object_id
|
22
24
|
|
23
|
-
attr_accessor :query_parameters
|
24
|
-
|
25
25
|
attr_accessor :fallback_parameters
|
26
26
|
|
27
27
|
class EnumAttributeValidator
|
@@ -52,9 +52,9 @@ module Algolia
|
|
52
52
|
:index_name => :indexName,
|
53
53
|
:threshold => :threshold,
|
54
54
|
:max_recommendations => :maxRecommendations,
|
55
|
+
:query_parameters => :queryParameters,
|
55
56
|
:model => :model,
|
56
57
|
:object_id => :objectID,
|
57
|
-
:query_parameters => :queryParameters,
|
58
58
|
:fallback_parameters => :fallbackParameters
|
59
59
|
}
|
60
60
|
end
|
@@ -68,12 +68,12 @@ module Algolia
|
|
68
68
|
def self.types_mapping
|
69
69
|
{
|
70
70
|
:index_name => :String,
|
71
|
-
:threshold => :
|
71
|
+
:threshold => :Float,
|
72
72
|
:max_recommendations => :Integer,
|
73
|
-
:
|
73
|
+
:query_parameters => :SearchParams,
|
74
|
+
:model => :RelatedModel,
|
74
75
|
:object_id => :String,
|
75
|
-
:
|
76
|
-
:fallback_parameters => :SearchParamsObject
|
76
|
+
:fallback_parameters => :FallbackParams
|
77
77
|
}
|
78
78
|
end
|
79
79
|
|
@@ -86,7 +86,7 @@ module Algolia
|
|
86
86
|
def self.openapi_all_of
|
87
87
|
[
|
88
88
|
:BaseRecommendRequest,
|
89
|
-
:
|
89
|
+
:RelatedProducts
|
90
90
|
]
|
91
91
|
end
|
92
92
|
|
@@ -94,14 +94,14 @@ module Algolia
|
|
94
94
|
# @param [Hash] attributes Model attributes in the form of hash
|
95
95
|
def initialize(attributes = {})
|
96
96
|
unless attributes.is_a?(Hash)
|
97
|
-
raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::
|
97
|
+
raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::RelatedQuery` initialize method"
|
98
98
|
end
|
99
99
|
|
100
100
|
# check to see if the attribute exists and convert string to symbol for hash key
|
101
101
|
attributes = attributes.each_with_object({}) do |(k, v), h|
|
102
102
|
unless self.class.attribute_map.key?(k.to_sym)
|
103
103
|
raise ArgumentError,
|
104
|
-
"`#{k}` is not a valid attribute in `Algolia::
|
104
|
+
"`#{k}` is not a valid attribute in `Algolia::RelatedQuery`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
105
105
|
end
|
106
106
|
|
107
107
|
h[k.to_sym] = v
|
@@ -115,12 +115,18 @@ module Algolia
|
|
115
115
|
|
116
116
|
if attributes.key?(:threshold)
|
117
117
|
self.threshold = attributes[:threshold]
|
118
|
+
else
|
119
|
+
self.threshold = nil
|
118
120
|
end
|
119
121
|
|
120
122
|
if attributes.key?(:max_recommendations)
|
121
123
|
self.max_recommendations = attributes[:max_recommendations]
|
122
124
|
end
|
123
125
|
|
126
|
+
if attributes.key?(:query_parameters)
|
127
|
+
self.query_parameters = attributes[:query_parameters]
|
128
|
+
end
|
129
|
+
|
124
130
|
if attributes.key?(:model)
|
125
131
|
self.model = attributes[:model]
|
126
132
|
else
|
@@ -133,10 +139,6 @@ module Algolia
|
|
133
139
|
self.object_id = nil
|
134
140
|
end
|
135
141
|
|
136
|
-
if attributes.key?(:query_parameters)
|
137
|
-
self.query_parameters = attributes[:query_parameters]
|
138
|
-
end
|
139
|
-
|
140
142
|
if attributes.key?(:fallback_parameters)
|
141
143
|
self.fallback_parameters = attributes[:fallback_parameters]
|
142
144
|
end
|
@@ -160,6 +162,24 @@ module Algolia
|
|
160
162
|
@threshold = threshold
|
161
163
|
end
|
162
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
|
+
|
163
183
|
# Checks equality by comparing each attribute.
|
164
184
|
# @param [Object] Object to be compared
|
165
185
|
def ==(other)
|
@@ -169,9 +189,9 @@ module Algolia
|
|
169
189
|
index_name == other.index_name &&
|
170
190
|
threshold == other.threshold &&
|
171
191
|
max_recommendations == other.max_recommendations &&
|
192
|
+
query_parameters == other.query_parameters &&
|
172
193
|
model == other.model &&
|
173
194
|
object_id == other.object_id &&
|
174
|
-
query_parameters == other.query_parameters &&
|
175
195
|
fallback_parameters == other.fallback_parameters
|
176
196
|
end
|
177
197
|
|
@@ -184,7 +204,7 @@ module Algolia
|
|
184
204
|
# Calculates hash code according to all attributes.
|
185
205
|
# @return [Integer] Hash code
|
186
206
|
def hash
|
187
|
-
[index_name, threshold, max_recommendations, model, object_id,
|
207
|
+
[index_name, threshold, max_recommendations, query_parameters, model, object_id, fallback_parameters].hash
|
188
208
|
end
|
189
209
|
|
190
210
|
# Builds the object from hash
|