algolia 3.42.3 → 3.45.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/do-not-edit-this-repository.yml +1 -1
  3. data/.github/workflows/issue.yml +7 -5
  4. data/.github/workflows/release.yml +4 -4
  5. data/CHANGELOG.md +29 -0
  6. data/Gemfile.lock +2 -2
  7. data/lib/algolia/api/abtesting_client.rb +20 -13
  8. data/lib/algolia/api/abtesting_v3_client.rb +2 -1
  9. data/lib/algolia/api/agent_studio_client.rb +2 -1
  10. data/lib/algolia/api/analytics_client.rb +223 -1
  11. data/lib/algolia/api/composition_client.rb +2 -1
  12. data/lib/algolia/api/ingestion_client.rb +2 -1
  13. data/lib/algolia/api/insights_client.rb +2 -1
  14. data/lib/algolia/api/monitoring_client.rb +2 -1
  15. data/lib/algolia/api/personalization_client.rb +2 -1
  16. data/lib/algolia/api/query_suggestions_client.rb +2 -1
  17. data/lib/algolia/api/recommend_client.rb +2 -1
  18. data/lib/algolia/api/search_client.rb +124 -20
  19. data/lib/algolia/api_client.rb +10 -2
  20. data/lib/algolia/chunked_helper_options.rb +1 -0
  21. data/lib/algolia/configuration.rb +10 -2
  22. data/lib/algolia/error.rb +20 -3
  23. data/lib/algolia/models/abtesting-v3/ab_test.rb +7 -19
  24. data/lib/algolia/models/abtesting-v3/decision.rb +219 -0
  25. data/lib/algolia/models/analytics/bin_edge.rb +109 -0
  26. data/lib/algolia/models/analytics/catalog.rb +208 -0
  27. data/lib/algolia/models/analytics/catalog_entry.rb +249 -0
  28. data/lib/algolia/models/analytics/distribution_definition.rb +243 -0
  29. data/lib/algolia/models/analytics/distribution_payload.rb +247 -0
  30. data/lib/algolia/models/analytics/domain_catalog.rb +253 -0
  31. data/lib/algolia/models/analytics/field_reference.rb +219 -0
  32. data/lib/algolia/models/analytics/filter_definition.rb +238 -0
  33. data/lib/algolia/models/analytics/order_definition.rb +230 -0
  34. data/lib/algolia/models/analytics/order_direction.rb +34 -0
  35. data/lib/algolia/models/analytics/parameter_definition.rb +230 -0
  36. data/lib/algolia/models/analytics/parameter_reference.rb +219 -0
  37. data/lib/algolia/models/analytics/parameter_value.rb +111 -0
  38. data/lib/algolia/models/analytics/scalar_payload.rb +247 -0
  39. data/lib/algolia/models/analytics/series.rb +234 -0
  40. data/lib/algolia/models/analytics/series_date.rb +223 -0
  41. data/lib/algolia/models/analytics/table_payload.rb +292 -0
  42. data/lib/algolia/models/analytics/table_response.rb +211 -0
  43. data/lib/algolia/models/analytics/timeseries_payload.rb +279 -0
  44. data/lib/algolia/models/analytics/timeseries_response.rb +213 -0
  45. data/lib/algolia/models/insights/added_to_cart_object_ids_after_search.rb +1 -1
  46. data/lib/algolia/models/insights/clicked_object_ids_after_search.rb +1 -1
  47. data/lib/algolia/models/insights/converted_object_ids_after_search.rb +1 -1
  48. data/lib/algolia/models/insights/events_items.rb +1 -0
  49. data/lib/algolia/models/insights/instantsearch.rb +269 -0
  50. data/lib/algolia/models/insights/instantsearch_event.rb +33 -0
  51. data/lib/algolia/models/search/log.rb +11 -0
  52. data/lib/algolia/transport/http/http_requester.rb +2 -2
  53. data/lib/algolia/transport/request_id.rb +49 -0
  54. data/lib/algolia/transport/transport.rb +79 -8
  55. data/lib/algolia/version.rb +1 -1
  56. data/lib/algolia.rb +1 -0
  57. metadata +26 -2
@@ -69,7 +69,8 @@ module Algolia
69
69
  config.write_timeout = 30000
70
70
  end
71
71
 
72
- @api_client = Algolia::ApiClient.new(config)
72
+ # Per-client capability; an explicit config.request_id_enabled always wins.
73
+ @api_client = Algolia::ApiClient.new(config, request_id_support: true)
73
74
  @ingestion_transporter = nil
74
75
  if config.transformation_options
75
76
  @ingestion_transporter = _build_ingestion_transporter(config.transformation_options)
@@ -3412,6 +3413,42 @@ module Algolia
3412
3413
  @api_client.deserialize(response.body, request_options[:debug_return_type] || "Search::UpdateApiKeyResponse")
3413
3414
  end
3414
3415
 
3416
+ # Helper: Derives the request options carrying the Request-ID shared by every request
3417
+ # of one helper invocation. Returns the options untouched when the client does not
3418
+ # support Request-ID or the caller already supplied one through the options (as a
3419
+ # header or an x-algolia-request-id query parameter) or the config headers, which
3420
+ # also makes nested helpers reuse the ID minted by their caller.
3421
+ #
3422
+ # @param request_options [Hash]
3423
+ #
3424
+ # @return [Hash]
3425
+ private def with_request_id(request_options = {})
3426
+ config = api_client.config
3427
+ unless api_client.request_id_enabled? &&
3428
+ !Transport::RequestId.request_id?(request_options[:header_params]) &&
3429
+ !Transport::RequestId.request_id?(config.header_params) &&
3430
+ !Transport::RequestId.request_id_query_param?(request_options[:query_params])
3431
+ return request_options
3432
+ end
3433
+
3434
+ request_options.merge(
3435
+ :header_params => (request_options[:header_params] || {}).merge(
3436
+ Transport::RequestId::HEADER => Transport::RequestId.generate
3437
+ )
3438
+ )
3439
+ end
3440
+
3441
+ # Helper: Drops the caller's timeouts from the given request options, so that the
3442
+ # failure-path cleanup calls run with the client defaults while keeping the other
3443
+ # options, notably the headers carrying the invocation's shared Request-ID.
3444
+ #
3445
+ # @param request_options [Hash]
3446
+ #
3447
+ # @return [Hash]
3448
+ private def without_timeouts(request_options)
3449
+ request_options.reject { |key, _| key == :timeout || key == :connect_timeout }
3450
+ end
3451
+
3415
3452
  # The parent search config MUST NOT leak into the ingestion transporter.
3416
3453
  def _build_ingestion_transporter(transformation_options)
3417
3454
  hosts = if transformation_options.hosts
@@ -3561,6 +3598,10 @@ module Algolia
3561
3598
  )
3562
3599
  assert_ingestion_transporter!
3563
3600
 
3601
+ # The shared Request-ID only covers the search-side calls: the ingestion
3602
+ # push goes to an API that must not receive the header.
3603
+ search_request_options = with_request_id(request_options)
3604
+
3564
3605
  if objects.empty?
3565
3606
  @api_client.logger.warn(
3566
3607
  "replace_all_objects_with_transformation was called with an empty list of objects, which will delete all records currently in the \"#{index_name}\" index."
@@ -3581,7 +3622,7 @@ module Algolia
3581
3622
  destination: tmp_index_name,
3582
3623
  scope: scopes
3583
3624
  ),
3584
- request_options
3625
+ search_request_options
3585
3626
  )
3586
3627
 
3587
3628
  watch_responses = @ingestion_transporter.chunked_push(
@@ -3595,7 +3636,13 @@ module Algolia
3595
3636
  opts
3596
3637
  )
3597
3638
 
3598
- wait_for_task(tmp_index_name, copy_operation_response.task_id, opts.max_retries)
3639
+ wait_for_task(
3640
+ tmp_index_name,
3641
+ copy_operation_response.task_id,
3642
+ opts.max_retries,
3643
+ Algolia::ChunkedHelperOptions::DEFAULT_TIMEOUT,
3644
+ search_request_options
3645
+ )
3599
3646
 
3600
3647
  copy_operation_response = operation_index(
3601
3648
  index_name,
@@ -3604,10 +3651,16 @@ module Algolia
3604
3651
  destination: tmp_index_name,
3605
3652
  scope: scopes
3606
3653
  ),
3607
- request_options
3654
+ search_request_options
3608
3655
  )
3609
3656
 
3610
- wait_for_task(tmp_index_name, copy_operation_response.task_id, opts.max_retries)
3657
+ wait_for_task(
3658
+ tmp_index_name,
3659
+ copy_operation_response.task_id,
3660
+ opts.max_retries,
3661
+ Algolia::ChunkedHelperOptions::DEFAULT_TIMEOUT,
3662
+ search_request_options
3663
+ )
3611
3664
 
3612
3665
  move_operation_response = operation_index(
3613
3666
  tmp_index_name,
@@ -3615,10 +3668,16 @@ module Algolia
3615
3668
  operation: Search::OperationType::MOVE,
3616
3669
  destination: index_name
3617
3670
  ),
3618
- request_options
3671
+ search_request_options
3619
3672
  )
3620
3673
 
3621
- wait_for_task(tmp_index_name, move_operation_response.task_id, opts.max_retries)
3674
+ wait_for_task(
3675
+ tmp_index_name,
3676
+ move_operation_response.task_id,
3677
+ opts.max_retries,
3678
+ Algolia::ChunkedHelperOptions::DEFAULT_TIMEOUT,
3679
+ search_request_options
3680
+ )
3622
3681
 
3623
3682
  search_watch_responses = watch_responses.map do |wr|
3624
3683
  Search::WatchResponse.build_from_hash(wr.to_hash)
@@ -3630,7 +3689,13 @@ module Algolia
3630
3689
  move_operation_response: move_operation_response
3631
3690
  )
3632
3691
  rescue Exception => e
3633
- delete_index(tmp_index_name)
3692
+ begin
3693
+ delete_index(tmp_index_name, without_timeouts(search_request_options))
3694
+ rescue StandardError => cleanup_error
3695
+ @api_client.logger.warn(
3696
+ "Failed to delete the temporary index \"#{tmp_index_name}\", please delete it manually: #{cleanup_error}"
3697
+ )
3698
+ end
3634
3699
 
3635
3700
  raise e
3636
3701
  end
@@ -3641,16 +3706,17 @@ module Algolia
3641
3706
  # @param index_name [String] the `index_name` where the operation was performed. (required)
3642
3707
  # @param task_id [Integer] the `task_id` returned in the method response. (required)
3643
3708
  # @param max_retries [Integer] the maximum number of retries. (optional, default to Algolia::ChunkedHelperOptions::DEFAULT_MAX_RETRIES)
3644
- # @param timeout [Proc] the function to decide how long to wait between retries. (optional)
3709
+ # @param timeout [Proc] the function to decide how long to wait between retries. (optional, default to Algolia::ChunkedHelperOptions::DEFAULT_TIMEOUT)
3645
3710
  # @param request_options [Hash] the requestOptions to send along with the query, they will be forwarded to the `get_task` method.
3646
3711
  # @return [Http::Response] the last get_task response
3647
3712
  def wait_for_task(
3648
3713
  index_name,
3649
3714
  task_id,
3650
3715
  max_retries = Algolia::ChunkedHelperOptions::DEFAULT_MAX_RETRIES,
3651
- timeout = -> (retry_count) { [retry_count * 200, 5000].min },
3716
+ timeout = Algolia::ChunkedHelperOptions::DEFAULT_TIMEOUT,
3652
3717
  request_options = {}
3653
3718
  )
3719
+ request_options = with_request_id(request_options)
3654
3720
  retries = 0
3655
3721
  while retries < max_retries
3656
3722
  res = get_task(index_name, task_id, request_options)
@@ -3672,15 +3738,16 @@ module Algolia
3672
3738
  #
3673
3739
  # @param task_id [Integer] the `task_id` returned in the method response. (required)
3674
3740
  # @param max_retries [Integer] the maximum number of retries. (optional, default to Algolia::ChunkedHelperOptions::DEFAULT_MAX_RETRIES)
3675
- # @param timeout [Proc] the function to decide how long to wait between retries. (optional)
3741
+ # @param timeout [Proc] the function to decide how long to wait between retries. (optional, default to Algolia::ChunkedHelperOptions::DEFAULT_TIMEOUT)
3676
3742
  # @param request_options [Hash] the requestOptions to send along with the query, they will be forwarded to the `get_task` method.
3677
3743
  # @return [Http::Response] the last get_task response
3678
3744
  def wait_for_app_task(
3679
3745
  task_id,
3680
3746
  max_retries = Algolia::ChunkedHelperOptions::DEFAULT_MAX_RETRIES,
3681
- timeout = -> (retry_count) { [retry_count * 200, 5000].min },
3747
+ timeout = Algolia::ChunkedHelperOptions::DEFAULT_TIMEOUT,
3682
3748
  request_options = {}
3683
3749
  )
3750
+ request_options = with_request_id(request_options)
3684
3751
  retries = 0
3685
3752
  while retries < max_retries
3686
3753
  res = get_app_task(task_id, request_options)
@@ -3703,8 +3770,8 @@ module Algolia
3703
3770
  # @param key [String] the `key` that has been added, deleted or updated.
3704
3771
  # @param operation [String] the `operation` that was done on a `key`.
3705
3772
  # @param api_key [Hash] necessary to know if an `update` operation has been processed, compare fields of the response with it.
3706
- # @param max_retries [Integer] the maximum number of retries.
3707
- # @param timeout [Proc] the function to decide how long to wait between retries.
3773
+ # @param max_retries [Integer] the maximum number of retries. (optional, default to Algolia::ChunkedHelperOptions::DEFAULT_MAX_RETRIES)
3774
+ # @param timeout [Proc] the function to decide how long to wait between retries. (optional, default to Algolia::ChunkedHelperOptions::DEFAULT_TIMEOUT)
3708
3775
  # @param request_options [Hash] the requestOptions to send along with the query, they will be forwarded to the `getApikey` method and merged with the transporter requestOptions.
3709
3776
  # @return [Http::Response] the last get_api_key response
3710
3777
  def wait_for_api_key(
@@ -3712,9 +3779,10 @@ module Algolia
3712
3779
  operation,
3713
3780
  api_key = Search::ApiKey.new,
3714
3781
  max_retries = Algolia::ChunkedHelperOptions::DEFAULT_MAX_RETRIES,
3715
- timeout = -> (retry_count) { [retry_count * 200, 5000].min },
3782
+ timeout = Algolia::ChunkedHelperOptions::DEFAULT_TIMEOUT,
3716
3783
  request_options = {}
3717
3784
  )
3785
+ request_options = with_request_id(request_options)
3718
3786
  api_key = api_client.object_to_hash(api_key)
3719
3787
 
3720
3788
  retries = 0
@@ -3769,6 +3837,7 @@ module Algolia
3769
3837
  # @param request_options [Hash] the requestOptions to send along with the query, they will be forwarded to the `browse` method.
3770
3838
  # @param block [Proc] the block to execute on each object of the index.
3771
3839
  def browse_objects(index_name, browse_params = Search::BrowseParamsObject.new, request_options = {}, &block)
3840
+ request_options = with_request_id(request_options)
3772
3841
  browse_params = api_client.object_to_hash(browse_params)
3773
3842
 
3774
3843
  browse_params[:hitsPerPage] = 1000 unless browse_params.key?(:hitsPerPage)
@@ -3798,6 +3867,7 @@ module Algolia
3798
3867
  # @param request_options [Hash] the requestOptions to send along with the query, they will be forwarded to the `searchRules` method.
3799
3868
  # @param block [Proc] the block to execute on each rule of the index.
3800
3869
  def browse_rules(index_name, search_rules_params = Search::SearchRulesParams.new, request_options = {}, &block)
3870
+ request_options = with_request_id(request_options)
3801
3871
  search_rules_params = api_client.object_to_hash(search_rules_params)
3802
3872
 
3803
3873
  search_rules_params[:page] ||= 0
@@ -3833,6 +3903,7 @@ module Algolia
3833
3903
  request_options = {},
3834
3904
  &block
3835
3905
  )
3906
+ request_options = with_request_id(request_options)
3836
3907
  search_synonyms_params = api_client.object_to_hash(search_synonyms_params)
3837
3908
 
3838
3909
  search_synonyms_params[:page] ||= 0
@@ -4036,6 +4107,7 @@ module Algolia
4036
4107
  request_options = {},
4037
4108
  chunked_options = nil
4038
4109
  )
4110
+ request_options = with_request_id(request_options)
4039
4111
  opts = Algolia::ChunkedHelperOptions.resolve(chunked_options)
4040
4112
  responses = []
4041
4113
  objects.each_slice(batch_size) do |chunk|
@@ -4048,7 +4120,13 @@ module Algolia
4048
4120
 
4049
4121
  if wait_for_tasks
4050
4122
  responses.each do |response|
4051
- wait_for_task(index_name, response.task_id, opts.max_retries)
4123
+ wait_for_task(
4124
+ index_name,
4125
+ response.task_id,
4126
+ opts.max_retries,
4127
+ Algolia::ChunkedHelperOptions::DEFAULT_TIMEOUT,
4128
+ request_options
4129
+ )
4052
4130
  end
4053
4131
  end
4054
4132
 
@@ -4074,6 +4152,8 @@ module Algolia
4074
4152
  request_options = {},
4075
4153
  chunked_options = nil
4076
4154
  )
4155
+ request_options = with_request_id(request_options)
4156
+
4077
4157
  if objects.empty?
4078
4158
  @api_client.logger.warn(
4079
4159
  "replace_all_objects was called with an empty list of objects, which will delete all records currently in the \"#{index_name}\" index."
@@ -4107,7 +4187,13 @@ module Algolia
4107
4187
  opts
4108
4188
  )
4109
4189
 
4110
- wait_for_task(tmp_index_name, copy_operation_response.task_id, opts.max_retries)
4190
+ wait_for_task(
4191
+ tmp_index_name,
4192
+ copy_operation_response.task_id,
4193
+ opts.max_retries,
4194
+ Algolia::ChunkedHelperOptions::DEFAULT_TIMEOUT,
4195
+ request_options
4196
+ )
4111
4197
 
4112
4198
  copy_operation_response = operation_index(
4113
4199
  index_name,
@@ -4119,7 +4205,13 @@ module Algolia
4119
4205
  request_options
4120
4206
  )
4121
4207
 
4122
- wait_for_task(tmp_index_name, copy_operation_response.task_id, opts.max_retries)
4208
+ wait_for_task(
4209
+ tmp_index_name,
4210
+ copy_operation_response.task_id,
4211
+ opts.max_retries,
4212
+ Algolia::ChunkedHelperOptions::DEFAULT_TIMEOUT,
4213
+ request_options
4214
+ )
4123
4215
 
4124
4216
  move_operation_response = operation_index(
4125
4217
  tmp_index_name,
@@ -4130,7 +4222,13 @@ module Algolia
4130
4222
  request_options
4131
4223
  )
4132
4224
 
4133
- wait_for_task(tmp_index_name, move_operation_response.task_id, opts.max_retries)
4225
+ wait_for_task(
4226
+ tmp_index_name,
4227
+ move_operation_response.task_id,
4228
+ opts.max_retries,
4229
+ Algolia::ChunkedHelperOptions::DEFAULT_TIMEOUT,
4230
+ request_options
4231
+ )
4134
4232
 
4135
4233
  Search::ReplaceAllObjectsResponse.new(
4136
4234
  copy_operation_response: copy_operation_response,
@@ -4138,7 +4236,13 @@ module Algolia
4138
4236
  move_operation_response: move_operation_response
4139
4237
  )
4140
4238
  rescue Exception => e
4141
- delete_index(tmp_index_name)
4239
+ begin
4240
+ delete_index(tmp_index_name, without_timeouts(request_options))
4241
+ rescue StandardError => cleanup_error
4242
+ @api_client.logger.warn(
4243
+ "Failed to delete the temporary index \"#{tmp_index_name}\", please delete it manually: #{cleanup_error}"
4244
+ )
4245
+ end
4142
4246
 
4143
4247
  raise e
4144
4248
  end
@@ -13,11 +13,19 @@ module Algolia
13
13
 
14
14
  # Initializes the ApiClient
15
15
  # @option config [Configuration] Configuration for initializing the object, default to Configuration.default
16
- def initialize(config = Configuration.default)
16
+ # @param request_id_support [true, false] the generated per-client Request-ID capability,
17
+ # applied when config.request_id_enabled is nil. Kept on the transport so a shared Configuration is never mutated.
18
+ def initialize(config = Configuration.default, request_id_support: false)
17
19
  @config = config
18
20
  @requester = config.requester || Http::HttpRequester.new("net_http_persistent", LoggerHelper.create)
19
21
  @logger = (@requester.logger if @requester.respond_to?(:logger)) || LoggerHelper.create
20
- @transporter = Transport::Transport.new(config, @requester)
22
+ @transporter = Transport::Transport.new(config, @requester, request_id_support: request_id_support)
23
+ end
24
+
25
+ # Whether the transport mints Request-ID headers, resolved per request.
26
+ # @return [true, false]
27
+ def request_id_enabled?
28
+ @transporter.request_id_enabled?
21
29
  end
22
30
 
23
31
  def self.default
@@ -3,6 +3,7 @@ module Algolia
3
3
  class ChunkedHelperOptions
4
4
  DEFAULT_MAX_RETRIES = 100
5
5
  DEFAULT_REPLACE_ALL_OBJECTS_MAX_RETRIES = 800
6
+ DEFAULT_TIMEOUT = -> (retry_count) { [retry_count * 200, 5000].min }
6
7
  attr_reader :max_retries
7
8
 
8
9
  def initialize(max_retries: DEFAULT_MAX_RETRIES)
@@ -1,5 +1,3 @@
1
- # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
2
-
3
1
  module Algolia
4
2
  class Configuration
5
3
  attr_accessor(
@@ -21,6 +19,14 @@ module Algolia
21
19
  # @return [true, false]
22
20
  attr_accessor :client_side_validation
23
21
 
22
+ # Whether the transport sends a Request-ID header, minted once per call and
23
+ # reused across its retry attempts. When nil, each generated client applies its
24
+ # per-client default (on for the search, recommend and composition APIs, off
25
+ # elsewhere); an explicit true or false always wins and may be flipped at any
26
+ # time. A caller-supplied Request-ID is never overwritten.
27
+ # @return [true, false, nil]
28
+ attr_accessor :request_id_enabled
29
+
24
30
  def initialize(app_id, api_key, hosts, client_name, opts = {})
25
31
  @hosts = hosts
26
32
  @app_id = app_id
@@ -33,6 +39,8 @@ module Algolia
33
39
  @requester = opts[:requester]
34
40
  @transformation_options = opts[:transformation_options]
35
41
 
42
+ @request_id_enabled = opts[:request_id_enabled]
43
+
36
44
  @user_agent = UserAgent.new.add(client_name, VERSION)
37
45
 
38
46
  if opts[:user_agent_segments]
data/lib/algolia/error.rb CHANGED
@@ -12,13 +12,20 @@ module Algolia
12
12
  class AlgoliaUnreachableHostError < AlgoliaError
13
13
  attr_reader :errors
14
14
 
15
- def initialize(message, errors = [])
15
+ # The last non-empty Correlation-ID header among the retried attempts, or nil.
16
+ # Quote it when contacting Algolia support.
17
+ attr_reader :correlation_id
18
+
19
+ def initialize(message, errors = [], correlation_id = nil)
16
20
  errors.last&.tap do |last_error|
17
21
  message += " Last error for #{last_error[:host]}: #{last_error[:error]}"
18
22
  end
19
23
 
24
+ message += " (Correlation-ID: #{correlation_id})" unless correlation_id.nil? || correlation_id.empty?
25
+
20
26
  super(message)
21
27
  @errors = errors
28
+ @correlation_id = correlation_id
22
29
  end
23
30
  end
24
31
 
@@ -29,10 +36,20 @@ module Algolia
29
36
  class AlgoliaHttpError < AlgoliaError
30
37
  attr_accessor :code, :http_message
31
38
 
32
- def initialize(code, message)
39
+ # The Correlation-ID header of the failed response (possibly ""), or nil.
40
+ # Quote it when contacting Algolia support.
41
+ attr_reader :correlation_id
42
+
43
+ def initialize(code, message, correlation_id = nil)
33
44
  self.code = code
34
45
  self.http_message = message
35
- super("#{code}: #{message}")
46
+ @correlation_id = correlation_id
47
+
48
+ if correlation_id.nil? || correlation_id.empty?
49
+ super("#{code}: #{message}")
50
+ else
51
+ super("#{code}: #{message} (Correlation-ID: #{correlation_id})")
52
+ end
36
53
  end
37
54
  end
38
55
  end
@@ -33,8 +33,7 @@ module Algolia
33
33
 
34
34
  attr_accessor :configuration
35
35
 
36
- # Unique migrated A/B test identifier.
37
- attr_accessor :migrated_ab_test_id
36
+ attr_accessor :decision
38
37
 
39
38
  # Attribute mapping from ruby-style variable name to JSON key.
40
39
  def self.attribute_map
@@ -48,7 +47,7 @@ module Algolia
48
47
  :status => :status,
49
48
  :variants => :variants,
50
49
  :configuration => :configuration,
51
- :migrated_ab_test_id => :migratedAbTestID
50
+ :decision => :decision
52
51
  }
53
52
  end
54
53
 
@@ -64,7 +63,7 @@ module Algolia
64
63
  :status => :"Status",
65
64
  :variants => :"Array<Variant>",
66
65
  :configuration => :"ABTestConfiguration",
67
- :migrated_ab_test_id => :"Integer"
66
+ :decision => :"Decision"
68
67
  }
69
68
  end
70
69
 
@@ -149,8 +148,8 @@ module Algolia
149
148
  self.configuration = attributes[:configuration]
150
149
  end
151
150
 
152
- if attributes.key?(:migrated_ab_test_id)
153
- self.migrated_ab_test_id = attributes[:migrated_ab_test_id]
151
+ if attributes.key?(:decision)
152
+ self.decision = attributes[:decision]
154
153
  end
155
154
  end
156
155
 
@@ -168,7 +167,7 @@ module Algolia
168
167
  status == other.status &&
169
168
  variants == other.variants &&
170
169
  configuration == other.configuration &&
171
- migrated_ab_test_id == other.migrated_ab_test_id
170
+ decision == other.decision
172
171
  end
173
172
 
174
173
  # @see the `==` method
@@ -180,18 +179,7 @@ module Algolia
180
179
  # Calculates hash code according to all attributes.
181
180
  # @return [Integer] Hash code
182
181
  def hash
183
- [
184
- ab_test_id,
185
- updated_at,
186
- created_at,
187
- end_at,
188
- stopped_at,
189
- name,
190
- status,
191
- variants,
192
- configuration,
193
- migrated_ab_test_id
194
- ].hash
182
+ [ab_test_id, updated_at, created_at, end_at, stopped_at, name, status, variants, configuration, decision].hash
195
183
  end
196
184
 
197
185
  # Builds the object from hash