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
@@ -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, query, params].hash
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
- :RecommendationsQuery,
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, query, params].hash
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
@@ -5,11 +5,9 @@ require 'time'
5
5
 
6
6
  module Algolia
7
7
  module Recommend
8
- class BaseRecommendedForYouQuery
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
- :query_parameters => :RecommendedForYouQueryParameters,
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::BaseRecommendedForYouQuery` initialize method"
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::BaseRecommendedForYouQuery`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
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, query_parameters, fallback_parameters].hash
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
- # Recommendations with a confidence score lower than `threshold` won't appear in results. > **Note**: Each recommendation has a confidence score of 0 to 100. The closer the score is to 100, the more relevant the recommendations are.
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. If 0, all recommendations will be returned.
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 => :Integer,
67
+ :threshold => :Float,
68
68
  :max_recommendations => :Integer,
69
+ :query_parameters => :SearchParams,
69
70
  :model => :RecommendedForYouModel,
70
- :query_parameters => :RecommendedForYouQueryParameters,
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
- :BaseRecommendedForYouQuery
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, model, query_parameters, fallback_parameters].hash
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 RecommendationModels
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, BOUGHT_TOGETHER].freeze
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 RecommendationModels.all_vars.include?(value)
26
+ return value if RelatedModel.all_vars.include?(value)
28
27
 
29
- raise "Invalid ENUM value #{value} for class #RecommendationModels"
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 Edit
9
- attr_accessor :type
8
+ class RelatedProducts
9
+ attr_accessor :model
10
10
 
11
- # Text or patterns to remove from the query string.
12
- attr_accessor :delete
11
+ # Unique record identifier.
12
+ attr_accessor :object_id
13
13
 
14
- # Text to be added in place of the deleted text inside the query string.
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
- :type => :type,
43
- :delete => :delete,
44
- :insert => :insert
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
- :type => :EditType,
57
- :delete => :String,
58
- :insert => :String
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::Edit` initialize method"
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::Edit`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
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?(:type)
85
- self.type = attributes[:type]
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?(:delete)
89
- self.delete = attributes[:delete]
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?(:insert)
93
- self.insert = attributes[:insert]
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
- type == other.type &&
104
- delete == other.delete &&
105
- insert == other.insert
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
- [type, delete, insert].hash
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 RecommendationsQuery
9
- # Index name.
8
+ class RelatedQuery
9
+ # Index name (case-sensitive).
10
10
  attr_accessor :index_name
11
11
 
12
- # Recommendations with a confidence score lower than `threshold` won't appear in results. > **Note**: Each recommendation has a confidence score of 0 to 100. The closer the score is to 100, the more relevant the recommendations are.
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. If 0, all recommendations will be returned.
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 => :Integer,
71
+ :threshold => :Float,
72
72
  :max_recommendations => :Integer,
73
- :model => :RecommendationModels,
73
+ :query_parameters => :SearchParams,
74
+ :model => :RelatedModel,
74
75
  :object_id => :String,
75
- :query_parameters => :SearchParamsObject,
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
- :BaseRecommendationsQuery
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::RecommendationsQuery` initialize method"
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::RecommendationsQuery`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
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, query_parameters, fallback_parameters].hash
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