algolia 3.0.0.beta.2 → 3.0.0.beta.4

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: ce6d6593d62ae959ce71401e5fc444b5c437ce4012214d537dd78ba0e8345155
4
- data.tar.gz: c3b0076421efe15774ec8acb41f694a7c99b119d70cc7334eb9f436ca576ac7a
3
+ metadata.gz: d8a5616a1aa9d89d365371c04b20236bd153937bc86549a340c90f2f996c467b
4
+ data.tar.gz: f07daa4f630934d9fee7a49d30ec1aaa48ad207799db4e754dad39b0fede65d2
5
5
  SHA512:
6
- metadata.gz: b6b6d6ba1e60ca6fa73a8734f913b345af4a070b38d0e599b585221b39fa4d79a8f71cf7d739e4517a3e4677aea6521a08eb7defcdb93969e979290d886d11aa
7
- data.tar.gz: abb19ef9c214cc448e08fe97b53c4205babff68745aa59e15fa30141a22b8230febf5517e215039b6cde468a3d5ebbd881fbb93d2a7457461907dba4936160f9
6
+ metadata.gz: 45af977700dd17bca72b31970899b2e790a6b51c599177fa254babced3e460ee0d67ca4e7cc6b6f1486a7856b0a275527fe30e44aaf3221c421f4a4b0042cd59
7
+ data.tar.gz: e8e4fc306aea4b38a5b842061530e4c305900d1b64ba54f701e7f32cdd019a9187076520c640010a1bcf04c79b323ff6e122488e0244c3a63a2b92bd885c6c5f
data/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## [3.0.0.beta.4](https://github.com/algolia/algoliasearch-client-ruby/compare/3.0.0.beta.3...3.0.0.beta.4)
2
+
3
+ - [b2a464a2b](https://github.com/algolia/api-clients-automation/commit/b2a464a2b) feat(clients): add generate_secured_api_key to ruby ([#3166](https://github.com/algolia/api-clients-automation/pull/3166)) by [@millotp](https://github.com/millotp/)
4
+ - [de4090789](https://github.com/algolia/api-clients-automation/commit/de4090789) fix(clients): safer replaceAllObjects + metis compliant ([#3164](https://github.com/algolia/api-clients-automation/pull/3164)) by [@shortcuts](https://github.com/shortcuts/)
5
+
6
+ ## [3.0.0.beta.3](https://github.com/algolia/algoliasearch-client-ruby/compare/3.0.0.beta.2...3.0.0.beta.3)
7
+
8
+ - [072c38b9a](https://github.com/algolia/api-clients-automation/commit/072c38b9a) fix(clients): remove unused models from lite clients ([#3159](https://github.com/algolia/api-clients-automation/pull/3159)) by [@shortcuts](https://github.com/shortcuts/)
9
+ - [c7f5de9d4](https://github.com/algolia/api-clients-automation/commit/c7f5de9d4) feat(clients): add waitForAppTask helper ([#3158](https://github.com/algolia/api-clients-automation/pull/3158)) by [@millotp](https://github.com/millotp/)
10
+ - [3a97fad1f](https://github.com/algolia/api-clients-automation/commit/3a97fad1f) fix(clients): chunked batch helper ([#3154](https://github.com/algolia/api-clients-automation/pull/3154)) by [@shortcuts](https://github.com/shortcuts/)
11
+ - [c251dc87e](https://github.com/algolia/api-clients-automation/commit/c251dc87e) fix(specs): rankingInfo required properties ([#3157](https://github.com/algolia/api-clients-automation/pull/3157)) by [@millotp](https://github.com/millotp/)
12
+ - [fd5a312fb](https://github.com/algolia/api-clients-automation/commit/fd5a312fb) feat(specs): add getAppTask endpoint to search ([#3156](https://github.com/algolia/api-clients-automation/pull/3156)) by [@millotp](https://github.com/millotp/)
13
+ - [cdc866549](https://github.com/algolia/api-clients-automation/commit/cdc866549) fix(specs): dont mention index api keys ([#3117](https://github.com/algolia/api-clients-automation/pull/3117)) by [@kai687](https://github.com/kai687/)
14
+
1
15
  ## [3.0.0.beta.2](https://github.com/algolia/algoliasearch-client-ruby/compare/3.0.0.beta.1...3.0.0.beta.2)
2
16
 
3
17
  - [2b70d9ea5](https://github.com/algolia/api-clients-automation/commit/2b70d9ea5) fix(specs): exhaustiveFacetsCount is not deprecated for sffv ([#3089](https://github.com/algolia/api-clients-automation/pull/3089)) by [@kai687](https://github.com/kai687/)
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- algolia (3.0.0.beta.2)
4
+ algolia (3.0.0.beta.4)
5
5
  faraday (>= 1.0.1, < 3.0)
6
6
  faraday-net_http_persistent (>= 0.15, < 3)
7
7
  net-http-persistent
@@ -32,7 +32,8 @@ GEM
32
32
  rainbow (3.1.1)
33
33
  rake (13.2.1)
34
34
  regexp_parser (2.9.1)
35
- rexml (3.2.6)
35
+ rexml (3.2.8)
36
+ strscan (>= 3.0.9)
36
37
  rubocop (1.63.5)
37
38
  json (~> 2.3)
38
39
  language_server-protocol (>= 3.17.0)
@@ -47,6 +48,7 @@ GEM
47
48
  rubocop-ast (1.31.3)
48
49
  parser (>= 3.3.1.0)
49
50
  ruby-progressbar (1.13.0)
51
+ strscan (3.1.0)
50
52
  unicode-display_width (2.5.0)
51
53
  uri (0.13.0)
52
54
 
data/README.md CHANGED
@@ -19,7 +19,7 @@
19
19
  <a href="http://stackoverflow.com/questions/tagged/algolia" target="_blank">Stack Overflow</a> •
20
20
  <a href="https://github.com/algolia/algoliasearch-client-ruby/issues" target="_blank">Report a bug</a> •
21
21
  <a href="https://www.algolia.com/doc/api-client/troubleshooting/faq/ruby/" target="_blank">FAQ</a> •
22
- <a href="https://www.algolia.com/support" target="_blank">Support</a>
22
+ <a href="https://alg.li/support" target="_blank">Support</a>
23
23
  </p>
24
24
 
25
25
  ## ✨ Features
data/algolia.gemspec CHANGED
@@ -8,8 +8,7 @@ Gem::Specification.new do |s|
8
8
  s.name = 'algolia'
9
9
  s.version = Algolia::VERSION
10
10
  s.platform = Gem::Platform::RUBY
11
- s.authors = ['Algolia']
12
- s.email = ['support@algolia.com']
11
+ s.authors = ['https://alg.li/support']
13
12
  s.homepage = 'https://github.com/algolia/algoliasearch-client-ruby'
14
13
  s.summary = 'A simple Ruby client for the algolia.com REST API'
15
14
  s.description = 'A simple Ruby client for the algolia.com REST API'
@@ -1,5 +1,8 @@
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
+ require 'openssl'
4
+ require 'base64'
5
+
3
6
  module Algolia
4
7
  class SearchClient
5
8
  attr_accessor :api_client
@@ -1125,6 +1128,50 @@ module Algolia
1125
1128
  @api_client.deserialize(response.body, request_options[:debug_return_type] || 'Search::GetApiKeyResponse')
1126
1129
  end
1127
1130
 
1131
+ # Checks the status of a given application task.
1132
+ #
1133
+ # Required API Key ACLs:
1134
+ # - editSettings
1135
+ # @param task_id [Integer] Unique task identifier. (required)
1136
+ # @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)
1137
+ # @return [Http::Response] the response
1138
+ def get_app_task_with_http_info(task_id, request_options = {})
1139
+ # verify the required parameter 'task_id' is set
1140
+ if @api_client.config.client_side_validation && task_id.nil?
1141
+ raise ArgumentError, "Parameter `task_id` is required when calling `get_app_task`."
1142
+ end
1143
+
1144
+ path = '/1/task/{taskID}'.sub('{' + 'taskID' + '}', Transport.encode_uri(task_id.to_s))
1145
+ query_params = {}
1146
+ query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
1147
+ header_params = {}
1148
+ header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?
1149
+
1150
+ post_body = request_options[:debug_body]
1151
+
1152
+ new_options = request_options.merge(
1153
+ :operation => :'SearchClient.get_app_task',
1154
+ :header_params => header_params,
1155
+ :query_params => query_params,
1156
+ :body => post_body,
1157
+ :use_read_transporter => false
1158
+ )
1159
+
1160
+ @api_client.call_api(:GET, path, new_options)
1161
+ end
1162
+
1163
+ # Checks the status of a given application task.
1164
+ #
1165
+ # Required API Key ACLs:
1166
+ # - editSettings
1167
+ # @param task_id [Integer] Unique task identifier. (required)
1168
+ # @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)
1169
+ # @return [GetTaskResponse]
1170
+ def get_app_task(task_id, request_options = {})
1171
+ response = get_app_task_with_http_info(task_id, request_options)
1172
+ @api_client.deserialize(response.body, request_options[:debug_return_type] || 'Search::GetTaskResponse')
1173
+ end
1174
+
1128
1175
  # Lists supported languages with their supported dictionary types and number of custom entries.
1129
1176
  #
1130
1177
  # Required API Key ACLs:
@@ -1918,7 +1965,7 @@ module Algolia
1918
1965
  @api_client.deserialize(response.body, request_options[:debug_return_type] || 'Search::MultipleBatchResponse')
1919
1966
  end
1920
1967
 
1921
- # Copies or moves (renames) an index within the same Algolia application. - Existing destination indices are overwritten, except for index-specific API keys and analytics data. - If the destination index doesn&#39;t exist yet, it&#39;ll be created. **Copy** - Copying a source index that doesn&#39;t exist creates a new index with 0 records and default settings. - The API keys of the source index are merged with the existing keys in the destination index. - You can&#39;t copy the &#x60;enableReRanking&#x60;, &#x60;mode&#x60;, and &#x60;replicas&#x60; settings. - You can&#39;t copy to a destination index that already has replicas. - Be aware of the [size limits](https://www.algolia.com/doc/guides/scaling/algolia-service-limits/#application-record-and-index-limits). - Related guide: [Copy indices](https://www.algolia.com/doc/guides/sending-and-managing-data/manage-indices-and-apps/manage-indices/how-to/copy-indices/) **Move** - Moving a source index that doesn&#39;t exist is ignored without returning an error. - When moving an index, the analytics data keep their original name and a new set of analytics data is started for the new name. To access the original analytics in the dashboard, create an index with the original name. - If the destination index has replicas, moving will overwrite the existing index and copy the data to the replica indices. - Related guide: [Move indices](https://www.algolia.com/doc/guides/sending-and-managing-data/manage-indices-and-apps/manage-indices/how-to/move-indices/).
1968
+ # Copies or moves (renames) an index within the same Algolia application. - Existing destination indices are overwritten, except for their analytics data. - If the destination index doesn&#39;t exist yet, it&#39;ll be created. **Copy** - Copying a source index that doesn&#39;t exist creates a new index with 0 records and default settings. - The API keys of the source index are merged with the existing keys in the destination index. - You can&#39;t copy the &#x60;enableReRanking&#x60;, &#x60;mode&#x60;, and &#x60;replicas&#x60; settings. - You can&#39;t copy to a destination index that already has replicas. - Be aware of the [size limits](https://www.algolia.com/doc/guides/scaling/algolia-service-limits/#application-record-and-index-limits). - Related guide: [Copy indices](https://www.algolia.com/doc/guides/sending-and-managing-data/manage-indices-and-apps/manage-indices/how-to/copy-indices/) **Move** - Moving a source index that doesn&#39;t exist is ignored without returning an error. - When moving an index, the analytics data keep their original name and a new set of analytics data is started for the new name. To access the original analytics in the dashboard, create an index with the original name. - If the destination index has replicas, moving will overwrite the existing index and copy the data to the replica indices. - Related guide: [Move indices](https://www.algolia.com/doc/guides/sending-and-managing-data/manage-indices-and-apps/manage-indices/how-to/move-indices/).
1922
1969
  #
1923
1970
  # Required API Key ACLs:
1924
1971
  # - addObject
@@ -1955,7 +2002,7 @@ module Algolia
1955
2002
  @api_client.call_api(:POST, path, new_options)
1956
2003
  end
1957
2004
 
1958
- # Copies or moves (renames) an index within the same Algolia application. - Existing destination indices are overwritten, except for index-specific API keys and analytics data. - If the destination index doesn't exist yet, it'll be created. **Copy** - Copying a source index that doesn't exist creates a new index with 0 records and default settings. - The API keys of the source index are merged with the existing keys in the destination index. - You can't copy the `enableReRanking`, `mode`, and `replicas` settings. - You can't copy to a destination index that already has replicas. - Be aware of the [size limits](https://www.algolia.com/doc/guides/scaling/algolia-service-limits/#application-record-and-index-limits). - Related guide: [Copy indices](https://www.algolia.com/doc/guides/sending-and-managing-data/manage-indices-and-apps/manage-indices/how-to/copy-indices/) **Move** - Moving a source index that doesn't exist is ignored without returning an error. - When moving an index, the analytics data keep their original name and a new set of analytics data is started for the new name. To access the original analytics in the dashboard, create an index with the original name. - If the destination index has replicas, moving will overwrite the existing index and copy the data to the replica indices. - Related guide: [Move indices](https://www.algolia.com/doc/guides/sending-and-managing-data/manage-indices-and-apps/manage-indices/how-to/move-indices/).
2005
+ # Copies or moves (renames) an index within the same Algolia application. - Existing destination indices are overwritten, except for their analytics data. - If the destination index doesn't exist yet, it'll be created. **Copy** - Copying a source index that doesn't exist creates a new index with 0 records and default settings. - The API keys of the source index are merged with the existing keys in the destination index. - You can't copy the `enableReRanking`, `mode`, and `replicas` settings. - You can't copy to a destination index that already has replicas. - Be aware of the [size limits](https://www.algolia.com/doc/guides/scaling/algolia-service-limits/#application-record-and-index-limits). - Related guide: [Copy indices](https://www.algolia.com/doc/guides/sending-and-managing-data/manage-indices-and-apps/manage-indices/how-to/copy-indices/) **Move** - Moving a source index that doesn't exist is ignored without returning an error. - When moving an index, the analytics data keep their original name and a new set of analytics data is started for the new name. To access the original analytics in the dashboard, create an index with the original name. - If the destination index has replicas, moving will overwrite the existing index and copy the data to the replica indices. - Related guide: [Move indices](https://www.algolia.com/doc/guides/sending-and-managing-data/manage-indices-and-apps/manage-indices/how-to/move-indices/).
1959
2006
  #
1960
2007
  # Required API Key ACLs:
1961
2008
  # - addObject
@@ -2945,6 +2992,27 @@ module Algolia
2945
2992
  raise ApiError, "The maximum number of retries exceeded. (#{max_retries})"
2946
2993
  end
2947
2994
 
2995
+ # Helper: Wait for an application-level task to be published (completed) for a given `task_id`.
2996
+ #
2997
+ # @param task_id [Integer] the `task_id` returned in the method response. (required)
2998
+ # @param max_retries [Integer] the maximum number of retries. (optional, default to 50)
2999
+ # @param timeout [Proc] the function to decide how long to wait between retries. (optional)
3000
+ # @param request_options [Hash] the requestOptions to send along with the query, they will be forwarded to the `get_task` method.
3001
+ # @return [Http::Response] the last get_task response
3002
+ def wait_for_app_task(task_id, max_retries = 50, timeout = ->(retry_count) { [retry_count * 200, 5000].min }, request_options = {})
3003
+ retries = 0
3004
+ while retries < max_retries
3005
+ res = get_app_task(task_id, request_options)
3006
+ if res.status == 'published'
3007
+ return res
3008
+ end
3009
+
3010
+ retries += 1
3011
+ sleep(timeout.call(retries) / 1000.0)
3012
+ end
3013
+ raise ApiError, "The maximum number of retries exceeded. (#{max_retries})"
3014
+ end
3015
+
2948
3016
  # Helper: Wait for an API key to be added, updated or deleted based on a given `operation`.
2949
3017
  #
2950
3018
  # @param operation [String] the `operation` that was done on a `key`.
@@ -3064,5 +3132,53 @@ module Algolia
3064
3132
 
3065
3133
  synonyms unless block_given?
3066
3134
  end
3135
+
3136
+ # Helper: Generates a secured API key based on the given `parent_api_key` and given `restrictions`.
3137
+ #
3138
+ # @param parent_api_key [String] Parent API key used the generate the secured key
3139
+ # @param restrictions [SecuredApiKeyRestrictions] Restrictions to apply on the secured key
3140
+ #
3141
+ # @return [String]
3142
+ #
3143
+ def generate_secured_api_key(parent_api_key, restrictions = {})
3144
+ restrictions = restrictions.to_hash
3145
+ if restrictions.key?(:searchParams)
3146
+ # merge searchParams with the root of the restrictions
3147
+
3148
+ restrictions.merge!(restrictions[:searchParams])
3149
+ restrictions.delete(:searchParams)
3150
+ end
3151
+
3152
+ url_encoded_restrictions = Algolia::Transport.stringify_query_params(restrictions).sort.to_h.map do |key, value|
3153
+ "#{key}=#{value}"
3154
+ end.join('&')
3155
+
3156
+ hmac = OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha256'), parent_api_key, url_encoded_restrictions)
3157
+
3158
+ puts "hmac: #{hmac}"
3159
+ puts "url_encoded_restrictions: #{url_encoded_restrictions}"
3160
+ Base64.encode64("#{hmac}#{url_encoded_restrictions}").gsub("\n", '')
3161
+ end
3162
+
3163
+ # Helper: Retrieves the remaining validity of the previous generated `secured_api_key`, the `validUntil` parameter must have been provided.
3164
+ #
3165
+ # @param secured_api_key [String]
3166
+ #
3167
+ # @return [Integer]
3168
+ #
3169
+ def get_secured_api_key_remaining_validity(secured_api_key)
3170
+ now = Time.now.to_i
3171
+ decoded_key = Base64.decode64(secured_api_key)
3172
+ regex = 'validUntil=(\d+)'
3173
+ matches = decoded_key.match(regex)
3174
+
3175
+ if matches.nil?
3176
+ raise AlgoliaError, 'The SecuredApiKey doesn\'t have a validUntil parameter.'
3177
+ end
3178
+
3179
+ valid_until = matches[1].to_i
3180
+
3181
+ valid_until - now
3182
+ end
3067
3183
  end
3068
3184
  end
@@ -14,14 +14,14 @@ module Algolia
14
14
  if arg.key?(:message) || arg.key?('message')
15
15
  super(arg[:message] || arg['message'])
16
16
  else
17
- super(arg)
17
+ super
18
18
  end
19
19
 
20
20
  arg.each do |k, v|
21
21
  instance_variable_set "@#{k}", v
22
22
  end
23
23
  else
24
- super(arg)
24
+ super
25
25
  @message = arg
26
26
  end
27
27
  end
@@ -111,8 +111,6 @@ module Algolia
111
111
 
112
112
  if attributes.key?(:filters)
113
113
  self.filters = attributes[:filters]
114
- else
115
- self.filters = nil
116
114
  end
117
115
 
118
116
  if attributes.key?(:first_matched_word)
@@ -153,8 +151,6 @@ module Algolia
153
151
 
154
152
  if attributes.key?(:promoted)
155
153
  self.promoted = attributes[:promoted]
156
- else
157
- self.promoted = nil
158
154
  end
159
155
 
160
156
  if attributes.key?(:proximity_distance)
@@ -169,8 +165,6 @@ module Algolia
169
165
 
170
166
  if attributes.key?(:words)
171
167
  self.words = attributes[:words]
172
- else
173
- self.words = nil
174
168
  end
175
169
 
176
170
  if attributes.key?(:promoted_by_re_ranking)
@@ -111,8 +111,6 @@ module Algolia
111
111
 
112
112
  if attributes.key?(:filters)
113
113
  self.filters = attributes[:filters]
114
- else
115
- self.filters = nil
116
114
  end
117
115
 
118
116
  if attributes.key?(:first_matched_word)
@@ -153,8 +151,6 @@ module Algolia
153
151
 
154
152
  if attributes.key?(:promoted)
155
153
  self.promoted = attributes[:promoted]
156
- else
157
- self.promoted = nil
158
154
  end
159
155
 
160
156
  if attributes.key?(:proximity_distance)
@@ -169,8 +165,6 @@ module Algolia
169
165
 
170
166
  if attributes.key?(:words)
171
167
  self.words = attributes[:words]
172
- else
173
- self.words = nil
174
168
  end
175
169
 
176
170
  if attributes.key?(:promoted_by_re_ranking)
@@ -0,0 +1,223 @@
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 Search
8
+ class ReplaceAllObjectsResponse
9
+ attr_accessor :copy_operation_response
10
+
11
+ # The response of the `batch` request(s).
12
+ attr_accessor :batch_responses
13
+
14
+ attr_accessor :move_operation_response
15
+
16
+ # Attribute mapping from ruby-style variable name to JSON key.
17
+ def self.attribute_map
18
+ {
19
+ :copy_operation_response => :copyOperationResponse,
20
+ :batch_responses => :batchResponses,
21
+ :move_operation_response => :moveOperationResponse
22
+ }
23
+ end
24
+
25
+ # Returns all the JSON keys this model knows about
26
+ def self.acceptable_attributes
27
+ attribute_map.values
28
+ end
29
+
30
+ # Attribute type mapping.
31
+ def self.types_mapping
32
+ {
33
+ :copy_operation_response => :UpdatedAtResponse,
34
+ :batch_responses => :'Array<BatchResponse>',
35
+ :move_operation_response => :UpdatedAtResponse
36
+ }
37
+ end
38
+
39
+ # List of attributes with nullable: true
40
+ def self.openapi_nullable
41
+ Set.new([])
42
+ end
43
+
44
+ # Initializes the object
45
+ # @param [Hash] attributes Model attributes in the form of hash
46
+ def initialize(attributes = {})
47
+ unless attributes.is_a?(Hash)
48
+ raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::ReplaceAllObjectsResponse` initialize method"
49
+ end
50
+
51
+ # check to see if the attribute exists and convert string to symbol for hash key
52
+ attributes = attributes.each_with_object({}) do |(k, v), h|
53
+ unless self.class.attribute_map.key?(k.to_sym)
54
+ raise ArgumentError,
55
+ "`#{k}` is not a valid attribute in `Algolia::ReplaceAllObjectsResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
56
+ end
57
+
58
+ h[k.to_sym] = v
59
+ end
60
+
61
+ if attributes.key?(:copy_operation_response)
62
+ self.copy_operation_response = attributes[:copy_operation_response]
63
+ else
64
+ self.copy_operation_response = nil
65
+ end
66
+
67
+ if attributes.key?(:batch_responses)
68
+ if (value = attributes[:batch_responses]).is_a?(Array)
69
+ self.batch_responses = value
70
+ end
71
+ else
72
+ self.batch_responses = nil
73
+ end
74
+
75
+ if attributes.key?(:move_operation_response)
76
+ self.move_operation_response = attributes[:move_operation_response]
77
+ else
78
+ self.move_operation_response = nil
79
+ end
80
+ end
81
+
82
+ # Checks equality by comparing each attribute.
83
+ # @param [Object] Object to be compared
84
+ def ==(other)
85
+ return true if equal?(other)
86
+
87
+ self.class == other.class &&
88
+ copy_operation_response == other.copy_operation_response &&
89
+ batch_responses == other.batch_responses &&
90
+ move_operation_response == other.move_operation_response
91
+ end
92
+
93
+ # @see the `==` method
94
+ # @param [Object] Object to be compared
95
+ def eql?(other)
96
+ self == other
97
+ end
98
+
99
+ # Calculates hash code according to all attributes.
100
+ # @return [Integer] Hash code
101
+ def hash
102
+ [copy_operation_response, batch_responses, move_operation_response].hash
103
+ end
104
+
105
+ # Builds the object from hash
106
+ # @param [Hash] attributes Model attributes in the form of hash
107
+ # @return [Object] Returns the model itself
108
+ def self.build_from_hash(attributes)
109
+ return nil unless attributes.is_a?(Hash)
110
+
111
+ attributes = attributes.transform_keys(&:to_sym)
112
+ transformed_hash = {}
113
+ types_mapping.each_pair do |key, type|
114
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
115
+ transformed_hash[key.to_sym] = nil
116
+ elsif type =~ /\AArray<(.*)>/i
117
+ # check to ensure the input is an array given that the attribute
118
+ # is documented as an array but the input is not
119
+ if attributes[attribute_map[key]].is_a?(Array)
120
+ transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v| _deserialize(::Regexp.last_match(1), v) }
121
+ end
122
+ elsif !attributes[attribute_map[key]].nil?
123
+ transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
124
+ end
125
+ end
126
+ new(transformed_hash)
127
+ end
128
+
129
+ # Deserializes the data based on type
130
+ # @param string type Data type
131
+ # @param string value Value to be deserialized
132
+ # @return [Object] Deserialized data
133
+ def self._deserialize(type, value)
134
+ case type.to_sym
135
+ when :Time
136
+ Time.parse(value)
137
+ when :Date
138
+ Date.parse(value)
139
+ when :String
140
+ value.to_s
141
+ when :Integer
142
+ value.to_i
143
+ when :Float
144
+ value.to_f
145
+ when :Boolean
146
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
147
+ true
148
+ else
149
+ false
150
+ end
151
+ when :Object
152
+ # generic object (usually a Hash), return directly
153
+ value
154
+ when /\AArray<(?<inner_type>.+)>\z/
155
+ inner_type = Regexp.last_match[:inner_type]
156
+ value.map { |v| _deserialize(inner_type, v) }
157
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
158
+ k_type = Regexp.last_match[:k_type]
159
+ v_type = Regexp.last_match[:v_type]
160
+ {}.tap do |hash|
161
+ value.each do |k, v|
162
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
163
+ end
164
+ end
165
+ else # model
166
+ # models (e.g. Pet) or oneOf
167
+ klass = Algolia::Search.const_get(type)
168
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
169
+ end
170
+ end
171
+
172
+ # Returns the string representation of the object
173
+ # @return [String] String presentation of the object
174
+ def to_s
175
+ to_hash.to_s
176
+ end
177
+
178
+ # to_body is an alias to to_hash (backward compatibility)
179
+ # @return [Hash] Returns the object in the form of hash
180
+ def to_body
181
+ to_hash
182
+ end
183
+
184
+ def to_json(*_args)
185
+ to_hash.to_json
186
+ end
187
+
188
+ # Returns the object in the form of hash
189
+ # @return [Hash] Returns the object in the form of hash
190
+ def to_hash
191
+ hash = {}
192
+ self.class.attribute_map.each_pair do |attr, param|
193
+ value = send(attr)
194
+ if value.nil?
195
+ is_nullable = self.class.openapi_nullable.include?(attr)
196
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
197
+ end
198
+
199
+ hash[param] = _to_hash(value)
200
+ end
201
+ hash
202
+ end
203
+
204
+ # Outputs non-array value in the form of hash
205
+ # For object, use to_hash. Otherwise, just return the value
206
+ # @param [Object] value Any valid value
207
+ # @return [Hash] Returns the value in the form of hash
208
+ def _to_hash(value)
209
+ if value.is_a?(Array)
210
+ value.compact.map { |v| _to_hash(v) }
211
+ elsif value.is_a?(Hash)
212
+ {}.tap do |hash|
213
+ value.each { |k, v| hash[k] = _to_hash(v) }
214
+ end
215
+ elsif value.respond_to? :to_hash
216
+ value.to_hash
217
+ else
218
+ value
219
+ end
220
+ end
221
+ end
222
+ end
223
+ end
@@ -9,6 +9,13 @@ module Algolia
9
9
  CGI.escape(uri).gsub('+', '%20')
10
10
  end
11
11
 
12
+ def self.stringify_query_params(query_params)
13
+ query_params.to_h do |key, value|
14
+ value = value.join(',') if value.is_a?(Array)
15
+ [encode_uri(key.to_s).to_sym, encode_uri(value.to_s)]
16
+ end
17
+ end
18
+
12
19
  class Transport
13
20
  include RetryOutcomeType
14
21
  include CallType
@@ -79,7 +86,7 @@ module Algolia
79
86
  request[:method] = method.downcase
80
87
  request[:path] = path
81
88
  request[:body] = build_body(body, request_options)
82
- request[:query_params] = stringify_query_params(request_options.query_params)
89
+ request[:query_params] = Algolia::Transport.stringify_query_params(request_options.query_params)
83
90
  request[:header_params] = generate_header_params(body, request_options)
84
91
  request[:timeout] = request_options.timeout
85
92
  request[:connect_timeout] = request_options.connect_timeout
@@ -128,13 +135,6 @@ module Algolia
128
135
  @config.write_timeout
129
136
  end
130
137
  end
131
-
132
- def stringify_query_params(query_params)
133
- query_params.to_h do |key, value|
134
- value = value.join(',') if value.is_a?(Array)
135
- [Algolia::Transport.encode_uri(key.to_s).to_sym, Algolia::Transport.encode_uri(value.to_s)]
136
- end
137
- end
138
138
  end
139
139
  end
140
140
  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.2'.freeze
4
+ VERSION = '3.0.0.beta.4'.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.2
4
+ version: 3.0.0.beta.4
5
5
  platform: ruby
6
6
  authors:
7
- - Algolia
7
+ - https://alg.li/support
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-17 00:00:00.000000000 Z
11
+ date: 2024-06-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -107,8 +107,7 @@ dependencies:
107
107
  - !ruby/object:Gem::Version
108
108
  version: '0'
109
109
  description: A simple Ruby client for the algolia.com REST API
110
- email:
111
- - support@algolia.com
110
+ email:
112
111
  executables: []
113
112
  extensions: []
114
113
  extra_rdoc_files: []
@@ -611,6 +610,7 @@ files:
611
610
  - lib/algolia/models/search/remove_user_id_response.rb
612
611
  - lib/algolia/models/search/remove_words_if_no_results.rb
613
612
  - lib/algolia/models/search/rendering_content.rb
613
+ - lib/algolia/models/search/replace_all_objects_response.rb
614
614
  - lib/algolia/models/search/replace_source_response.rb
615
615
  - lib/algolia/models/search/rule.rb
616
616
  - lib/algolia/models/search/save_object_response.rb