algolia 3.0.0.beta.2 → 3.0.0.beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/Gemfile.lock +4 -2
- data/algolia.gemspec +1 -2
- data/lib/algolia/api/search_client.rb +67 -2
- data/lib/algolia/api_error.rb +2 -2
- data/lib/algolia/models/recommend/ranking_info.rb +0 -6
- data/lib/algolia/models/search/ranking_info.rb +0 -6
- data/lib/algolia/models/search/replace_all_objects_response.rb +223 -0
- data/lib/algolia/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 55b1f581a3ca4f6ef59d05989130f89559c010f4e114c749a4b9dc523bf45fa6
|
|
4
|
+
data.tar.gz: 8b6e80f68129c52f05c2ce91f05a93c4436831f4c3ea450be2351ad6e5c964a5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 698e012f76df7596ceec8b4200bc77f4e4b889b535a9f015b1b69ad9d780c1a53cb4750ad4a4670908dc931152bdd869f80d961c4c305364cbf9ee8bac8549c2
|
|
7
|
+
data.tar.gz: 98c728722f3b2fdc67162b2b4cd6695dac5c1e22d5f5f6c35114ae5c7e3243d64cd43b7bc3a733b751a9acfe5f59f6fa37f228322184a107b2599df4f9ba2951
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
## [3.0.0.beta.3](https://github.com/algolia/algoliasearch-client-ruby/compare/3.0.0.beta.2...3.0.0.beta.3)
|
|
2
|
+
|
|
3
|
+
- [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/)
|
|
4
|
+
- [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/)
|
|
5
|
+
- [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/)
|
|
6
|
+
- [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/)
|
|
7
|
+
- [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/)
|
|
8
|
+
- [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/)
|
|
9
|
+
|
|
1
10
|
## [3.0.0.beta.2](https://github.com/algolia/algoliasearch-client-ruby/compare/3.0.0.beta.1...3.0.0.beta.2)
|
|
2
11
|
|
|
3
12
|
- [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.
|
|
4
|
+
algolia (3.0.0.beta.3)
|
|
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.
|
|
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/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 = ['
|
|
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'
|
|
@@ -1125,6 +1125,50 @@ module Algolia
|
|
|
1125
1125
|
@api_client.deserialize(response.body, request_options[:debug_return_type] || 'Search::GetApiKeyResponse')
|
|
1126
1126
|
end
|
|
1127
1127
|
|
|
1128
|
+
# Checks the status of a given application task.
|
|
1129
|
+
#
|
|
1130
|
+
# Required API Key ACLs:
|
|
1131
|
+
# - editSettings
|
|
1132
|
+
# @param task_id [Integer] Unique task identifier. (required)
|
|
1133
|
+
# @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)
|
|
1134
|
+
# @return [Http::Response] the response
|
|
1135
|
+
def get_app_task_with_http_info(task_id, request_options = {})
|
|
1136
|
+
# verify the required parameter 'task_id' is set
|
|
1137
|
+
if @api_client.config.client_side_validation && task_id.nil?
|
|
1138
|
+
raise ArgumentError, "Parameter `task_id` is required when calling `get_app_task`."
|
|
1139
|
+
end
|
|
1140
|
+
|
|
1141
|
+
path = '/1/task/{taskID}'.sub('{' + 'taskID' + '}', Transport.encode_uri(task_id.to_s))
|
|
1142
|
+
query_params = {}
|
|
1143
|
+
query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
|
|
1144
|
+
header_params = {}
|
|
1145
|
+
header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?
|
|
1146
|
+
|
|
1147
|
+
post_body = request_options[:debug_body]
|
|
1148
|
+
|
|
1149
|
+
new_options = request_options.merge(
|
|
1150
|
+
:operation => :'SearchClient.get_app_task',
|
|
1151
|
+
:header_params => header_params,
|
|
1152
|
+
:query_params => query_params,
|
|
1153
|
+
:body => post_body,
|
|
1154
|
+
:use_read_transporter => false
|
|
1155
|
+
)
|
|
1156
|
+
|
|
1157
|
+
@api_client.call_api(:GET, path, new_options)
|
|
1158
|
+
end
|
|
1159
|
+
|
|
1160
|
+
# Checks the status of a given application task.
|
|
1161
|
+
#
|
|
1162
|
+
# Required API Key ACLs:
|
|
1163
|
+
# - editSettings
|
|
1164
|
+
# @param task_id [Integer] Unique task identifier. (required)
|
|
1165
|
+
# @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)
|
|
1166
|
+
# @return [GetTaskResponse]
|
|
1167
|
+
def get_app_task(task_id, request_options = {})
|
|
1168
|
+
response = get_app_task_with_http_info(task_id, request_options)
|
|
1169
|
+
@api_client.deserialize(response.body, request_options[:debug_return_type] || 'Search::GetTaskResponse')
|
|
1170
|
+
end
|
|
1171
|
+
|
|
1128
1172
|
# Lists supported languages with their supported dictionary types and number of custom entries.
|
|
1129
1173
|
#
|
|
1130
1174
|
# Required API Key ACLs:
|
|
@@ -1918,7 +1962,7 @@ module Algolia
|
|
|
1918
1962
|
@api_client.deserialize(response.body, request_options[:debug_return_type] || 'Search::MultipleBatchResponse')
|
|
1919
1963
|
end
|
|
1920
1964
|
|
|
1921
|
-
# Copies or moves (renames) an index within the same Algolia application. - Existing destination indices are overwritten, except for
|
|
1965
|
+
# 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/).
|
|
1922
1966
|
#
|
|
1923
1967
|
# Required API Key ACLs:
|
|
1924
1968
|
# - addObject
|
|
@@ -1955,7 +1999,7 @@ module Algolia
|
|
|
1955
1999
|
@api_client.call_api(:POST, path, new_options)
|
|
1956
2000
|
end
|
|
1957
2001
|
|
|
1958
|
-
# Copies or moves (renames) an index within the same Algolia application. - Existing destination indices are overwritten, except for
|
|
2002
|
+
# 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
2003
|
#
|
|
1960
2004
|
# Required API Key ACLs:
|
|
1961
2005
|
# - addObject
|
|
@@ -2945,6 +2989,27 @@ module Algolia
|
|
|
2945
2989
|
raise ApiError, "The maximum number of retries exceeded. (#{max_retries})"
|
|
2946
2990
|
end
|
|
2947
2991
|
|
|
2992
|
+
# Helper: Wait for an application-level task to be published (completed) for a given `task_id`.
|
|
2993
|
+
#
|
|
2994
|
+
# @param task_id [Integer] the `task_id` returned in the method response. (required)
|
|
2995
|
+
# @param max_retries [Integer] the maximum number of retries. (optional, default to 50)
|
|
2996
|
+
# @param timeout [Proc] the function to decide how long to wait between retries. (optional)
|
|
2997
|
+
# @param request_options [Hash] the requestOptions to send along with the query, they will be forwarded to the `get_task` method.
|
|
2998
|
+
# @return [Http::Response] the last get_task response
|
|
2999
|
+
def wait_for_app_task(task_id, max_retries = 50, timeout = ->(retry_count) { [retry_count * 200, 5000].min }, request_options = {})
|
|
3000
|
+
retries = 0
|
|
3001
|
+
while retries < max_retries
|
|
3002
|
+
res = get_app_task(task_id, request_options)
|
|
3003
|
+
if res.status == 'published'
|
|
3004
|
+
return res
|
|
3005
|
+
end
|
|
3006
|
+
|
|
3007
|
+
retries += 1
|
|
3008
|
+
sleep(timeout.call(retries) / 1000.0)
|
|
3009
|
+
end
|
|
3010
|
+
raise ApiError, "The maximum number of retries exceeded. (#{max_retries})"
|
|
3011
|
+
end
|
|
3012
|
+
|
|
2948
3013
|
# Helper: Wait for an API key to be added, updated or deleted based on a given `operation`.
|
|
2949
3014
|
#
|
|
2950
3015
|
# @param operation [String] the `operation` that was done on a `key`.
|
data/lib/algolia/api_error.rb
CHANGED
|
@@ -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
|
|
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
|
|
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
|
data/lib/algolia/version.rb
CHANGED
|
@@ -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.
|
|
4
|
+
VERSION = '3.0.0.beta.3'.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.
|
|
4
|
+
version: 3.0.0.beta.3
|
|
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-
|
|
11
|
+
date: 2024-06-11 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
|