algolia 3.0.0.beta.6 → 3.0.0.beta.7

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: b052211b4a0ecb74c42f11d50147460cf98a1aae441095e4c421800d611c1f0c
4
- data.tar.gz: ce30bdefbd8703da5fc943ebdd24126874c05ad78368212e19e70138eea52f9e
3
+ metadata.gz: 7cc326f3f421493311bb0c56147b9de597c87de115eb3923a0cf649aaba02c38
4
+ data.tar.gz: a7568b187d6b185503521786b2a8e80591b140e2a6109b0ff2a80f7cdbbf3eaa
5
5
  SHA512:
6
- metadata.gz: 735dc36265137ffee7456a8cd0cfeb5c6607e56c71bb7595b9c113780661d24d48c2f9f37c8053dc9f5928097beb925a6211107c08f2a01d664e101c5795a346
7
- data.tar.gz: ca760e5f13736c3ea825087a46bc9cc4013c98223700c5d140a412eac63559c746d62ca3d07aed6fef9663cf89ad0a349f9e627cd3fdea3608a70d619bdc470e
6
+ metadata.gz: 2f2d6b16d9862a70444bce125e299eb0569c9d33b4b1734269ac47774f8ac67990d6aba65e1e00a9213253463a2fd28c53b0665d68a862f28fb25ab52176d077
7
+ data.tar.gz: 514f78082cd25d98bba2817d30463580f44db2ed616d725fc94c58ed25165b8eb6fd6d811575ec4767668b46fa98975305eddb537c7f814f6a08ffab7275fd43
@@ -24,4 +24,4 @@ jobs:
24
24
  ruby-version: 3.2.2
25
25
  bundler-cache: true
26
26
 
27
- - uses: rubygems/release-gem@v1
27
+ - uses: rubygems/release-gem@612653d273a73bdae1df8453e090060bb4db5f31
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## [3.0.0.beta.7](https://github.com/algolia/algoliasearch-client-ruby/compare/3.0.0.beta.6...3.0.0.beta.7)
2
+
3
+ - [95e4c1e17](https://github.com/algolia/api-clients-automation/commit/95e4c1e17) chore(ruby): scope to last commit ([#3266](https://github.com/algolia/api-clients-automation/pull/3266)) by [@shortcuts](https://github.com/shortcuts/)
4
+ - [8e98407c1](https://github.com/algolia/api-clients-automation/commit/8e98407c1) fix(clients): update ingestion transformations description and fix taggroups ([#3265](https://github.com/algolia/api-clients-automation/pull/3265)) by [@shortcuts](https://github.com/shortcuts/)
5
+
1
6
  ## [3.0.0.beta.6](https://github.com/algolia/algoliasearch-client-ruby/compare/3.0.0.beta.5...3.0.0.beta.6)
2
7
 
3
8
  - [e5cfcf0c4](https://github.com/algolia/api-clients-automation/commit/e5cfcf0c4) feat(clients): generate common LICENSE ([#3258](https://github.com/algolia/api-clients-automation/pull/3258)) 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.0.beta.6)
4
+ algolia (3.0.0.beta.7)
5
5
  faraday (>= 1.0.1, < 3.0)
6
6
  faraday-net_http_persistent (>= 0.15, < 3)
7
7
  net-http-persistent
@@ -1934,7 +1934,7 @@ module Algolia
1934
1934
  @api_client.deserialize(response.body, request_options[:debug_return_type] || 'Ingestion::SourceWatchResponse')
1935
1935
  end
1936
1936
 
1937
- # Searches for transformations.
1937
+ # Try a transformation.
1938
1938
  #
1939
1939
  # Required API Key ACLs:
1940
1940
  # - addObject
@@ -1968,7 +1968,7 @@ module Algolia
1968
1968
  @api_client.call_api(:POST, path, new_options)
1969
1969
  end
1970
1970
 
1971
- # Searches for transformations.
1971
+ # Try a transformation.
1972
1972
  #
1973
1973
  # Required API Key ACLs:
1974
1974
  # - addObject
@@ -37,13 +37,13 @@ module Algolia
37
37
  #
38
38
  # Required API Key ACLs:
39
39
  # - editSettings
40
- # @param query_suggestions_configuration_with_index [QuerySuggestionsConfigurationWithIndex] (required)
40
+ # @param configuration_with_index [ConfigurationWithIndex] (required)
41
41
  # @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)
42
42
  # @return [Http::Response] the response
43
- def create_config_with_http_info(query_suggestions_configuration_with_index, request_options = {})
44
- # verify the required parameter 'query_suggestions_configuration_with_index' is set
45
- if @api_client.config.client_side_validation && query_suggestions_configuration_with_index.nil?
46
- raise ArgumentError, "Parameter `query_suggestions_configuration_with_index` is required when calling `create_config`."
43
+ def create_config_with_http_info(configuration_with_index, request_options = {})
44
+ # verify the required parameter 'configuration_with_index' is set
45
+ if @api_client.config.client_side_validation && configuration_with_index.nil?
46
+ raise ArgumentError, "Parameter `configuration_with_index` is required when calling `create_config`."
47
47
  end
48
48
 
49
49
  path = '/1/configs'
@@ -52,7 +52,7 @@ module Algolia
52
52
  header_params = {}
53
53
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?
54
54
 
55
- post_body = request_options[:debug_body] || @api_client.object_to_http_body(query_suggestions_configuration_with_index)
55
+ post_body = request_options[:debug_body] || @api_client.object_to_http_body(configuration_with_index)
56
56
 
57
57
  new_options = request_options.merge(
58
58
  :operation => :'QuerySuggestionsClient.create_config',
@@ -69,11 +69,11 @@ module Algolia
69
69
  #
70
70
  # Required API Key ACLs:
71
71
  # - editSettings
72
- # @param query_suggestions_configuration_with_index [QuerySuggestionsConfigurationWithIndex] (required)
72
+ # @param configuration_with_index [ConfigurationWithIndex] (required)
73
73
  # @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)
74
74
  # @return [BaseResponse]
75
- def create_config(query_suggestions_configuration_with_index, request_options = {})
76
- response = create_config_with_http_info(query_suggestions_configuration_with_index, request_options)
75
+ def create_config(configuration_with_index, request_options = {})
76
+ response = create_config_with_http_info(configuration_with_index, request_options)
77
77
  @api_client.deserialize(response.body, request_options[:debug_return_type] || 'QuerySuggestions::BaseResponse')
78
78
  end
79
79
 
@@ -328,10 +328,10 @@ module Algolia
328
328
  # Required API Key ACLs:
329
329
  # - settings
330
330
  # @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)
331
- # @return [Array<QuerySuggestionsConfigurationResponse>]
331
+ # @return [Array<ConfigurationResponse>]
332
332
  def get_all_configs(request_options = {})
333
333
  response = get_all_configs_with_http_info(request_options)
334
- @api_client.deserialize(response.body, request_options[:debug_return_type] || 'Array<QuerySuggestions::QuerySuggestionsConfigurationResponse>')
334
+ @api_client.deserialize(response.body, request_options[:debug_return_type] || 'Array<QuerySuggestions::ConfigurationResponse>')
335
335
  end
336
336
 
337
337
  # Retrieves a single Query Suggestions configuration by its index name.
@@ -372,10 +372,10 @@ module Algolia
372
372
  # - settings
373
373
  # @param index_name [String] Query Suggestions index name. (required)
374
374
  # @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)
375
- # @return [QuerySuggestionsConfigurationResponse]
375
+ # @return [ConfigurationResponse]
376
376
  def get_config(index_name, request_options = {})
377
377
  response = get_config_with_http_info(index_name, request_options)
378
- @api_client.deserialize(response.body, request_options[:debug_return_type] || 'QuerySuggestions::QuerySuggestionsConfigurationResponse')
378
+ @api_client.deserialize(response.body, request_options[:debug_return_type] || 'QuerySuggestions::ConfigurationResponse')
379
379
  end
380
380
 
381
381
  # Reports the status of a Query Suggestions index.
@@ -471,17 +471,17 @@ module Algolia
471
471
  # Required API Key ACLs:
472
472
  # - editSettings
473
473
  # @param index_name [String] Query Suggestions index name. (required)
474
- # @param query_suggestions_configuration [QuerySuggestionsConfiguration] (required)
474
+ # @param configuration [Configuration] (required)
475
475
  # @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)
476
476
  # @return [Http::Response] the response
477
- def update_config_with_http_info(index_name, query_suggestions_configuration, request_options = {})
477
+ def update_config_with_http_info(index_name, configuration, request_options = {})
478
478
  # verify the required parameter 'index_name' is set
479
479
  if @api_client.config.client_side_validation && index_name.nil?
480
480
  raise ArgumentError, "Parameter `index_name` is required when calling `update_config`."
481
481
  end
482
- # verify the required parameter 'query_suggestions_configuration' is set
483
- if @api_client.config.client_side_validation && query_suggestions_configuration.nil?
484
- raise ArgumentError, "Parameter `query_suggestions_configuration` is required when calling `update_config`."
482
+ # verify the required parameter 'configuration' is set
483
+ if @api_client.config.client_side_validation && configuration.nil?
484
+ raise ArgumentError, "Parameter `configuration` is required when calling `update_config`."
485
485
  end
486
486
 
487
487
  path = '/1/configs/{indexName}'.sub('{' + 'indexName' + '}', Transport.encode_uri(index_name.to_s))
@@ -490,7 +490,7 @@ module Algolia
490
490
  header_params = {}
491
491
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?
492
492
 
493
- post_body = request_options[:debug_body] || @api_client.object_to_http_body(query_suggestions_configuration)
493
+ post_body = request_options[:debug_body] || @api_client.object_to_http_body(configuration)
494
494
 
495
495
  new_options = request_options.merge(
496
496
  :operation => :'QuerySuggestionsClient.update_config',
@@ -508,11 +508,11 @@ module Algolia
508
508
  # Required API Key ACLs:
509
509
  # - editSettings
510
510
  # @param index_name [String] Query Suggestions index name. (required)
511
- # @param query_suggestions_configuration [QuerySuggestionsConfiguration] (required)
511
+ # @param configuration [Configuration] (required)
512
512
  # @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)
513
513
  # @return [BaseResponse]
514
- def update_config(index_name, query_suggestions_configuration, request_options = {})
515
- response = update_config_with_http_info(index_name, query_suggestions_configuration, request_options)
514
+ def update_config(index_name, configuration, request_options = {})
515
+ response = update_config_with_http_info(index_name, configuration, request_options)
516
516
  @api_client.deserialize(response.body, request_options[:debug_return_type] || 'QuerySuggestions::BaseResponse')
517
517
  end
518
518
  end
@@ -0,0 +1,258 @@
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 QuerySuggestions
8
+ # Query Suggestions configuration.
9
+ class Configuration
10
+ # Algolia indices from which to get the popular searches for query suggestions.
11
+ attr_accessor :source_indices
12
+
13
+ attr_accessor :languages
14
+
15
+ attr_accessor :exclude
16
+
17
+ # Whether to turn on personalized query suggestions.
18
+ attr_accessor :enable_personalization
19
+
20
+ # Whether to include suggestions with special characters.
21
+ attr_accessor :allow_special_characters
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :source_indices => :sourceIndices,
27
+ :languages => :languages,
28
+ :exclude => :exclude,
29
+ :enable_personalization => :enablePersonalization,
30
+ :allow_special_characters => :allowSpecialCharacters
31
+ }
32
+ end
33
+
34
+ # Returns all the JSON keys this model knows about
35
+ def self.acceptable_attributes
36
+ attribute_map.values
37
+ end
38
+
39
+ # Attribute type mapping.
40
+ def self.types_mapping
41
+ {
42
+ :source_indices => :'Array<SourceIndex>',
43
+ :languages => :Languages,
44
+ :exclude => :'Array<String>',
45
+ :enable_personalization => :Boolean,
46
+ :allow_special_characters => :Boolean
47
+ }
48
+ end
49
+
50
+ # List of attributes with nullable: true
51
+ def self.openapi_nullable
52
+ Set.new([
53
+ :exclude
54
+ ])
55
+ end
56
+
57
+ # Initializes the object
58
+ # @param [Hash] attributes Model attributes in the form of hash
59
+ def initialize(attributes = {})
60
+ unless attributes.is_a?(Hash)
61
+ raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::Configuration` initialize method"
62
+ end
63
+
64
+ # check to see if the attribute exists and convert string to symbol for hash key
65
+ attributes = attributes.each_with_object({}) do |(k, v), h|
66
+ unless self.class.attribute_map.key?(k.to_sym)
67
+ raise ArgumentError,
68
+ "`#{k}` is not a valid attribute in `Algolia::Configuration`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
69
+ end
70
+
71
+ h[k.to_sym] = v
72
+ end
73
+
74
+ if attributes.key?(:source_indices)
75
+ if (value = attributes[:source_indices]).is_a?(Array)
76
+ self.source_indices = value
77
+ end
78
+ else
79
+ self.source_indices = nil
80
+ end
81
+
82
+ if attributes.key?(:languages)
83
+ self.languages = attributes[:languages]
84
+ end
85
+
86
+ if attributes.key?(:exclude)
87
+ if (value = attributes[:exclude]).is_a?(Array)
88
+ self.exclude = value
89
+ end
90
+ end
91
+
92
+ if attributes.key?(:enable_personalization)
93
+ self.enable_personalization = attributes[:enable_personalization]
94
+ end
95
+
96
+ if attributes.key?(:allow_special_characters)
97
+ self.allow_special_characters = attributes[:allow_special_characters]
98
+ end
99
+ end
100
+
101
+ # Custom attribute writer method with validation
102
+ # @param [Object] source_indices Value to be assigned
103
+ def source_indices=(source_indices)
104
+ if source_indices.nil?
105
+ raise ArgumentError, 'source_indices cannot be nil'
106
+ end
107
+
108
+ if source_indices.length < 1
109
+ raise ArgumentError, 'invalid value for "source_indices", number of items must be greater than or equal to 1.'
110
+ end
111
+
112
+ @source_indices = source_indices
113
+ end
114
+
115
+ # Checks equality by comparing each attribute.
116
+ # @param [Object] Object to be compared
117
+ def ==(other)
118
+ return true if equal?(other)
119
+
120
+ self.class == other.class &&
121
+ source_indices == other.source_indices &&
122
+ languages == other.languages &&
123
+ exclude == other.exclude &&
124
+ enable_personalization == other.enable_personalization &&
125
+ allow_special_characters == other.allow_special_characters
126
+ end
127
+
128
+ # @see the `==` method
129
+ # @param [Object] Object to be compared
130
+ def eql?(other)
131
+ self == other
132
+ end
133
+
134
+ # Calculates hash code according to all attributes.
135
+ # @return [Integer] Hash code
136
+ def hash
137
+ [source_indices, languages, exclude, enable_personalization, allow_special_characters].hash
138
+ end
139
+
140
+ # Builds the object from hash
141
+ # @param [Hash] attributes Model attributes in the form of hash
142
+ # @return [Object] Returns the model itself
143
+ def self.build_from_hash(attributes)
144
+ return nil unless attributes.is_a?(Hash)
145
+
146
+ attributes = attributes.transform_keys(&:to_sym)
147
+ transformed_hash = {}
148
+ types_mapping.each_pair do |key, type|
149
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
150
+ transformed_hash[key.to_sym] = nil
151
+ elsif type =~ /\AArray<(.*)>/i
152
+ # check to ensure the input is an array given that the attribute
153
+ # is documented as an array but the input is not
154
+ if attributes[attribute_map[key]].is_a?(Array)
155
+ transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v| _deserialize(::Regexp.last_match(1), v) }
156
+ end
157
+ elsif !attributes[attribute_map[key]].nil?
158
+ transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
159
+ end
160
+ end
161
+ new(transformed_hash)
162
+ end
163
+
164
+ # Deserializes the data based on type
165
+ # @param string type Data type
166
+ # @param string value Value to be deserialized
167
+ # @return [Object] Deserialized data
168
+ def self._deserialize(type, value)
169
+ case type.to_sym
170
+ when :Time
171
+ Time.parse(value)
172
+ when :Date
173
+ Date.parse(value)
174
+ when :String
175
+ value.to_s
176
+ when :Integer
177
+ value.to_i
178
+ when :Float
179
+ value.to_f
180
+ when :Boolean
181
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
182
+ true
183
+ else
184
+ false
185
+ end
186
+ when :Object
187
+ # generic object (usually a Hash), return directly
188
+ value
189
+ when /\AArray<(?<inner_type>.+)>\z/
190
+ inner_type = Regexp.last_match[:inner_type]
191
+ value.map { |v| _deserialize(inner_type, v) }
192
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
193
+ k_type = Regexp.last_match[:k_type]
194
+ v_type = Regexp.last_match[:v_type]
195
+ {}.tap do |hash|
196
+ value.each do |k, v|
197
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
198
+ end
199
+ end
200
+ else # model
201
+ # models (e.g. Pet) or oneOf
202
+ klass = Algolia::QuerySuggestions.const_get(type)
203
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
204
+ end
205
+ end
206
+
207
+ # Returns the string representation of the object
208
+ # @return [String] String presentation of the object
209
+ def to_s
210
+ to_hash.to_s
211
+ end
212
+
213
+ # to_body is an alias to to_hash (backward compatibility)
214
+ # @return [Hash] Returns the object in the form of hash
215
+ def to_body
216
+ to_hash
217
+ end
218
+
219
+ def to_json(*_args)
220
+ to_hash.to_json
221
+ end
222
+
223
+ # Returns the object in the form of hash
224
+ # @return [Hash] Returns the object in the form of hash
225
+ def to_hash
226
+ hash = {}
227
+ self.class.attribute_map.each_pair do |attr, param|
228
+ value = send(attr)
229
+ if value.nil?
230
+ is_nullable = self.class.openapi_nullable.include?(attr)
231
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
232
+ end
233
+
234
+ hash[param] = _to_hash(value)
235
+ end
236
+ hash
237
+ end
238
+
239
+ # Outputs non-array value in the form of hash
240
+ # For object, use to_hash. Otherwise, just return the value
241
+ # @param [Object] value Any valid value
242
+ # @return [Hash] Returns the value in the form of hash
243
+ def _to_hash(value)
244
+ if value.is_a?(Array)
245
+ value.compact.map { |v| _to_hash(v) }
246
+ elsif value.is_a?(Hash)
247
+ {}.tap do |hash|
248
+ value.each { |k, v| hash[k] = _to_hash(v) }
249
+ end
250
+ elsif value.respond_to? :to_hash
251
+ value.to_hash
252
+ else
253
+ value
254
+ end
255
+ end
256
+ end
257
+ end
258
+ end
@@ -0,0 +1,298 @@
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 QuerySuggestions
8
+ # API response for retrieving Query Suggestions configurations.
9
+ class ConfigurationResponse
10
+ # Algolia application ID to which this Query Suggestions configuration belongs.
11
+ attr_accessor :app_id
12
+
13
+ # Name of the Query Suggestions index (case-sensitive).
14
+ attr_accessor :index_name
15
+
16
+ # Algolia indices from which to get the popular searches for query suggestions.
17
+ attr_accessor :source_indices
18
+
19
+ attr_accessor :languages
20
+
21
+ attr_accessor :exclude
22
+
23
+ # Whether to turn on personalized query suggestions.
24
+ attr_accessor :enable_personalization
25
+
26
+ # Whether to include suggestions with special characters.
27
+ attr_accessor :allow_special_characters
28
+
29
+ # Attribute mapping from ruby-style variable name to JSON key.
30
+ def self.attribute_map
31
+ {
32
+ :app_id => :appID,
33
+ :index_name => :indexName,
34
+ :source_indices => :sourceIndices,
35
+ :languages => :languages,
36
+ :exclude => :exclude,
37
+ :enable_personalization => :enablePersonalization,
38
+ :allow_special_characters => :allowSpecialCharacters
39
+ }
40
+ end
41
+
42
+ # Returns all the JSON keys this model knows about
43
+ def self.acceptable_attributes
44
+ attribute_map.values
45
+ end
46
+
47
+ # Attribute type mapping.
48
+ def self.types_mapping
49
+ {
50
+ :app_id => :String,
51
+ :index_name => :String,
52
+ :source_indices => :'Array<SourceIndex>',
53
+ :languages => :Languages,
54
+ :exclude => :'Array<String>',
55
+ :enable_personalization => :Boolean,
56
+ :allow_special_characters => :Boolean
57
+ }
58
+ end
59
+
60
+ # List of attributes with nullable: true
61
+ def self.openapi_nullable
62
+ Set.new([
63
+ :exclude
64
+ ])
65
+ end
66
+
67
+ # List of class defined in allOf (OpenAPI v3)
68
+ def self.openapi_all_of
69
+ [
70
+ :AppID,
71
+ :ConfigurationWithIndex
72
+ ]
73
+ end
74
+
75
+ # Initializes the object
76
+ # @param [Hash] attributes Model attributes in the form of hash
77
+ def initialize(attributes = {})
78
+ unless attributes.is_a?(Hash)
79
+ raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::ConfigurationResponse` initialize method"
80
+ end
81
+
82
+ # check to see if the attribute exists and convert string to symbol for hash key
83
+ attributes = attributes.each_with_object({}) do |(k, v), h|
84
+ unless self.class.attribute_map.key?(k.to_sym)
85
+ raise ArgumentError,
86
+ "`#{k}` is not a valid attribute in `Algolia::ConfigurationResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
87
+ end
88
+
89
+ h[k.to_sym] = v
90
+ end
91
+
92
+ if attributes.key?(:app_id)
93
+ self.app_id = attributes[:app_id]
94
+ else
95
+ self.app_id = nil
96
+ end
97
+
98
+ if attributes.key?(:index_name)
99
+ self.index_name = attributes[:index_name]
100
+ else
101
+ self.index_name = nil
102
+ end
103
+
104
+ if attributes.key?(:source_indices)
105
+ if (value = attributes[:source_indices]).is_a?(Array)
106
+ self.source_indices = value
107
+ end
108
+ else
109
+ self.source_indices = nil
110
+ end
111
+
112
+ if attributes.key?(:languages)
113
+ self.languages = attributes[:languages]
114
+ else
115
+ self.languages = nil
116
+ end
117
+
118
+ if attributes.key?(:exclude)
119
+ if (value = attributes[:exclude]).is_a?(Array)
120
+ self.exclude = value
121
+ end
122
+ else
123
+ self.exclude = nil
124
+ end
125
+
126
+ if attributes.key?(:enable_personalization)
127
+ self.enable_personalization = attributes[:enable_personalization]
128
+ else
129
+ self.enable_personalization = nil
130
+ end
131
+
132
+ if attributes.key?(:allow_special_characters)
133
+ self.allow_special_characters = attributes[:allow_special_characters]
134
+ else
135
+ self.allow_special_characters = nil
136
+ end
137
+ end
138
+
139
+ # Custom attribute writer method with validation
140
+ # @param [Object] source_indices Value to be assigned
141
+ def source_indices=(source_indices)
142
+ if source_indices.nil?
143
+ raise ArgumentError, 'source_indices cannot be nil'
144
+ end
145
+
146
+ if source_indices.length < 1
147
+ raise ArgumentError, 'invalid value for "source_indices", number of items must be greater than or equal to 1.'
148
+ end
149
+
150
+ @source_indices = source_indices
151
+ end
152
+
153
+ # Checks equality by comparing each attribute.
154
+ # @param [Object] Object to be compared
155
+ def ==(other)
156
+ return true if equal?(other)
157
+
158
+ self.class == other.class &&
159
+ app_id == other.app_id &&
160
+ index_name == other.index_name &&
161
+ source_indices == other.source_indices &&
162
+ languages == other.languages &&
163
+ exclude == other.exclude &&
164
+ enable_personalization == other.enable_personalization &&
165
+ allow_special_characters == other.allow_special_characters
166
+ end
167
+
168
+ # @see the `==` method
169
+ # @param [Object] Object to be compared
170
+ def eql?(other)
171
+ self == other
172
+ end
173
+
174
+ # Calculates hash code according to all attributes.
175
+ # @return [Integer] Hash code
176
+ def hash
177
+ [app_id, index_name, source_indices, languages, exclude, enable_personalization, allow_special_characters].hash
178
+ end
179
+
180
+ # Builds the object from hash
181
+ # @param [Hash] attributes Model attributes in the form of hash
182
+ # @return [Object] Returns the model itself
183
+ def self.build_from_hash(attributes)
184
+ return nil unless attributes.is_a?(Hash)
185
+
186
+ attributes = attributes.transform_keys(&:to_sym)
187
+ transformed_hash = {}
188
+ types_mapping.each_pair do |key, type|
189
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
190
+ transformed_hash[key.to_sym] = nil
191
+ elsif type =~ /\AArray<(.*)>/i
192
+ # check to ensure the input is an array given that the attribute
193
+ # is documented as an array but the input is not
194
+ if attributes[attribute_map[key]].is_a?(Array)
195
+ transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v| _deserialize(::Regexp.last_match(1), v) }
196
+ end
197
+ elsif !attributes[attribute_map[key]].nil?
198
+ transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
199
+ end
200
+ end
201
+ new(transformed_hash)
202
+ end
203
+
204
+ # Deserializes the data based on type
205
+ # @param string type Data type
206
+ # @param string value Value to be deserialized
207
+ # @return [Object] Deserialized data
208
+ def self._deserialize(type, value)
209
+ case type.to_sym
210
+ when :Time
211
+ Time.parse(value)
212
+ when :Date
213
+ Date.parse(value)
214
+ when :String
215
+ value.to_s
216
+ when :Integer
217
+ value.to_i
218
+ when :Float
219
+ value.to_f
220
+ when :Boolean
221
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
222
+ true
223
+ else
224
+ false
225
+ end
226
+ when :Object
227
+ # generic object (usually a Hash), return directly
228
+ value
229
+ when /\AArray<(?<inner_type>.+)>\z/
230
+ inner_type = Regexp.last_match[:inner_type]
231
+ value.map { |v| _deserialize(inner_type, v) }
232
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
233
+ k_type = Regexp.last_match[:k_type]
234
+ v_type = Regexp.last_match[:v_type]
235
+ {}.tap do |hash|
236
+ value.each do |k, v|
237
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
238
+ end
239
+ end
240
+ else # model
241
+ # models (e.g. Pet) or oneOf
242
+ klass = Algolia::QuerySuggestions.const_get(type)
243
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
244
+ end
245
+ end
246
+
247
+ # Returns the string representation of the object
248
+ # @return [String] String presentation of the object
249
+ def to_s
250
+ to_hash.to_s
251
+ end
252
+
253
+ # to_body is an alias to to_hash (backward compatibility)
254
+ # @return [Hash] Returns the object in the form of hash
255
+ def to_body
256
+ to_hash
257
+ end
258
+
259
+ def to_json(*_args)
260
+ to_hash.to_json
261
+ end
262
+
263
+ # Returns the object in the form of hash
264
+ # @return [Hash] Returns the object in the form of hash
265
+ def to_hash
266
+ hash = {}
267
+ self.class.attribute_map.each_pair do |attr, param|
268
+ value = send(attr)
269
+ if value.nil?
270
+ is_nullable = self.class.openapi_nullable.include?(attr)
271
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
272
+ end
273
+
274
+ hash[param] = _to_hash(value)
275
+ end
276
+ hash
277
+ end
278
+
279
+ # Outputs non-array value in the form of hash
280
+ # For object, use to_hash. Otherwise, just return the value
281
+ # @param [Object] value Any valid value
282
+ # @return [Hash] Returns the value in the form of hash
283
+ def _to_hash(value)
284
+ if value.is_a?(Array)
285
+ value.compact.map { |v| _to_hash(v) }
286
+ elsif value.is_a?(Hash)
287
+ {}.tap do |hash|
288
+ value.each { |k, v| hash[k] = _to_hash(v) }
289
+ end
290
+ elsif value.respond_to? :to_hash
291
+ value.to_hash
292
+ else
293
+ value
294
+ end
295
+ end
296
+ end
297
+ end
298
+ end
@@ -0,0 +1,277 @@
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 QuerySuggestions
8
+ # Query Suggestions configuration.
9
+ class ConfigurationWithIndex
10
+ # Algolia indices from which to get the popular searches for query suggestions.
11
+ attr_accessor :source_indices
12
+
13
+ attr_accessor :languages
14
+
15
+ attr_accessor :exclude
16
+
17
+ # Whether to turn on personalized query suggestions.
18
+ attr_accessor :enable_personalization
19
+
20
+ # Whether to include suggestions with special characters.
21
+ attr_accessor :allow_special_characters
22
+
23
+ # Name of the Query Suggestions index (case-sensitive).
24
+ attr_accessor :index_name
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :source_indices => :sourceIndices,
30
+ :languages => :languages,
31
+ :exclude => :exclude,
32
+ :enable_personalization => :enablePersonalization,
33
+ :allow_special_characters => :allowSpecialCharacters,
34
+ :index_name => :indexName
35
+ }
36
+ end
37
+
38
+ # Returns all the JSON keys this model knows about
39
+ def self.acceptable_attributes
40
+ attribute_map.values
41
+ end
42
+
43
+ # Attribute type mapping.
44
+ def self.types_mapping
45
+ {
46
+ :source_indices => :'Array<SourceIndex>',
47
+ :languages => :Languages,
48
+ :exclude => :'Array<String>',
49
+ :enable_personalization => :Boolean,
50
+ :allow_special_characters => :Boolean,
51
+ :index_name => :String
52
+ }
53
+ end
54
+
55
+ # List of attributes with nullable: true
56
+ def self.openapi_nullable
57
+ Set.new([
58
+ :exclude
59
+ ])
60
+ end
61
+
62
+ # List of class defined in allOf (OpenAPI v3)
63
+ def self.openapi_all_of
64
+ [
65
+ :Configuration
66
+ ]
67
+ end
68
+
69
+ # Initializes the object
70
+ # @param [Hash] attributes Model attributes in the form of hash
71
+ def initialize(attributes = {})
72
+ unless attributes.is_a?(Hash)
73
+ raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::ConfigurationWithIndex` initialize method"
74
+ end
75
+
76
+ # check to see if the attribute exists and convert string to symbol for hash key
77
+ attributes = attributes.each_with_object({}) do |(k, v), h|
78
+ unless self.class.attribute_map.key?(k.to_sym)
79
+ raise ArgumentError,
80
+ "`#{k}` is not a valid attribute in `Algolia::ConfigurationWithIndex`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
81
+ end
82
+
83
+ h[k.to_sym] = v
84
+ end
85
+
86
+ if attributes.key?(:source_indices)
87
+ if (value = attributes[:source_indices]).is_a?(Array)
88
+ self.source_indices = value
89
+ end
90
+ else
91
+ self.source_indices = nil
92
+ end
93
+
94
+ if attributes.key?(:languages)
95
+ self.languages = attributes[:languages]
96
+ end
97
+
98
+ if attributes.key?(:exclude)
99
+ if (value = attributes[:exclude]).is_a?(Array)
100
+ self.exclude = value
101
+ end
102
+ end
103
+
104
+ if attributes.key?(:enable_personalization)
105
+ self.enable_personalization = attributes[:enable_personalization]
106
+ end
107
+
108
+ if attributes.key?(:allow_special_characters)
109
+ self.allow_special_characters = attributes[:allow_special_characters]
110
+ end
111
+
112
+ if attributes.key?(:index_name)
113
+ self.index_name = attributes[:index_name]
114
+ else
115
+ self.index_name = nil
116
+ end
117
+ end
118
+
119
+ # Custom attribute writer method with validation
120
+ # @param [Object] source_indices Value to be assigned
121
+ def source_indices=(source_indices)
122
+ if source_indices.nil?
123
+ raise ArgumentError, 'source_indices cannot be nil'
124
+ end
125
+
126
+ if source_indices.length < 1
127
+ raise ArgumentError, 'invalid value for "source_indices", number of items must be greater than or equal to 1.'
128
+ end
129
+
130
+ @source_indices = source_indices
131
+ end
132
+
133
+ # Checks equality by comparing each attribute.
134
+ # @param [Object] Object to be compared
135
+ def ==(other)
136
+ return true if equal?(other)
137
+
138
+ self.class == other.class &&
139
+ source_indices == other.source_indices &&
140
+ languages == other.languages &&
141
+ exclude == other.exclude &&
142
+ enable_personalization == other.enable_personalization &&
143
+ allow_special_characters == other.allow_special_characters &&
144
+ index_name == other.index_name
145
+ end
146
+
147
+ # @see the `==` method
148
+ # @param [Object] Object to be compared
149
+ def eql?(other)
150
+ self == other
151
+ end
152
+
153
+ # Calculates hash code according to all attributes.
154
+ # @return [Integer] Hash code
155
+ def hash
156
+ [source_indices, languages, exclude, enable_personalization, allow_special_characters, index_name].hash
157
+ end
158
+
159
+ # Builds the object from hash
160
+ # @param [Hash] attributes Model attributes in the form of hash
161
+ # @return [Object] Returns the model itself
162
+ def self.build_from_hash(attributes)
163
+ return nil unless attributes.is_a?(Hash)
164
+
165
+ attributes = attributes.transform_keys(&:to_sym)
166
+ transformed_hash = {}
167
+ types_mapping.each_pair do |key, type|
168
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
169
+ transformed_hash[key.to_sym] = nil
170
+ elsif type =~ /\AArray<(.*)>/i
171
+ # check to ensure the input is an array given that the attribute
172
+ # is documented as an array but the input is not
173
+ if attributes[attribute_map[key]].is_a?(Array)
174
+ transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v| _deserialize(::Regexp.last_match(1), v) }
175
+ end
176
+ elsif !attributes[attribute_map[key]].nil?
177
+ transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
178
+ end
179
+ end
180
+ new(transformed_hash)
181
+ end
182
+
183
+ # Deserializes the data based on type
184
+ # @param string type Data type
185
+ # @param string value Value to be deserialized
186
+ # @return [Object] Deserialized data
187
+ def self._deserialize(type, value)
188
+ case type.to_sym
189
+ when :Time
190
+ Time.parse(value)
191
+ when :Date
192
+ Date.parse(value)
193
+ when :String
194
+ value.to_s
195
+ when :Integer
196
+ value.to_i
197
+ when :Float
198
+ value.to_f
199
+ when :Boolean
200
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
201
+ true
202
+ else
203
+ false
204
+ end
205
+ when :Object
206
+ # generic object (usually a Hash), return directly
207
+ value
208
+ when /\AArray<(?<inner_type>.+)>\z/
209
+ inner_type = Regexp.last_match[:inner_type]
210
+ value.map { |v| _deserialize(inner_type, v) }
211
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
212
+ k_type = Regexp.last_match[:k_type]
213
+ v_type = Regexp.last_match[:v_type]
214
+ {}.tap do |hash|
215
+ value.each do |k, v|
216
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
217
+ end
218
+ end
219
+ else # model
220
+ # models (e.g. Pet) or oneOf
221
+ klass = Algolia::QuerySuggestions.const_get(type)
222
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
223
+ end
224
+ end
225
+
226
+ # Returns the string representation of the object
227
+ # @return [String] String presentation of the object
228
+ def to_s
229
+ to_hash.to_s
230
+ end
231
+
232
+ # to_body is an alias to to_hash (backward compatibility)
233
+ # @return [Hash] Returns the object in the form of hash
234
+ def to_body
235
+ to_hash
236
+ end
237
+
238
+ def to_json(*_args)
239
+ to_hash.to_json
240
+ end
241
+
242
+ # Returns the object in the form of hash
243
+ # @return [Hash] Returns the object in the form of hash
244
+ def to_hash
245
+ hash = {}
246
+ self.class.attribute_map.each_pair do |attr, param|
247
+ value = send(attr)
248
+ if value.nil?
249
+ is_nullable = self.class.openapi_nullable.include?(attr)
250
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
251
+ end
252
+
253
+ hash[param] = _to_hash(value)
254
+ end
255
+ hash
256
+ end
257
+
258
+ # Outputs non-array value in the form of hash
259
+ # For object, use to_hash. Otherwise, just return the value
260
+ # @param [Object] value Any valid value
261
+ # @return [Hash] Returns the value in the form of hash
262
+ def _to_hash(value)
263
+ if value.is_a?(Array)
264
+ value.compact.map { |v| _to_hash(v) }
265
+ elsif value.is_a?(Hash)
266
+ {}.tap do |hash|
267
+ value.each { |k, v| hash[k] = _to_hash(v) }
268
+ end
269
+ elsif value.respond_to? :to_hash
270
+ value.to_hash
271
+ else
272
+ value
273
+ end
274
+ end
275
+ end
276
+ end
277
+ end
@@ -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.0.beta.6'.freeze
4
+ VERSION = '3.0.0.beta.7'.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.0.beta.6
4
+ version: 3.0.0.beta.7
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-06-26 00:00:00.000000000 Z
11
+ date: 2024-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -407,6 +407,9 @@ files:
407
407
  - lib/algolia/models/query-suggestions/base_query_suggestions_configuration_response.rb
408
408
  - lib/algolia/models/query-suggestions/base_query_suggestions_configuration_with_index.rb
409
409
  - lib/algolia/models/query-suggestions/base_response.rb
410
+ - lib/algolia/models/query-suggestions/configuration.rb
411
+ - lib/algolia/models/query-suggestions/configuration_response.rb
412
+ - lib/algolia/models/query-suggestions/configuration_with_index.rb
410
413
  - lib/algolia/models/query-suggestions/error_base.rb
411
414
  - lib/algolia/models/query-suggestions/facet.rb
412
415
  - lib/algolia/models/query-suggestions/get_config_status200_response.rb