cheminee 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 69f9d4856f7f3d4f693aa9affb128fc80a79870f2a7ef0125ab5629ecc31a104
4
- data.tar.gz: 9a33b5e2cbb5f8e8f6793d7f83db0c88b245f376f062404fec10eff4363dbba6
3
+ metadata.gz: a65121f7843c1764ac85077b8ceaa08a05c0a5f71978ea8d6f96881bada945b1
4
+ data.tar.gz: 5ae188e4b9b0567db00612372c3fe9f1e57ce379560a35eca2cfd83805c2d4bb
5
5
  SHA512:
6
- metadata.gz: 99e125d536f7bbda6e0242d20ba225284d5a9abb3aa0f8edad28a6d42ff9e88086785bd54e3deaed2d4393860079fac1f1b960350f9f063c9c50d15343447b38
7
- data.tar.gz: dd107d62aef25c62a8664e7b9ea8843af3d49955e67e71efcedaa1106e4401379c2975f2a6e90d87727ea9a40e775ab5dc712ed05d8c6f89389b156afa77080b
6
+ metadata.gz: b414dae786b782a47511dfe8d13f96fda7d30b9d890de210b4ee4ab2c17372e39d03dd63e6848cae0ea49c8b7d58695ce35b81b058ddd94864f80c371d3d7e78
7
+ data.tar.gz: 62129b1704d60fb0038c369ff861ff82bfb68b31684904e9dfe5dc470eff1345e40b8b8e9331cf2bfc0aad91531c58dd8b115d6724577f0ce4ee7843122fe9d8
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cheminee (0.1.5)
4
+ cheminee (0.1.6)
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.5
10
+ - Package version: 0.1.6
11
11
  - Build package: org.openapitools.codegen.languages.RubyClientCodegen
12
12
  For more information, please visit [https://github.com/rdkit-rs/cheminee](https://github.com/rdkit-rs/cheminee)
13
13
 
@@ -24,16 +24,16 @@ gem build cheminee.gemspec
24
24
  Then either install the gem locally:
25
25
 
26
26
  ```shell
27
- gem install ./cheminee-0.1.5.gem
27
+ gem install ./cheminee-0.1.6.gem
28
28
  ```
29
29
 
30
- (for development, run `gem install --dev ./cheminee-0.1.5.gem` to install the development dependencies)
30
+ (for development, run `gem install --dev ./cheminee-0.1.6.gem` to install the development dependencies)
31
31
 
32
32
  or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
33
33
 
34
34
  Finally add this to the Gemfile:
35
35
 
36
- gem 'cheminee', '~> 0.1.5'
36
+ gem 'cheminee', '~> 0.1.6'
37
37
 
38
38
  ### Install from Git
39
39
 
@@ -75,6 +75,7 @@ All URIs are relative to *http://localhost:3000/api*
75
75
  Class | Method | HTTP request | Description
76
76
  ------------ | ------------- | ------------- | -------------
77
77
  *Cheminee::DefaultApi* | [**v1_indexes_get**](docs/DefaultApi.md#v1_indexes_get) | **GET** /v1/indexes |
78
+ *Cheminee::DefaultApi* | [**v1_indexes_index_bulk_index_post**](docs/DefaultApi.md#v1_indexes_index_bulk_index_post) | **POST** /v1/indexes/{index}/bulk_index |
78
79
  *Cheminee::DefaultApi* | [**v1_indexes_index_get**](docs/DefaultApi.md#v1_indexes_index_get) | **GET** /v1/indexes/{index} |
79
80
  *Cheminee::DefaultApi* | [**v1_indexes_index_post**](docs/DefaultApi.md#v1_indexes_index_post) | **POST** /v1/indexes/{index} |
80
81
  *Cheminee::DefaultApi* | [**v1_indexes_index_search_substructure_get**](docs/DefaultApi.md#v1_indexes_index_search_substructure_get) | **GET** /v1/indexes/{index}/search/substructure |
@@ -84,10 +85,15 @@ Class | Method | HTTP request | Description
84
85
 
85
86
  ## Documentation for Models
86
87
 
88
+ - [Cheminee::BulkRequest](docs/BulkRequest.md)
89
+ - [Cheminee::BulkRequestDoc](docs/BulkRequestDoc.md)
87
90
  - [Cheminee::CreateIndexError](docs/CreateIndexError.md)
88
91
  - [Cheminee::GetIndexesResponseError](docs/GetIndexesResponseError.md)
89
92
  - [Cheminee::IndexMeta](docs/IndexMeta.md)
90
93
  - [Cheminee::ListIndexResponseErr](docs/ListIndexResponseErr.md)
94
+ - [Cheminee::PostIndexBulkResponseError](docs/PostIndexBulkResponseError.md)
95
+ - [Cheminee::PostIndexBulkResponseOk](docs/PostIndexBulkResponseOk.md)
96
+ - [Cheminee::PostIndexBulkResponseOkStatus](docs/PostIndexBulkResponseOkStatus.md)
91
97
  - [Cheminee::Schema](docs/Schema.md)
92
98
  - [Cheminee::Smile](docs/Smile.md)
93
99
  - [Cheminee::StandardizedSmile](docs/StandardizedSmile.md)
@@ -0,0 +1,18 @@
1
+ # Cheminee::BulkRequest
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **docs** | [**Array<BulkRequestDoc>**](BulkRequestDoc.md) | | |
8
+
9
+ ## Example
10
+
11
+ ```ruby
12
+ require 'cheminee'
13
+
14
+ instance = Cheminee::BulkRequest.new(
15
+ docs: null
16
+ )
17
+ ```
18
+
@@ -0,0 +1,20 @@
1
+ # Cheminee::BulkRequestDoc
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **smile** | **String** | | |
8
+ | **extra_data** | **Object** | | [optional] |
9
+
10
+ ## Example
11
+
12
+ ```ruby
13
+ require 'cheminee'
14
+
15
+ instance = Cheminee::BulkRequestDoc.new(
16
+ smile: null,
17
+ extra_data: null
18
+ )
19
+ ```
20
+
data/docs/DefaultApi.md CHANGED
@@ -5,6 +5,7 @@ All URIs are relative to *http://localhost:3000/api*
5
5
  | Method | HTTP request | Description |
6
6
  | ------ | ------------ | ----------- |
7
7
  | [**v1_indexes_get**](DefaultApi.md#v1_indexes_get) | **GET** /v1/indexes | |
8
+ | [**v1_indexes_index_bulk_index_post**](DefaultApi.md#v1_indexes_index_bulk_index_post) | **POST** /v1/indexes/{index}/bulk_index | |
8
9
  | [**v1_indexes_index_get**](DefaultApi.md#v1_indexes_index_get) | **GET** /v1/indexes/{index} | |
9
10
  | [**v1_indexes_index_post**](DefaultApi.md#v1_indexes_index_post) | **POST** /v1/indexes/{index} | |
10
11
  | [**v1_indexes_index_search_substructure_get**](DefaultApi.md#v1_indexes_index_search_substructure_get) | **GET** /v1/indexes/{index}/search/substructure | |
@@ -71,6 +72,70 @@ No authorization required
71
72
  - **Accept**: application/json; charset=utf-8
72
73
 
73
74
 
75
+ ## v1_indexes_index_bulk_index_post
76
+
77
+ > <PostIndexBulkResponseOk> v1_indexes_index_bulk_index_post(index, bulk_request)
78
+
79
+
80
+
81
+ ### Examples
82
+
83
+ ```ruby
84
+ require 'time'
85
+ require 'cheminee'
86
+
87
+ api_instance = Cheminee::DefaultApi.new
88
+ index = 'index_example' # String |
89
+ bulk_request = Cheminee::BulkRequest.new({docs: [Cheminee::BulkRequestDoc.new({smile: 'smile_example'})]}) # BulkRequest |
90
+
91
+ begin
92
+
93
+ result = api_instance.v1_indexes_index_bulk_index_post(index, bulk_request)
94
+ p result
95
+ rescue Cheminee::ApiError => e
96
+ puts "Error when calling DefaultApi->v1_indexes_index_bulk_index_post: #{e}"
97
+ end
98
+ ```
99
+
100
+ #### Using the v1_indexes_index_bulk_index_post_with_http_info variant
101
+
102
+ This returns an Array which contains the response data, status code and headers.
103
+
104
+ > <Array(<PostIndexBulkResponseOk>, Integer, Hash)> v1_indexes_index_bulk_index_post_with_http_info(index, bulk_request)
105
+
106
+ ```ruby
107
+ begin
108
+
109
+ data, status_code, headers = api_instance.v1_indexes_index_bulk_index_post_with_http_info(index, bulk_request)
110
+ p status_code # => 2xx
111
+ p headers # => { ... }
112
+ p data # => <PostIndexBulkResponseOk>
113
+ rescue Cheminee::ApiError => e
114
+ puts "Error when calling DefaultApi->v1_indexes_index_bulk_index_post_with_http_info: #{e}"
115
+ end
116
+ ```
117
+
118
+ ### Parameters
119
+
120
+ | Name | Type | Description | Notes |
121
+ | ---- | ---- | ----------- | ----- |
122
+ | **index** | **String** | | |
123
+ | **bulk_request** | [**BulkRequest**](BulkRequest.md) | | |
124
+
125
+ ### Return type
126
+
127
+ [**PostIndexBulkResponseOk**](PostIndexBulkResponseOk.md)
128
+
129
+ ### Authorization
130
+
131
+ No authorization required
132
+
133
+ ### HTTP request headers
134
+
135
+ - **Content-Type**: application/json; charset=utf-8
136
+ - **Accept**: application/json; charset=utf-8
137
+
138
+
74
139
  ## v1_indexes_index_get
75
140
 
76
141
  > <Array<IndexMeta>> v1_indexes_index_get(index)
@@ -0,0 +1,18 @@
1
+ # Cheminee::PostIndexBulkResponseError
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::PostIndexBulkResponseError.new(
15
+ error: null
16
+ )
17
+ ```
18
+
@@ -0,0 +1,18 @@
1
+ # Cheminee::PostIndexBulkResponseOk
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **statuses** | [**Array&lt;PostIndexBulkResponseOkStatus&gt;**](PostIndexBulkResponseOkStatus.md) | | |
8
+
9
+ ## Example
10
+
11
+ ```ruby
12
+ require 'cheminee'
13
+
14
+ instance = Cheminee::PostIndexBulkResponseOk.new(
15
+ statuses: null
16
+ )
17
+ ```
18
+
@@ -0,0 +1,20 @@
1
+ # Cheminee::PostIndexBulkResponseOkStatus
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::PostIndexBulkResponseOkStatus.new(
16
+ opcode: null,
17
+ error: null
18
+ )
19
+ ```
20
+
@@ -72,6 +72,76 @@ module Cheminee
72
72
  return data, status_code, headers
73
73
  end
74
74
 
75
+ # @param index [String]
76
+ # @param bulk_request [BulkRequest]
77
+ # @param [Hash] opts the optional parameters
78
+ # @return [PostIndexBulkResponseOk]
79
+ def v1_indexes_index_bulk_index_post(index, bulk_request, opts = {})
80
+ data, _status_code, _headers = v1_indexes_index_bulk_index_post_with_http_info(index, bulk_request, opts)
81
+ data
82
+ end
83
+
84
+ # @param index [String]
85
+ # @param bulk_request [BulkRequest]
86
+ # @param [Hash] opts the optional parameters
87
+ # @return [Array<(PostIndexBulkResponseOk, Integer, Hash)>] PostIndexBulkResponseOk data, response status code and response headers
88
+ def v1_indexes_index_bulk_index_post_with_http_info(index, bulk_request, opts = {})
89
+ if @api_client.config.debugging
90
+ @api_client.config.logger.debug 'Calling API: DefaultApi.v1_indexes_index_bulk_index_post ...'
91
+ end
92
+ # verify the required parameter 'index' is set
93
+ if @api_client.config.client_side_validation && index.nil?
94
+ fail ArgumentError, "Missing the required parameter 'index' when calling DefaultApi.v1_indexes_index_bulk_index_post"
95
+ end
96
+ # verify the required parameter 'bulk_request' is set
97
+ if @api_client.config.client_side_validation && bulk_request.nil?
98
+ fail ArgumentError, "Missing the required parameter 'bulk_request' when calling DefaultApi.v1_indexes_index_bulk_index_post"
99
+ end
100
+ # resource path
101
+ local_var_path = '/v1/indexes/{index}/bulk_index'.sub('{' + 'index' + '}', CGI.escape(index.to_s))
102
+
103
+ # query parameters
104
+ query_params = opts[:query_params] || {}
105
+
106
+ # header parameters
107
+ header_params = opts[:header_params] || {}
108
+ # HTTP header 'Accept' (if needed)
109
+ header_params['Accept'] = @api_client.select_header_accept(['application/json; charset=utf-8'])
110
+ # HTTP header 'Content-Type'
111
+ content_type = @api_client.select_header_content_type(['application/json; charset=utf-8'])
112
+ if !content_type.nil?
113
+ header_params['Content-Type'] = content_type
114
+ end
115
+
116
+ # form parameters
117
+ form_params = opts[:form_params] || {}
118
+
119
+ # http body (model)
120
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(bulk_request)
121
+
122
+ # return_type
123
+ return_type = opts[:debug_return_type] || 'PostIndexBulkResponseOk'
124
+
125
+ # auth_names
126
+ auth_names = opts[:debug_auth_names] || []
127
+
128
+ new_options = opts.merge(
129
+ :operation => :"DefaultApi.v1_indexes_index_bulk_index_post",
130
+ :header_params => header_params,
131
+ :query_params => query_params,
132
+ :form_params => form_params,
133
+ :body => post_body,
134
+ :auth_names => auth_names,
135
+ :return_type => return_type
136
+ )
137
+
138
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
139
+ if @api_client.config.debugging
140
+ @api_client.config.logger.debug "API called: DefaultApi#v1_indexes_index_bulk_index_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
141
+ end
142
+ return data, status_code, headers
143
+ end
144
+
75
145
  # @param index [String]
76
146
  # @param [Hash] opts the optional parameters
77
147
  # @return [Array<IndexMeta>]
@@ -0,0 +1,223 @@
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 BulkRequest
18
+ attr_accessor :docs
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'docs' => :'docs'
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
+ :'docs' => :'Array<BulkRequestDoc>'
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::BulkRequest` 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::BulkRequest`. 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?(:'docs')
61
+ if (value = attributes[:'docs']).is_a?(Array)
62
+ self.docs = value
63
+ end
64
+ else
65
+ self.docs = nil
66
+ end
67
+ end
68
+
69
+ # Show invalid properties with the reasons. Usually used together with valid?
70
+ # @return Array for valid properties with the reasons
71
+ def list_invalid_properties
72
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
73
+ invalid_properties = Array.new
74
+ if @docs.nil?
75
+ invalid_properties.push('invalid value for "docs", docs cannot be nil.')
76
+ end
77
+
78
+ invalid_properties
79
+ end
80
+
81
+ # Check to see if the all the properties in the model are valid
82
+ # @return true if the model is valid
83
+ def valid?
84
+ warn '[DEPRECATED] the `valid?` method is obsolete'
85
+ return false if @docs.nil?
86
+ true
87
+ end
88
+
89
+ # Checks equality by comparing each attribute.
90
+ # @param [Object] Object to be compared
91
+ def ==(o)
92
+ return true if self.equal?(o)
93
+ self.class == o.class &&
94
+ docs == o.docs
95
+ end
96
+
97
+ # @see the `==` method
98
+ # @param [Object] Object to be compared
99
+ def eql?(o)
100
+ self == o
101
+ end
102
+
103
+ # Calculates hash code according to all attributes.
104
+ # @return [Integer] Hash code
105
+ def hash
106
+ [docs].hash
107
+ end
108
+
109
+ # Builds the object from hash
110
+ # @param [Hash] attributes Model attributes in the form of hash
111
+ # @return [Object] Returns the model itself
112
+ def self.build_from_hash(attributes)
113
+ return nil unless attributes.is_a?(Hash)
114
+ attributes = attributes.transform_keys(&:to_sym)
115
+ transformed_hash = {}
116
+ openapi_types.each_pair do |key, type|
117
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
118
+ transformed_hash["#{key}"] = nil
119
+ elsif type =~ /\AArray<(.*)>/i
120
+ # check to ensure the input is an array given that the attribute
121
+ # is documented as an array but the input is not
122
+ if attributes[attribute_map[key]].is_a?(Array)
123
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
124
+ end
125
+ elsif !attributes[attribute_map[key]].nil?
126
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
127
+ end
128
+ end
129
+ new(transformed_hash)
130
+ end
131
+
132
+ # Deserializes the data based on type
133
+ # @param string type Data type
134
+ # @param string value Value to be deserialized
135
+ # @return [Object] Deserialized data
136
+ def self._deserialize(type, value)
137
+ case type.to_sym
138
+ when :Time
139
+ Time.parse(value)
140
+ when :Date
141
+ Date.parse(value)
142
+ when :String
143
+ value.to_s
144
+ when :Integer
145
+ value.to_i
146
+ when :Float
147
+ value.to_f
148
+ when :Boolean
149
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
150
+ true
151
+ else
152
+ false
153
+ end
154
+ when :Object
155
+ # generic object (usually a Hash), return directly
156
+ value
157
+ when /\AArray<(?<inner_type>.+)>\z/
158
+ inner_type = Regexp.last_match[:inner_type]
159
+ value.map { |v| _deserialize(inner_type, v) }
160
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
161
+ k_type = Regexp.last_match[:k_type]
162
+ v_type = Regexp.last_match[:v_type]
163
+ {}.tap do |hash|
164
+ value.each do |k, v|
165
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
166
+ end
167
+ end
168
+ else # model
169
+ # models (e.g. Pet) or oneOf
170
+ klass = Cheminee.const_get(type)
171
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
172
+ end
173
+ end
174
+
175
+ # Returns the string representation of the object
176
+ # @return [String] String presentation of the object
177
+ def to_s
178
+ to_hash.to_s
179
+ end
180
+
181
+ # to_body is an alias to to_hash (backward compatibility)
182
+ # @return [Hash] Returns the object in the form of hash
183
+ def to_body
184
+ to_hash
185
+ end
186
+
187
+ # Returns the object in the form of hash
188
+ # @return [Hash] Returns the object in the form of hash
189
+ def to_hash
190
+ hash = {}
191
+ self.class.attribute_map.each_pair do |attr, param|
192
+ value = self.send(attr)
193
+ if value.nil?
194
+ is_nullable = self.class.openapi_nullable.include?(attr)
195
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
196
+ end
197
+
198
+ hash[param] = _to_hash(value)
199
+ end
200
+ hash
201
+ end
202
+
203
+ # Outputs non-array value in the form of hash
204
+ # For object, use to_hash. Otherwise, just return the value
205
+ # @param [Object] value Any valid value
206
+ # @return [Hash] Returns the value in the form of hash
207
+ def _to_hash(value)
208
+ if value.is_a?(Array)
209
+ value.compact.map { |v| _to_hash(v) }
210
+ elsif value.is_a?(Hash)
211
+ {}.tap do |hash|
212
+ value.each { |k, v| hash[k] = _to_hash(v) }
213
+ end
214
+ elsif value.respond_to? :to_hash
215
+ value.to_hash
216
+ else
217
+ value
218
+ end
219
+ end
220
+
221
+ end
222
+
223
+ end