cheminee 0.0.14 → 0.0.15

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.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +8 -8
  3. data/README.md +11 -33
  4. data/cheminee.gemspec +1 -2
  5. data/docs/DefaultApi.md +16 -475
  6. data/lib/cheminee/api/default_api.rb +17 -481
  7. data/lib/cheminee/api_client.rb +21 -23
  8. data/lib/cheminee/api_error.rb +1 -1
  9. data/lib/cheminee/configuration.rb +5 -6
  10. data/lib/cheminee/models/smile.rb +1 -1
  11. data/lib/cheminee/models/standardized_smile.rb +1 -1
  12. data/lib/cheminee/version.rb +2 -2
  13. data/lib/cheminee.rb +3 -18
  14. data/pkg/cheminee-0.0.15.gem +0 -0
  15. data/spec/api_client_spec.rb +1 -1
  16. data/spec/configuration_spec.rb +4 -4
  17. data/spec/spec_helper.rb +1 -1
  18. metadata +3 -75
  19. data/docs/BulkRequest.md +0 -18
  20. data/docs/BulkRequestDoc.md +0 -20
  21. data/docs/CreateIndexError.md +0 -18
  22. data/docs/GetIndexesResponseError.md +0 -18
  23. data/docs/IndexMeta.md +0 -20
  24. data/docs/IndexSchema.md +0 -20
  25. data/docs/ListIndexResponseErr.md +0 -18
  26. data/docs/PostIndexBulkResponseError.md +0 -18
  27. data/docs/PostIndexBulkResponseOk.md +0 -18
  28. data/docs/PostIndexBulkResponseOkStatus.md +0 -20
  29. data/docs/QueryResponseError.md +0 -18
  30. data/docs/QuerySearchHit.md +0 -22
  31. data/docs/Schema.md +0 -20
  32. data/docs/Smiles.md +0 -18
  33. data/docs/StandardizedSmiles.md +0 -20
  34. data/docs/StructureResponseError.md +0 -18
  35. data/docs/StructureSearchHit.md +0 -26
  36. data/docs/SubstructureSearchHit.md +0 -24
  37. data/lib/cheminee/models/bulk_request.rb +0 -223
  38. data/lib/cheminee/models/bulk_request_doc.rb +0 -232
  39. data/lib/cheminee/models/create_index_error.rb +0 -221
  40. data/lib/cheminee/models/get_indexes_response_error.rb +0 -221
  41. data/lib/cheminee/models/index_meta.rb +0 -237
  42. data/lib/cheminee/models/index_schema.rb +0 -233
  43. data/lib/cheminee/models/list_index_response_err.rb +0 -221
  44. data/lib/cheminee/models/post_index_bulk_response_error.rb +0 -221
  45. data/lib/cheminee/models/post_index_bulk_response_ok.rb +0 -223
  46. data/lib/cheminee/models/post_index_bulk_response_ok_status.rb +0 -223
  47. data/lib/cheminee/models/query_response_error.rb +0 -221
  48. data/lib/cheminee/models/query_search_hit.rb +0 -249
  49. data/lib/cheminee/models/schema.rb +0 -233
  50. data/lib/cheminee/models/smiles.rb +0 -221
  51. data/lib/cheminee/models/standardized_smiles.rb +0 -223
  52. data/lib/cheminee/models/structure_response_error.rb +0 -221
  53. data/lib/cheminee/models/structure_search_hit.rb +0 -281
  54. data/lib/cheminee/models/substructure_search_hit.rb +0 -265
  55. data/pkg/cheminee-0.0.14.gem +0 -0
  56. data/spec/models/bulk_request_doc_spec.rb +0 -42
  57. data/spec/models/bulk_request_spec.rb +0 -36
  58. data/spec/models/create_index_error_spec.rb +0 -36
  59. data/spec/models/get_indexes_response_error_spec.rb +0 -36
  60. data/spec/models/index_meta_spec.rb +0 -42
  61. data/spec/models/index_schema_spec.rb +0 -42
  62. data/spec/models/list_index_response_err_spec.rb +0 -36
  63. data/spec/models/post_index_bulk_response_error_spec.rb +0 -36
  64. data/spec/models/post_index_bulk_response_ok_spec.rb +0 -36
  65. data/spec/models/post_index_bulk_response_ok_status_spec.rb +0 -42
  66. data/spec/models/query_response_error_spec.rb +0 -36
  67. data/spec/models/query_search_hit_spec.rb +0 -48
  68. data/spec/models/schema_spec.rb +0 -42
  69. data/spec/models/smiles_spec.rb +0 -36
  70. data/spec/models/standardized_smiles_spec.rb +0 -42
  71. data/spec/models/structure_response_error_spec.rb +0 -36
  72. data/spec/models/structure_search_hit_spec.rb +0 -60
  73. data/spec/models/substructure_search_hit_spec.rb +0 -54
@@ -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.3.0-SNAPSHOT
9
+ OpenAPI Generator version: 7.0.0-SNAPSHOT
10
10
 
11
11
  =end
12
12
 
@@ -19,491 +19,27 @@ module Cheminee
19
19
  def initialize(api_client = ApiClient.default)
20
20
  @api_client = api_client
21
21
  end
22
- # List indexes
22
+ # @param smile [Array<Smile>]
23
23
  # @param [Hash] opts the optional parameters
24
- # @return [Array<IndexMeta>]
25
- def v1_indexes_get(opts = {})
26
- data, _status_code, _headers = v1_indexes_get_with_http_info(opts)
24
+ # @return [Array<StandardizedSmile>]
25
+ def standardize_post(smile, opts = {})
26
+ data, _status_code, _headers = standardize_post_with_http_info(smile, opts)
27
27
  data
28
28
  end
29
29
 
30
- # List indexes
30
+ # @param smile [Array<Smile>]
31
31
  # @param [Hash] opts the optional parameters
32
- # @return [Array<(Array<IndexMeta>, Integer, Hash)>] Array<IndexMeta> data, response status code and response headers
33
- def v1_indexes_get_with_http_info(opts = {})
32
+ # @return [Array<(Array<StandardizedSmile>, Integer, Hash)>] Array<StandardizedSmile> data, response status code and response headers
33
+ def standardize_post_with_http_info(smile, opts = {})
34
34
  if @api_client.config.debugging
35
- @api_client.config.logger.debug 'Calling API: DefaultApi.v1_indexes_get ...'
35
+ @api_client.config.logger.debug 'Calling API: DefaultApi.standardize_post ...'
36
36
  end
37
- # resource path
38
- local_var_path = '/v1/indexes'
39
-
40
- # query parameters
41
- query_params = opts[:query_params] || {}
42
-
43
- # header parameters
44
- header_params = opts[:header_params] || {}
45
- # HTTP header 'Accept' (if needed)
46
- header_params['Accept'] = @api_client.select_header_accept(['application/json; charset=utf-8'])
47
-
48
- # form parameters
49
- form_params = opts[:form_params] || {}
50
-
51
- # http body (model)
52
- post_body = opts[:debug_body]
53
-
54
- # return_type
55
- return_type = opts[:debug_return_type] || 'Array<IndexMeta>'
56
-
57
- # auth_names
58
- auth_names = opts[:debug_auth_names] || []
59
-
60
- new_options = opts.merge(
61
- :operation => :"DefaultApi.v1_indexes_get",
62
- :header_params => header_params,
63
- :query_params => query_params,
64
- :form_params => form_params,
65
- :body => post_body,
66
- :auth_names => auth_names,
67
- :return_type => return_type
68
- )
69
-
70
- data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
71
- if @api_client.config.debugging
72
- @api_client.config.logger.debug "API called: DefaultApi#v1_indexes_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
73
- end
74
- return data, status_code, headers
75
- end
76
-
77
- # Index a list of SMILES and associated, free-form JSON attributes which are indexed and searchable
78
- # @param index [String]
79
- # @param bulk_request [BulkRequest]
80
- # @param [Hash] opts the optional parameters
81
- # @return [PostIndexBulkResponseOk]
82
- def v1_indexes_index_bulk_index_post(index, bulk_request, opts = {})
83
- data, _status_code, _headers = v1_indexes_index_bulk_index_post_with_http_info(index, bulk_request, opts)
84
- data
85
- end
86
-
87
- # Index a list of SMILES and associated, free-form JSON attributes which are indexed and searchable
88
- # @param index [String]
89
- # @param bulk_request [BulkRequest]
90
- # @param [Hash] opts the optional parameters
91
- # @return [Array<(PostIndexBulkResponseOk, Integer, Hash)>] PostIndexBulkResponseOk data, response status code and response headers
92
- def v1_indexes_index_bulk_index_post_with_http_info(index, bulk_request, opts = {})
93
- if @api_client.config.debugging
94
- @api_client.config.logger.debug 'Calling API: DefaultApi.v1_indexes_index_bulk_index_post ...'
95
- end
96
- # verify the required parameter 'index' is set
97
- if @api_client.config.client_side_validation && index.nil?
98
- fail ArgumentError, "Missing the required parameter 'index' when calling DefaultApi.v1_indexes_index_bulk_index_post"
99
- end
100
- # verify the required parameter 'bulk_request' is set
101
- if @api_client.config.client_side_validation && bulk_request.nil?
102
- fail ArgumentError, "Missing the required parameter 'bulk_request' when calling DefaultApi.v1_indexes_index_bulk_index_post"
103
- end
104
- # resource path
105
- local_var_path = '/v1/indexes/{index}/bulk_index'.sub('{' + 'index' + '}', CGI.escape(index.to_s))
106
-
107
- # query parameters
108
- query_params = opts[:query_params] || {}
109
-
110
- # header parameters
111
- header_params = opts[:header_params] || {}
112
- # HTTP header 'Accept' (if needed)
113
- header_params['Accept'] = @api_client.select_header_accept(['application/json; charset=utf-8'])
114
- # HTTP header 'Content-Type'
115
- content_type = @api_client.select_header_content_type(['application/json; charset=utf-8'])
116
- if !content_type.nil?
117
- header_params['Content-Type'] = content_type
118
- end
119
-
120
- # form parameters
121
- form_params = opts[:form_params] || {}
122
-
123
- # http body (model)
124
- post_body = opts[:debug_body] || @api_client.object_to_http_body(bulk_request)
125
-
126
- # return_type
127
- return_type = opts[:debug_return_type] || 'PostIndexBulkResponseOk'
128
-
129
- # auth_names
130
- auth_names = opts[:debug_auth_names] || []
131
-
132
- new_options = opts.merge(
133
- :operation => :"DefaultApi.v1_indexes_index_bulk_index_post",
134
- :header_params => header_params,
135
- :query_params => query_params,
136
- :form_params => form_params,
137
- :body => post_body,
138
- :auth_names => auth_names,
139
- :return_type => return_type
140
- )
141
-
142
- data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
143
- if @api_client.config.debugging
144
- @api_client.config.logger.debug "API called: DefaultApi#v1_indexes_index_bulk_index_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
145
- end
146
- return data, status_code, headers
147
- end
148
-
149
- # Get extended information about an index
150
- # @param index [String]
151
- # @param [Hash] opts the optional parameters
152
- # @return [IndexSchema]
153
- def v1_indexes_index_get(index, opts = {})
154
- data, _status_code, _headers = v1_indexes_index_get_with_http_info(index, opts)
155
- data
156
- end
157
-
158
- # Get extended information about an index
159
- # @param index [String]
160
- # @param [Hash] opts the optional parameters
161
- # @return [Array<(IndexSchema, Integer, Hash)>] IndexSchema data, response status code and response headers
162
- def v1_indexes_index_get_with_http_info(index, opts = {})
163
- if @api_client.config.debugging
164
- @api_client.config.logger.debug 'Calling API: DefaultApi.v1_indexes_index_get ...'
165
- end
166
- # verify the required parameter 'index' is set
167
- if @api_client.config.client_side_validation && index.nil?
168
- fail ArgumentError, "Missing the required parameter 'index' when calling DefaultApi.v1_indexes_index_get"
169
- end
170
- # resource path
171
- local_var_path = '/v1/indexes/{index}'.sub('{' + 'index' + '}', CGI.escape(index.to_s))
172
-
173
- # query parameters
174
- query_params = opts[:query_params] || {}
175
-
176
- # header parameters
177
- header_params = opts[:header_params] || {}
178
- # HTTP header 'Accept' (if needed)
179
- header_params['Accept'] = @api_client.select_header_accept(['application/json; charset=utf-8'])
180
-
181
- # form parameters
182
- form_params = opts[:form_params] || {}
183
-
184
- # http body (model)
185
- post_body = opts[:debug_body]
186
-
187
- # return_type
188
- return_type = opts[:debug_return_type] || 'IndexSchema'
189
-
190
- # auth_names
191
- auth_names = opts[:debug_auth_names] || []
192
-
193
- new_options = opts.merge(
194
- :operation => :"DefaultApi.v1_indexes_index_get",
195
- :header_params => header_params,
196
- :query_params => query_params,
197
- :form_params => form_params,
198
- :body => post_body,
199
- :auth_names => auth_names,
200
- :return_type => return_type
201
- )
202
-
203
- data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
204
- if @api_client.config.debugging
205
- @api_client.config.logger.debug "API called: DefaultApi#v1_indexes_index_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
206
- end
207
- return data, status_code, headers
208
- end
209
-
210
- # Create an index
211
- # @param index [String]
212
- # @param schema [String]
213
- # @param [Hash] opts the optional parameters
214
- # @option opts [String] :sort_by
215
- # @return [IndexMeta]
216
- def v1_indexes_index_post(index, schema, opts = {})
217
- data, _status_code, _headers = v1_indexes_index_post_with_http_info(index, schema, opts)
218
- data
219
- end
220
-
221
- # Create an index
222
- # @param index [String]
223
- # @param schema [String]
224
- # @param [Hash] opts the optional parameters
225
- # @option opts [String] :sort_by
226
- # @return [Array<(IndexMeta, Integer, Hash)>] IndexMeta data, response status code and response headers
227
- def v1_indexes_index_post_with_http_info(index, schema, opts = {})
228
- if @api_client.config.debugging
229
- @api_client.config.logger.debug 'Calling API: DefaultApi.v1_indexes_index_post ...'
230
- end
231
- # verify the required parameter 'index' is set
232
- if @api_client.config.client_side_validation && index.nil?
233
- fail ArgumentError, "Missing the required parameter 'index' when calling DefaultApi.v1_indexes_index_post"
234
- end
235
- # verify the required parameter 'schema' is set
236
- if @api_client.config.client_side_validation && schema.nil?
237
- fail ArgumentError, "Missing the required parameter 'schema' when calling DefaultApi.v1_indexes_index_post"
238
- end
239
- # resource path
240
- local_var_path = '/v1/indexes/{index}'.sub('{' + 'index' + '}', CGI.escape(index.to_s))
241
-
242
- # query parameters
243
- query_params = opts[:query_params] || {}
244
- query_params[:'schema'] = schema
245
- query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?
246
-
247
- # header parameters
248
- header_params = opts[:header_params] || {}
249
- # HTTP header 'Accept' (if needed)
250
- header_params['Accept'] = @api_client.select_header_accept(['application/json; charset=utf-8'])
251
-
252
- # form parameters
253
- form_params = opts[:form_params] || {}
254
-
255
- # http body (model)
256
- post_body = opts[:debug_body]
257
-
258
- # return_type
259
- return_type = opts[:debug_return_type] || 'IndexMeta'
260
-
261
- # auth_names
262
- auth_names = opts[:debug_auth_names] || []
263
-
264
- new_options = opts.merge(
265
- :operation => :"DefaultApi.v1_indexes_index_post",
266
- :header_params => header_params,
267
- :query_params => query_params,
268
- :form_params => form_params,
269
- :body => post_body,
270
- :auth_names => auth_names,
271
- :return_type => return_type
272
- )
273
-
274
- data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
275
- if @api_client.config.debugging
276
- @api_client.config.logger.debug "API called: DefaultApi#v1_indexes_index_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
277
- end
278
- return data, status_code, headers
279
- end
280
-
281
- # Perform basic query search against index
282
- # @param index [String]
283
- # @param query [String]
284
- # @param [Hash] opts the optional parameters
285
- # @option opts [Integer] :limit
286
- # @return [Array<QuerySearchHit>]
287
- def v1_indexes_index_search_basic_get(index, query, opts = {})
288
- data, _status_code, _headers = v1_indexes_index_search_basic_get_with_http_info(index, query, opts)
289
- data
290
- end
291
-
292
- # Perform basic query search against index
293
- # @param index [String]
294
- # @param query [String]
295
- # @param [Hash] opts the optional parameters
296
- # @option opts [Integer] :limit
297
- # @return [Array<(Array<QuerySearchHit>, Integer, Hash)>] Array<QuerySearchHit> data, response status code and response headers
298
- def v1_indexes_index_search_basic_get_with_http_info(index, query, opts = {})
299
- if @api_client.config.debugging
300
- @api_client.config.logger.debug 'Calling API: DefaultApi.v1_indexes_index_search_basic_get ...'
301
- end
302
- # verify the required parameter 'index' is set
303
- if @api_client.config.client_side_validation && index.nil?
304
- fail ArgumentError, "Missing the required parameter 'index' when calling DefaultApi.v1_indexes_index_search_basic_get"
305
- end
306
- # verify the required parameter 'query' is set
307
- if @api_client.config.client_side_validation && query.nil?
308
- fail ArgumentError, "Missing the required parameter 'query' when calling DefaultApi.v1_indexes_index_search_basic_get"
309
- end
310
- # resource path
311
- local_var_path = '/v1/indexes/{index}/search/basic'.sub('{' + 'index' + '}', CGI.escape(index.to_s))
312
-
313
- # query parameters
314
- query_params = opts[:query_params] || {}
315
- query_params[:'query'] = query
316
- query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
317
-
318
- # header parameters
319
- header_params = opts[:header_params] || {}
320
- # HTTP header 'Accept' (if needed)
321
- header_params['Accept'] = @api_client.select_header_accept(['application/json; charset=utf-8'])
322
-
323
- # form parameters
324
- form_params = opts[:form_params] || {}
325
-
326
- # http body (model)
327
- post_body = opts[:debug_body]
328
-
329
- # return_type
330
- return_type = opts[:debug_return_type] || 'Array<QuerySearchHit>'
331
-
332
- # auth_names
333
- auth_names = opts[:debug_auth_names] || []
334
-
335
- new_options = opts.merge(
336
- :operation => :"DefaultApi.v1_indexes_index_search_basic_get",
337
- :header_params => header_params,
338
- :query_params => query_params,
339
- :form_params => form_params,
340
- :body => post_body,
341
- :auth_names => auth_names,
342
- :return_type => return_type
343
- )
344
-
345
- data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
346
- if @api_client.config.debugging
347
- @api_client.config.logger.debug "API called: DefaultApi#v1_indexes_index_search_basic_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
348
- end
349
- return data, status_code, headers
350
- end
351
-
352
- # Perform substructure search against index
353
- # @param index [String]
354
- # @param smiles [String]
355
- # @param [Hash] opts the optional parameters
356
- # @option opts [Integer] :result_limit
357
- # @option opts [Integer] :tautomer_limit
358
- # @option opts [String] :extra_query
359
- # @return [Array<StructureSearchHit>]
360
- def v1_indexes_index_search_substructure_get(index, smiles, opts = {})
361
- data, _status_code, _headers = v1_indexes_index_search_substructure_get_with_http_info(index, smiles, opts)
362
- data
363
- end
364
-
365
- # Perform substructure search against index
366
- # @param index [String]
367
- # @param smiles [String]
368
- # @param [Hash] opts the optional parameters
369
- # @option opts [Integer] :result_limit
370
- # @option opts [Integer] :tautomer_limit
371
- # @option opts [String] :extra_query
372
- # @return [Array<(Array<StructureSearchHit>, Integer, Hash)>] Array<StructureSearchHit> data, response status code and response headers
373
- def v1_indexes_index_search_substructure_get_with_http_info(index, smiles, opts = {})
374
- if @api_client.config.debugging
375
- @api_client.config.logger.debug 'Calling API: DefaultApi.v1_indexes_index_search_substructure_get ...'
376
- end
377
- # verify the required parameter 'index' is set
378
- if @api_client.config.client_side_validation && index.nil?
379
- fail ArgumentError, "Missing the required parameter 'index' when calling DefaultApi.v1_indexes_index_search_substructure_get"
380
- end
381
- # verify the required parameter 'smiles' is set
382
- if @api_client.config.client_side_validation && smiles.nil?
383
- fail ArgumentError, "Missing the required parameter 'smiles' when calling DefaultApi.v1_indexes_index_search_substructure_get"
384
- end
385
- # resource path
386
- local_var_path = '/v1/indexes/{index}/search/substructure'.sub('{' + 'index' + '}', CGI.escape(index.to_s))
387
-
388
- # query parameters
389
- query_params = opts[:query_params] || {}
390
- query_params[:'smiles'] = smiles
391
- query_params[:'result_limit'] = opts[:'result_limit'] if !opts[:'result_limit'].nil?
392
- query_params[:'tautomer_limit'] = opts[:'tautomer_limit'] if !opts[:'tautomer_limit'].nil?
393
- query_params[:'extra_query'] = opts[:'extra_query'] if !opts[:'extra_query'].nil?
394
-
395
- # header parameters
396
- header_params = opts[:header_params] || {}
397
- # HTTP header 'Accept' (if needed)
398
- header_params['Accept'] = @api_client.select_header_accept(['application/json; charset=utf-8'])
399
-
400
- # form parameters
401
- form_params = opts[:form_params] || {}
402
-
403
- # http body (model)
404
- post_body = opts[:debug_body]
405
-
406
- # return_type
407
- return_type = opts[:debug_return_type] || 'Array<StructureSearchHit>'
408
-
409
- # auth_names
410
- auth_names = opts[:debug_auth_names] || []
411
-
412
- new_options = opts.merge(
413
- :operation => :"DefaultApi.v1_indexes_index_search_substructure_get",
414
- :header_params => header_params,
415
- :query_params => query_params,
416
- :form_params => form_params,
417
- :body => post_body,
418
- :auth_names => auth_names,
419
- :return_type => return_type
420
- )
421
-
422
- data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
423
- if @api_client.config.debugging
424
- @api_client.config.logger.debug "API called: DefaultApi#v1_indexes_index_search_substructure_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
425
- end
426
- return data, status_code, headers
427
- end
428
-
429
- # List schemas available for creating indexes
430
- # @param [Hash] opts the optional parameters
431
- # @return [Array<Schema>]
432
- def v1_schemas_get(opts = {})
433
- data, _status_code, _headers = v1_schemas_get_with_http_info(opts)
434
- data
435
- end
436
-
437
- # List schemas available for creating indexes
438
- # @param [Hash] opts the optional parameters
439
- # @return [Array<(Array<Schema>, Integer, Hash)>] Array<Schema> data, response status code and response headers
440
- def v1_schemas_get_with_http_info(opts = {})
441
- if @api_client.config.debugging
442
- @api_client.config.logger.debug 'Calling API: DefaultApi.v1_schemas_get ...'
443
- end
444
- # resource path
445
- local_var_path = '/v1/schemas'
446
-
447
- # query parameters
448
- query_params = opts[:query_params] || {}
449
-
450
- # header parameters
451
- header_params = opts[:header_params] || {}
452
- # HTTP header 'Accept' (if needed)
453
- header_params['Accept'] = @api_client.select_header_accept(['application/json; charset=utf-8'])
454
-
455
- # form parameters
456
- form_params = opts[:form_params] || {}
457
-
458
- # http body (model)
459
- post_body = opts[:debug_body]
460
-
461
- # return_type
462
- return_type = opts[:debug_return_type] || 'Array<Schema>'
463
-
464
- # auth_names
465
- auth_names = opts[:debug_auth_names] || []
466
-
467
- new_options = opts.merge(
468
- :operation => :"DefaultApi.v1_schemas_get",
469
- :header_params => header_params,
470
- :query_params => query_params,
471
- :form_params => form_params,
472
- :body => post_body,
473
- :auth_names => auth_names,
474
- :return_type => return_type
475
- )
476
-
477
- data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
478
- if @api_client.config.debugging
479
- @api_client.config.logger.debug "API called: DefaultApi#v1_schemas_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
480
- end
481
- return data, status_code, headers
482
- end
483
-
484
- # Pass a list of SMILES through fragment_parent, uncharger, and canonicalization routines
485
- # @param smiles [Array<Smiles>]
486
- # @param [Hash] opts the optional parameters
487
- # @return [Array<StandardizedSmiles>]
488
- def v1_standardize_post(smiles, opts = {})
489
- data, _status_code, _headers = v1_standardize_post_with_http_info(smiles, opts)
490
- data
491
- end
492
-
493
- # Pass a list of SMILES through fragment_parent, uncharger, and canonicalization routines
494
- # @param smiles [Array<Smiles>]
495
- # @param [Hash] opts the optional parameters
496
- # @return [Array<(Array<StandardizedSmiles>, Integer, Hash)>] Array<StandardizedSmiles> data, response status code and response headers
497
- def v1_standardize_post_with_http_info(smiles, opts = {})
498
- if @api_client.config.debugging
499
- @api_client.config.logger.debug 'Calling API: DefaultApi.v1_standardize_post ...'
500
- end
501
- # verify the required parameter 'smiles' is set
502
- if @api_client.config.client_side_validation && smiles.nil?
503
- fail ArgumentError, "Missing the required parameter 'smiles' when calling DefaultApi.v1_standardize_post"
37
+ # verify the required parameter 'smile' is set
38
+ if @api_client.config.client_side_validation && smile.nil?
39
+ fail ArgumentError, "Missing the required parameter 'smile' when calling DefaultApi.standardize_post"
504
40
  end
505
41
  # resource path
506
- local_var_path = '/v1/standardize'
42
+ local_var_path = '/standardize'
507
43
 
508
44
  # query parameters
509
45
  query_params = opts[:query_params] || {}
@@ -522,16 +58,16 @@ module Cheminee
522
58
  form_params = opts[:form_params] || {}
523
59
 
524
60
  # http body (model)
525
- post_body = opts[:debug_body] || @api_client.object_to_http_body(smiles)
61
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(smile)
526
62
 
527
63
  # return_type
528
- return_type = opts[:debug_return_type] || 'Array<StandardizedSmiles>'
64
+ return_type = opts[:debug_return_type] || 'Array<StandardizedSmile>'
529
65
 
530
66
  # auth_names
531
67
  auth_names = opts[:debug_auth_names] || []
532
68
 
533
69
  new_options = opts.merge(
534
- :operation => :"DefaultApi.v1_standardize_post",
70
+ :operation => :"DefaultApi.standardize_post",
535
71
  :header_params => header_params,
536
72
  :query_params => query_params,
537
73
  :form_params => form_params,
@@ -542,7 +78,7 @@ module Cheminee
542
78
 
543
79
  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
544
80
  if @api_client.config.debugging
545
- @api_client.config.logger.debug "API called: DefaultApi#v1_standardize_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
81
+ @api_client.config.logger.debug "API called: DefaultApi#standardize_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
546
82
  end
547
83
  return data, status_code, headers
548
84
  end
@@ -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.3.0-SNAPSHOT
9
+ OpenAPI Generator version: 7.0.0-SNAPSHOT
10
10
 
11
11
  =end
12
12
 
@@ -17,7 +17,6 @@ require 'tempfile'
17
17
  require 'time'
18
18
  require 'typhoeus'
19
19
 
20
-
21
20
  module Cheminee
22
21
  class ApiClient
23
22
  # The Configuration object holding settings to be used in the API client.
@@ -46,10 +45,9 @@ module Cheminee
46
45
  # Call an API with given options.
47
46
  #
48
47
  # @return [Array<(Object, Integer, Hash)>] an array of 3 elements:
49
- # the data deserialized from response body (may be a Tempfile or nil), response status code and response headers.
48
+ # the data deserialized from response body (could be nil), response status code and response headers.
50
49
  def call_api(http_method, path, opts = {})
51
50
  request = build_request(http_method, path, opts)
52
- tempfile = download_file(request) if opts[:return_type] == 'File'
53
51
  response = request.run
54
52
 
55
53
  if @config.debugging
@@ -71,9 +69,7 @@ module Cheminee
71
69
  end
72
70
  end
73
71
 
74
- if opts[:return_type] == 'File'
75
- data = tempfile
76
- elsif opts[:return_type]
72
+ if opts[:return_type]
77
73
  data = deserialize(response, opts[:return_type])
78
74
  else
79
75
  data = nil
@@ -128,7 +124,9 @@ module Cheminee
128
124
  end
129
125
  end
130
126
 
131
- Typhoeus::Request.new(url, req_opts)
127
+ request = Typhoeus::Request.new(url, req_opts)
128
+ download_file(request) if opts[:return_type] == 'File'
129
+ request
132
130
  end
133
131
 
134
132
  # Builds the HTTP request body
@@ -166,8 +164,6 @@ module Cheminee
166
164
  # process can use.
167
165
  #
168
166
  # @see Configuration#temp_folder_path
169
- #
170
- # @return [Tempfile] the tempfile generated
171
167
  def download_file(request)
172
168
  tempfile = nil
173
169
  encoding = nil
@@ -182,24 +178,21 @@ module Cheminee
182
178
  prefix = prefix + '-' unless prefix.end_with?('-')
183
179
  encoding = response.body.encoding
184
180
  tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
181
+ @tempfile = tempfile
185
182
  end
186
183
  request.on_body do |chunk|
187
184
  chunk.force_encoding(encoding)
188
185
  tempfile.write(chunk)
189
186
  end
190
- # run the request to ensure the tempfile is created successfully before returning it
191
- request.run
192
- if tempfile
193
- tempfile.close
194
- @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
195
- "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
196
- "will be deleted automatically with GC. It's also recommended to delete the temp file "\
197
- "explicitly with `tempfile.delete`"
198
- else
199
- fail ApiError.new("Failed to create the tempfile based on the HTTP response from the server: #{request.inspect}")
187
+ request.on_complete do |response|
188
+ if tempfile
189
+ tempfile.close
190
+ @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
191
+ "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
192
+ "will be deleted automatically with GC. It's also recommended to delete the temp file "\
193
+ "explicitly with `tempfile.delete`"
194
+ end
200
195
  end
201
-
202
- tempfile
203
196
  end
204
197
 
205
198
  # Check if the given MIME is a JSON MIME.
@@ -220,10 +213,15 @@ module Cheminee
220
213
  # @param [String] return_type some examples: "User", "Array<User>", "Hash<String, Integer>"
221
214
  def deserialize(response, return_type)
222
215
  body = response.body
216
+
217
+ # handle file downloading - return the File instance processed in request callbacks
218
+ # note that response body is empty when the file is written in chunks in request on_body callback
219
+ return @tempfile if return_type == 'File'
220
+
223
221
  return nil if body.nil? || body.empty?
224
222
 
225
223
  # return response body directly for String return type
226
- return body.to_s if return_type == 'String'
224
+ return body if return_type == 'String'
227
225
 
228
226
  # ensuring a default content type
229
227
  content_type = response.headers['Content-Type'] || 'application/json'
@@ -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.3.0-SNAPSHOT
9
+ OpenAPI Generator version: 7.0.0-SNAPSHOT
10
10
 
11
11
  =end
12
12