cheminee 0.0.15 → 0.1.5
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/Gemfile.lock +4 -4
- data/README.md +19 -9
- data/cheminee.gemspec +1 -1
- data/docs/CreateIndexError.md +18 -0
- data/docs/DefaultApi.md +327 -10
- data/docs/GetIndexesResponseError.md +18 -0
- data/docs/IndexMeta.md +20 -0
- data/docs/ListIndexResponseErr.md +18 -0
- data/docs/Schema.md +20 -0
- data/docs/SubstructureSearchHit.md +24 -0
- data/lib/cheminee/api/default_api.rb +309 -9
- data/lib/cheminee/api_client.rb +3 -2
- data/lib/cheminee/api_error.rb +1 -1
- data/lib/cheminee/configuration.rb +6 -5
- data/lib/cheminee/models/create_index_error.rb +221 -0
- data/lib/cheminee/models/get_indexes_response_error.rb +221 -0
- data/lib/cheminee/models/index_meta.rb +237 -0
- data/lib/cheminee/models/list_index_response_err.rb +221 -0
- data/lib/cheminee/models/schema.rb +233 -0
- data/lib/cheminee/models/smile.rb +1 -1
- data/lib/cheminee/models/standardized_smile.rb +1 -1
- data/lib/cheminee/models/substructure_search_hit.rb +265 -0
- data/lib/cheminee/version.rb +2 -2
- data/lib/cheminee.rb +7 -1
- data/pkg/cheminee-0.1.5.gem +0 -0
- data/spec/api_client_spec.rb +1 -1
- data/spec/configuration_spec.rb +4 -4
- data/spec/models/create_index_error_spec.rb +36 -0
- data/spec/models/get_indexes_response_error_spec.rb +36 -0
- data/spec/models/index_meta_spec.rb +42 -0
- data/spec/models/list_index_response_err_spec.rb +36 -0
- data/spec/models/schema_spec.rb +42 -0
- data/spec/models/substructure_search_hit_spec.rb +54 -0
- data/spec/spec_helper.rb +1 -1
- metadata +27 -3
- data/pkg/cheminee-0.0.15.gem +0 -0
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 1.0
|
7
7
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version: 7.
|
9
|
+
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -19,27 +19,327 @@ module Cheminee
|
|
19
19
|
def initialize(api_client = ApiClient.default)
|
20
20
|
@api_client = api_client
|
21
21
|
end
|
22
|
+
# @param [Hash] opts the optional parameters
|
23
|
+
# @return [Array<IndexMeta>]
|
24
|
+
def v1_indexes_get(opts = {})
|
25
|
+
data, _status_code, _headers = v1_indexes_get_with_http_info(opts)
|
26
|
+
data
|
27
|
+
end
|
28
|
+
|
29
|
+
# @param [Hash] opts the optional parameters
|
30
|
+
# @return [Array<(Array<IndexMeta>, Integer, Hash)>] Array<IndexMeta> data, response status code and response headers
|
31
|
+
def v1_indexes_get_with_http_info(opts = {})
|
32
|
+
if @api_client.config.debugging
|
33
|
+
@api_client.config.logger.debug 'Calling API: DefaultApi.v1_indexes_get ...'
|
34
|
+
end
|
35
|
+
# resource path
|
36
|
+
local_var_path = '/v1/indexes'
|
37
|
+
|
38
|
+
# query parameters
|
39
|
+
query_params = opts[:query_params] || {}
|
40
|
+
|
41
|
+
# header parameters
|
42
|
+
header_params = opts[:header_params] || {}
|
43
|
+
# HTTP header 'Accept' (if needed)
|
44
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json; charset=utf-8'])
|
45
|
+
|
46
|
+
# form parameters
|
47
|
+
form_params = opts[:form_params] || {}
|
48
|
+
|
49
|
+
# http body (model)
|
50
|
+
post_body = opts[:debug_body]
|
51
|
+
|
52
|
+
# return_type
|
53
|
+
return_type = opts[:debug_return_type] || 'Array<IndexMeta>'
|
54
|
+
|
55
|
+
# auth_names
|
56
|
+
auth_names = opts[:debug_auth_names] || []
|
57
|
+
|
58
|
+
new_options = opts.merge(
|
59
|
+
:operation => :"DefaultApi.v1_indexes_get",
|
60
|
+
:header_params => header_params,
|
61
|
+
:query_params => query_params,
|
62
|
+
:form_params => form_params,
|
63
|
+
:body => post_body,
|
64
|
+
:auth_names => auth_names,
|
65
|
+
:return_type => return_type
|
66
|
+
)
|
67
|
+
|
68
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
69
|
+
if @api_client.config.debugging
|
70
|
+
@api_client.config.logger.debug "API called: DefaultApi#v1_indexes_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
71
|
+
end
|
72
|
+
return data, status_code, headers
|
73
|
+
end
|
74
|
+
|
75
|
+
# @param index [String]
|
76
|
+
# @param [Hash] opts the optional parameters
|
77
|
+
# @return [Array<IndexMeta>]
|
78
|
+
def v1_indexes_index_get(index, opts = {})
|
79
|
+
data, _status_code, _headers = v1_indexes_index_get_with_http_info(index, opts)
|
80
|
+
data
|
81
|
+
end
|
82
|
+
|
83
|
+
# @param index [String]
|
84
|
+
# @param [Hash] opts the optional parameters
|
85
|
+
# @return [Array<(Array<IndexMeta>, Integer, Hash)>] Array<IndexMeta> data, response status code and response headers
|
86
|
+
def v1_indexes_index_get_with_http_info(index, opts = {})
|
87
|
+
if @api_client.config.debugging
|
88
|
+
@api_client.config.logger.debug 'Calling API: DefaultApi.v1_indexes_index_get ...'
|
89
|
+
end
|
90
|
+
# verify the required parameter 'index' is set
|
91
|
+
if @api_client.config.client_side_validation && index.nil?
|
92
|
+
fail ArgumentError, "Missing the required parameter 'index' when calling DefaultApi.v1_indexes_index_get"
|
93
|
+
end
|
94
|
+
# resource path
|
95
|
+
local_var_path = '/v1/indexes/{index}'.sub('{' + 'index' + '}', CGI.escape(index.to_s))
|
96
|
+
|
97
|
+
# query parameters
|
98
|
+
query_params = opts[:query_params] || {}
|
99
|
+
|
100
|
+
# header parameters
|
101
|
+
header_params = opts[:header_params] || {}
|
102
|
+
# HTTP header 'Accept' (if needed)
|
103
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json; charset=utf-8'])
|
104
|
+
|
105
|
+
# form parameters
|
106
|
+
form_params = opts[:form_params] || {}
|
107
|
+
|
108
|
+
# http body (model)
|
109
|
+
post_body = opts[:debug_body]
|
110
|
+
|
111
|
+
# return_type
|
112
|
+
return_type = opts[:debug_return_type] || 'Array<IndexMeta>'
|
113
|
+
|
114
|
+
# auth_names
|
115
|
+
auth_names = opts[:debug_auth_names] || []
|
116
|
+
|
117
|
+
new_options = opts.merge(
|
118
|
+
:operation => :"DefaultApi.v1_indexes_index_get",
|
119
|
+
:header_params => header_params,
|
120
|
+
:query_params => query_params,
|
121
|
+
:form_params => form_params,
|
122
|
+
:body => post_body,
|
123
|
+
:auth_names => auth_names,
|
124
|
+
:return_type => return_type
|
125
|
+
)
|
126
|
+
|
127
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
128
|
+
if @api_client.config.debugging
|
129
|
+
@api_client.config.logger.debug "API called: DefaultApi#v1_indexes_index_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
130
|
+
end
|
131
|
+
return data, status_code, headers
|
132
|
+
end
|
133
|
+
|
134
|
+
# @param index [String]
|
135
|
+
# @param schema [String]
|
136
|
+
# @param [Hash] opts the optional parameters
|
137
|
+
# @option opts [String] :sort_by
|
138
|
+
# @return [IndexMeta]
|
139
|
+
def v1_indexes_index_post(index, schema, opts = {})
|
140
|
+
data, _status_code, _headers = v1_indexes_index_post_with_http_info(index, schema, opts)
|
141
|
+
data
|
142
|
+
end
|
143
|
+
|
144
|
+
# @param index [String]
|
145
|
+
# @param schema [String]
|
146
|
+
# @param [Hash] opts the optional parameters
|
147
|
+
# @option opts [String] :sort_by
|
148
|
+
# @return [Array<(IndexMeta, Integer, Hash)>] IndexMeta data, response status code and response headers
|
149
|
+
def v1_indexes_index_post_with_http_info(index, schema, opts = {})
|
150
|
+
if @api_client.config.debugging
|
151
|
+
@api_client.config.logger.debug 'Calling API: DefaultApi.v1_indexes_index_post ...'
|
152
|
+
end
|
153
|
+
# verify the required parameter 'index' is set
|
154
|
+
if @api_client.config.client_side_validation && index.nil?
|
155
|
+
fail ArgumentError, "Missing the required parameter 'index' when calling DefaultApi.v1_indexes_index_post"
|
156
|
+
end
|
157
|
+
# verify the required parameter 'schema' is set
|
158
|
+
if @api_client.config.client_side_validation && schema.nil?
|
159
|
+
fail ArgumentError, "Missing the required parameter 'schema' when calling DefaultApi.v1_indexes_index_post"
|
160
|
+
end
|
161
|
+
# resource path
|
162
|
+
local_var_path = '/v1/indexes/{index}'.sub('{' + 'index' + '}', CGI.escape(index.to_s))
|
163
|
+
|
164
|
+
# query parameters
|
165
|
+
query_params = opts[:query_params] || {}
|
166
|
+
query_params[:'schema'] = schema
|
167
|
+
query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?
|
168
|
+
|
169
|
+
# header parameters
|
170
|
+
header_params = opts[:header_params] || {}
|
171
|
+
# HTTP header 'Accept' (if needed)
|
172
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json; charset=utf-8'])
|
173
|
+
|
174
|
+
# form parameters
|
175
|
+
form_params = opts[:form_params] || {}
|
176
|
+
|
177
|
+
# http body (model)
|
178
|
+
post_body = opts[:debug_body]
|
179
|
+
|
180
|
+
# return_type
|
181
|
+
return_type = opts[:debug_return_type] || 'IndexMeta'
|
182
|
+
|
183
|
+
# auth_names
|
184
|
+
auth_names = opts[:debug_auth_names] || []
|
185
|
+
|
186
|
+
new_options = opts.merge(
|
187
|
+
:operation => :"DefaultApi.v1_indexes_index_post",
|
188
|
+
:header_params => header_params,
|
189
|
+
:query_params => query_params,
|
190
|
+
:form_params => form_params,
|
191
|
+
:body => post_body,
|
192
|
+
:auth_names => auth_names,
|
193
|
+
:return_type => return_type
|
194
|
+
)
|
195
|
+
|
196
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
197
|
+
if @api_client.config.debugging
|
198
|
+
@api_client.config.logger.debug "API called: DefaultApi#v1_indexes_index_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
199
|
+
end
|
200
|
+
return data, status_code, headers
|
201
|
+
end
|
202
|
+
|
203
|
+
# @param index [String]
|
204
|
+
# @param q [String]
|
205
|
+
# @param [Hash] opts the optional parameters
|
206
|
+
# @return [Array<SubstructureSearchHit>]
|
207
|
+
def v1_indexes_index_search_substructure_get(index, q, opts = {})
|
208
|
+
data, _status_code, _headers = v1_indexes_index_search_substructure_get_with_http_info(index, q, opts)
|
209
|
+
data
|
210
|
+
end
|
211
|
+
|
212
|
+
# @param index [String]
|
213
|
+
# @param q [String]
|
214
|
+
# @param [Hash] opts the optional parameters
|
215
|
+
# @return [Array<(Array<SubstructureSearchHit>, Integer, Hash)>] Array<SubstructureSearchHit> data, response status code and response headers
|
216
|
+
def v1_indexes_index_search_substructure_get_with_http_info(index, q, opts = {})
|
217
|
+
if @api_client.config.debugging
|
218
|
+
@api_client.config.logger.debug 'Calling API: DefaultApi.v1_indexes_index_search_substructure_get ...'
|
219
|
+
end
|
220
|
+
# verify the required parameter 'index' is set
|
221
|
+
if @api_client.config.client_side_validation && index.nil?
|
222
|
+
fail ArgumentError, "Missing the required parameter 'index' when calling DefaultApi.v1_indexes_index_search_substructure_get"
|
223
|
+
end
|
224
|
+
# verify the required parameter 'q' is set
|
225
|
+
if @api_client.config.client_side_validation && q.nil?
|
226
|
+
fail ArgumentError, "Missing the required parameter 'q' when calling DefaultApi.v1_indexes_index_search_substructure_get"
|
227
|
+
end
|
228
|
+
# resource path
|
229
|
+
local_var_path = '/v1/indexes/{index}/search/substructure'.sub('{' + 'index' + '}', CGI.escape(index.to_s))
|
230
|
+
|
231
|
+
# query parameters
|
232
|
+
query_params = opts[:query_params] || {}
|
233
|
+
query_params[:'q'] = q
|
234
|
+
|
235
|
+
# header parameters
|
236
|
+
header_params = opts[:header_params] || {}
|
237
|
+
# HTTP header 'Accept' (if needed)
|
238
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json; charset=utf-8'])
|
239
|
+
|
240
|
+
# form parameters
|
241
|
+
form_params = opts[:form_params] || {}
|
242
|
+
|
243
|
+
# http body (model)
|
244
|
+
post_body = opts[:debug_body]
|
245
|
+
|
246
|
+
# return_type
|
247
|
+
return_type = opts[:debug_return_type] || 'Array<SubstructureSearchHit>'
|
248
|
+
|
249
|
+
# auth_names
|
250
|
+
auth_names = opts[:debug_auth_names] || []
|
251
|
+
|
252
|
+
new_options = opts.merge(
|
253
|
+
:operation => :"DefaultApi.v1_indexes_index_search_substructure_get",
|
254
|
+
:header_params => header_params,
|
255
|
+
:query_params => query_params,
|
256
|
+
:form_params => form_params,
|
257
|
+
:body => post_body,
|
258
|
+
:auth_names => auth_names,
|
259
|
+
:return_type => return_type
|
260
|
+
)
|
261
|
+
|
262
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
263
|
+
if @api_client.config.debugging
|
264
|
+
@api_client.config.logger.debug "API called: DefaultApi#v1_indexes_index_search_substructure_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
265
|
+
end
|
266
|
+
return data, status_code, headers
|
267
|
+
end
|
268
|
+
|
269
|
+
# @param [Hash] opts the optional parameters
|
270
|
+
# @return [Array<Schema>]
|
271
|
+
def v1_schemas_get(opts = {})
|
272
|
+
data, _status_code, _headers = v1_schemas_get_with_http_info(opts)
|
273
|
+
data
|
274
|
+
end
|
275
|
+
|
276
|
+
# @param [Hash] opts the optional parameters
|
277
|
+
# @return [Array<(Array<Schema>, Integer, Hash)>] Array<Schema> data, response status code and response headers
|
278
|
+
def v1_schemas_get_with_http_info(opts = {})
|
279
|
+
if @api_client.config.debugging
|
280
|
+
@api_client.config.logger.debug 'Calling API: DefaultApi.v1_schemas_get ...'
|
281
|
+
end
|
282
|
+
# resource path
|
283
|
+
local_var_path = '/v1/schemas'
|
284
|
+
|
285
|
+
# query parameters
|
286
|
+
query_params = opts[:query_params] || {}
|
287
|
+
|
288
|
+
# header parameters
|
289
|
+
header_params = opts[:header_params] || {}
|
290
|
+
# HTTP header 'Accept' (if needed)
|
291
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json; charset=utf-8'])
|
292
|
+
|
293
|
+
# form parameters
|
294
|
+
form_params = opts[:form_params] || {}
|
295
|
+
|
296
|
+
# http body (model)
|
297
|
+
post_body = opts[:debug_body]
|
298
|
+
|
299
|
+
# return_type
|
300
|
+
return_type = opts[:debug_return_type] || 'Array<Schema>'
|
301
|
+
|
302
|
+
# auth_names
|
303
|
+
auth_names = opts[:debug_auth_names] || []
|
304
|
+
|
305
|
+
new_options = opts.merge(
|
306
|
+
:operation => :"DefaultApi.v1_schemas_get",
|
307
|
+
:header_params => header_params,
|
308
|
+
:query_params => query_params,
|
309
|
+
:form_params => form_params,
|
310
|
+
:body => post_body,
|
311
|
+
:auth_names => auth_names,
|
312
|
+
:return_type => return_type
|
313
|
+
)
|
314
|
+
|
315
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
316
|
+
if @api_client.config.debugging
|
317
|
+
@api_client.config.logger.debug "API called: DefaultApi#v1_schemas_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
318
|
+
end
|
319
|
+
return data, status_code, headers
|
320
|
+
end
|
321
|
+
|
22
322
|
# @param smile [Array<Smile>]
|
23
323
|
# @param [Hash] opts the optional parameters
|
24
324
|
# @return [Array<StandardizedSmile>]
|
25
|
-
def
|
26
|
-
data, _status_code, _headers =
|
325
|
+
def v1_standardize_post(smile, opts = {})
|
326
|
+
data, _status_code, _headers = v1_standardize_post_with_http_info(smile, opts)
|
27
327
|
data
|
28
328
|
end
|
29
329
|
|
30
330
|
# @param smile [Array<Smile>]
|
31
331
|
# @param [Hash] opts the optional parameters
|
32
332
|
# @return [Array<(Array<StandardizedSmile>, Integer, Hash)>] Array<StandardizedSmile> data, response status code and response headers
|
33
|
-
def
|
333
|
+
def v1_standardize_post_with_http_info(smile, opts = {})
|
34
334
|
if @api_client.config.debugging
|
35
|
-
@api_client.config.logger.debug 'Calling API: DefaultApi.
|
335
|
+
@api_client.config.logger.debug 'Calling API: DefaultApi.v1_standardize_post ...'
|
36
336
|
end
|
37
337
|
# verify the required parameter 'smile' is set
|
38
338
|
if @api_client.config.client_side_validation && smile.nil?
|
39
|
-
fail ArgumentError, "Missing the required parameter 'smile' when calling DefaultApi.
|
339
|
+
fail ArgumentError, "Missing the required parameter 'smile' when calling DefaultApi.v1_standardize_post"
|
40
340
|
end
|
41
341
|
# resource path
|
42
|
-
local_var_path = '/standardize'
|
342
|
+
local_var_path = '/v1/standardize'
|
43
343
|
|
44
344
|
# query parameters
|
45
345
|
query_params = opts[:query_params] || {}
|
@@ -67,7 +367,7 @@ module Cheminee
|
|
67
367
|
auth_names = opts[:debug_auth_names] || []
|
68
368
|
|
69
369
|
new_options = opts.merge(
|
70
|
-
:operation => :"DefaultApi.
|
370
|
+
:operation => :"DefaultApi.v1_standardize_post",
|
71
371
|
:header_params => header_params,
|
72
372
|
:query_params => query_params,
|
73
373
|
:form_params => form_params,
|
@@ -78,7 +378,7 @@ module Cheminee
|
|
78
378
|
|
79
379
|
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
80
380
|
if @api_client.config.debugging
|
81
|
-
@api_client.config.logger.debug "API called: DefaultApi#
|
381
|
+
@api_client.config.logger.debug "API called: DefaultApi#v1_standardize_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
82
382
|
end
|
83
383
|
return data, status_code, headers
|
84
384
|
end
|
data/lib/cheminee/api_client.rb
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 1.0
|
7
7
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version: 7.
|
9
|
+
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -17,6 +17,7 @@ require 'tempfile'
|
|
17
17
|
require 'time'
|
18
18
|
require 'typhoeus'
|
19
19
|
|
20
|
+
|
20
21
|
module Cheminee
|
21
22
|
class ApiClient
|
22
23
|
# The Configuration object holding settings to be used in the API client.
|
@@ -221,7 +222,7 @@ module Cheminee
|
|
221
222
|
return nil if body.nil? || body.empty?
|
222
223
|
|
223
224
|
# return response body directly for String return type
|
224
|
-
return body if return_type == 'String'
|
225
|
+
return body.to_s if return_type == 'String'
|
225
226
|
|
226
227
|
# ensuring a default content type
|
227
228
|
content_type = response.headers['Content-Type'] || 'application/json'
|
data/lib/cheminee/api_error.rb
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 1.0
|
7
7
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version: 7.
|
9
|
+
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -151,7 +151,7 @@ module Cheminee
|
|
151
151
|
def initialize
|
152
152
|
@scheme = 'http'
|
153
153
|
@host = 'localhost:3000'
|
154
|
-
@base_path = '/api
|
154
|
+
@base_path = '/api'
|
155
155
|
@server_index = nil
|
156
156
|
@server_operation_index = {}
|
157
157
|
@server_variables = {}
|
@@ -222,8 +222,8 @@ module Cheminee
|
|
222
222
|
|
223
223
|
# Gets access_token using access_token_getter or uses the static access_token
|
224
224
|
def access_token_with_refresh
|
225
|
-
|
226
|
-
|
225
|
+
return access_token if access_token_getter.nil?
|
226
|
+
access_token_getter.call
|
227
227
|
end
|
228
228
|
|
229
229
|
# Gets Basic Auth token string
|
@@ -241,7 +241,7 @@ module Cheminee
|
|
241
241
|
def server_settings
|
242
242
|
[
|
243
243
|
{
|
244
|
-
url: "http://localhost:3000/api
|
244
|
+
url: "http://localhost:3000/api",
|
245
245
|
description: "No description provided",
|
246
246
|
}
|
247
247
|
]
|
@@ -286,5 +286,6 @@ module Cheminee
|
|
286
286
|
url
|
287
287
|
end
|
288
288
|
|
289
|
+
|
289
290
|
end
|
290
291
|
end
|
@@ -0,0 +1,221 @@
|
|
1
|
+
=begin
|
2
|
+
#Cheminée
|
3
|
+
|
4
|
+
#Cheminée: The Chemical Structure Search Engine
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Cheminee
|
17
|
+
class CreateIndexError
|
18
|
+
attr_accessor :error
|
19
|
+
|
20
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
21
|
+
def self.attribute_map
|
22
|
+
{
|
23
|
+
:'error' => :'error'
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
# Returns all the JSON keys this model knows about
|
28
|
+
def self.acceptable_attributes
|
29
|
+
attribute_map.values
|
30
|
+
end
|
31
|
+
|
32
|
+
# Attribute type mapping.
|
33
|
+
def self.openapi_types
|
34
|
+
{
|
35
|
+
:'error' => :'String'
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
# List of attributes with nullable: true
|
40
|
+
def self.openapi_nullable
|
41
|
+
Set.new([
|
42
|
+
])
|
43
|
+
end
|
44
|
+
|
45
|
+
# Initializes the object
|
46
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
47
|
+
def initialize(attributes = {})
|
48
|
+
if (!attributes.is_a?(Hash))
|
49
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Cheminee::CreateIndexError` initialize method"
|
50
|
+
end
|
51
|
+
|
52
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
53
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
54
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
55
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Cheminee::CreateIndexError`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
56
|
+
end
|
57
|
+
h[k.to_sym] = v
|
58
|
+
}
|
59
|
+
|
60
|
+
if attributes.key?(:'error')
|
61
|
+
self.error = attributes[:'error']
|
62
|
+
else
|
63
|
+
self.error = nil
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
68
|
+
# @return Array for valid properties with the reasons
|
69
|
+
def list_invalid_properties
|
70
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
71
|
+
invalid_properties = Array.new
|
72
|
+
if @error.nil?
|
73
|
+
invalid_properties.push('invalid value for "error", error cannot be nil.')
|
74
|
+
end
|
75
|
+
|
76
|
+
invalid_properties
|
77
|
+
end
|
78
|
+
|
79
|
+
# Check to see if the all the properties in the model are valid
|
80
|
+
# @return true if the model is valid
|
81
|
+
def valid?
|
82
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
83
|
+
return false if @error.nil?
|
84
|
+
true
|
85
|
+
end
|
86
|
+
|
87
|
+
# Checks equality by comparing each attribute.
|
88
|
+
# @param [Object] Object to be compared
|
89
|
+
def ==(o)
|
90
|
+
return true if self.equal?(o)
|
91
|
+
self.class == o.class &&
|
92
|
+
error == o.error
|
93
|
+
end
|
94
|
+
|
95
|
+
# @see the `==` method
|
96
|
+
# @param [Object] Object to be compared
|
97
|
+
def eql?(o)
|
98
|
+
self == o
|
99
|
+
end
|
100
|
+
|
101
|
+
# Calculates hash code according to all attributes.
|
102
|
+
# @return [Integer] Hash code
|
103
|
+
def hash
|
104
|
+
[error].hash
|
105
|
+
end
|
106
|
+
|
107
|
+
# Builds the object from hash
|
108
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
109
|
+
# @return [Object] Returns the model itself
|
110
|
+
def self.build_from_hash(attributes)
|
111
|
+
return nil unless attributes.is_a?(Hash)
|
112
|
+
attributes = attributes.transform_keys(&:to_sym)
|
113
|
+
transformed_hash = {}
|
114
|
+
openapi_types.each_pair do |key, type|
|
115
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
116
|
+
transformed_hash["#{key}"] = nil
|
117
|
+
elsif type =~ /\AArray<(.*)>/i
|
118
|
+
# check to ensure the input is an array given that the attribute
|
119
|
+
# is documented as an array but the input is not
|
120
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
121
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
122
|
+
end
|
123
|
+
elsif !attributes[attribute_map[key]].nil?
|
124
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
125
|
+
end
|
126
|
+
end
|
127
|
+
new(transformed_hash)
|
128
|
+
end
|
129
|
+
|
130
|
+
# Deserializes the data based on type
|
131
|
+
# @param string type Data type
|
132
|
+
# @param string value Value to be deserialized
|
133
|
+
# @return [Object] Deserialized data
|
134
|
+
def self._deserialize(type, value)
|
135
|
+
case type.to_sym
|
136
|
+
when :Time
|
137
|
+
Time.parse(value)
|
138
|
+
when :Date
|
139
|
+
Date.parse(value)
|
140
|
+
when :String
|
141
|
+
value.to_s
|
142
|
+
when :Integer
|
143
|
+
value.to_i
|
144
|
+
when :Float
|
145
|
+
value.to_f
|
146
|
+
when :Boolean
|
147
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
148
|
+
true
|
149
|
+
else
|
150
|
+
false
|
151
|
+
end
|
152
|
+
when :Object
|
153
|
+
# generic object (usually a Hash), return directly
|
154
|
+
value
|
155
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
156
|
+
inner_type = Regexp.last_match[:inner_type]
|
157
|
+
value.map { |v| _deserialize(inner_type, v) }
|
158
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
159
|
+
k_type = Regexp.last_match[:k_type]
|
160
|
+
v_type = Regexp.last_match[:v_type]
|
161
|
+
{}.tap do |hash|
|
162
|
+
value.each do |k, v|
|
163
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
164
|
+
end
|
165
|
+
end
|
166
|
+
else # model
|
167
|
+
# models (e.g. Pet) or oneOf
|
168
|
+
klass = Cheminee.const_get(type)
|
169
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
# Returns the string representation of the object
|
174
|
+
# @return [String] String presentation of the object
|
175
|
+
def to_s
|
176
|
+
to_hash.to_s
|
177
|
+
end
|
178
|
+
|
179
|
+
# to_body is an alias to to_hash (backward compatibility)
|
180
|
+
# @return [Hash] Returns the object in the form of hash
|
181
|
+
def to_body
|
182
|
+
to_hash
|
183
|
+
end
|
184
|
+
|
185
|
+
# Returns the object in the form of hash
|
186
|
+
# @return [Hash] Returns the object in the form of hash
|
187
|
+
def to_hash
|
188
|
+
hash = {}
|
189
|
+
self.class.attribute_map.each_pair do |attr, param|
|
190
|
+
value = self.send(attr)
|
191
|
+
if value.nil?
|
192
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
193
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
194
|
+
end
|
195
|
+
|
196
|
+
hash[param] = _to_hash(value)
|
197
|
+
end
|
198
|
+
hash
|
199
|
+
end
|
200
|
+
|
201
|
+
# Outputs non-array value in the form of hash
|
202
|
+
# For object, use to_hash. Otherwise, just return the value
|
203
|
+
# @param [Object] value Any valid value
|
204
|
+
# @return [Hash] Returns the value in the form of hash
|
205
|
+
def _to_hash(value)
|
206
|
+
if value.is_a?(Array)
|
207
|
+
value.compact.map { |v| _to_hash(v) }
|
208
|
+
elsif value.is_a?(Hash)
|
209
|
+
{}.tap do |hash|
|
210
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
211
|
+
end
|
212
|
+
elsif value.respond_to? :to_hash
|
213
|
+
value.to_hash
|
214
|
+
else
|
215
|
+
value
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
end
|
220
|
+
|
221
|
+
end
|