Class: Algolia::AbtestingV3Client

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config = nil) ⇒ AbtestingV3Client

Returns a new instance of AbtestingV3Client.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/algolia/api/abtesting_v3_client.rb', line 9

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 == ""

  if config.connect_timeout.nil?
    config.connect_timeout = 2000
  end

  if config.read_timeout.nil?
    config.read_timeout = 5000
  end

  if config.write_timeout.nil?
    config.write_timeout = 30000
  end

  # Per-client capability; an explicit config.request_id_enabled always wins.
  @api_client = Algolia::ApiClient.new(config, request_id_support: false)
end

Instance Attribute Details

#api_client ⇒ Object

Returns the value of attribute api_client.



7
8
9
# File 'lib/algolia/api/abtesting_v3_client.rb', line 7

def api_client
  @api_client
end

Class Method Details

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



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/algolia/api/abtesting_v3_client.rb', line 30

def self.create(app_id, api_key, region = nil, opts = {})
  hosts = []
  regions = ["de", "us"]

  if region.is_a?(Hash) && (opts.nil? || opts.empty?)
    opts = region
    region = nil
  end

  if !region.nil? && (!region.is_a?(String) || !regions.include?(region))
    raise "`region` must be one of the following: #{regions.join(", ")}"
  end

  hosts <<
    Transport::StatefulHost.new(
      region.nil? ? "analytics.algolia.com" : "analytics.{region}.algolia.com".sub("{region}", region),
      accept: CallType::READ | CallType::WRITE
    )

  config = Algolia::Configuration.new(app_id, api_key, hosts, "AbtestingV3", opts)
  new(config)
end

.create_with_config(config) ⇒ Object



53
54
55
# File 'lib/algolia/api/abtesting_v3_client.rb', line 53

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

Instance Method Details

#add_ab_tests(add_ab_tests_request, request_options = {}) ⇒ ABTestResponse

Creates a new A/B test.

Required API Key ACLs:

- editSettings

Parameters:

  • add_ab_tests_request (AddABTestsRequest) —

    (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:

  • (ABTestResponse)


112
113
114
115
# File 'lib/algolia/api/abtesting_v3_client.rb', line 112

def add_ab_tests(add_ab_tests_request, request_options = {})
  response = add_ab_tests_with_http_info(add_ab_tests_request, request_options)
  @api_client.deserialize(response.body, request_options[:debug_return_type] || "AbtestingV3::ABTestResponse")
end

#add_ab_tests_with_http_info(add_ab_tests_request, request_options = {}) ⇒ Http::Response

Creates a new A/B test.

Required API Key ACLs:

- editSettings

Parameters:

  • add_ab_tests_request (AddABTestsRequest) —

    (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:



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

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

  path = "/3/abtests"
  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(add_ab_tests_request)

  new_options = request_options.merge(
    :operation => :"AbtestingV3Client.add_ab_tests",
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

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

#add_user_agent_segment(segment, version = nil) ⇒ Object



67
68
69
70
71
# File 'lib/algolia/api/abtesting_v3_client.rb', line 67

def add_user_agent_segment(segment, version = nil)
  @api_client.config.add_user_agent_segment(segment, version)

  self
end

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

Parameters:

  • path (String) —

    Path of the endpoint, for example 1/newFeature. (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)


159
160
161
162
# File 'lib/algolia/api/abtesting_v3_client.rb', line 159

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, for example 1/newFeature. (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:



123
124
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
150
151
# File 'lib/algolia/api/abtesting_v3_client.rb', line 123

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
  # verify the required parameter 'path' is not empty
  if @api_client.config.client_side_validation && path.empty?
    raise ArgumentError, "Parameter `path` is required when calling `custom_delete`."
  end

  path = "/{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 => :"AbtestingV3Client.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, for example 1/newFeature. (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)


206
207
208
209
# File 'lib/algolia/api/abtesting_v3_client.rb', line 206

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, for example 1/newFeature. (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:



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
195
196
197
198
# File 'lib/algolia/api/abtesting_v3_client.rb', line 170

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
  # verify the required parameter 'path' is not empty
  if @api_client.config.client_side_validation && path.empty?
    raise ArgumentError, "Parameter `path` is required when calling `custom_get`."
  end

  path = "/{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 => :"AbtestingV3Client.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, for example 1/newFeature. (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)


255
256
257
258
# File 'lib/algolia/api/abtesting_v3_client.rb', line 255

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, for example 1/newFeature. (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:



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
# File 'lib/algolia/api/abtesting_v3_client.rb', line 218

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
  # verify the required parameter 'path' is not empty
  if @api_client.config.client_side_validation && path.empty?
    raise ArgumentError, "Parameter `path` is required when calling `custom_post`."
  end

  path = "/{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 => :"AbtestingV3Client.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, for example 1/newFeature. (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)


304
305
306
307
# File 'lib/algolia/api/abtesting_v3_client.rb', line 304

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, for example 1/newFeature. (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:



267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
# File 'lib/algolia/api/abtesting_v3_client.rb', line 267

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
  # verify the required parameter 'path' is not empty
  if @api_client.config.client_side_validation && path.empty?
    raise ArgumentError, "Parameter `path` is required when calling `custom_put`."
  end

  path = "/{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 => :"AbtestingV3Client.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_ab_test(id, request_options = {}) ⇒ ABTestResponse

Deletes an A/B test by its ID.

Required API Key ACLs:

- editSettings

Parameters:

  • id (Integer) —

    Unique A/B test 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:

  • (ABTestResponse)


348
349
350
351
# File 'lib/algolia/api/abtesting_v3_client.rb', line 348

def delete_ab_test(id, request_options = {})
  response = delete_ab_test_with_http_info(id, request_options)
  @api_client.deserialize(response.body, request_options[:debug_return_type] || "AbtestingV3::ABTestResponse")
end

#delete_ab_test_with_http_info(id, request_options = {}) ⇒ Http::Response

Deletes an A/B test by its ID.

Required API Key ACLs:

- editSettings

Parameters:

  • id (Integer) —

    Unique A/B test 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:



316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
# File 'lib/algolia/api/abtesting_v3_client.rb', line 316

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

  path = "/3/abtests/{id}".sub("{" + "id" + "}", Transport.encode_uri(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 => :"AbtestingV3Client.delete_ab_test",
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

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

#estimate_ab_test(estimate_ab_test_request, request_options = {}) ⇒ EstimateABTestResponse

Given the traffic percentage and the expected effect size, this endpoint estimates the sample size and duration of an A/B test based on historical traffic.

Required API Key ACLs:

- analytics

Parameters:

  • estimate_ab_test_request (EstimateABTestRequest) —

    (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:

  • (EstimateABTestResponse)


392
393
394
395
396
397
398
# File 'lib/algolia/api/abtesting_v3_client.rb', line 392

def estimate_ab_test(estimate_ab_test_request, request_options = {})
  response = estimate_ab_test_with_http_info(estimate_ab_test_request, request_options)
  @api_client.deserialize(
    response.body,
    request_options[:debug_return_type] || "AbtestingV3::EstimateABTestResponse"
  )
end

#estimate_ab_test_with_http_info(estimate_ab_test_request, request_options = {}) ⇒ Http::Response

Given the traffic percentage and the expected effect size, this endpoint estimates the sample size and duration of an A/B test based on historical traffic.

Required API Key ACLs:

- analytics

Parameters:

  • estimate_ab_test_request (EstimateABTestRequest) —

    (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:



360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
# File 'lib/algolia/api/abtesting_v3_client.rb', line 360

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

  path = "/3/abtests/estimate"
  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(estimate_ab_test_request)

  new_options = request_options.merge(
    :operation => :"AbtestingV3Client.estimate_ab_test",
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

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

#get_ab_test(id, request_options = {}) ⇒ ABTest

Retrieves the details for an A/B test by its ID.

Required API Key ACLs:

- analytics

Parameters:

  • id (Integer) —

    Unique A/B test 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:

  • (ABTest)


439
440
441
442
# File 'lib/algolia/api/abtesting_v3_client.rb', line 439

def get_ab_test(id, request_options = {})
  response = get_ab_test_with_http_info(id, request_options)
  @api_client.deserialize(response.body, request_options[:debug_return_type] || "AbtestingV3::ABTest")
end

#get_ab_test_with_http_info(id, request_options = {}) ⇒ Http::Response

Retrieves the details for an A/B test by its ID.

Required API Key ACLs:

- analytics

Parameters:

  • id (Integer) —

    Unique A/B test 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:



407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
# File 'lib/algolia/api/abtesting_v3_client.rb', line 407

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

  path = "/3/abtests/{id}".sub("{" + "id" + "}", Transport.encode_uri(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 => :"AbtestingV3Client.get_ab_test",
    :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_timeseries(id, start_date = nil, end_date = nil, metric = nil, request_options = {}) ⇒ Timeseries

Retrieves timeseries for an A/B test by its ID.

Required API Key ACLs:

- analytics

Parameters:

  • id (Integer) —

    Unique A/B test identifier. (required)

  • start_date (String) (defaults to: nil) —

    Start date of the period to analyze, in YYYY-MM-DD format.

  • end_date (String) (defaults to: nil) —

    End date of the period to analyze, in YYYY-MM-DD format.

  • metric (Array<MetricName>) (defaults to: nil) —

    List of metrics to retrieve. If not specified, all metrics are returned.

  • 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:

  • (Timeseries)


492
493
494
495
# File 'lib/algolia/api/abtesting_v3_client.rb', line 492

def get_timeseries(id, start_date = nil, end_date = nil, metric = nil, request_options = {})
  response = get_timeseries_with_http_info(id, start_date, end_date, metric, request_options)
  @api_client.deserialize(response.body, request_options[:debug_return_type] || "AbtestingV3::Timeseries")
end

#get_timeseries_with_http_info(id, start_date = nil, end_date = nil, metric = nil, request_options = {}) ⇒ Http::Response

Retrieves timeseries for an A/B test by its ID.

Required API Key ACLs:

- analytics

Parameters:

  • id (Integer) —

    Unique A/B test identifier. (required)

  • start_date (String) (defaults to: nil) —

    Start date of the period to analyze, in YYYY-MM-DD format.

  • end_date (String) (defaults to: nil) —

    End date of the period to analyze, in YYYY-MM-DD format.

  • metric (Array<MetricName>) (defaults to: nil) —

    List of metrics to retrieve. If not specified, all metrics are returned.

  • 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:



454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
# File 'lib/algolia/api/abtesting_v3_client.rb', line 454

def get_timeseries_with_http_info(id, start_date = nil, end_date = nil, metric = nil, request_options = {})
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    raise ArgumentError, "Parameter `id` is required when calling `get_timeseries`."
  end

  path = "/3/abtests/{id}/timeseries".sub("{" + "id" + "}", Transport.encode_uri(id.to_s))
  query_params = {}
  query_params[:startDate] = start_date unless start_date.nil?
  query_params[:endDate] = end_date unless end_date.nil?
  query_params[:metric] = @api_client.build_collection_param(metric, :multi) unless metric.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 => :"AbtestingV3Client.get_timeseries",
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

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

#list_ab_tests(offset = nil, limit = nil, index_prefix = nil, index_suffix = nil, direction = nil, request_options = {}) ⇒ ListABTestsResponse

Lists all A/B tests you configured for this application.

Required API Key ACLs:

- analytics

Parameters:

  • offset (Integer) (defaults to: nil) —

    Position of the first item to return. (default to 0)

  • limit (Integer) (defaults to: nil) —

    Number of items to return. (default to 10)

  • index_prefix (String) (defaults to: nil) —

    Index name prefix. Only A/B tests for indices starting with this string are included in the response.

  • index_suffix (String) (defaults to: nil) —

    Index name suffix. Only A/B tests for indices ending with this string are included in the response.

  • direction (Direction) (defaults to: nil) —

    Sort order for A/B tests by start date. Use 'asc' for ascending or 'desc' for descending. Active A/B tests are always listed first.

  • 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:

  • (ListABTestsResponse)


551
552
553
554
555
556
557
558
559
560
561
# File 'lib/algolia/api/abtesting_v3_client.rb', line 551

def list_ab_tests(
  offset = nil,
  limit = nil,
  index_prefix = nil,
  index_suffix = nil,
  direction = nil,
  request_options = {}
)
  response = list_ab_tests_with_http_info(offset, limit, index_prefix, index_suffix, direction, request_options)
  @api_client.deserialize(response.body, request_options[:debug_return_type] || "AbtestingV3::ListABTestsResponse")
end

#list_ab_tests_with_http_info(offset = nil, limit = nil, index_prefix = nil, index_suffix = nil, direction = nil, request_options = {}) ⇒ Http::Response

Lists all A/B tests you configured for this application.

Required API Key ACLs:

- analytics

Parameters:

  • offset (Integer) (defaults to: nil) —

    Position of the first item to return. (default to 0)

  • limit (Integer) (defaults to: nil) —

    Number of items to return. (default to 10)

  • index_prefix (String) (defaults to: nil) —

    Index name prefix. Only A/B tests for indices starting with this string are included in the response.

  • index_suffix (String) (defaults to: nil) —

    Index name suffix. Only A/B tests for indices ending with this string are included in the response.

  • direction (Direction) (defaults to: nil) —

    Sort order for A/B tests by start date. Use 'asc' for ascending or 'desc' for descending. Active A/B tests are always listed first.

  • 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:



508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
# File 'lib/algolia/api/abtesting_v3_client.rb', line 508

def list_ab_tests_with_http_info(
  offset = nil,
  limit = nil,
  index_prefix = nil,
  index_suffix = nil,
  direction = nil,
  request_options = {}
)
  path = "/3/abtests"
  query_params = {}
  query_params[:offset] = offset unless offset.nil?
  query_params[:limit] = limit unless limit.nil?
  query_params[:indexPrefix] = index_prefix unless index_prefix.nil?
  query_params[:indexSuffix] = index_suffix unless index_suffix.nil?
  query_params[:direction] = direction unless direction.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 => :"AbtestingV3Client.list_ab_tests",
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

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

#set_client_api_key(api_key) ⇒ void

This method returns an undefined value.

Helper method to switch the API key used to authenticate the requests.

Parameters:

  • api_key (String) —

    the new API key to use.



61
62
63
64
65
# File 'lib/algolia/api/abtesting_v3_client.rb', line 61

def set_client_api_key(api_key)
  @api_client.set_client_api_key(api_key)

  self
end

#stop_ab_test(id, request_options = {}) ⇒ ABTestResponse

Stops an A/B test by its ID. You can't restart stopped A/B tests.

Required API Key ACLs:

- editSettings

Parameters:

  • id (Integer) —

    Unique A/B test 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:

  • (ABTestResponse)


602
603
604
605
# File 'lib/algolia/api/abtesting_v3_client.rb', line 602

def stop_ab_test(id, request_options = {})
  response = stop_ab_test_with_http_info(id, request_options)
  @api_client.deserialize(response.body, request_options[:debug_return_type] || "AbtestingV3::ABTestResponse")
end

#stop_ab_test_with_http_info(id, request_options = {}) ⇒ Http::Response

Stops an A/B test by its ID. You can't restart stopped A/B tests.

Required API Key ACLs:

- editSettings

Parameters:

  • id (Integer) —

    Unique A/B test 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:



570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
# File 'lib/algolia/api/abtesting_v3_client.rb', line 570

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

  path = "/3/abtests/{id}/stop".sub("{" + "id" + "}", Transport.encode_uri(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 => :"AbtestingV3Client.stop_ab_test",
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

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