Class: Algolia::RecommendClient

Inherits:
Object
  • Object
show all
Defined in:
lib/algolia/api/recommend_client.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config = nil) ⇒ RecommendClient

Returns a new instance of RecommendClient.



7
8
9
10
11
12
13
# File 'lib/algolia/api/recommend_client.rb', line 7

def initialize(config = nil)
  raise '`config` is missing.' if config.nil?
  raise '`app_id` is missing.' if config.app_id.nil? || config.app_id == ''
  raise '`api_key` is missing.' if config.api_key.nil? || config.api_key == ''

  @api_client = Algolia::ApiClient.new(config)
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



5
6
7
# File 'lib/algolia/api/recommend_client.rb', line 5

def api_client
  @api_client
end

Class Method Details

.create(app_id, api_key, opts = {}) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/algolia/api/recommend_client.rb', line 15

def self.create(app_id, api_key, opts = {})
  hosts = []
  hosts << Transport::StatefulHost.new("#{app_id}-dsn.algolia.net", accept: CallType::READ)
  hosts << Transport::StatefulHost.new("#{app_id}.algolia.net", accept: CallType::WRITE)

  hosts += 1.upto(3).map do |i|
    Transport::StatefulHost.new("#{app_id}-#{i}.algolianet.com", accept: CallType::READ | CallType::WRITE)
  end.shuffle

  config = Algolia::Configuration.new(app_id, api_key, hosts, 'Recommend', opts)
  create_with_config(config)
end

.create_with_config(config) ⇒ Object



28
29
30
# File 'lib/algolia/api/recommend_client.rb', line 28

def self.create_with_config(config)
  new(config)
end

Instance Method Details

#custom_delete(path, parameters = nil, request_options = {}) ⇒ Object

Parameters:

  • path (String)

    Path of the endpoint, anything after &quot;/1&quot; must be specified. (required)

  • parameters (Hash<String, Object>) (defaults to: nil)

    Query parameters to apply to the current query.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (Object)


70
71
72
73
# File 'lib/algolia/api/recommend_client.rb', line 70

def custom_delete(path, parameters = nil, request_options = {})
  response = custom_delete_with_http_info(path, parameters, request_options)
  @api_client.deserialize(response.body, request_options[:debug_return_type] || 'Object')
end

#custom_delete_with_http_info(path, parameters = nil, request_options = {}) ⇒ Http::Response

Returns the response.

Parameters:

  • path (String)

    Path of the endpoint, anything after &quot;/1&quot; must be specified. (required)

  • parameters (Hash<String, Object>) (defaults to: nil)

    Query parameters to apply to the current query.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/algolia/api/recommend_client.rb', line 38

def custom_delete_with_http_info(path, parameters = nil, request_options = {})
  # verify the required parameter 'path' is set
  if @api_client.config.client_side_validation && path.nil?
    raise ArgumentError, "Parameter `path` is required when calling `custom_delete`."
  end

  path = '/1{path}'.sub('{' + 'path' + '}', path.to_s)
  query_params = {}
  query_params = query_params.merge(parameters) unless parameters.nil?
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :'RecommendClient.custom_delete',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:DELETE, path, new_options)
end

#custom_get(path, parameters = nil, request_options = {}) ⇒ Object

Parameters:

  • path (String)

    Path of the endpoint, anything after &quot;/1&quot; must be specified. (required)

  • parameters (Hash<String, Object>) (defaults to: nil)

    Query parameters to apply to the current query.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (Object)


113
114
115
116
# File 'lib/algolia/api/recommend_client.rb', line 113

def custom_get(path, parameters = nil, request_options = {})
  response = custom_get_with_http_info(path, parameters, request_options)
  @api_client.deserialize(response.body, request_options[:debug_return_type] || 'Object')
end

#custom_get_with_http_info(path, parameters = nil, request_options = {}) ⇒ Http::Response

Returns the response.

Parameters:

  • path (String)

    Path of the endpoint, anything after &quot;/1&quot; must be specified. (required)

  • parameters (Hash<String, Object>) (defaults to: nil)

    Query parameters to apply to the current query.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/algolia/api/recommend_client.rb', line 81

def custom_get_with_http_info(path, parameters = nil, request_options = {})
  # verify the required parameter 'path' is set
  if @api_client.config.client_side_validation && path.nil?
    raise ArgumentError, "Parameter `path` is required when calling `custom_get`."
  end

  path = '/1{path}'.sub('{' + 'path' + '}', path.to_s)
  query_params = {}
  query_params = query_params.merge(parameters) unless parameters.nil?
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :'RecommendClient.custom_get',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:GET, path, new_options)
end

#custom_post(path, parameters = nil, body = nil, request_options = {}) ⇒ Object

Parameters:

  • path (String)

    Path of the endpoint, anything after &quot;/1&quot; must be specified. (required)

  • parameters (Hash<String, Object>) (defaults to: nil)

    Query parameters to apply to the current query.

  • body (Object) (defaults to: nil)

    Parameters to send with the custom request.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (Object)


158
159
160
161
# File 'lib/algolia/api/recommend_client.rb', line 158

def custom_post(path, parameters = nil, body = nil, request_options = {})
  response = custom_post_with_http_info(path, parameters, body, request_options)
  @api_client.deserialize(response.body, request_options[:debug_return_type] || 'Object')
end

#custom_post_with_http_info(path, parameters = nil, body = nil, request_options = {}) ⇒ Http::Response

Returns the response.

Parameters:

  • path (String)

    Path of the endpoint, anything after &quot;/1&quot; must be specified. (required)

  • parameters (Hash<String, Object>) (defaults to: nil)

    Query parameters to apply to the current query.

  • body (Object) (defaults to: nil)

    Parameters to send with the custom request.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/algolia/api/recommend_client.rb', line 125

def custom_post_with_http_info(path, parameters = nil, body = nil, request_options = {})
  # verify the required parameter 'path' is set
  if @api_client.config.client_side_validation && path.nil?
    raise ArgumentError, "Parameter `path` is required when calling `custom_post`."
  end

  path = '/1{path}'.sub('{' + 'path' + '}', path.to_s)
  query_params = {}
  query_params = query_params.merge(parameters) unless parameters.nil?
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body] || @api_client.object_to_http_body(body)

  new_options = request_options.merge(
    :operation => :'RecommendClient.custom_post',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:POST, path, new_options)
end

#custom_put(path, parameters = nil, body = nil, request_options = {}) ⇒ Object

Parameters:

  • path (String)

    Path of the endpoint, anything after &quot;/1&quot; must be specified. (required)

  • parameters (Hash<String, Object>) (defaults to: nil)

    Query parameters to apply to the current query.

  • body (Object) (defaults to: nil)

    Parameters to send with the custom request.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (Object)


203
204
205
206
# File 'lib/algolia/api/recommend_client.rb', line 203

def custom_put(path, parameters = nil, body = nil, request_options = {})
  response = custom_put_with_http_info(path, parameters, body, request_options)
  @api_client.deserialize(response.body, request_options[:debug_return_type] || 'Object')
end

#custom_put_with_http_info(path, parameters = nil, body = nil, request_options = {}) ⇒ Http::Response

Returns the response.

Parameters:

  • path (String)

    Path of the endpoint, anything after &quot;/1&quot; must be specified. (required)

  • parameters (Hash<String, Object>) (defaults to: nil)

    Query parameters to apply to the current query.

  • body (Object) (defaults to: nil)

    Parameters to send with the custom request.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# File 'lib/algolia/api/recommend_client.rb', line 170

def custom_put_with_http_info(path, parameters = nil, body = nil, request_options = {})
  # verify the required parameter 'path' is set
  if @api_client.config.client_side_validation && path.nil?
    raise ArgumentError, "Parameter `path` is required when calling `custom_put`."
  end

  path = '/1{path}'.sub('{' + 'path' + '}', path.to_s)
  query_params = {}
  query_params = query_params.merge(parameters) unless parameters.nil?
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body] || @api_client.object_to_http_body(body)

  new_options = request_options.merge(
    :operation => :'RecommendClient.custom_put',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:PUT, path, new_options)
end

#delete_recommend_rule(index_name, model, object_id, request_options = {}) ⇒ DeletedAtResponse

Delete a [Recommend rule](www.algolia.com/doc/guides/algolia-recommend/how-to/rules/).

Required API Key ACLs:

- editSettings

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • model (RecommendModels)
  • object_id (String)

    Unique record (object) identifier. (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (DeletedAtResponse)


261
262
263
264
# File 'lib/algolia/api/recommend_client.rb', line 261

def delete_recommend_rule(index_name, model, object_id, request_options = {})
  response = delete_recommend_rule_with_http_info(index_name, model, object_id, request_options)
  @api_client.deserialize(response.body, request_options[:debug_return_type] || 'Recommend::DeletedAtResponse')
end

#delete_recommend_rule_with_http_info(index_name, model, object_id, request_options = {}) ⇒ Http::Response

Delete a [Recommend rule](www.algolia.com/doc/guides/algolia-recommend/how-to/rules/).

Required API Key ACLs:

- editSettings

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • model (RecommendModels)
  • object_id (String)

    Unique record (object) identifier. (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
# File 'lib/algolia/api/recommend_client.rb', line 217

def delete_recommend_rule_with_http_info(index_name, model, object_id, request_options = {})
  # verify the required parameter 'index_name' is set
  if @api_client.config.client_side_validation && index_name.nil?
    raise ArgumentError, "Parameter `index_name` is required when calling `delete_recommend_rule`."
  end
  # verify the required parameter 'model' is set
  if @api_client.config.client_side_validation && model.nil?
    raise ArgumentError, "Parameter `model` is required when calling `delete_recommend_rule`."
  end
  # verify the required parameter 'object_id' is set
  if @api_client.config.client_side_validation && object_id.nil?
    raise ArgumentError, "Parameter `object_id` is required when calling `delete_recommend_rule`."
  end

  path = '/1/indexes/{indexName}/{model}/recommend/rules/{objectID}'.sub('{' + 'indexName' + '}', Transport.encode_uri(index_name.to_s)).sub('{' + 'model' + '}', Transport.encode_uri(model.to_s)).sub(
    '{' + 'objectID' + '}', Transport.encode_uri(object_id.to_s)
  )
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :'RecommendClient.delete_recommend_rule',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:DELETE, path, new_options)
end

#get_recommend_rule(index_name, model, object_id, request_options = {}) ⇒ RuleResponse

Return a [Recommend rule](www.algolia.com/doc/guides/algolia-recommend/how-to/rules/).

Required API Key ACLs:

- settings

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • model (RecommendModels)
  • object_id (String)

    Unique record (object) identifier. (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (RuleResponse)


319
320
321
322
# File 'lib/algolia/api/recommend_client.rb', line 319

def get_recommend_rule(index_name, model, object_id, request_options = {})
  response = get_recommend_rule_with_http_info(index_name, model, object_id, request_options)
  @api_client.deserialize(response.body, request_options[:debug_return_type] || 'Recommend::RuleResponse')
end

#get_recommend_rule_with_http_info(index_name, model, object_id, request_options = {}) ⇒ Http::Response

Return a [Recommend rule](www.algolia.com/doc/guides/algolia-recommend/how-to/rules/).

Required API Key ACLs:

- settings

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • model (RecommendModels)
  • object_id (String)

    Unique record (object) identifier. (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
# File 'lib/algolia/api/recommend_client.rb', line 275

def get_recommend_rule_with_http_info(index_name, model, object_id, request_options = {})
  # verify the required parameter 'index_name' is set
  if @api_client.config.client_side_validation && index_name.nil?
    raise ArgumentError, "Parameter `index_name` is required when calling `get_recommend_rule`."
  end
  # verify the required parameter 'model' is set
  if @api_client.config.client_side_validation && model.nil?
    raise ArgumentError, "Parameter `model` is required when calling `get_recommend_rule`."
  end
  # verify the required parameter 'object_id' is set
  if @api_client.config.client_side_validation && object_id.nil?
    raise ArgumentError, "Parameter `object_id` is required when calling `get_recommend_rule`."
  end

  path = '/1/indexes/{indexName}/{model}/recommend/rules/{objectID}'.sub('{' + 'indexName' + '}', Transport.encode_uri(index_name.to_s)).sub('{' + 'model' + '}', Transport.encode_uri(model.to_s)).sub(
    '{' + 'objectID' + '}', Transport.encode_uri(object_id.to_s)
  )
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :'RecommendClient.get_recommend_rule',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:GET, path, new_options)
end

#get_recommend_status(index_name, model, task_id, request_options = {}) ⇒ GetRecommendTaskResponse

Some operations, such as deleting a Recommend rule, will respond with a ‘taskID` value. Use this value here to check the status of that task.

Required API Key ACLs:

- editSettings

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • model (RecommendModels)
  • task_id (Integer)

    Unique identifier of a task. Numeric value (up to 64bits). (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (GetRecommendTaskResponse)


377
378
379
380
# File 'lib/algolia/api/recommend_client.rb', line 377

def get_recommend_status(index_name, model, task_id, request_options = {})
  response = get_recommend_status_with_http_info(index_name, model, task_id, request_options)
  @api_client.deserialize(response.body, request_options[:debug_return_type] || 'Recommend::GetRecommendTaskResponse')
end

#get_recommend_status_with_http_info(index_name, model, task_id, request_options = {}) ⇒ Http::Response

Some operations, such as deleting a Recommend rule, will respond with a &#x60;taskID&#x60; value. Use this value here to check the status of that task.

Required API Key ACLs:

- editSettings

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • model (RecommendModels)
  • task_id (Integer)

    Unique identifier of a task. Numeric value (up to 64bits). (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
# File 'lib/algolia/api/recommend_client.rb', line 333

def get_recommend_status_with_http_info(index_name, model, task_id, request_options = {})
  # verify the required parameter 'index_name' is set
  if @api_client.config.client_side_validation && index_name.nil?
    raise ArgumentError, "Parameter `index_name` is required when calling `get_recommend_status`."
  end
  # verify the required parameter 'model' is set
  if @api_client.config.client_side_validation && model.nil?
    raise ArgumentError, "Parameter `model` is required when calling `get_recommend_status`."
  end
  # verify the required parameter 'task_id' is set
  if @api_client.config.client_side_validation && task_id.nil?
    raise ArgumentError, "Parameter `task_id` is required when calling `get_recommend_status`."
  end

  path = '/1/indexes/{indexName}/{model}/task/{taskID}'.sub('{' + 'indexName' + '}', Transport.encode_uri(index_name.to_s)).sub('{' + 'model' + '}', Transport.encode_uri(model.to_s)).sub(
    '{' + 'taskID' + '}', Transport.encode_uri(task_id.to_s)
  )
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :'RecommendClient.get_recommend_status',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:GET, path, new_options)
end

#get_recommendations(get_recommendations_params, request_options = {}) ⇒ GetRecommendationsResponse

Returns results from either recommendation or trending models: - Recommendations are provided by the [Related Products](www.algolia.com/doc/guides/algolia-recommend/overview/#related-products-and-related-content) and [Frequently Bought Together](www.algolia.com/doc/guides/algolia-recommend/overview/#frequently-bought-together) models - Trending models are [Trending Items and Trending Facet Values](www.algolia.com/doc/guides/algolia-recommend/overview/#trending-items-and-trending-facet-values).

Required API Key ACLs:

- search

Parameters:

  • get_recommendations_params (GetRecommendationsParams)

    (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (GetRecommendationsResponse)


421
422
423
424
# File 'lib/algolia/api/recommend_client.rb', line 421

def get_recommendations(get_recommendations_params, request_options = {})
  response = get_recommendations_with_http_info(get_recommendations_params, request_options)
  @api_client.deserialize(response.body, request_options[:debug_return_type] || 'Recommend::GetRecommendationsResponse')
end

#get_recommendations_with_http_info(get_recommendations_params, request_options = {}) ⇒ Http::Response

Returns results from either recommendation or trending models: - Recommendations are provided by the [Related Products](www.algolia.com/doc/guides/algolia-recommend/overview/#related-products-and-related-content) and [Frequently Bought Together](www.algolia.com/doc/guides/algolia-recommend/overview/#frequently-bought-together) models - Trending models are [Trending Items and Trending Facet Values](www.algolia.com/doc/guides/algolia-recommend/overview/#trending-items-and-trending-facet-values).

Required API Key ACLs:

- search

Parameters:

  • get_recommendations_params (GetRecommendationsParams)

    (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
# File 'lib/algolia/api/recommend_client.rb', line 389

def get_recommendations_with_http_info(get_recommendations_params, request_options = {})
  # verify the required parameter 'get_recommendations_params' is set
  if @api_client.config.client_side_validation && get_recommendations_params.nil?
    raise ArgumentError, "Parameter `get_recommendations_params` is required when calling `get_recommendations`."
  end

  path = '/1/indexes/*/recommendations'
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body] || @api_client.object_to_http_body(get_recommendations_params)

  new_options = request_options.merge(
    :operation => :'RecommendClient.get_recommendations',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => true
  )

  @api_client.call_api(:POST, path, new_options)
end

#search_recommend_rules(index_name, model, search_recommend_rules_params = nil, request_options = {}) ⇒ SearchRecommendRulesResponse

List [Recommend rules](www.algolia.com/doc/guides/algolia-recommend/how-to/rules/).

Required API Key ACLs:

- settings

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • model (RecommendModels)
  • search_recommend_rules_params (SearchRecommendRulesParams) (defaults to: nil)
  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (SearchRecommendRulesResponse)


474
475
476
477
# File 'lib/algolia/api/recommend_client.rb', line 474

def search_recommend_rules(index_name, model, search_recommend_rules_params = nil, request_options = {})
  response = search_recommend_rules_with_http_info(index_name, model, search_recommend_rules_params, request_options)
  @api_client.deserialize(response.body, request_options[:debug_return_type] || 'Recommend::SearchRecommendRulesResponse')
end

#search_recommend_rules_with_http_info(index_name, model, search_recommend_rules_params = nil, request_options = {}) ⇒ Http::Response

List [Recommend rules](www.algolia.com/doc/guides/algolia-recommend/how-to/rules/).

Required API Key ACLs:

- settings

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • model (RecommendModels)
  • search_recommend_rules_params (SearchRecommendRulesParams) (defaults to: nil)
  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
# File 'lib/algolia/api/recommend_client.rb', line 435

def search_recommend_rules_with_http_info(index_name, model, search_recommend_rules_params = nil, request_options = {})
  # verify the required parameter 'index_name' is set
  if @api_client.config.client_side_validation && index_name.nil?
    raise ArgumentError, "Parameter `index_name` is required when calling `search_recommend_rules`."
  end
  # verify the required parameter 'model' is set
  if @api_client.config.client_side_validation && model.nil?
    raise ArgumentError, "Parameter `model` is required when calling `search_recommend_rules`."
  end

  path = '/1/indexes/{indexName}/{model}/recommend/rules/search'.sub('{' + 'indexName' + '}', Transport.encode_uri(index_name.to_s)).sub('{' + 'model' + '}',
                                                                                                                                         Transport.encode_uri(model.to_s))
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body] || @api_client.object_to_http_body(search_recommend_rules_params)

  new_options = request_options.merge(
    :operation => :'RecommendClient.search_recommend_rules',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => true
  )

  @api_client.call_api(:POST, path, new_options)
end