algolia 3.0.2 → 3.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a2db79886806c29bdf96a017eea6d71dc27642c96c458b3bb738f36e10a2a656
4
- data.tar.gz: 794c03f031a23e286fff1ed4afc1c6b68dda072e6b0b9f79326df42c2103f855
3
+ metadata.gz: 0e17bb4992fec59b9eadf29c8243f9c10f029dc9af23278a0c51230b7d9ef4bb
4
+ data.tar.gz: a4f61aa37084e234676d7d6abe97a9e3febf78b3069b45eb0eeab6cb49979f6c
5
5
  SHA512:
6
- metadata.gz: e9d02e869e5951131489f5189a629cec8af091b0d106e8628e7807e28510b3bea59b1d388882598b7020ba81c99725e9a966bf67861ae5dd6d26a64d78329485
7
- data.tar.gz: 8a5b4f638f685d1c4ccdd3e29b9b62c6a8992827ae3de13252d66b18a66a3e6a05f9b7e07a0df746db24313d207e38df79303772305e1934505a1e48c7eeb7b0
6
+ metadata.gz: 1c508315e7ff164a28ac8e6631d5ed6036cfe815330c99b8ad08b7f74f613317e7c43354afcda3b1a3989653961758468260ddb7b05f160a51393d67af5f76a6
7
+ data.tar.gz: 610361616a11645b18962e5128f39b20ed6fd9c6fec22bc6076ddb7deb84d7e3a13c01353c297d00603068539ec1be9a66f2528cdc02ed411ec50726ad5d7da5
@@ -0,0 +1,69 @@
1
+ name: 'Issue sync with Jira'
2
+ on:
3
+ issues:
4
+ types: [opened]
5
+
6
+ permissions:
7
+ issues: write
8
+ contents: read
9
+
10
+ jobs:
11
+ sync:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - name: Create ticket
15
+ uses: actions/github-script@v7
16
+ with:
17
+ script: |
18
+ const action = context.payload.action;
19
+ if (action !== 'opened') {
20
+ return;
21
+ }
22
+ const title = context.payload.issue.title;
23
+ const body = context.payload.issue.body;
24
+
25
+ const res = await fetch('https://algolia.atlassian.net/rest/api/3/issue', {
26
+ method: 'POST',
27
+ headers: {
28
+ 'Accept': 'application/json',
29
+ 'Content-Type': 'application/json',
30
+ 'Authorization': `Basic ${{ secrets.JIRA_TOKEN }}`
31
+ },
32
+ body: JSON.stringify({
33
+ fields: {
34
+ description: {
35
+ content: [
36
+ {
37
+ content: [
38
+ {
39
+ text: `Issue created by ${context.actor} at ${context.payload.issue.html_url} \n\n${body}`,
40
+ type: 'text'
41
+ }
42
+ ],
43
+ type: 'paragraph'
44
+ }
45
+ ],
46
+ type: 'doc',
47
+ version: 1
48
+ },
49
+ issuetype: {
50
+ id: '10001'
51
+ },
52
+ parent: {
53
+ key: 'DI-2737'
54
+ },
55
+ project: {
56
+ id: '10118'
57
+ },
58
+ summary: `[GH-ISSUE] ${title}`
59
+ },
60
+ update: {}
61
+ })
62
+ });
63
+
64
+ if (!res.ok) {
65
+ throw new Error(`Failed to create ticket: ${res.statusText} (${res.status}) - ${await res.text()}`);
66
+ }
67
+
68
+ const data = await res.json();
69
+ console.log(`Created ticket: ${data.key}`);
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## [3.1.1](https://github.com/algolia/algoliasearch-client-ruby/compare/3.1.0...3.1.1)
2
+
3
+ - [4cbbce55c](https://github.com/algolia/api-clients-automation/commit/4cbbce55c) fix(clients): highlight and snippet results e2e ([#3567](https://github.com/algolia/api-clients-automation/pull/3567)) by [@shortcuts](https://github.com/shortcuts/)
4
+ - [7c7de04ab](https://github.com/algolia/api-clients-automation/commit/7c7de04ab) fix(specs): another wrong link ([#3570](https://github.com/algolia/api-clients-automation/pull/3570)) by [@kai687](https://github.com/kai687/)
5
+ - [f38a9ef12](https://github.com/algolia/api-clients-automation/commit/f38a9ef12) chore(specs): breaking change method names mapping table ([#3568](https://github.com/algolia/api-clients-automation/pull/3568)) by [@shortcuts](https://github.com/shortcuts/)
6
+ - [9dedfc90f](https://github.com/algolia/api-clients-automation/commit/9dedfc90f) fix(clients): mention `main` branch instead of `master` ([#3566](https://github.com/algolia/api-clients-automation/pull/3566)) by [@shortcuts](https://github.com/shortcuts/)
7
+ - [0e5ffb1e8](https://github.com/algolia/api-clients-automation/commit/0e5ffb1e8) fix(specs): broken link ([#3559](https://github.com/algolia/api-clients-automation/pull/3559)) by [@kai687](https://github.com/kai687/)
8
+
9
+ ## [3.1.0](https://github.com/algolia/algoliasearch-client-ruby/compare/3.0.2...3.1.0)
10
+
11
+ - [d53060d96](https://github.com/algolia/api-clients-automation/commit/d53060d96) feat(specs): add /schedule endpoint ([#3350](https://github.com/algolia/api-clients-automation/pull/3350)) by [@febeck](https://github.com/febeck/)
12
+
1
13
  ## [3.0.2](https://github.com/algolia/algoliasearch-client-ruby/compare/3.0.1...3.0.2)
2
14
 
3
15
  - [6cfc2d479](https://github.com/algolia/api-clients-automation/commit/6cfc2d479) chore(specs): update rendered title for search params ([#3553](https://github.com/algolia/api-clients-automation/pull/3553)) by [@shortcuts](https://github.com/shortcuts/)
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- algolia (3.0.2)
4
+ algolia (3.1.1)
5
5
  base64 (>= 0.2.0, < 1)
6
6
  faraday (>= 1.0.1, < 3.0)
7
7
  faraday-net_http_persistent (>= 0.15, < 3)
data/README.md CHANGED
@@ -13,7 +13,7 @@
13
13
  </p>
14
14
 
15
15
  <p align="center">
16
- <a href="https://www.algolia.com/doc/api-client/getting-started/install/ruby/" target="_blank">Documentation</a> •
16
+ <a href="https://www.algolia.com/doc/libraries/ruby/" target="_blank">Documentation</a> •
17
17
  <a href="https://github.com/algolia/algoliasearch-rails" target="_blank">Rails</a> •
18
18
  <a href="https://discourse.algolia.com" target="_blank">Community Forum</a> •
19
19
  <a href="http://stackoverflow.com/questions/tagged/algolia" target="_blank">Stack Overflow</a> •
@@ -47,7 +47,7 @@ Finally, you may begin searching a object using the `search` method:
47
47
  objects = client.search_single_index('your_index_name', 'Foo')
48
48
  ```
49
49
 
50
- For full documentation, visit the **[Algolia Ruby API Client](https://www.algolia.com/doc/api-client/getting-started/install/ruby/)**.
50
+ For full documentation, visit the **[Algolia Ruby API Client](https://www.algolia.com/doc/libraries/ruby/)**.
51
51
 
52
52
  ## ❓ Troubleshooting
53
53
 
@@ -409,6 +409,50 @@ module Algolia
409
409
  @api_client.deserialize(response.body, request_options[:debug_return_type] || "Abtesting::ListABTestsResponse")
410
410
  end
411
411
 
412
+ # Schedule an A/B test to be started at a later time.
413
+ #
414
+ # Required API Key ACLs:
415
+ # - editSettings
416
+ # @param schedule_ab_tests_request [ScheduleABTestsRequest] (required)
417
+ # @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)
418
+ # @return [Http::Response] the response
419
+ def schedule_ab_test_with_http_info(schedule_ab_tests_request, request_options = {})
420
+ # verify the required parameter 'schedule_ab_tests_request' is set
421
+ if @api_client.config.client_side_validation && schedule_ab_tests_request.nil?
422
+ raise ArgumentError, "Parameter `schedule_ab_tests_request` is required when calling `schedule_ab_test`."
423
+ end
424
+
425
+ path = "/2/abtests/schedule"
426
+ query_params = {}
427
+ query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
428
+ header_params = {}
429
+ header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?
430
+
431
+ post_body = request_options[:debug_body] || @api_client.object_to_http_body(schedule_ab_tests_request)
432
+
433
+ new_options = request_options.merge(
434
+ :operation => :"AbtestingClient.schedule_ab_test",
435
+ :header_params => header_params,
436
+ :query_params => query_params,
437
+ :body => post_body,
438
+ :use_read_transporter => false
439
+ )
440
+
441
+ @api_client.call_api(:POST, path, new_options)
442
+ end
443
+
444
+ # Schedule an A/B test to be started at a later time.
445
+ #
446
+ # Required API Key ACLs:
447
+ # - editSettings
448
+ # @param schedule_ab_tests_request [ScheduleABTestsRequest] (required)
449
+ # @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)
450
+ # @return [ScheduleABTestResponse]
451
+ def schedule_ab_test(schedule_ab_tests_request, request_options = {})
452
+ response = schedule_ab_test_with_http_info(schedule_ab_tests_request, request_options)
453
+ @api_client.deserialize(response.body, request_options[:debug_return_type] || "Abtesting::ScheduleABTestResponse")
454
+ end
455
+
412
456
  # Stops an A/B test by its ID. You can&#39;t restart stopped A/B tests.
413
457
  #
414
458
  # Required API Key ACLs:
@@ -818,7 +818,7 @@ module Algolia
818
818
  @api_client.deserialize(response.body, request_options[:debug_return_type] || "Search::DeleteApiKeyResponse")
819
819
  end
820
820
 
821
- # This operation doesn&#39;t accept empty queries or filters. It&#39;s more efficient to get a list of object IDs with the [&#x60;browse&#x60; operation](#tag/Search/operation/browse), and then delete the records using the [&#x60;batch&#x60; operation](tag/Records/operation/batch).
821
+ # This operation doesn&#39;t accept empty queries or filters. It&#39;s more efficient to get a list of object IDs with the [&#x60;browse&#x60; operation](#tag/Search/operation/browse), and then delete the records using the [&#x60;batch&#x60; operation](#tag/Records/operation/batch).
822
822
  #
823
823
  # Required API Key ACLs:
824
824
  # - deleteIndex
@@ -855,7 +855,7 @@ module Algolia
855
855
  @api_client.call_api(:POST, path, new_options)
856
856
  end
857
857
 
858
- # This operation doesn't accept empty queries or filters. It's more efficient to get a list of object IDs with the [`browse` operation](#tag/Search/operation/browse), and then delete the records using the [`batch` operation](tag/Records/operation/batch).
858
+ # This operation doesn't accept empty queries or filters. It's more efficient to get a list of object IDs with the [`browse` operation](#tag/Search/operation/browse), and then delete the records using the [`batch` operation](#tag/Records/operation/batch).
859
859
  #
860
860
  # Required API Key ACLs:
861
861
  # - deleteIndex
@@ -2294,7 +2294,7 @@ module Algolia
2294
2294
  @api_client.deserialize(response.body, request_options[:debug_return_type] || "Search::AddApiKeyResponse")
2295
2295
  end
2296
2296
 
2297
- # Adds a record to an index or replace it. - If the record doesn&#39;t have an object ID, a new record with an auto-generated object ID is added to your index. - If a record with the specified object ID exists, the existing record is replaced. - If a record with the specified object ID doesn&#39;t exist, a new record is added to your index. - If you add a record to an index that doesn&#39;t exist yet, a new index is created. To update _some_ attributes of a record, use the [&#x60;partial&#x60; operation](#tag/Records/operation/partial). To add, update, or replace multiple records, use the [&#x60;batch&#x60; operation](#tag/Records/operation/batch).
2297
+ # Adds a record to an index or replace it. - If the record doesn&#39;t have an object ID, a new record with an auto-generated object ID is added to your index. - If a record with the specified object ID exists, the existing record is replaced. - If a record with the specified object ID doesn&#39;t exist, a new record is added to your index. - If you add a record to an index that doesn&#39;t exist yet, a new index is created. To update _some_ attributes of a record, use the [&#x60;partial&#x60; operation](#tag/Records/operation/partialUpdateObject). To add, update, or replace multiple records, use the [&#x60;batch&#x60; operation](#tag/Records/operation/batch).
2298
2298
  #
2299
2299
  # Required API Key ACLs:
2300
2300
  # - addObject
@@ -2331,7 +2331,7 @@ module Algolia
2331
2331
  @api_client.call_api(:POST, path, new_options)
2332
2332
  end
2333
2333
 
2334
- # Adds a record to an index or replace it. - If the record doesn't have an object ID, a new record with an auto-generated object ID is added to your index. - If a record with the specified object ID exists, the existing record is replaced. - If a record with the specified object ID doesn't exist, a new record is added to your index. - If you add a record to an index that doesn't exist yet, a new index is created. To update _some_ attributes of a record, use the [`partial` operation](#tag/Records/operation/partial). To add, update, or replace multiple records, use the [`batch` operation](#tag/Records/operation/batch).
2334
+ # Adds a record to an index or replace it. - If the record doesn't have an object ID, a new record with an auto-generated object ID is added to your index. - If a record with the specified object ID exists, the existing record is replaced. - If a record with the specified object ID doesn't exist, a new record is added to your index. - If you add a record to an index that doesn't exist yet, a new index is created. To update _some_ attributes of a record, use the [`partial` operation](#tag/Records/operation/partialUpdateObject). To add, update, or replace multiple records, use the [`batch` operation](#tag/Records/operation/batch).
2335
2335
  #
2336
2336
  # Required API Key ACLs:
2337
2337
  # - addObject
@@ -144,34 +144,24 @@ module Algolia
144
144
 
145
145
  if attributes.key?(:click_significance)
146
146
  self.click_significance = attributes[:click_significance]
147
- else
148
- self.click_significance = nil
149
147
  end
150
148
 
151
149
  if attributes.key?(:conversion_significance)
152
150
  self.conversion_significance = attributes[:conversion_significance]
153
- else
154
- self.conversion_significance = nil
155
151
  end
156
152
 
157
153
  if attributes.key?(:add_to_cart_significance)
158
154
  self.add_to_cart_significance = attributes[:add_to_cart_significance]
159
- else
160
- self.add_to_cart_significance = nil
161
155
  end
162
156
 
163
157
  if attributes.key?(:purchase_significance)
164
158
  self.purchase_significance = attributes[:purchase_significance]
165
- else
166
- self.purchase_significance = nil
167
159
  end
168
160
 
169
161
  if attributes.key?(:revenue_significance)
170
162
  if (value = attributes[:revenue_significance]).is_a?(Hash)
171
163
  self.revenue_significance = value
172
164
  end
173
- else
174
- self.revenue_significance = nil
175
165
  end
176
166
 
177
167
  if attributes.key?(:updated_at)
@@ -0,0 +1,214 @@
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
+ require "date"
4
+ require "time"
5
+
6
+ module Algolia
7
+ module Abtesting
8
+ class ScheduleABTestResponse
9
+ # Unique scheduled A/B test identifier.
10
+ attr_accessor :ab_test_schedule_id
11
+
12
+ # Attribute mapping from ruby-style variable name to JSON key.
13
+ def self.attribute_map
14
+ {
15
+ :ab_test_schedule_id => :abTestScheduleID
16
+ }
17
+ end
18
+
19
+ # Returns all the JSON keys this model knows about
20
+ def self.acceptable_attributes
21
+ attribute_map.values
22
+ end
23
+
24
+ # Attribute type mapping.
25
+ def self.types_mapping
26
+ {
27
+ :ab_test_schedule_id => :"Integer"
28
+ }
29
+ end
30
+
31
+ # List of attributes with nullable: true
32
+ def self.openapi_nullable
33
+ Set.new(
34
+ []
35
+ )
36
+ end
37
+
38
+ # Initializes the object
39
+ # @param [Hash] attributes Model attributes in the form of hash
40
+ def initialize(attributes = {})
41
+ if (!attributes.is_a?(Hash))
42
+ raise(
43
+ ArgumentError,
44
+ "The input argument (attributes) must be a hash in `Algolia::ScheduleABTestResponse` initialize method"
45
+ )
46
+ end
47
+
48
+ # check to see if the attribute exists and convert string to symbol for hash key
49
+ attributes = attributes.each_with_object({}) { |(k, v), h|
50
+ if (!self.class.attribute_map.key?(k.to_sym))
51
+ raise(
52
+ ArgumentError,
53
+ "`#{k}` is not a valid attribute in `Algolia::ScheduleABTestResponse`. Please check the name to make sure it's valid. List of attributes: " +
54
+ self.class.attribute_map.keys.inspect
55
+ )
56
+ end
57
+
58
+ h[k.to_sym] = v
59
+ }
60
+
61
+ if attributes.key?(:ab_test_schedule_id)
62
+ self.ab_test_schedule_id = attributes[:ab_test_schedule_id]
63
+ else
64
+ self.ab_test_schedule_id = nil
65
+ end
66
+ end
67
+
68
+ # Checks equality by comparing each attribute.
69
+ # @param [Object] Object to be compared
70
+ def ==(other)
71
+ return true if self.equal?(other)
72
+ self.class == other.class &&
73
+ ab_test_schedule_id == other.ab_test_schedule_id
74
+ end
75
+
76
+ # @see the `==` method
77
+ # @param [Object] Object to be compared
78
+ def eql?(other)
79
+ self == other
80
+ end
81
+
82
+ # Calculates hash code according to all attributes.
83
+ # @return [Integer] Hash code
84
+ def hash
85
+ [ab_test_schedule_id].hash
86
+ end
87
+
88
+ # Builds the object from hash
89
+ # @param [Hash] attributes Model attributes in the form of hash
90
+ # @return [Object] Returns the model itself
91
+ def self.build_from_hash(attributes)
92
+ return nil unless attributes.is_a?(Hash)
93
+ attributes = attributes.transform_keys(&:to_sym)
94
+ transformed_hash = {}
95
+ types_mapping.each_pair do |key, type|
96
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
97
+ transformed_hash[key.to_sym] = nil
98
+ elsif type =~ /\AArray<(.*)>/i
99
+ # check to ensure the input is an array given that the attribute
100
+ # is documented as an array but the input is not
101
+ if attributes[attribute_map[key]].is_a?(Array)
102
+ transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
103
+ _deserialize(::Regexp.last_match(1), v)
104
+ }
105
+ end
106
+ elsif !attributes[attribute_map[key]].nil?
107
+ transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
108
+ end
109
+ end
110
+
111
+ new(transformed_hash)
112
+ end
113
+
114
+ # Deserializes the data based on type
115
+ # @param string type Data type
116
+ # @param string value Value to be deserialized
117
+ # @return [Object] Deserialized data
118
+ def self._deserialize(type, value)
119
+ case type.to_sym
120
+ when :Time
121
+ Time.parse(value)
122
+ when :Date
123
+ Date.parse(value)
124
+ when :String
125
+ value.to_s
126
+ when :Integer
127
+ value.to_i
128
+ when :Float
129
+ value.to_f
130
+ when :Boolean
131
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
132
+ true
133
+ else
134
+ false
135
+ end
136
+
137
+ when :Object
138
+ # generic object (usually a Hash), return directly
139
+ value
140
+ when /\AArray<(?<inner_type>.+)>\z/
141
+ inner_type = Regexp.last_match[:inner_type]
142
+ value.map { |v| _deserialize(inner_type, v) }
143
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
144
+ k_type = Regexp.last_match[:k_type]
145
+ v_type = Regexp.last_match[:v_type]
146
+ {}.tap do |hash|
147
+ value.each do |k, v|
148
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
149
+ end
150
+ end
151
+ # model
152
+ else
153
+ # models (e.g. Pet) or oneOf
154
+ klass = Algolia::Abtesting.const_get(type)
155
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
156
+ .build_from_hash(value)
157
+ end
158
+ end
159
+
160
+ # Returns the string representation of the object
161
+ # @return [String] String presentation of the object
162
+ def to_s
163
+ to_hash.to_s
164
+ end
165
+
166
+ # to_body is an alias to to_hash (backward compatibility)
167
+ # @return [Hash] Returns the object in the form of hash
168
+ def to_body
169
+ to_hash
170
+ end
171
+
172
+ def to_json(*_args)
173
+ to_hash.to_json
174
+ end
175
+
176
+ # Returns the object in the form of hash
177
+ # @return [Hash] Returns the object in the form of hash
178
+ def to_hash
179
+ hash = {}
180
+ self.class.attribute_map.each_pair do |attr, param|
181
+ value = send(attr)
182
+ if value.nil?
183
+ is_nullable = self.class.openapi_nullable.include?(attr)
184
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
185
+ end
186
+
187
+ hash[param] = _to_hash(value)
188
+ end
189
+
190
+ hash
191
+ end
192
+
193
+ # Outputs non-array value in the form of hash
194
+ # For object, use to_hash. Otherwise, just return the value
195
+ # @param [Object] value Any valid value
196
+ # @return [Hash] Returns the value in the form of hash
197
+ def _to_hash(value)
198
+ if value.is_a?(Array)
199
+ value.compact.map { |v| _to_hash(v) }
200
+ elsif value.is_a?(Hash)
201
+ {}.tap do |hash|
202
+ value.each { |k, v| hash[k] = _to_hash(v) }
203
+ end
204
+ elsif value.respond_to?(:to_hash)
205
+ value.to_hash
206
+ else
207
+ value
208
+ end
209
+ end
210
+
211
+ end
212
+
213
+ end
214
+ end
@@ -0,0 +1,270 @@
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
+ require "date"
4
+ require "time"
5
+
6
+ module Algolia
7
+ module Abtesting
8
+ class ScheduleABTestsRequest
9
+ # A/B test name.
10
+ attr_accessor :name
11
+
12
+ # A/B test variants.
13
+ attr_accessor :variants
14
+
15
+ # Date and time when the A/B test is scheduled to start, in RFC 3339 format.
16
+ attr_accessor :scheduled_at
17
+
18
+ # End date and time of the A/B test, in RFC 3339 format.
19
+ attr_accessor :end_at
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :name => :name,
25
+ :variants => :variants,
26
+ :scheduled_at => :scheduledAt,
27
+ :end_at => :endAt
28
+ }
29
+ end
30
+
31
+ # Returns all the JSON keys this model knows about
32
+ def self.acceptable_attributes
33
+ attribute_map.values
34
+ end
35
+
36
+ # Attribute type mapping.
37
+ def self.types_mapping
38
+ {
39
+ :name => :"String",
40
+ :variants => :"Array<AddABTestsVariant>",
41
+ :scheduled_at => :"String",
42
+ :end_at => :"String"
43
+ }
44
+ end
45
+
46
+ # List of attributes with nullable: true
47
+ def self.openapi_nullable
48
+ Set.new(
49
+ []
50
+ )
51
+ end
52
+
53
+ # Initializes the object
54
+ # @param [Hash] attributes Model attributes in the form of hash
55
+ def initialize(attributes = {})
56
+ if (!attributes.is_a?(Hash))
57
+ raise(
58
+ ArgumentError,
59
+ "The input argument (attributes) must be a hash in `Algolia::ScheduleABTestsRequest` initialize method"
60
+ )
61
+ end
62
+
63
+ # check to see if the attribute exists and convert string to symbol for hash key
64
+ attributes = attributes.each_with_object({}) { |(k, v), h|
65
+ if (!self.class.attribute_map.key?(k.to_sym))
66
+ raise(
67
+ ArgumentError,
68
+ "`#{k}` is not a valid attribute in `Algolia::ScheduleABTestsRequest`. Please check the name to make sure it's valid. List of attributes: " +
69
+ self.class.attribute_map.keys.inspect
70
+ )
71
+ end
72
+
73
+ h[k.to_sym] = v
74
+ }
75
+
76
+ if attributes.key?(:name)
77
+ self.name = attributes[:name]
78
+ else
79
+ self.name = nil
80
+ end
81
+
82
+ if attributes.key?(:variants)
83
+ if (value = attributes[:variants]).is_a?(Array)
84
+ self.variants = value
85
+ end
86
+ else
87
+ self.variants = nil
88
+ end
89
+
90
+ if attributes.key?(:scheduled_at)
91
+ self.scheduled_at = attributes[:scheduled_at]
92
+ else
93
+ self.scheduled_at = nil
94
+ end
95
+
96
+ if attributes.key?(:end_at)
97
+ self.end_at = attributes[:end_at]
98
+ else
99
+ self.end_at = nil
100
+ end
101
+ end
102
+
103
+ # Custom attribute writer method with validation
104
+ # @param [Object] variants Value to be assigned
105
+ def variants=(variants)
106
+ if variants.nil?
107
+ raise ArgumentError, "variants cannot be nil"
108
+ end
109
+
110
+ if variants.length > 2
111
+ raise ArgumentError, "invalid value for \"variants\", number of items must be less than or equal to 2."
112
+ end
113
+
114
+ if variants.length < 2
115
+ raise ArgumentError, "invalid value for \"variants\", number of items must be greater than or equal to 2."
116
+ end
117
+
118
+ @variants = variants
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
+ scheduled_at == other.scheduled_at &&
129
+ end_at == other.end_at
130
+ end
131
+
132
+ # @see the `==` method
133
+ # @param [Object] Object to be compared
134
+ def eql?(other)
135
+ self == other
136
+ end
137
+
138
+ # Calculates hash code according to all attributes.
139
+ # @return [Integer] Hash code
140
+ def hash
141
+ [name, variants, scheduled_at, end_at].hash
142
+ end
143
+
144
+ # Builds the object from hash
145
+ # @param [Hash] attributes Model attributes in the form of hash
146
+ # @return [Object] Returns the model itself
147
+ def self.build_from_hash(attributes)
148
+ return nil unless attributes.is_a?(Hash)
149
+ attributes = attributes.transform_keys(&:to_sym)
150
+ transformed_hash = {}
151
+ types_mapping.each_pair do |key, type|
152
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
153
+ transformed_hash[key.to_sym] = nil
154
+ elsif type =~ /\AArray<(.*)>/i
155
+ # check to ensure the input is an array given that the attribute
156
+ # is documented as an array but the input is not
157
+ if attributes[attribute_map[key]].is_a?(Array)
158
+ transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
159
+ _deserialize(::Regexp.last_match(1), v)
160
+ }
161
+ end
162
+ elsif !attributes[attribute_map[key]].nil?
163
+ transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
164
+ end
165
+ end
166
+
167
+ new(transformed_hash)
168
+ end
169
+
170
+ # Deserializes the data based on type
171
+ # @param string type Data type
172
+ # @param string value Value to be deserialized
173
+ # @return [Object] Deserialized data
174
+ def self._deserialize(type, value)
175
+ case type.to_sym
176
+ when :Time
177
+ Time.parse(value)
178
+ when :Date
179
+ Date.parse(value)
180
+ when :String
181
+ value.to_s
182
+ when :Integer
183
+ value.to_i
184
+ when :Float
185
+ value.to_f
186
+ when :Boolean
187
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
188
+ true
189
+ else
190
+ false
191
+ end
192
+
193
+ when :Object
194
+ # generic object (usually a Hash), return directly
195
+ value
196
+ when /\AArray<(?<inner_type>.+)>\z/
197
+ inner_type = Regexp.last_match[:inner_type]
198
+ value.map { |v| _deserialize(inner_type, v) }
199
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
200
+ k_type = Regexp.last_match[:k_type]
201
+ v_type = Regexp.last_match[:v_type]
202
+ {}.tap do |hash|
203
+ value.each do |k, v|
204
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
205
+ end
206
+ end
207
+ # model
208
+ else
209
+ # models (e.g. Pet) or oneOf
210
+ klass = Algolia::Abtesting.const_get(type)
211
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
212
+ .build_from_hash(value)
213
+ end
214
+ end
215
+
216
+ # Returns the string representation of the object
217
+ # @return [String] String presentation of the object
218
+ def to_s
219
+ to_hash.to_s
220
+ end
221
+
222
+ # to_body is an alias to to_hash (backward compatibility)
223
+ # @return [Hash] Returns the object in the form of hash
224
+ def to_body
225
+ to_hash
226
+ end
227
+
228
+ def to_json(*_args)
229
+ to_hash.to_json
230
+ end
231
+
232
+ # Returns the object in the form of hash
233
+ # @return [Hash] Returns the object in the form of hash
234
+ def to_hash
235
+ hash = {}
236
+ self.class.attribute_map.each_pair do |attr, param|
237
+ value = send(attr)
238
+ if value.nil?
239
+ is_nullable = self.class.openapi_nullable.include?(attr)
240
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
241
+ end
242
+
243
+ hash[param] = _to_hash(value)
244
+ end
245
+
246
+ hash
247
+ end
248
+
249
+ # Outputs non-array value in the form of hash
250
+ # For object, use to_hash. Otherwise, just return the value
251
+ # @param [Object] value Any valid value
252
+ # @return [Hash] Returns the value in the form of hash
253
+ def _to_hash(value)
254
+ if value.is_a?(Array)
255
+ value.compact.map { |v| _to_hash(v) }
256
+ elsif value.is_a?(Hash)
257
+ {}.tap do |hash|
258
+ value.each { |k, v| hash[k] = _to_hash(v) }
259
+ end
260
+ elsif value.respond_to?(:to_hash)
261
+ value.to_hash
262
+ else
263
+ value
264
+ end
265
+ end
266
+
267
+ end
268
+
269
+ end
270
+ end
@@ -167,14 +167,10 @@ module Algolia
167
167
 
168
168
  if attributes.key?(:add_to_cart_rate)
169
169
  self.add_to_cart_rate = attributes[:add_to_cart_rate]
170
- else
171
- self.add_to_cart_rate = nil
172
170
  end
173
171
 
174
172
  if attributes.key?(:average_click_position)
175
173
  self.average_click_position = attributes[:average_click_position]
176
- else
177
- self.average_click_position = nil
178
174
  end
179
175
 
180
176
  if attributes.key?(:click_count)
@@ -185,8 +181,6 @@ module Algolia
185
181
 
186
182
  if attributes.key?(:click_through_rate)
187
183
  self.click_through_rate = attributes[:click_through_rate]
188
- else
189
- self.click_through_rate = nil
190
184
  end
191
185
 
192
186
  if attributes.key?(:conversion_count)
@@ -197,8 +191,6 @@ module Algolia
197
191
 
198
192
  if attributes.key?(:conversion_rate)
199
193
  self.conversion_rate = attributes[:conversion_rate]
200
- else
201
- self.conversion_rate = nil
202
194
  end
203
195
 
204
196
  if attributes.key?(:currencies)
@@ -241,8 +233,6 @@ module Algolia
241
233
 
242
234
  if attributes.key?(:purchase_rate)
243
235
  self.purchase_rate = attributes[:purchase_rate]
244
- else
245
- self.purchase_rate = nil
246
236
  end
247
237
 
248
238
  if attributes.key?(:search_count)
@@ -1,5 +1,5 @@
1
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
2
 
3
3
  module Algolia
4
- VERSION = "3.0.2".freeze
4
+ VERSION = "3.1.1".freeze
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: algolia
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.2
4
+ version: 3.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - https://alg.li/support
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-19 00:00:00.000000000 Z
11
+ date: 2024-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -118,6 +118,7 @@ executables: []
118
118
  extensions: []
119
119
  extra_rdoc_files: []
120
120
  files:
121
+ - ".github/workflows/issue.yml"
121
122
  - ".github/workflows/release.yml"
122
123
  - ".gitignore"
123
124
  - CHANGELOG.md
@@ -159,6 +160,8 @@ files:
159
160
  - lib/algolia/models/abtesting/minimum_detectable_effect.rb
160
161
  - lib/algolia/models/abtesting/outliers.rb
161
162
  - lib/algolia/models/abtesting/outliers_filter.rb
163
+ - lib/algolia/models/abtesting/schedule_ab_test_response.rb
164
+ - lib/algolia/models/abtesting/schedule_ab_tests_request.rb
162
165
  - lib/algolia/models/abtesting/status.rb
163
166
  - lib/algolia/models/abtesting/variant.rb
164
167
  - lib/algolia/models/analytics/click_position.rb