Class: Algolia::AbtestingClient
- Inherits:
-
Object
- Object
- Algolia::AbtestingClient
- Defined in:
- lib/algolia/api/abtesting_client.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Class Method Summary collapse
Instance Method Summary collapse
-
#add_ab_tests(add_ab_tests_request, request_options = {}) ⇒ ABTestResponse
Creates a new A/B test.
-
#add_ab_tests_with_http_info(add_ab_tests_request, request_options = {}) ⇒ Http::Response
Creates a new A/B test.
- #add_user_agent_segment(segment, version = nil) ⇒ Object
- #custom_delete(path, parameters = nil, request_options = {}) ⇒ Object
-
#custom_delete_with_http_info(path, parameters = nil, request_options = {}) ⇒ Http::Response
The response.
- #custom_get(path, parameters = nil, request_options = {}) ⇒ Object
-
#custom_get_with_http_info(path, parameters = nil, request_options = {}) ⇒ Http::Response
The response.
- #custom_post(path, parameters = nil, body = nil, request_options = {}) ⇒ Object
-
#custom_post_with_http_info(path, parameters = nil, body = nil, request_options = {}) ⇒ Http::Response
The response.
- #custom_put(path, parameters = nil, body = nil, request_options = {}) ⇒ Object
-
#custom_put_with_http_info(path, parameters = nil, body = nil, request_options = {}) ⇒ Http::Response
The response.
-
#delete_ab_test(id, request_options = {}) ⇒ ABTestResponse
Deletes an A/B test by its ID.
-
#delete_ab_test_with_http_info(id, request_options = {}) ⇒ Http::Response
Deletes an A/B test by its ID.
-
#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.
-
#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.
-
#get_ab_test(id, request_options = {}) ⇒ ABTest
Retrieves the details for an A/B test by its ID.
-
#get_ab_test_with_http_info(id, request_options = {}) ⇒ Http::Response
Retrieves the details for an A/B test by its ID.
-
#initialize(config = nil) ⇒ AbtestingClient
constructor
A new instance of AbtestingClient.
-
#list_ab_tests(offset = nil, limit = nil, index_prefix = nil, index_suffix = nil, request_options = {}) ⇒ ListABTestsResponse
Lists all A/B tests you configured for this application.
-
#list_ab_tests_with_http_info(offset = nil, limit = nil, index_prefix = nil, index_suffix = nil, request_options = {}) ⇒ Http::Response
Lists all A/B tests you configured for this application.
-
#schedule_ab_test(schedule_ab_tests_request, request_options = {}) ⇒ ScheduleABTestResponse
Schedule an A/B test to be started at a later time.
-
#schedule_ab_test_with_http_info(schedule_ab_tests_request, request_options = {}) ⇒ Http::Response
Schedule an A/B test to be started at a later time.
-
#set_client_api_key(api_key) ⇒ void
Helper method to switch the API key used to authenticate the requests.
-
#stop_ab_test(id, request_options = {}) ⇒ ABTestResponse
Stops an A/B test by its ID.
-
#stop_ab_test_with_http_info(id, request_options = {}) ⇒ Http::Response
Stops an A/B test by its ID.
Constructor Details
#initialize(config = nil) ⇒ AbtestingClient
Returns a new instance of AbtestingClient.
7 8 9 10 11 12 13 |
# File 'lib/algolia/api/abtesting_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_client ⇒ Object
Returns the value of attribute api_client.
5 6 7 |
# File 'lib/algolia/api/abtesting_client.rb', line 5 def api_client @api_client end |
Class Method Details
.create(app_id, api_key, region = nil, opts = {}) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/algolia/api/abtesting_client.rb', line 15 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 opts.nil? || opts[:connect_timeout].nil? opts[:connect_timeout] = 2000 end if opts.nil? || opts[:read_timeout].nil? opts[:read_timeout] = 5000 end if opts.nil? || opts[:write_timeout].nil? opts[:write_timeout] = 30000 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, "Abtesting", opts) create_with_config(config) end |
.create_with_config(config) ⇒ Object
50 51 52 |
# File 'lib/algolia/api/abtesting_client.rb', line 50 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
109 110 111 112 |
# File 'lib/algolia/api/abtesting_client.rb', line 109 def add_ab_tests(add_ab_tests_request, = {}) response = add_ab_tests_with_http_info(add_ab_tests_request, ) @api_client.deserialize(response.body, [:debug_return_type] || "Abtesting::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
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/algolia/api/abtesting_client.rb', line 77 def add_ab_tests_with_http_info(add_ab_tests_request, = {}) # 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 = "/2/abtests" query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(add_ab_tests_request) = .merge( :operation => :"AbtestingClient.add_ab_tests", :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:POST, path, ) end |
#add_user_agent_segment(segment, version = nil) ⇒ Object
64 65 66 67 68 |
# File 'lib/algolia/api/abtesting_client.rb', line 64 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
152 153 154 155 |
# File 'lib/algolia/api/abtesting_client.rb', line 152 def custom_delete(path, parameters = nil, = {}) response = custom_delete_with_http_info(path, parameters, ) @api_client.deserialize(response.body, [:debug_return_type] || "Object") end |
#custom_delete_with_http_info(path, parameters = nil, request_options = {}) ⇒ Http::Response
Returns the response.
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/algolia/api/abtesting_client.rb', line 120 def custom_delete_with_http_info(path, parameters = nil, = {}) # 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 = "/{path}".sub("{" + "path" + "}", path.to_s) query_params = {} query_params = query_params.merge(parameters) unless parameters.nil? query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .merge( :operation => :"AbtestingClient.custom_delete", :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:DELETE, path, ) end |
#custom_get(path, parameters = nil, request_options = {}) ⇒ Object
195 196 197 198 |
# File 'lib/algolia/api/abtesting_client.rb', line 195 def custom_get(path, parameters = nil, = {}) response = custom_get_with_http_info(path, parameters, ) @api_client.deserialize(response.body, [:debug_return_type] || "Object") end |
#custom_get_with_http_info(path, parameters = nil, request_options = {}) ⇒ Http::Response
Returns the response.
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
# File 'lib/algolia/api/abtesting_client.rb', line 163 def custom_get_with_http_info(path, parameters = nil, = {}) # 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 = "/{path}".sub("{" + "path" + "}", path.to_s) query_params = {} query_params = query_params.merge(parameters) unless parameters.nil? query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .merge( :operation => :"AbtestingClient.custom_get", :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:GET, path, ) end |
#custom_post(path, parameters = nil, body = nil, request_options = {}) ⇒ Object
240 241 242 243 |
# File 'lib/algolia/api/abtesting_client.rb', line 240 def custom_post(path, parameters = nil, body = nil, = {}) response = custom_post_with_http_info(path, parameters, body, ) @api_client.deserialize(response.body, [:debug_return_type] || "Object") end |
#custom_post_with_http_info(path, parameters = nil, body = nil, request_options = {}) ⇒ Http::Response
Returns the response.
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 |
# File 'lib/algolia/api/abtesting_client.rb', line 207 def custom_post_with_http_info(path, parameters = nil, body = nil, = {}) # 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 = "/{path}".sub("{" + "path" + "}", path.to_s) query_params = {} query_params = query_params.merge(parameters) unless parameters.nil? query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(body) = .merge( :operation => :"AbtestingClient.custom_post", :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:POST, path, ) end |
#custom_put(path, parameters = nil, body = nil, request_options = {}) ⇒ Object
285 286 287 288 |
# File 'lib/algolia/api/abtesting_client.rb', line 285 def custom_put(path, parameters = nil, body = nil, = {}) response = custom_put_with_http_info(path, parameters, body, ) @api_client.deserialize(response.body, [:debug_return_type] || "Object") end |
#custom_put_with_http_info(path, parameters = nil, body = nil, request_options = {}) ⇒ Http::Response
Returns the response.
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 |
# File 'lib/algolia/api/abtesting_client.rb', line 252 def custom_put_with_http_info(path, parameters = nil, body = nil, = {}) # 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 = "/{path}".sub("{" + "path" + "}", path.to_s) query_params = {} query_params = query_params.merge(parameters) unless parameters.nil? query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(body) = .merge( :operation => :"AbtestingClient.custom_put", :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:PUT, path, ) end |
#delete_ab_test(id, request_options = {}) ⇒ ABTestResponse
Deletes an A/B test by its ID.
Required API Key ACLs:
- editSettings
329 330 331 332 |
# File 'lib/algolia/api/abtesting_client.rb', line 329 def delete_ab_test(id, = {}) response = delete_ab_test_with_http_info(id, ) @api_client.deserialize(response.body, [:debug_return_type] || "Abtesting::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
297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 |
# File 'lib/algolia/api/abtesting_client.rb', line 297 def delete_ab_test_with_http_info(id, = {}) # 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 = "/2/abtests/{id}".sub("{" + "id" + "}", Transport.encode_uri(id.to_s)) query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .merge( :operation => :"AbtestingClient.delete_ab_test", :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:DELETE, path, ) 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
373 374 375 376 |
# File 'lib/algolia/api/abtesting_client.rb', line 373 def estimate_ab_test(estimate_ab_test_request, = {}) response = estimate_ab_test_with_http_info(estimate_ab_test_request, ) @api_client.deserialize(response.body, [:debug_return_type] || "Abtesting::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
341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 |
# File 'lib/algolia/api/abtesting_client.rb', line 341 def estimate_ab_test_with_http_info(estimate_ab_test_request, = {}) # 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 = "/2/abtests/estimate" query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(estimate_ab_test_request) = .merge( :operation => :"AbtestingClient.estimate_ab_test", :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:POST, path, ) end |
#get_ab_test(id, request_options = {}) ⇒ ABTest
Retrieves the details for an A/B test by its ID.
Required API Key ACLs:
- analytics
417 418 419 420 |
# File 'lib/algolia/api/abtesting_client.rb', line 417 def get_ab_test(id, = {}) response = get_ab_test_with_http_info(id, ) @api_client.deserialize(response.body, [:debug_return_type] || "Abtesting::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
385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 |
# File 'lib/algolia/api/abtesting_client.rb', line 385 def get_ab_test_with_http_info(id, = {}) # 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 = "/2/abtests/{id}".sub("{" + "id" + "}", Transport.encode_uri(id.to_s)) query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .merge( :operation => :"AbtestingClient.get_ab_test", :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:GET, path, ) end |
#list_ab_tests(offset = nil, limit = nil, index_prefix = nil, index_suffix = nil, request_options = {}) ⇒ ListABTestsResponse
Lists all A/B tests you configured for this application.
Required API Key ACLs:
- analytics
472 473 474 475 |
# File 'lib/algolia/api/abtesting_client.rb', line 472 def list_ab_tests(offset = nil, limit = nil, index_prefix = nil, index_suffix = nil, = {}) response = list_ab_tests_with_http_info(offset, limit, index_prefix, index_suffix, ) @api_client.deserialize(response.body, [:debug_return_type] || "Abtesting::ListABTestsResponse") end |
#list_ab_tests_with_http_info(offset = nil, limit = nil, index_prefix = nil, index_suffix = nil, request_options = {}) ⇒ Http::Response
Lists all A/B tests you configured for this application.
Required API Key ACLs:
- analytics
432 433 434 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 |
# File 'lib/algolia/api/abtesting_client.rb', line 432 def list_ab_tests_with_http_info( offset = nil, limit = nil, index_prefix = nil, index_suffix = nil, = {} ) path = "/2/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 = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .merge( :operation => :"AbtestingClient.list_ab_tests", :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:GET, path, ) end |
#schedule_ab_test(schedule_ab_tests_request, request_options = {}) ⇒ ScheduleABTestResponse
Schedule an A/B test to be started at a later time.
Required API Key ACLs:
- editSettings
516 517 518 519 |
# File 'lib/algolia/api/abtesting_client.rb', line 516 def schedule_ab_test(schedule_ab_tests_request, = {}) response = schedule_ab_test_with_http_info(schedule_ab_tests_request, ) @api_client.deserialize(response.body, [:debug_return_type] || "Abtesting::ScheduleABTestResponse") end |
#schedule_ab_test_with_http_info(schedule_ab_tests_request, request_options = {}) ⇒ Http::Response
Schedule an A/B test to be started at a later time.
Required API Key ACLs:
- editSettings
484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 |
# File 'lib/algolia/api/abtesting_client.rb', line 484 def schedule_ab_test_with_http_info(schedule_ab_tests_request, = {}) # verify the required parameter 'schedule_ab_tests_request' is set if @api_client.config.client_side_validation && schedule_ab_tests_request.nil? raise ArgumentError, "Parameter `schedule_ab_tests_request` is required when calling `schedule_ab_test`." end path = "/2/abtests/schedule" query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(schedule_ab_tests_request) = .merge( :operation => :"AbtestingClient.schedule_ab_test", :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:POST, path, ) 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.
58 59 60 61 62 |
# File 'lib/algolia/api/abtesting_client.rb', line 58 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
560 561 562 563 |
# File 'lib/algolia/api/abtesting_client.rb', line 560 def stop_ab_test(id, = {}) response = stop_ab_test_with_http_info(id, ) @api_client.deserialize(response.body, [:debug_return_type] || "Abtesting::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
528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 |
# File 'lib/algolia/api/abtesting_client.rb', line 528 def stop_ab_test_with_http_info(id, = {}) # 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 = "/2/abtests/{id}/stop".sub("{" + "id" + "}", Transport.encode_uri(id.to_s)) query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .merge( :operation => :"AbtestingClient.stop_ab_test", :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:POST, path, ) end |