cheminee 0.1.22 → 0.1.23

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fd0fd97ae51080c209966e664af3d010b5039209f090bb675ed8c8fabb9b54cd
4
- data.tar.gz: 0b64fcebc54a5a300b823e15c5a5675579ba82f413d45f45829878ca8d86f61d
3
+ metadata.gz: bb3416731e2bd1d1828c7e8e61362304b1b45540cddb3d2c3b289b124df21341
4
+ data.tar.gz: 58e1a691dbc26f79ebfa1683d99bc480b5e74aa6d50615e85029911788fafb9c
5
5
  SHA512:
6
- metadata.gz: 2d19c6eb9230b6636e5744bddc2bc070687fa9f6d6cadf5434770b8ba7d9ebda7c364353c58bc6a378077b09679bc7db0935f0b1650e7e64ea72ec592139bfc2
7
- data.tar.gz: 6b4108795132e7b21cd6f9e4bd2f46933cb7fc6935043b2c0f95b9b24ee7a0f0673266e341804160789dc3d154b86c7cace186bb6b4ac8bf6f6e7f6cefb09e87
6
+ metadata.gz: b0737fb6be7ba9a4fd82e5054baf8f068ba2129eff5bf8f1b62a7403866073c81ee5f1c892f905d219e871b14caec7fe5d967049fc23d3677791e5a9a4c5515f
7
+ data.tar.gz: b2a37023b18805ba4a7750451dc2269cfea3bc5fa6e42da35e3a2004cc13d9716cd046cd244f6d3fdf5a85f5d473f85ec7492f6c935aee26753027f84e3631ac
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cheminee (0.1.22)
4
+ cheminee (0.1.23)
5
5
  typhoeus (~> 1.0, >= 1.0.1)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -7,7 +7,7 @@ Cheminée: The Chemical Structure Search Engine
7
7
  This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
8
8
 
9
9
  - API version: 1.0
10
- - Package version: 0.1.22
10
+ - Package version: 0.1.23
11
11
  - Generator version: 7.8.0-SNAPSHOT
12
12
  - Build package: org.openapitools.codegen.languages.RubyClientCodegen
13
13
  For more information, please visit [https://github.com/rdkit-rs/cheminee](https://github.com/rdkit-rs/cheminee)
@@ -25,16 +25,16 @@ gem build cheminee.gemspec
25
25
  Then either install the gem locally:
26
26
 
27
27
  ```shell
28
- gem install ./cheminee-0.1.22.gem
28
+ gem install ./cheminee-0.1.23.gem
29
29
  ```
30
30
 
31
- (for development, run `gem install --dev ./cheminee-0.1.22.gem` to install the development dependencies)
31
+ (for development, run `gem install --dev ./cheminee-0.1.23.gem` to install the development dependencies)
32
32
 
33
33
  or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
34
34
 
35
35
  Finally add this to the Gemfile:
36
36
 
37
- gem 'cheminee', '~> 0.1.22'
37
+ gem 'cheminee', '~> 0.1.23'
38
38
 
39
39
  ### Install from Git
40
40
 
@@ -80,7 +80,9 @@ Class | Method | HTTP request | Description
80
80
  ------------ | ------------- | ------------- | -------------
81
81
  *Cheminee::DefaultApi* | [**v1_convert_mol_block_to_smiles_post**](docs/DefaultApi.md#v1_convert_mol_block_to_smiles_post) | **POST** /v1/convert/mol_block_to_smiles | Pass a list of SMILES through fragment_parent, uncharger, and canonicalization routines
82
82
  *Cheminee::DefaultApi* | [**v1_indexes_get**](docs/DefaultApi.md#v1_indexes_get) | **GET** /v1/indexes | List indexes
83
+ *Cheminee::DefaultApi* | [**v1_indexes_index_bulk_delete_delete**](docs/DefaultApi.md#v1_indexes_index_bulk_delete_delete) | **DELETE** /v1/indexes/{index}/bulk_delete | Delete a list of smiles (after standardization) from an index
83
84
  *Cheminee::DefaultApi* | [**v1_indexes_index_bulk_index_post**](docs/DefaultApi.md#v1_indexes_index_bulk_index_post) | **POST** /v1/indexes/{index}/bulk_index | Index a list of SMILES and associated, free-form JSON attributes which are indexed and searchable
85
+ *Cheminee::DefaultApi* | [**v1_indexes_index_delete**](docs/DefaultApi.md#v1_indexes_index_delete) | **DELETE** /v1/indexes/{index} | Delete an index
84
86
  *Cheminee::DefaultApi* | [**v1_indexes_index_get**](docs/DefaultApi.md#v1_indexes_index_get) | **GET** /v1/indexes/{index} | Get extended information about an index
85
87
  *Cheminee::DefaultApi* | [**v1_indexes_index_post**](docs/DefaultApi.md#v1_indexes_index_post) | **POST** /v1/indexes/{index} | Create an index
86
88
  *Cheminee::DefaultApi* | [**v1_indexes_index_search_basic_get**](docs/DefaultApi.md#v1_indexes_index_search_basic_get) | **GET** /v1/indexes/{index}/search/basic | Perform basic query search against index
@@ -96,6 +98,10 @@ Class | Method | HTTP request | Description
96
98
  - [Cheminee::BulkRequestDoc](docs/BulkRequestDoc.md)
97
99
  - [Cheminee::ConvertedSmiles](docs/ConvertedSmiles.md)
98
100
  - [Cheminee::CreateIndexError](docs/CreateIndexError.md)
101
+ - [Cheminee::DeleteIndexBulkResponseError](docs/DeleteIndexBulkResponseError.md)
102
+ - [Cheminee::DeleteIndexBulkResponseOk](docs/DeleteIndexBulkResponseOk.md)
103
+ - [Cheminee::DeleteIndexBulkResponseOkStatus](docs/DeleteIndexBulkResponseOkStatus.md)
104
+ - [Cheminee::DeleteIndexError](docs/DeleteIndexError.md)
99
105
  - [Cheminee::GetIndexesResponseError](docs/GetIndexesResponseError.md)
100
106
  - [Cheminee::IndexMeta](docs/IndexMeta.md)
101
107
  - [Cheminee::IndexSchema](docs/IndexSchema.md)
data/docs/DefaultApi.md CHANGED
@@ -6,7 +6,9 @@ All URIs are relative to *http://localhost:4001/api*
6
6
  | ------ | ------------ | ----------- |
7
7
  | [**v1_convert_mol_block_to_smiles_post**](DefaultApi.md#v1_convert_mol_block_to_smiles_post) | **POST** /v1/convert/mol_block_to_smiles | Pass a list of SMILES through fragment_parent, uncharger, and canonicalization routines |
8
8
  | [**v1_indexes_get**](DefaultApi.md#v1_indexes_get) | **GET** /v1/indexes | List indexes |
9
+ | [**v1_indexes_index_bulk_delete_delete**](DefaultApi.md#v1_indexes_index_bulk_delete_delete) | **DELETE** /v1/indexes/{index}/bulk_delete | Delete a list of smiles (after standardization) from an index |
9
10
  | [**v1_indexes_index_bulk_index_post**](DefaultApi.md#v1_indexes_index_bulk_index_post) | **POST** /v1/indexes/{index}/bulk_index | Index a list of SMILES and associated, free-form JSON attributes which are indexed and searchable |
11
+ | [**v1_indexes_index_delete**](DefaultApi.md#v1_indexes_index_delete) | **DELETE** /v1/indexes/{index} | Delete an index |
10
12
  | [**v1_indexes_index_get**](DefaultApi.md#v1_indexes_index_get) | **GET** /v1/indexes/{index} | Get extended information about an index |
11
13
  | [**v1_indexes_index_post**](DefaultApi.md#v1_indexes_index_post) | **POST** /v1/indexes/{index} | Create an index |
12
14
  | [**v1_indexes_index_search_basic_get**](DefaultApi.md#v1_indexes_index_search_basic_get) | **GET** /v1/indexes/{index}/search/basic | Perform basic query search against index |
@@ -139,6 +141,70 @@ No authorization required
139
141
  - **Accept**: application/json; charset=utf-8
140
142
 
141
143
 
144
+ ## v1_indexes_index_bulk_delete_delete
145
+
146
+ > <DeleteIndexBulkResponseOk> v1_indexes_index_bulk_delete_delete(index, bulk_request)
147
+
148
+ Delete a list of smiles (after standardization) from an index
149
+
150
+ ### Examples
151
+
152
+ ```ruby
153
+ require 'time'
154
+ require 'cheminee'
155
+
156
+ api_instance = Cheminee::DefaultApi.new
157
+ index = 'index_example' # String |
158
+ bulk_request = Cheminee::BulkRequest.new({docs: [Cheminee::BulkRequestDoc.new({smiles: 'smiles_example'})]}) # BulkRequest |
159
+
160
+ begin
161
+ # Delete a list of smiles (after standardization) from an index
162
+ result = api_instance.v1_indexes_index_bulk_delete_delete(index, bulk_request)
163
+ p result
164
+ rescue Cheminee::ApiError => e
165
+ puts "Error when calling DefaultApi->v1_indexes_index_bulk_delete_delete: #{e}"
166
+ end
167
+ ```
168
+
169
+ #### Using the v1_indexes_index_bulk_delete_delete_with_http_info variant
170
+
171
+ This returns an Array which contains the response data, status code and headers.
172
+
173
+ > <Array(<DeleteIndexBulkResponseOk>, Integer, Hash)> v1_indexes_index_bulk_delete_delete_with_http_info(index, bulk_request)
174
+
175
+ ```ruby
176
+ begin
177
+ # Delete a list of smiles (after standardization) from an index
178
+ data, status_code, headers = api_instance.v1_indexes_index_bulk_delete_delete_with_http_info(index, bulk_request)
179
+ p status_code # => 2xx
180
+ p headers # => { ... }
181
+ p data # => <DeleteIndexBulkResponseOk>
182
+ rescue Cheminee::ApiError => e
183
+ puts "Error when calling DefaultApi->v1_indexes_index_bulk_delete_delete_with_http_info: #{e}"
184
+ end
185
+ ```
186
+
187
+ ### Parameters
188
+
189
+ | Name | Type | Description | Notes |
190
+ | ---- | ---- | ----------- | ----- |
191
+ | **index** | **String** | | |
192
+ | **bulk_request** | [**BulkRequest**](BulkRequest.md) | | |
193
+
194
+ ### Return type
195
+
196
+ [**DeleteIndexBulkResponseOk**](DeleteIndexBulkResponseOk.md)
197
+
198
+ ### Authorization
199
+
200
+ No authorization required
201
+
202
+ ### HTTP request headers
203
+
204
+ - **Content-Type**: application/json; charset=utf-8
205
+ - **Accept**: application/json; charset=utf-8
206
+
207
+
142
208
  ## v1_indexes_index_bulk_index_post
143
209
 
144
210
  > <PostIndexBulkResponseOk> v1_indexes_index_bulk_index_post(index, bulk_request)
@@ -203,6 +269,68 @@ No authorization required
203
269
  - **Accept**: application/json; charset=utf-8
204
270
 
205
271
 
272
+ ## v1_indexes_index_delete
273
+
274
+ > <IndexMeta> v1_indexes_index_delete(index)
275
+
276
+ Delete an index
277
+
278
+ ### Examples
279
+
280
+ ```ruby
281
+ require 'time'
282
+ require 'cheminee'
283
+
284
+ api_instance = Cheminee::DefaultApi.new
285
+ index = 'index_example' # String |
286
+
287
+ begin
288
+ # Delete an index
289
+ result = api_instance.v1_indexes_index_delete(index)
290
+ p result
291
+ rescue Cheminee::ApiError => e
292
+ puts "Error when calling DefaultApi->v1_indexes_index_delete: #{e}"
293
+ end
294
+ ```
295
+
296
+ #### Using the v1_indexes_index_delete_with_http_info variant
297
+
298
+ This returns an Array which contains the response data, status code and headers.
299
+
300
+ > <Array(<IndexMeta>, Integer, Hash)> v1_indexes_index_delete_with_http_info(index)
301
+
302
+ ```ruby
303
+ begin
304
+ # Delete an index
305
+ data, status_code, headers = api_instance.v1_indexes_index_delete_with_http_info(index)
306
+ p status_code # => 2xx
307
+ p headers # => { ... }
308
+ p data # => <IndexMeta>
309
+ rescue Cheminee::ApiError => e
310
+ puts "Error when calling DefaultApi->v1_indexes_index_delete_with_http_info: #{e}"
311
+ end
312
+ ```
313
+
314
+ ### Parameters
315
+
316
+ | Name | Type | Description | Notes |
317
+ | ---- | ---- | ----------- | ----- |
318
+ | **index** | **String** | | |
319
+
320
+ ### Return type
321
+
322
+ [**IndexMeta**](IndexMeta.md)
323
+
324
+ ### Authorization
325
+
326
+ No authorization required
327
+
328
+ ### HTTP request headers
329
+
330
+ - **Content-Type**: Not defined
331
+ - **Accept**: application/json; charset=utf-8
332
+
333
+
206
334
  ## v1_indexes_index_get
207
335
 
208
336
  > <IndexSchema> v1_indexes_index_get(index)
@@ -0,0 +1,18 @@
1
+ # Cheminee::DeleteIndexBulkResponseError
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **error** | **String** | | |
8
+
9
+ ## Example
10
+
11
+ ```ruby
12
+ require 'cheminee'
13
+
14
+ instance = Cheminee::DeleteIndexBulkResponseError.new(
15
+ error: null
16
+ )
17
+ ```
18
+
@@ -0,0 +1,18 @@
1
+ # Cheminee::DeleteIndexBulkResponseOk
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **statuses** | [**Array&lt;DeleteIndexBulkResponseOkStatus&gt;**](DeleteIndexBulkResponseOkStatus.md) | | |
8
+
9
+ ## Example
10
+
11
+ ```ruby
12
+ require 'cheminee'
13
+
14
+ instance = Cheminee::DeleteIndexBulkResponseOk.new(
15
+ statuses: null
16
+ )
17
+ ```
18
+
@@ -0,0 +1,20 @@
1
+ # Cheminee::DeleteIndexBulkResponseOkStatus
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **opcode** | **Integer** | | [optional] |
8
+ | **error** | **String** | | [optional] |
9
+
10
+ ## Example
11
+
12
+ ```ruby
13
+ require 'cheminee'
14
+
15
+ instance = Cheminee::DeleteIndexBulkResponseOkStatus.new(
16
+ opcode: null,
17
+ error: null
18
+ )
19
+ ```
20
+
@@ -0,0 +1,18 @@
1
+ # Cheminee::DeleteIndexError
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **error** | **String** | | |
8
+
9
+ ## Example
10
+
11
+ ```ruby
12
+ require 'cheminee'
13
+
14
+ instance = Cheminee::DeleteIndexError.new(
15
+ error: null
16
+ )
17
+ ```
18
+
@@ -147,6 +147,78 @@ module Cheminee
147
147
  return data, status_code, headers
148
148
  end
149
149
 
150
+ # Delete a list of smiles (after standardization) from an index
151
+ # @param index [String]
152
+ # @param bulk_request [BulkRequest]
153
+ # @param [Hash] opts the optional parameters
154
+ # @return [DeleteIndexBulkResponseOk]
155
+ def v1_indexes_index_bulk_delete_delete(index, bulk_request, opts = {})
156
+ data, _status_code, _headers = v1_indexes_index_bulk_delete_delete_with_http_info(index, bulk_request, opts)
157
+ data
158
+ end
159
+
160
+ # Delete a list of smiles (after standardization) from an index
161
+ # @param index [String]
162
+ # @param bulk_request [BulkRequest]
163
+ # @param [Hash] opts the optional parameters
164
+ # @return [Array<(DeleteIndexBulkResponseOk, Integer, Hash)>] DeleteIndexBulkResponseOk data, response status code and response headers
165
+ def v1_indexes_index_bulk_delete_delete_with_http_info(index, bulk_request, opts = {})
166
+ if @api_client.config.debugging
167
+ @api_client.config.logger.debug 'Calling API: DefaultApi.v1_indexes_index_bulk_delete_delete ...'
168
+ end
169
+ # verify the required parameter 'index' is set
170
+ if @api_client.config.client_side_validation && index.nil?
171
+ fail ArgumentError, "Missing the required parameter 'index' when calling DefaultApi.v1_indexes_index_bulk_delete_delete"
172
+ end
173
+ # verify the required parameter 'bulk_request' is set
174
+ if @api_client.config.client_side_validation && bulk_request.nil?
175
+ fail ArgumentError, "Missing the required parameter 'bulk_request' when calling DefaultApi.v1_indexes_index_bulk_delete_delete"
176
+ end
177
+ # resource path
178
+ local_var_path = '/v1/indexes/{index}/bulk_delete'.sub('{' + 'index' + '}', CGI.escape(index.to_s))
179
+
180
+ # query parameters
181
+ query_params = opts[:query_params] || {}
182
+
183
+ # header parameters
184
+ header_params = opts[:header_params] || {}
185
+ # HTTP header 'Accept' (if needed)
186
+ header_params['Accept'] = @api_client.select_header_accept(['application/json; charset=utf-8']) unless header_params['Accept']
187
+ # HTTP header 'Content-Type'
188
+ content_type = @api_client.select_header_content_type(['application/json; charset=utf-8'])
189
+ if !content_type.nil?
190
+ header_params['Content-Type'] = content_type
191
+ end
192
+
193
+ # form parameters
194
+ form_params = opts[:form_params] || {}
195
+
196
+ # http body (model)
197
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(bulk_request)
198
+
199
+ # return_type
200
+ return_type = opts[:debug_return_type] || 'DeleteIndexBulkResponseOk'
201
+
202
+ # auth_names
203
+ auth_names = opts[:debug_auth_names] || []
204
+
205
+ new_options = opts.merge(
206
+ :operation => :"DefaultApi.v1_indexes_index_bulk_delete_delete",
207
+ :header_params => header_params,
208
+ :query_params => query_params,
209
+ :form_params => form_params,
210
+ :body => post_body,
211
+ :auth_names => auth_names,
212
+ :return_type => return_type
213
+ )
214
+
215
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
216
+ if @api_client.config.debugging
217
+ @api_client.config.logger.debug "API called: DefaultApi#v1_indexes_index_bulk_delete_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
218
+ end
219
+ return data, status_code, headers
220
+ end
221
+
150
222
  # Index a list of SMILES and associated, free-form JSON attributes which are indexed and searchable
151
223
  # @param index [String]
152
224
  # @param bulk_request [BulkRequest]
@@ -219,6 +291,67 @@ module Cheminee
219
291
  return data, status_code, headers
220
292
  end
221
293
 
294
+ # Delete an index
295
+ # @param index [String]
296
+ # @param [Hash] opts the optional parameters
297
+ # @return [IndexMeta]
298
+ def v1_indexes_index_delete(index, opts = {})
299
+ data, _status_code, _headers = v1_indexes_index_delete_with_http_info(index, opts)
300
+ data
301
+ end
302
+
303
+ # Delete an index
304
+ # @param index [String]
305
+ # @param [Hash] opts the optional parameters
306
+ # @return [Array<(IndexMeta, Integer, Hash)>] IndexMeta data, response status code and response headers
307
+ def v1_indexes_index_delete_with_http_info(index, opts = {})
308
+ if @api_client.config.debugging
309
+ @api_client.config.logger.debug 'Calling API: DefaultApi.v1_indexes_index_delete ...'
310
+ end
311
+ # verify the required parameter 'index' is set
312
+ if @api_client.config.client_side_validation && index.nil?
313
+ fail ArgumentError, "Missing the required parameter 'index' when calling DefaultApi.v1_indexes_index_delete"
314
+ end
315
+ # resource path
316
+ local_var_path = '/v1/indexes/{index}'.sub('{' + 'index' + '}', CGI.escape(index.to_s))
317
+
318
+ # query parameters
319
+ query_params = opts[:query_params] || {}
320
+
321
+ # header parameters
322
+ header_params = opts[:header_params] || {}
323
+ # HTTP header 'Accept' (if needed)
324
+ header_params['Accept'] = @api_client.select_header_accept(['application/json; charset=utf-8']) unless header_params['Accept']
325
+
326
+ # form parameters
327
+ form_params = opts[:form_params] || {}
328
+
329
+ # http body (model)
330
+ post_body = opts[:debug_body]
331
+
332
+ # return_type
333
+ return_type = opts[:debug_return_type] || 'IndexMeta'
334
+
335
+ # auth_names
336
+ auth_names = opts[:debug_auth_names] || []
337
+
338
+ new_options = opts.merge(
339
+ :operation => :"DefaultApi.v1_indexes_index_delete",
340
+ :header_params => header_params,
341
+ :query_params => query_params,
342
+ :form_params => form_params,
343
+ :body => post_body,
344
+ :auth_names => auth_names,
345
+ :return_type => return_type
346
+ )
347
+
348
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
349
+ if @api_client.config.debugging
350
+ @api_client.config.logger.debug "API called: DefaultApi#v1_indexes_index_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
351
+ end
352
+ return data, status_code, headers
353
+ end
354
+
222
355
  # Get extended information about an index
223
356
  # @param index [String]
224
357
  # @param [Hash] opts the optional parameters
@@ -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
+ Generator version: 7.8.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Cheminee
17
+ class DeleteIndexBulkResponseError
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::DeleteIndexBulkResponseError` 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::DeleteIndexBulkResponseError`. 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_any_of) || 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