algolia 3.30.0 → 3.31.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 698d0bf438f61272bc29420b92a6e6d3d7284810c99a915d58b7b28e6ef64061
4
- data.tar.gz: a59ba07ae58c007bbf2c832b400cce0cca4e89fa3cdf9f80965d1b4eb93e3ddb
3
+ metadata.gz: 7fc0efa08965447a7c2772b827b9c01532be62407efce5e13c39abb5653f6df1
4
+ data.tar.gz: 724d31363790d71616659594e61b685dd97da85e593ffc47a222bc6d8322fedf
5
5
  SHA512:
6
- metadata.gz: d196cc67966b88bd8ea0de06a9d4b4a8ebb54722d1716fd421de078eb64c8410475dc32fbaf67b1c50ae402e94923f59d15cdfd84fcc8e9c079283c06b81dfa9
7
- data.tar.gz: 37fba20279d136c60e354072e8ecd05e2e079f9253579eba8b054b5feff8e3bd10722583aa888e0a49842a8cfa8354a53f13588dd78433524a7f5c6f16e199a3
6
+ metadata.gz: 914312d094561990bcc25ebe70c5c49cf9db7b86526074d6f145856c38b9b3eb141acb8b7af10f256341a9b0790e9be0604ea9b314984f5258d628f2adb060a3
7
+ data.tar.gz: ab97ed1e6fe928b454895d54b7401e144f9d142d760c18ad2af54d515f4a26491b866efb02eebabefbac2efbff75db01790a41fc365f37aae9a55b2afdcd07b0
@@ -24,6 +24,6 @@ jobs:
24
24
  ruby-version: 3.4.7
25
25
  bundler-cache: true
26
26
 
27
- - uses: rubygems/release-gem@9fc8c0f9a461e67716cde28f188b9a5c029333a8
27
+ - uses: rubygems/release-gem@1c162a739e8b4cb21a676e97b087e8268d8fc40b
28
28
  with:
29
29
  await-release: false
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## [3.31.0](https://github.com/algolia/algoliasearch-client-ruby/compare/3.30.0...3.31.0)
2
+
3
+ - [ecfea56dc](https://github.com/algolia/api-clients-automation/commit/ecfea56dc) feat(clients): remove schedule capabilities ([#5552](https://github.com/algolia/api-clients-automation/pull/5552)) by [@cdhawke](https://github.com/cdhawke/)
4
+ - [391059ed9](https://github.com/algolia/api-clients-automation/commit/391059ed9) chore(deps): dependencies 2025-11-03 ([#5553](https://github.com/algolia/api-clients-automation/pull/5553)) by [@algolia-bot](https://github.com/algolia-bot/)
5
+ - [ff4b8f02c](https://github.com/algolia/api-clients-automation/commit/ff4b8f02c) feat(specs): add fallbackParameters to Frequently bought together [RECO-2443] ([#5579](https://github.com/algolia/api-clients-automation/pull/5579)) by [@raed667](https://github.com/raed667/)
6
+
1
7
  ## [3.30.0](https://github.com/algolia/algoliasearch-client-ruby/compare/3.29.0...3.30.0)
2
8
 
3
9
  - [d9b21b4b1](https://github.com/algolia/api-clients-automation/commit/d9b21b4b1) feat(specs): add `renderingContent` query parameter in Composition API main injection ([#5549](https://github.com/algolia/api-clients-automation/pull/5549)) by [@ClaraMuller](https://github.com/ClaraMuller/)
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- algolia (3.30.0)
4
+ algolia (3.31.0)
5
5
  base64 (>= 0.2.0, < 1)
6
6
  faraday (>= 1.0.1, < 3.0)
7
7
  faraday-net_http_persistent (>= 0.15, < 3)
@@ -476,50 +476,6 @@ module Algolia
476
476
  @api_client.deserialize(response.body, request_options[:debug_return_type] || "Abtesting::ListABTestsResponse")
477
477
  end
478
478
 
479
- # Schedule an A/B test to be started at a later time.
480
- #
481
- # Required API Key ACLs:
482
- # - editSettings
483
- # @param schedule_ab_tests_request [ScheduleABTestsRequest] (required)
484
- # @param 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)
485
- # @return [Http::Response] the response
486
- def schedule_ab_test_with_http_info(schedule_ab_tests_request, request_options = {})
487
- # verify the required parameter 'schedule_ab_tests_request' is set
488
- if @api_client.config.client_side_validation && schedule_ab_tests_request.nil?
489
- raise ArgumentError, "Parameter `schedule_ab_tests_request` is required when calling `schedule_ab_test`."
490
- end
491
-
492
- path = "/2/abtests/schedule"
493
- query_params = {}
494
- query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
495
- header_params = {}
496
- header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?
497
-
498
- post_body = request_options[:debug_body] || @api_client.object_to_http_body(schedule_ab_tests_request)
499
-
500
- new_options = request_options.merge(
501
- :operation => :"AbtestingClient.schedule_ab_test",
502
- :header_params => header_params,
503
- :query_params => query_params,
504
- :body => post_body,
505
- :use_read_transporter => false
506
- )
507
-
508
- @api_client.call_api(:POST, path, new_options)
509
- end
510
-
511
- # Schedule an A/B test to be started at a later time.
512
- #
513
- # Required API Key ACLs:
514
- # - editSettings
515
- # @param schedule_ab_tests_request [ScheduleABTestsRequest] (required)
516
- # @param 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)
517
- # @return [ScheduleABTestResponse]
518
- def schedule_ab_test(schedule_ab_tests_request, request_options = {})
519
- response = schedule_ab_test_with_http_info(schedule_ab_tests_request, request_options)
520
- @api_client.deserialize(response.body, request_options[:debug_return_type] || "Abtesting::ScheduleABTestResponse")
521
- end
522
-
523
479
  # Stops an A/B test by its ID. You can't restart stopped A/B tests.
524
480
  #
525
481
  # Required API Key ACLs:
@@ -543,53 +543,6 @@ module Algolia
543
543
  @api_client.deserialize(response.body, request_options[:debug_return_type] || "AbtestingV3::ListABTestsResponse")
544
544
  end
545
545
 
546
- # Schedule an A/B test to be started at a later time.
547
- #
548
- # Required API Key ACLs:
549
- # - editSettings
550
- # @param schedule_ab_tests_request [ScheduleABTestsRequest] (required)
551
- # @param 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)
552
- # @return [Http::Response] the response
553
- def schedule_ab_test_with_http_info(schedule_ab_tests_request, request_options = {})
554
- # verify the required parameter 'schedule_ab_tests_request' is set
555
- if @api_client.config.client_side_validation && schedule_ab_tests_request.nil?
556
- raise ArgumentError, "Parameter `schedule_ab_tests_request` is required when calling `schedule_ab_test`."
557
- end
558
-
559
- path = "/3/abtests/schedule"
560
- query_params = {}
561
- query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
562
- header_params = {}
563
- header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?
564
-
565
- post_body = request_options[:debug_body] || @api_client.object_to_http_body(schedule_ab_tests_request)
566
-
567
- new_options = request_options.merge(
568
- :operation => :"AbtestingV3Client.schedule_ab_test",
569
- :header_params => header_params,
570
- :query_params => query_params,
571
- :body => post_body,
572
- :use_read_transporter => false
573
- )
574
-
575
- @api_client.call_api(:POST, path, new_options)
576
- end
577
-
578
- # Schedule an A/B test to be started at a later time.
579
- #
580
- # Required API Key ACLs:
581
- # - editSettings
582
- # @param schedule_ab_tests_request [ScheduleABTestsRequest] (required)
583
- # @param 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)
584
- # @return [ScheduleABTestResponse]
585
- def schedule_ab_test(schedule_ab_tests_request, request_options = {})
586
- response = schedule_ab_test_with_http_info(schedule_ab_tests_request, request_options)
587
- @api_client.deserialize(
588
- response.body,
589
- request_options[:debug_return_type] || "AbtestingV3::ScheduleABTestResponse"
590
- )
591
- end
592
-
593
546
  # Stops an A/B test by its ID. You can't restart stopped A/B tests.
594
547
  #
595
548
  # Required API Key ACLs:
@@ -24,6 +24,8 @@ module Algolia
24
24
  # Unique record identifier.
25
25
  attr_accessor :algolia_object_id
26
26
 
27
+ attr_accessor :fallback_parameters
28
+
27
29
  # Attribute mapping from ruby-style variable name to JSON key.
28
30
  def self.attribute_map
29
31
  {
@@ -32,7 +34,8 @@ module Algolia
32
34
  :max_recommendations => :maxRecommendations,
33
35
  :query_parameters => :queryParameters,
34
36
  :model => :model,
35
- :algolia_object_id => :objectID
37
+ :algolia_object_id => :objectID,
38
+ :fallback_parameters => :fallbackParameters
36
39
  }
37
40
  end
38
41
 
@@ -44,7 +47,8 @@ module Algolia
44
47
  :max_recommendations => :"Integer",
45
48
  :query_parameters => :"RecommendSearchParams",
46
49
  :model => :"FbtModel",
47
- :algolia_object_id => :"String"
50
+ :algolia_object_id => :"String",
51
+ :fallback_parameters => :"FallbackParams"
48
52
  }
49
53
  end
50
54
 
@@ -117,6 +121,10 @@ module Algolia
117
121
  else
118
122
  self.algolia_object_id = nil
119
123
  end
124
+
125
+ if attributes.key?(:fallback_parameters)
126
+ self.fallback_parameters = attributes[:fallback_parameters]
127
+ end
120
128
  end
121
129
 
122
130
  # Checks equality by comparing each attribute.
@@ -129,7 +137,8 @@ module Algolia
129
137
  max_recommendations == other.max_recommendations &&
130
138
  query_parameters == other.query_parameters &&
131
139
  model == other.model &&
132
- algolia_object_id == other.algolia_object_id
140
+ algolia_object_id == other.algolia_object_id &&
141
+ fallback_parameters == other.fallback_parameters
133
142
  end
134
143
 
135
144
  # @see the `==` method
@@ -141,7 +150,7 @@ module Algolia
141
150
  # Calculates hash code according to all attributes.
142
151
  # @return [Integer] Hash code
143
152
  def hash
144
- [index_name, threshold, max_recommendations, query_parameters, model, algolia_object_id].hash
153
+ [index_name, threshold, max_recommendations, query_parameters, model, algolia_object_id, fallback_parameters].hash
145
154
  end
146
155
 
147
156
  # Builds the object from hash
@@ -3,5 +3,5 @@
3
3
  # 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.
4
4
 
5
5
  module Algolia
6
- VERSION = "3.30.0"
6
+ VERSION = "3.31.0"
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: algolia
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.30.0
4
+ version: 3.31.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - https://alg.li/support
@@ -171,8 +171,6 @@ files:
171
171
  - lib/algolia/models/abtesting-v3/metrics_filter.rb
172
172
  - lib/algolia/models/abtesting-v3/minimum_detectable_effect.rb
173
173
  - lib/algolia/models/abtesting-v3/outliers_filter.rb
174
- - lib/algolia/models/abtesting-v3/schedule_ab_test_response.rb
175
- - lib/algolia/models/abtesting-v3/schedule_ab_tests_request.rb
176
174
  - lib/algolia/models/abtesting-v3/status.rb
177
175
  - lib/algolia/models/abtesting-v3/timeseries.rb
178
176
  - lib/algolia/models/abtesting-v3/timeseries_variant.rb
@@ -198,8 +196,6 @@ files:
198
196
  - lib/algolia/models/abtesting/minimum_detectable_effect.rb
199
197
  - lib/algolia/models/abtesting/outliers.rb
200
198
  - lib/algolia/models/abtesting/outliers_filter.rb
201
- - lib/algolia/models/abtesting/schedule_ab_test_response.rb
202
- - lib/algolia/models/abtesting/schedule_ab_tests_request.rb
203
199
  - lib/algolia/models/abtesting/status.rb
204
200
  - lib/algolia/models/abtesting/variant.rb
205
201
  - lib/algolia/models/analytics/click_position.rb
@@ -1,209 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # 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.
4
-
5
- require "date"
6
- require "time"
7
-
8
- module Algolia
9
- module Abtesting
10
- class ScheduleABTestResponse
11
- # Unique scheduled A/B test identifier.
12
- attr_accessor :ab_test_schedule_id
13
-
14
- # Attribute mapping from ruby-style variable name to JSON key.
15
- def self.attribute_map
16
- {
17
- :ab_test_schedule_id => :abTestScheduleID
18
- }
19
- end
20
-
21
- # Attribute type mapping.
22
- def self.types_mapping
23
- {
24
- :ab_test_schedule_id => :"Integer"
25
- }
26
- end
27
-
28
- # List of attributes with nullable: true
29
- def self.openapi_nullable
30
- Set.new(
31
- []
32
- )
33
- end
34
-
35
- # Initializes the object
36
- # @param [Hash] attributes Model attributes in the form of hash
37
- def initialize(attributes = {})
38
- if (!attributes.is_a?(Hash))
39
- raise(
40
- ArgumentError,
41
- "The input argument (attributes) must be a hash in `Algolia::ScheduleABTestResponse` initialize method"
42
- )
43
- end
44
-
45
- # check to see if the attribute exists and convert string to symbol for hash key
46
- attributes = attributes.each_with_object({}) { |(k, v), h|
47
- if (!self.class.attribute_map.key?(k.to_sym))
48
- raise(
49
- ArgumentError,
50
- "`#{k}` is not a valid attribute in `Algolia::ScheduleABTestResponse`. Please check the name to make sure it's valid. List of attributes: " +
51
- self.class.attribute_map.keys.inspect
52
- )
53
- end
54
-
55
- h[k.to_sym] = v
56
- }
57
-
58
- if attributes.key?(:ab_test_schedule_id)
59
- self.ab_test_schedule_id = attributes[:ab_test_schedule_id]
60
- else
61
- self.ab_test_schedule_id = nil
62
- end
63
- end
64
-
65
- # Checks equality by comparing each attribute.
66
- # @param [Object] Object to be compared
67
- def ==(other)
68
- return true if self.equal?(other)
69
- self.class == other.class &&
70
- ab_test_schedule_id == other.ab_test_schedule_id
71
- end
72
-
73
- # @see the `==` method
74
- # @param [Object] Object to be compared
75
- def eql?(other)
76
- self == other
77
- end
78
-
79
- # Calculates hash code according to all attributes.
80
- # @return [Integer] Hash code
81
- def hash
82
- [ab_test_schedule_id].hash
83
- end
84
-
85
- # Builds the object from hash
86
- # @param [Hash] attributes Model attributes in the form of hash
87
- # @return [Object] Returns the model itself
88
- def self.build_from_hash(attributes)
89
- return nil unless attributes.is_a?(Hash)
90
- attributes = attributes.transform_keys(&:to_sym)
91
- transformed_hash = {}
92
- types_mapping.each_pair do |key, type|
93
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
94
- transformed_hash[key.to_sym] = nil
95
- elsif type =~ /\AArray<(.*)>/i
96
- # check to ensure the input is an array given that the attribute
97
- # is documented as an array but the input is not
98
- if attributes[attribute_map[key]].is_a?(Array)
99
- transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
100
- _deserialize(::Regexp.last_match(1), v)
101
- }
102
- end
103
- elsif !attributes[attribute_map[key]].nil?
104
- transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
105
- end
106
- end
107
-
108
- new(transformed_hash)
109
- end
110
-
111
- # Deserializes the data based on type
112
- # @param string type Data type
113
- # @param string value Value to be deserialized
114
- # @return [Object] Deserialized data
115
- def self._deserialize(type, value)
116
- case type.to_sym
117
- when :Time
118
- Time.parse(value)
119
- when :Date
120
- Date.parse(value)
121
- when :String
122
- value.to_s
123
- when :Integer
124
- value.to_i
125
- when :Float
126
- value.to_f
127
- when :Boolean
128
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
129
- true
130
- else
131
- false
132
- end
133
-
134
- when :Object
135
- # generic object (usually a Hash), return directly
136
- value
137
- when /\AArray<(?<inner_type>.+)>\z/
138
- inner_type = Regexp.last_match[:inner_type]
139
- value.map { |v| _deserialize(inner_type, v) }
140
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
141
- k_type = Regexp.last_match[:k_type]
142
- v_type = Regexp.last_match[:v_type]
143
- {}.tap do |hash|
144
- value.each do |k, v|
145
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
146
- end
147
- end
148
- # model
149
- else
150
- # models (e.g. Pet) or oneOf
151
- klass = Algolia::Abtesting.const_get(type)
152
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
153
- .build_from_hash(value)
154
- end
155
- end
156
-
157
- # Returns the string representation of the object
158
- # @return [String] String presentation of the object
159
- def to_s
160
- to_hash.to_s
161
- end
162
-
163
- # to_body is an alias to to_hash (backward compatibility)
164
- # @return [Hash] Returns the object in the form of hash
165
- def to_body
166
- to_hash
167
- end
168
-
169
- def to_json(*_args)
170
- to_hash.to_json
171
- end
172
-
173
- # Returns the object in the form of hash
174
- # @return [Hash] Returns the object in the form of hash
175
- def to_hash
176
- hash = {}
177
- self.class.attribute_map.each_pair do |attr, param|
178
- value = send(attr)
179
- if value.nil?
180
- is_nullable = self.class.openapi_nullable.include?(attr)
181
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
182
- end
183
-
184
- hash[param] = _to_hash(value)
185
- end
186
-
187
- hash
188
- end
189
-
190
- # Outputs non-array value in the form of hash
191
- # For object, use to_hash. Otherwise, just return the value
192
- # @param [Object] value Any valid value
193
- # @return [Hash] Returns the value in the form of hash
194
- def _to_hash(value)
195
- if value.is_a?(Array)
196
- value.compact.map { |v| _to_hash(v) }
197
- elsif value.is_a?(Hash)
198
- {}.tap do |hash|
199
- value.each { |k, v| hash[k] = _to_hash(v) }
200
- end
201
- elsif value.respond_to?(:to_hash)
202
- value.to_hash
203
- else
204
- value
205
- end
206
- end
207
- end
208
- end
209
- end
@@ -1,247 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # 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.
4
-
5
- require "date"
6
- require "time"
7
-
8
- module Algolia
9
- module Abtesting
10
- class ScheduleABTestsRequest
11
- # A/B test name.
12
- attr_accessor :name
13
-
14
- # A/B test variants.
15
- attr_accessor :variants
16
-
17
- # Date and time when the A/B test is scheduled to start, in RFC 3339 format.
18
- attr_accessor :scheduled_at
19
-
20
- # End date and time of the A/B test, in RFC 3339 format.
21
- attr_accessor :end_at
22
-
23
- # Attribute mapping from ruby-style variable name to JSON key.
24
- def self.attribute_map
25
- {
26
- :name => :name,
27
- :variants => :variants,
28
- :scheduled_at => :scheduledAt,
29
- :end_at => :endAt
30
- }
31
- end
32
-
33
- # Attribute type mapping.
34
- def self.types_mapping
35
- {
36
- :name => :"String",
37
- :variants => :"Array<AddABTestsVariant>",
38
- :scheduled_at => :"String",
39
- :end_at => :"String"
40
- }
41
- end
42
-
43
- # List of attributes with nullable: true
44
- def self.openapi_nullable
45
- Set.new(
46
- []
47
- )
48
- end
49
-
50
- # Initializes the object
51
- # @param [Hash] attributes Model attributes in the form of hash
52
- def initialize(attributes = {})
53
- if (!attributes.is_a?(Hash))
54
- raise(
55
- ArgumentError,
56
- "The input argument (attributes) must be a hash in `Algolia::ScheduleABTestsRequest` initialize method"
57
- )
58
- end
59
-
60
- # check to see if the attribute exists and convert string to symbol for hash key
61
- attributes = attributes.each_with_object({}) { |(k, v), h|
62
- if (!self.class.attribute_map.key?(k.to_sym))
63
- raise(
64
- ArgumentError,
65
- "`#{k}` is not a valid attribute in `Algolia::ScheduleABTestsRequest`. Please check the name to make sure it's valid. List of attributes: " +
66
- self.class.attribute_map.keys.inspect
67
- )
68
- end
69
-
70
- h[k.to_sym] = v
71
- }
72
-
73
- if attributes.key?(:name)
74
- self.name = attributes[:name]
75
- else
76
- self.name = nil
77
- end
78
-
79
- if attributes.key?(:variants)
80
- if (value = attributes[:variants]).is_a?(Array)
81
- self.variants = value
82
- end
83
- else
84
- self.variants = nil
85
- end
86
-
87
- if attributes.key?(:scheduled_at)
88
- self.scheduled_at = attributes[:scheduled_at]
89
- else
90
- self.scheduled_at = nil
91
- end
92
-
93
- if attributes.key?(:end_at)
94
- self.end_at = attributes[:end_at]
95
- else
96
- self.end_at = nil
97
- end
98
- end
99
-
100
- # Checks equality by comparing each attribute.
101
- # @param [Object] Object to be compared
102
- def ==(other)
103
- return true if self.equal?(other)
104
- self.class == other.class &&
105
- name == other.name &&
106
- variants == other.variants &&
107
- scheduled_at == other.scheduled_at &&
108
- end_at == other.end_at
109
- end
110
-
111
- # @see the `==` method
112
- # @param [Object] Object to be compared
113
- def eql?(other)
114
- self == other
115
- end
116
-
117
- # Calculates hash code according to all attributes.
118
- # @return [Integer] Hash code
119
- def hash
120
- [name, variants, scheduled_at, end_at].hash
121
- end
122
-
123
- # Builds the object from hash
124
- # @param [Hash] attributes Model attributes in the form of hash
125
- # @return [Object] Returns the model itself
126
- def self.build_from_hash(attributes)
127
- return nil unless attributes.is_a?(Hash)
128
- attributes = attributes.transform_keys(&:to_sym)
129
- transformed_hash = {}
130
- types_mapping.each_pair do |key, type|
131
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
132
- transformed_hash[key.to_sym] = nil
133
- elsif type =~ /\AArray<(.*)>/i
134
- # check to ensure the input is an array given that the attribute
135
- # is documented as an array but the input is not
136
- if attributes[attribute_map[key]].is_a?(Array)
137
- transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
138
- _deserialize(::Regexp.last_match(1), v)
139
- }
140
- end
141
- elsif !attributes[attribute_map[key]].nil?
142
- transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
143
- end
144
- end
145
-
146
- new(transformed_hash)
147
- end
148
-
149
- # Deserializes the data based on type
150
- # @param string type Data type
151
- # @param string value Value to be deserialized
152
- # @return [Object] Deserialized data
153
- def self._deserialize(type, value)
154
- case type.to_sym
155
- when :Time
156
- Time.parse(value)
157
- when :Date
158
- Date.parse(value)
159
- when :String
160
- value.to_s
161
- when :Integer
162
- value.to_i
163
- when :Float
164
- value.to_f
165
- when :Boolean
166
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
167
- true
168
- else
169
- false
170
- end
171
-
172
- when :Object
173
- # generic object (usually a Hash), return directly
174
- value
175
- when /\AArray<(?<inner_type>.+)>\z/
176
- inner_type = Regexp.last_match[:inner_type]
177
- value.map { |v| _deserialize(inner_type, v) }
178
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
179
- k_type = Regexp.last_match[:k_type]
180
- v_type = Regexp.last_match[:v_type]
181
- {}.tap do |hash|
182
- value.each do |k, v|
183
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
184
- end
185
- end
186
- # model
187
- else
188
- # models (e.g. Pet) or oneOf
189
- klass = Algolia::Abtesting.const_get(type)
190
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
191
- .build_from_hash(value)
192
- end
193
- end
194
-
195
- # Returns the string representation of the object
196
- # @return [String] String presentation of the object
197
- def to_s
198
- to_hash.to_s
199
- end
200
-
201
- # to_body is an alias to to_hash (backward compatibility)
202
- # @return [Hash] Returns the object in the form of hash
203
- def to_body
204
- to_hash
205
- end
206
-
207
- def to_json(*_args)
208
- to_hash.to_json
209
- end
210
-
211
- # Returns the object in the form of hash
212
- # @return [Hash] Returns the object in the form of hash
213
- def to_hash
214
- hash = {}
215
- self.class.attribute_map.each_pair do |attr, param|
216
- value = send(attr)
217
- if value.nil?
218
- is_nullable = self.class.openapi_nullable.include?(attr)
219
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
220
- end
221
-
222
- hash[param] = _to_hash(value)
223
- end
224
-
225
- hash
226
- end
227
-
228
- # Outputs non-array value in the form of hash
229
- # For object, use to_hash. Otherwise, just return the value
230
- # @param [Object] value Any valid value
231
- # @return [Hash] Returns the value in the form of hash
232
- def _to_hash(value)
233
- if value.is_a?(Array)
234
- value.compact.map { |v| _to_hash(v) }
235
- elsif value.is_a?(Hash)
236
- {}.tap do |hash|
237
- value.each { |k, v| hash[k] = _to_hash(v) }
238
- end
239
- elsif value.respond_to?(:to_hash)
240
- value.to_hash
241
- else
242
- value
243
- end
244
- end
245
- end
246
- end
247
- end
@@ -1,209 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # 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.
4
-
5
- require "date"
6
- require "time"
7
-
8
- module Algolia
9
- module AbtestingV3
10
- class ScheduleABTestResponse
11
- # Unique scheduled A/B test identifier.
12
- attr_accessor :ab_test_schedule_id
13
-
14
- # Attribute mapping from ruby-style variable name to JSON key.
15
- def self.attribute_map
16
- {
17
- :ab_test_schedule_id => :abTestScheduleID
18
- }
19
- end
20
-
21
- # Attribute type mapping.
22
- def self.types_mapping
23
- {
24
- :ab_test_schedule_id => :"Integer"
25
- }
26
- end
27
-
28
- # List of attributes with nullable: true
29
- def self.openapi_nullable
30
- Set.new(
31
- []
32
- )
33
- end
34
-
35
- # Initializes the object
36
- # @param [Hash] attributes Model attributes in the form of hash
37
- def initialize(attributes = {})
38
- if (!attributes.is_a?(Hash))
39
- raise(
40
- ArgumentError,
41
- "The input argument (attributes) must be a hash in `Algolia::ScheduleABTestResponse` initialize method"
42
- )
43
- end
44
-
45
- # check to see if the attribute exists and convert string to symbol for hash key
46
- attributes = attributes.each_with_object({}) { |(k, v), h|
47
- if (!self.class.attribute_map.key?(k.to_sym))
48
- raise(
49
- ArgumentError,
50
- "`#{k}` is not a valid attribute in `Algolia::ScheduleABTestResponse`. Please check the name to make sure it's valid. List of attributes: " +
51
- self.class.attribute_map.keys.inspect
52
- )
53
- end
54
-
55
- h[k.to_sym] = v
56
- }
57
-
58
- if attributes.key?(:ab_test_schedule_id)
59
- self.ab_test_schedule_id = attributes[:ab_test_schedule_id]
60
- else
61
- self.ab_test_schedule_id = nil
62
- end
63
- end
64
-
65
- # Checks equality by comparing each attribute.
66
- # @param [Object] Object to be compared
67
- def ==(other)
68
- return true if self.equal?(other)
69
- self.class == other.class &&
70
- ab_test_schedule_id == other.ab_test_schedule_id
71
- end
72
-
73
- # @see the `==` method
74
- # @param [Object] Object to be compared
75
- def eql?(other)
76
- self == other
77
- end
78
-
79
- # Calculates hash code according to all attributes.
80
- # @return [Integer] Hash code
81
- def hash
82
- [ab_test_schedule_id].hash
83
- end
84
-
85
- # Builds the object from hash
86
- # @param [Hash] attributes Model attributes in the form of hash
87
- # @return [Object] Returns the model itself
88
- def self.build_from_hash(attributes)
89
- return nil unless attributes.is_a?(Hash)
90
- attributes = attributes.transform_keys(&:to_sym)
91
- transformed_hash = {}
92
- types_mapping.each_pair do |key, type|
93
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
94
- transformed_hash[key.to_sym] = nil
95
- elsif type =~ /\AArray<(.*)>/i
96
- # check to ensure the input is an array given that the attribute
97
- # is documented as an array but the input is not
98
- if attributes[attribute_map[key]].is_a?(Array)
99
- transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
100
- _deserialize(::Regexp.last_match(1), v)
101
- }
102
- end
103
- elsif !attributes[attribute_map[key]].nil?
104
- transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
105
- end
106
- end
107
-
108
- new(transformed_hash)
109
- end
110
-
111
- # Deserializes the data based on type
112
- # @param string type Data type
113
- # @param string value Value to be deserialized
114
- # @return [Object] Deserialized data
115
- def self._deserialize(type, value)
116
- case type.to_sym
117
- when :Time
118
- Time.parse(value)
119
- when :Date
120
- Date.parse(value)
121
- when :String
122
- value.to_s
123
- when :Integer
124
- value.to_i
125
- when :Float
126
- value.to_f
127
- when :Boolean
128
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
129
- true
130
- else
131
- false
132
- end
133
-
134
- when :Object
135
- # generic object (usually a Hash), return directly
136
- value
137
- when /\AArray<(?<inner_type>.+)>\z/
138
- inner_type = Regexp.last_match[:inner_type]
139
- value.map { |v| _deserialize(inner_type, v) }
140
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
141
- k_type = Regexp.last_match[:k_type]
142
- v_type = Regexp.last_match[:v_type]
143
- {}.tap do |hash|
144
- value.each do |k, v|
145
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
146
- end
147
- end
148
- # model
149
- else
150
- # models (e.g. Pet) or oneOf
151
- klass = Algolia::AbtestingV3.const_get(type)
152
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
153
- .build_from_hash(value)
154
- end
155
- end
156
-
157
- # Returns the string representation of the object
158
- # @return [String] String presentation of the object
159
- def to_s
160
- to_hash.to_s
161
- end
162
-
163
- # to_body is an alias to to_hash (backward compatibility)
164
- # @return [Hash] Returns the object in the form of hash
165
- def to_body
166
- to_hash
167
- end
168
-
169
- def to_json(*_args)
170
- to_hash.to_json
171
- end
172
-
173
- # Returns the object in the form of hash
174
- # @return [Hash] Returns the object in the form of hash
175
- def to_hash
176
- hash = {}
177
- self.class.attribute_map.each_pair do |attr, param|
178
- value = send(attr)
179
- if value.nil?
180
- is_nullable = self.class.openapi_nullable.include?(attr)
181
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
182
- end
183
-
184
- hash[param] = _to_hash(value)
185
- end
186
-
187
- hash
188
- end
189
-
190
- # Outputs non-array value in the form of hash
191
- # For object, use to_hash. Otherwise, just return the value
192
- # @param [Object] value Any valid value
193
- # @return [Hash] Returns the value in the form of hash
194
- def _to_hash(value)
195
- if value.is_a?(Array)
196
- value.compact.map { |v| _to_hash(v) }
197
- elsif value.is_a?(Hash)
198
- {}.tap do |hash|
199
- value.each { |k, v| hash[k] = _to_hash(v) }
200
- end
201
- elsif value.respond_to?(:to_hash)
202
- value.to_hash
203
- else
204
- value
205
- end
206
- end
207
- end
208
- end
209
- end
@@ -1,270 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # 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.
4
-
5
- require "date"
6
- require "time"
7
-
8
- module Algolia
9
- module AbtestingV3
10
- class ScheduleABTestsRequest
11
- # A/B test name.
12
- attr_accessor :name
13
-
14
- # A/B test variants.
15
- attr_accessor :variants
16
-
17
- # A/B test metrics involved in the test. Only these metrics will be considered when calculating results.
18
- attr_accessor :metrics
19
-
20
- attr_accessor :configuration
21
-
22
- # Date and time when the A/B test is scheduled to start, in RFC 3339 format.
23
- attr_accessor :scheduled_at
24
-
25
- # End date and time of the A/B test, in RFC 3339 format.
26
- attr_accessor :end_at
27
-
28
- # Attribute mapping from ruby-style variable name to JSON key.
29
- def self.attribute_map
30
- {
31
- :name => :name,
32
- :variants => :variants,
33
- :metrics => :metrics,
34
- :configuration => :configuration,
35
- :scheduled_at => :scheduledAt,
36
- :end_at => :endAt
37
- }
38
- end
39
-
40
- # Attribute type mapping.
41
- def self.types_mapping
42
- {
43
- :name => :"String",
44
- :variants => :"Array<AddABTestsVariant>",
45
- :metrics => :"Array<CreateMetric>",
46
- :configuration => :"ABTestConfiguration",
47
- :scheduled_at => :"String",
48
- :end_at => :"String"
49
- }
50
- end
51
-
52
- # List of attributes with nullable: true
53
- def self.openapi_nullable
54
- Set.new(
55
- []
56
- )
57
- end
58
-
59
- # Initializes the object
60
- # @param [Hash] attributes Model attributes in the form of hash
61
- def initialize(attributes = {})
62
- if (!attributes.is_a?(Hash))
63
- raise(
64
- ArgumentError,
65
- "The input argument (attributes) must be a hash in `Algolia::ScheduleABTestsRequest` initialize method"
66
- )
67
- end
68
-
69
- # check to see if the attribute exists and convert string to symbol for hash key
70
- attributes = attributes.each_with_object({}) { |(k, v), h|
71
- if (!self.class.attribute_map.key?(k.to_sym))
72
- raise(
73
- ArgumentError,
74
- "`#{k}` is not a valid attribute in `Algolia::ScheduleABTestsRequest`. Please check the name to make sure it's valid. List of attributes: " +
75
- self.class.attribute_map.keys.inspect
76
- )
77
- end
78
-
79
- h[k.to_sym] = v
80
- }
81
-
82
- if attributes.key?(:name)
83
- self.name = attributes[:name]
84
- else
85
- self.name = nil
86
- end
87
-
88
- if attributes.key?(:variants)
89
- if (value = attributes[:variants]).is_a?(Array)
90
- self.variants = value
91
- end
92
- else
93
- self.variants = nil
94
- end
95
-
96
- if attributes.key?(:metrics)
97
- if (value = attributes[:metrics]).is_a?(Array)
98
- self.metrics = value
99
- end
100
- else
101
- self.metrics = nil
102
- end
103
-
104
- if attributes.key?(:configuration)
105
- self.configuration = attributes[:configuration]
106
- end
107
-
108
- if attributes.key?(:scheduled_at)
109
- self.scheduled_at = attributes[:scheduled_at]
110
- else
111
- self.scheduled_at = nil
112
- end
113
-
114
- if attributes.key?(:end_at)
115
- self.end_at = attributes[:end_at]
116
- else
117
- self.end_at = nil
118
- end
119
- end
120
-
121
- # Checks equality by comparing each attribute.
122
- # @param [Object] Object to be compared
123
- def ==(other)
124
- return true if self.equal?(other)
125
- self.class == other.class &&
126
- name == other.name &&
127
- variants == other.variants &&
128
- metrics == other.metrics &&
129
- configuration == other.configuration &&
130
- scheduled_at == other.scheduled_at &&
131
- end_at == other.end_at
132
- end
133
-
134
- # @see the `==` method
135
- # @param [Object] Object to be compared
136
- def eql?(other)
137
- self == other
138
- end
139
-
140
- # Calculates hash code according to all attributes.
141
- # @return [Integer] Hash code
142
- def hash
143
- [name, variants, metrics, configuration, scheduled_at, end_at].hash
144
- end
145
-
146
- # Builds the object from hash
147
- # @param [Hash] attributes Model attributes in the form of hash
148
- # @return [Object] Returns the model itself
149
- def self.build_from_hash(attributes)
150
- return nil unless attributes.is_a?(Hash)
151
- attributes = attributes.transform_keys(&:to_sym)
152
- transformed_hash = {}
153
- types_mapping.each_pair do |key, type|
154
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
155
- transformed_hash[key.to_sym] = nil
156
- elsif type =~ /\AArray<(.*)>/i
157
- # check to ensure the input is an array given that the attribute
158
- # is documented as an array but the input is not
159
- if attributes[attribute_map[key]].is_a?(Array)
160
- transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
161
- _deserialize(::Regexp.last_match(1), v)
162
- }
163
- end
164
- elsif !attributes[attribute_map[key]].nil?
165
- transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
166
- end
167
- end
168
-
169
- new(transformed_hash)
170
- end
171
-
172
- # Deserializes the data based on type
173
- # @param string type Data type
174
- # @param string value Value to be deserialized
175
- # @return [Object] Deserialized data
176
- def self._deserialize(type, value)
177
- case type.to_sym
178
- when :Time
179
- Time.parse(value)
180
- when :Date
181
- Date.parse(value)
182
- when :String
183
- value.to_s
184
- when :Integer
185
- value.to_i
186
- when :Float
187
- value.to_f
188
- when :Boolean
189
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
190
- true
191
- else
192
- false
193
- end
194
-
195
- when :Object
196
- # generic object (usually a Hash), return directly
197
- value
198
- when /\AArray<(?<inner_type>.+)>\z/
199
- inner_type = Regexp.last_match[:inner_type]
200
- value.map { |v| _deserialize(inner_type, v) }
201
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
202
- k_type = Regexp.last_match[:k_type]
203
- v_type = Regexp.last_match[:v_type]
204
- {}.tap do |hash|
205
- value.each do |k, v|
206
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
207
- end
208
- end
209
- # model
210
- else
211
- # models (e.g. Pet) or oneOf
212
- klass = Algolia::AbtestingV3.const_get(type)
213
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
214
- .build_from_hash(value)
215
- end
216
- end
217
-
218
- # Returns the string representation of the object
219
- # @return [String] String presentation of the object
220
- def to_s
221
- to_hash.to_s
222
- end
223
-
224
- # to_body is an alias to to_hash (backward compatibility)
225
- # @return [Hash] Returns the object in the form of hash
226
- def to_body
227
- to_hash
228
- end
229
-
230
- def to_json(*_args)
231
- to_hash.to_json
232
- end
233
-
234
- # Returns the object in the form of hash
235
- # @return [Hash] Returns the object in the form of hash
236
- def to_hash
237
- hash = {}
238
- self.class.attribute_map.each_pair do |attr, param|
239
- value = send(attr)
240
- if value.nil?
241
- is_nullable = self.class.openapi_nullable.include?(attr)
242
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
243
- end
244
-
245
- hash[param] = _to_hash(value)
246
- end
247
-
248
- hash
249
- end
250
-
251
- # Outputs non-array value in the form of hash
252
- # For object, use to_hash. Otherwise, just return the value
253
- # @param [Object] value Any valid value
254
- # @return [Hash] Returns the value in the form of hash
255
- def _to_hash(value)
256
- if value.is_a?(Array)
257
- value.compact.map { |v| _to_hash(v) }
258
- elsif value.is_a?(Hash)
259
- {}.tap do |hash|
260
- value.each { |k, v| hash[k] = _to_hash(v) }
261
- end
262
- elsif value.respond_to?(:to_hash)
263
- value.to_hash
264
- else
265
- value
266
- end
267
- end
268
- end
269
- end
270
- end