cheminee 0.0.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +72 -0
- data/README.md +112 -0
- data/Rakefile +10 -0
- data/cheminee.gemspec +39 -0
- data/docs/BulkRequest.md +18 -0
- data/docs/BulkRequestDoc.md +20 -0
- data/docs/CreateIndexError.md +18 -0
- data/docs/DefaultApi.md +529 -0
- data/docs/GetIndexesResponseError.md +18 -0
- data/docs/IndexMeta.md +20 -0
- data/docs/IndexSchema.md +20 -0
- data/docs/ListIndexResponseErr.md +18 -0
- data/docs/PostIndexBulkResponseError.md +18 -0
- data/docs/PostIndexBulkResponseOk.md +18 -0
- data/docs/PostIndexBulkResponseOkStatus.md +20 -0
- data/docs/QueryResponseError.md +18 -0
- data/docs/QuerySearchHit.md +22 -0
- data/docs/Schema.md +20 -0
- data/docs/Smile.md +18 -0
- data/docs/Smiles.md +18 -0
- data/docs/StandardizedSmile.md +20 -0
- data/docs/StandardizedSmiles.md +20 -0
- data/docs/StructureResponseError.md +18 -0
- data/docs/StructureSearchHit.md +26 -0
- data/docs/SubstructureSearchHit.md +24 -0
- data/git_push.sh +57 -0
- data/lib/cheminee/api/default_api.rb +550 -0
- data/lib/cheminee/api_client.rb +393 -0
- data/lib/cheminee/api_error.rb +58 -0
- data/lib/cheminee/configuration.rb +291 -0
- data/lib/cheminee/models/bulk_request.rb +223 -0
- data/lib/cheminee/models/bulk_request_doc.rb +232 -0
- 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/index_schema.rb +233 -0
- data/lib/cheminee/models/list_index_response_err.rb +221 -0
- data/lib/cheminee/models/post_index_bulk_response_error.rb +221 -0
- data/lib/cheminee/models/post_index_bulk_response_ok.rb +223 -0
- data/lib/cheminee/models/post_index_bulk_response_ok_status.rb +223 -0
- data/lib/cheminee/models/query_response_error.rb +221 -0
- data/lib/cheminee/models/query_search_hit.rb +249 -0
- data/lib/cheminee/models/schema.rb +233 -0
- data/lib/cheminee/models/smile.rb +221 -0
- data/lib/cheminee/models/smiles.rb +221 -0
- data/lib/cheminee/models/standardized_smile.rb +223 -0
- data/lib/cheminee/models/standardized_smiles.rb +223 -0
- data/lib/cheminee/models/structure_response_error.rb +221 -0
- data/lib/cheminee/models/structure_search_hit.rb +281 -0
- data/lib/cheminee/models/substructure_search_hit.rb +265 -0
- data/lib/cheminee/version.rb +15 -0
- data/lib/cheminee.rb +57 -0
- data/openapi-generator-config.json +7 -0
- data/openapi.json +77 -0
- data/pkg/cheminee-0.0.14.gem +0 -0
- data/spec/api/default_api_spec.rb +45 -0
- data/spec/api_client_spec.rb +228 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/bulk_request_doc_spec.rb +42 -0
- data/spec/models/bulk_request_spec.rb +36 -0
- 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/index_schema_spec.rb +42 -0
- data/spec/models/list_index_response_err_spec.rb +36 -0
- data/spec/models/post_index_bulk_response_error_spec.rb +36 -0
- data/spec/models/post_index_bulk_response_ok_spec.rb +36 -0
- data/spec/models/post_index_bulk_response_ok_status_spec.rb +42 -0
- data/spec/models/query_response_error_spec.rb +36 -0
- data/spec/models/query_search_hit_spec.rb +48 -0
- data/spec/models/schema_spec.rb +42 -0
- data/spec/models/smile_spec.rb +34 -0
- data/spec/models/smiles_spec.rb +36 -0
- data/spec/models/standardized_smile_spec.rb +40 -0
- data/spec/models/standardized_smiles_spec.rb +42 -0
- data/spec/models/structure_response_error_spec.rb +36 -0
- data/spec/models/structure_search_hit_spec.rb +60 -0
- data/spec/models/substructure_search_hit_spec.rb +54 -0
- data/spec/spec_helper.rb +111 -0
- metadata +187 -0
@@ -0,0 +1,281 @@
|
|
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.3.0-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Cheminee
|
17
|
+
class StructureSearchHit
|
18
|
+
attr_accessor :extra_data
|
19
|
+
|
20
|
+
attr_accessor :smiles
|
21
|
+
|
22
|
+
attr_accessor :score
|
23
|
+
|
24
|
+
attr_accessor :query
|
25
|
+
|
26
|
+
attr_accessor :used_tautomers
|
27
|
+
|
28
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
29
|
+
def self.attribute_map
|
30
|
+
{
|
31
|
+
:'extra_data' => :'extra_data',
|
32
|
+
:'smiles' => :'smiles',
|
33
|
+
:'score' => :'score',
|
34
|
+
:'query' => :'query',
|
35
|
+
:'used_tautomers' => :'used_tautomers'
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
# Returns all the JSON keys this model knows about
|
40
|
+
def self.acceptable_attributes
|
41
|
+
attribute_map.values
|
42
|
+
end
|
43
|
+
|
44
|
+
# Attribute type mapping.
|
45
|
+
def self.openapi_types
|
46
|
+
{
|
47
|
+
:'extra_data' => :'Object',
|
48
|
+
:'smiles' => :'String',
|
49
|
+
:'score' => :'Float',
|
50
|
+
:'query' => :'String',
|
51
|
+
:'used_tautomers' => :'Boolean'
|
52
|
+
}
|
53
|
+
end
|
54
|
+
|
55
|
+
# List of attributes with nullable: true
|
56
|
+
def self.openapi_nullable
|
57
|
+
Set.new([
|
58
|
+
:'extra_data',
|
59
|
+
])
|
60
|
+
end
|
61
|
+
|
62
|
+
# Initializes the object
|
63
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
64
|
+
def initialize(attributes = {})
|
65
|
+
if (!attributes.is_a?(Hash))
|
66
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Cheminee::StructureSearchHit` initialize method"
|
67
|
+
end
|
68
|
+
|
69
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
70
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
71
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
72
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Cheminee::StructureSearchHit`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
73
|
+
end
|
74
|
+
h[k.to_sym] = v
|
75
|
+
}
|
76
|
+
|
77
|
+
if attributes.key?(:'extra_data')
|
78
|
+
self.extra_data = attributes[:'extra_data']
|
79
|
+
else
|
80
|
+
self.extra_data = nil
|
81
|
+
end
|
82
|
+
|
83
|
+
if attributes.key?(:'smiles')
|
84
|
+
self.smiles = attributes[:'smiles']
|
85
|
+
else
|
86
|
+
self.smiles = nil
|
87
|
+
end
|
88
|
+
|
89
|
+
if attributes.key?(:'score')
|
90
|
+
self.score = attributes[:'score']
|
91
|
+
else
|
92
|
+
self.score = nil
|
93
|
+
end
|
94
|
+
|
95
|
+
if attributes.key?(:'query')
|
96
|
+
self.query = attributes[:'query']
|
97
|
+
else
|
98
|
+
self.query = nil
|
99
|
+
end
|
100
|
+
|
101
|
+
if attributes.key?(:'used_tautomers')
|
102
|
+
self.used_tautomers = attributes[:'used_tautomers']
|
103
|
+
else
|
104
|
+
self.used_tautomers = nil
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
109
|
+
# @return Array for valid properties with the reasons
|
110
|
+
def list_invalid_properties
|
111
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
112
|
+
invalid_properties = Array.new
|
113
|
+
if @smiles.nil?
|
114
|
+
invalid_properties.push('invalid value for "smiles", smiles cannot be nil.')
|
115
|
+
end
|
116
|
+
|
117
|
+
if @score.nil?
|
118
|
+
invalid_properties.push('invalid value for "score", score cannot be nil.')
|
119
|
+
end
|
120
|
+
|
121
|
+
if @query.nil?
|
122
|
+
invalid_properties.push('invalid value for "query", query cannot be nil.')
|
123
|
+
end
|
124
|
+
|
125
|
+
if @used_tautomers.nil?
|
126
|
+
invalid_properties.push('invalid value for "used_tautomers", used_tautomers cannot be nil.')
|
127
|
+
end
|
128
|
+
|
129
|
+
invalid_properties
|
130
|
+
end
|
131
|
+
|
132
|
+
# Check to see if the all the properties in the model are valid
|
133
|
+
# @return true if the model is valid
|
134
|
+
def valid?
|
135
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
136
|
+
return false if @smiles.nil?
|
137
|
+
return false if @score.nil?
|
138
|
+
return false if @query.nil?
|
139
|
+
return false if @used_tautomers.nil?
|
140
|
+
true
|
141
|
+
end
|
142
|
+
|
143
|
+
# Checks equality by comparing each attribute.
|
144
|
+
# @param [Object] Object to be compared
|
145
|
+
def ==(o)
|
146
|
+
return true if self.equal?(o)
|
147
|
+
self.class == o.class &&
|
148
|
+
extra_data == o.extra_data &&
|
149
|
+
smiles == o.smiles &&
|
150
|
+
score == o.score &&
|
151
|
+
query == o.query &&
|
152
|
+
used_tautomers == o.used_tautomers
|
153
|
+
end
|
154
|
+
|
155
|
+
# @see the `==` method
|
156
|
+
# @param [Object] Object to be compared
|
157
|
+
def eql?(o)
|
158
|
+
self == o
|
159
|
+
end
|
160
|
+
|
161
|
+
# Calculates hash code according to all attributes.
|
162
|
+
# @return [Integer] Hash code
|
163
|
+
def hash
|
164
|
+
[extra_data, smiles, score, query, used_tautomers].hash
|
165
|
+
end
|
166
|
+
|
167
|
+
# Builds the object from hash
|
168
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
169
|
+
# @return [Object] Returns the model itself
|
170
|
+
def self.build_from_hash(attributes)
|
171
|
+
return nil unless attributes.is_a?(Hash)
|
172
|
+
attributes = attributes.transform_keys(&:to_sym)
|
173
|
+
transformed_hash = {}
|
174
|
+
openapi_types.each_pair do |key, type|
|
175
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
176
|
+
transformed_hash["#{key}"] = nil
|
177
|
+
elsif type =~ /\AArray<(.*)>/i
|
178
|
+
# check to ensure the input is an array given that the attribute
|
179
|
+
# is documented as an array but the input is not
|
180
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
181
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
182
|
+
end
|
183
|
+
elsif !attributes[attribute_map[key]].nil?
|
184
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
185
|
+
end
|
186
|
+
end
|
187
|
+
new(transformed_hash)
|
188
|
+
end
|
189
|
+
|
190
|
+
# Deserializes the data based on type
|
191
|
+
# @param string type Data type
|
192
|
+
# @param string value Value to be deserialized
|
193
|
+
# @return [Object] Deserialized data
|
194
|
+
def self._deserialize(type, value)
|
195
|
+
case type.to_sym
|
196
|
+
when :Time
|
197
|
+
Time.parse(value)
|
198
|
+
when :Date
|
199
|
+
Date.parse(value)
|
200
|
+
when :String
|
201
|
+
value.to_s
|
202
|
+
when :Integer
|
203
|
+
value.to_i
|
204
|
+
when :Float
|
205
|
+
value.to_f
|
206
|
+
when :Boolean
|
207
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
208
|
+
true
|
209
|
+
else
|
210
|
+
false
|
211
|
+
end
|
212
|
+
when :Object
|
213
|
+
# generic object (usually a Hash), return directly
|
214
|
+
value
|
215
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
216
|
+
inner_type = Regexp.last_match[:inner_type]
|
217
|
+
value.map { |v| _deserialize(inner_type, v) }
|
218
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
219
|
+
k_type = Regexp.last_match[:k_type]
|
220
|
+
v_type = Regexp.last_match[:v_type]
|
221
|
+
{}.tap do |hash|
|
222
|
+
value.each do |k, v|
|
223
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
224
|
+
end
|
225
|
+
end
|
226
|
+
else # model
|
227
|
+
# models (e.g. Pet) or oneOf
|
228
|
+
klass = Cheminee.const_get(type)
|
229
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
233
|
+
# Returns the string representation of the object
|
234
|
+
# @return [String] String presentation of the object
|
235
|
+
def to_s
|
236
|
+
to_hash.to_s
|
237
|
+
end
|
238
|
+
|
239
|
+
# to_body is an alias to to_hash (backward compatibility)
|
240
|
+
# @return [Hash] Returns the object in the form of hash
|
241
|
+
def to_body
|
242
|
+
to_hash
|
243
|
+
end
|
244
|
+
|
245
|
+
# Returns the object in the form of hash
|
246
|
+
# @return [Hash] Returns the object in the form of hash
|
247
|
+
def to_hash
|
248
|
+
hash = {}
|
249
|
+
self.class.attribute_map.each_pair do |attr, param|
|
250
|
+
value = self.send(attr)
|
251
|
+
if value.nil?
|
252
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
253
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
254
|
+
end
|
255
|
+
|
256
|
+
hash[param] = _to_hash(value)
|
257
|
+
end
|
258
|
+
hash
|
259
|
+
end
|
260
|
+
|
261
|
+
# Outputs non-array value in the form of hash
|
262
|
+
# For object, use to_hash. Otherwise, just return the value
|
263
|
+
# @param [Object] value Any valid value
|
264
|
+
# @return [Hash] Returns the value in the form of hash
|
265
|
+
def _to_hash(value)
|
266
|
+
if value.is_a?(Array)
|
267
|
+
value.compact.map { |v| _to_hash(v) }
|
268
|
+
elsif value.is_a?(Hash)
|
269
|
+
{}.tap do |hash|
|
270
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
271
|
+
end
|
272
|
+
elsif value.respond_to? :to_hash
|
273
|
+
value.to_hash
|
274
|
+
else
|
275
|
+
value
|
276
|
+
end
|
277
|
+
end
|
278
|
+
|
279
|
+
end
|
280
|
+
|
281
|
+
end
|
@@ -0,0 +1,265 @@
|
|
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 SubstructureSearchHit
|
18
|
+
attr_accessor :extra_data
|
19
|
+
|
20
|
+
attr_accessor :smiles
|
21
|
+
|
22
|
+
attr_accessor :score
|
23
|
+
|
24
|
+
attr_accessor :query
|
25
|
+
|
26
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
27
|
+
def self.attribute_map
|
28
|
+
{
|
29
|
+
:'extra_data' => :'extra_data',
|
30
|
+
:'smiles' => :'smiles',
|
31
|
+
:'score' => :'score',
|
32
|
+
:'query' => :'query'
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
# Returns all the JSON keys this model knows about
|
37
|
+
def self.acceptable_attributes
|
38
|
+
attribute_map.values
|
39
|
+
end
|
40
|
+
|
41
|
+
# Attribute type mapping.
|
42
|
+
def self.openapi_types
|
43
|
+
{
|
44
|
+
:'extra_data' => :'Object',
|
45
|
+
:'smiles' => :'String',
|
46
|
+
:'score' => :'Float',
|
47
|
+
:'query' => :'String'
|
48
|
+
}
|
49
|
+
end
|
50
|
+
|
51
|
+
# List of attributes with nullable: true
|
52
|
+
def self.openapi_nullable
|
53
|
+
Set.new([
|
54
|
+
:'extra_data',
|
55
|
+
])
|
56
|
+
end
|
57
|
+
|
58
|
+
# Initializes the object
|
59
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
60
|
+
def initialize(attributes = {})
|
61
|
+
if (!attributes.is_a?(Hash))
|
62
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Cheminee::SubstructureSearchHit` initialize method"
|
63
|
+
end
|
64
|
+
|
65
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
66
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
67
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
68
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Cheminee::SubstructureSearchHit`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
69
|
+
end
|
70
|
+
h[k.to_sym] = v
|
71
|
+
}
|
72
|
+
|
73
|
+
if attributes.key?(:'extra_data')
|
74
|
+
self.extra_data = attributes[:'extra_data']
|
75
|
+
else
|
76
|
+
self.extra_data = nil
|
77
|
+
end
|
78
|
+
|
79
|
+
if attributes.key?(:'smiles')
|
80
|
+
self.smiles = attributes[:'smiles']
|
81
|
+
else
|
82
|
+
self.smiles = nil
|
83
|
+
end
|
84
|
+
|
85
|
+
if attributes.key?(:'score')
|
86
|
+
self.score = attributes[:'score']
|
87
|
+
else
|
88
|
+
self.score = nil
|
89
|
+
end
|
90
|
+
|
91
|
+
if attributes.key?(:'query')
|
92
|
+
self.query = attributes[:'query']
|
93
|
+
else
|
94
|
+
self.query = nil
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
99
|
+
# @return Array for valid properties with the reasons
|
100
|
+
def list_invalid_properties
|
101
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
102
|
+
invalid_properties = Array.new
|
103
|
+
if @smiles.nil?
|
104
|
+
invalid_properties.push('invalid value for "smiles", smiles cannot be nil.')
|
105
|
+
end
|
106
|
+
|
107
|
+
if @score.nil?
|
108
|
+
invalid_properties.push('invalid value for "score", score cannot be nil.')
|
109
|
+
end
|
110
|
+
|
111
|
+
if @query.nil?
|
112
|
+
invalid_properties.push('invalid value for "query", query cannot be nil.')
|
113
|
+
end
|
114
|
+
|
115
|
+
invalid_properties
|
116
|
+
end
|
117
|
+
|
118
|
+
# Check to see if the all the properties in the model are valid
|
119
|
+
# @return true if the model is valid
|
120
|
+
def valid?
|
121
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
122
|
+
return false if @smiles.nil?
|
123
|
+
return false if @score.nil?
|
124
|
+
return false if @query.nil?
|
125
|
+
true
|
126
|
+
end
|
127
|
+
|
128
|
+
# Checks equality by comparing each attribute.
|
129
|
+
# @param [Object] Object to be compared
|
130
|
+
def ==(o)
|
131
|
+
return true if self.equal?(o)
|
132
|
+
self.class == o.class &&
|
133
|
+
extra_data == o.extra_data &&
|
134
|
+
smiles == o.smiles &&
|
135
|
+
score == o.score &&
|
136
|
+
query == o.query
|
137
|
+
end
|
138
|
+
|
139
|
+
# @see the `==` method
|
140
|
+
# @param [Object] Object to be compared
|
141
|
+
def eql?(o)
|
142
|
+
self == o
|
143
|
+
end
|
144
|
+
|
145
|
+
# Calculates hash code according to all attributes.
|
146
|
+
# @return [Integer] Hash code
|
147
|
+
def hash
|
148
|
+
[extra_data, smiles, score, query].hash
|
149
|
+
end
|
150
|
+
|
151
|
+
# Builds the object from hash
|
152
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
153
|
+
# @return [Object] Returns the model itself
|
154
|
+
def self.build_from_hash(attributes)
|
155
|
+
return nil unless attributes.is_a?(Hash)
|
156
|
+
attributes = attributes.transform_keys(&:to_sym)
|
157
|
+
transformed_hash = {}
|
158
|
+
openapi_types.each_pair do |key, type|
|
159
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
160
|
+
transformed_hash["#{key}"] = nil
|
161
|
+
elsif type =~ /\AArray<(.*)>/i
|
162
|
+
# check to ensure the input is an array given that the attribute
|
163
|
+
# is documented as an array but the input is not
|
164
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
165
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
166
|
+
end
|
167
|
+
elsif !attributes[attribute_map[key]].nil?
|
168
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
169
|
+
end
|
170
|
+
end
|
171
|
+
new(transformed_hash)
|
172
|
+
end
|
173
|
+
|
174
|
+
# Deserializes the data based on type
|
175
|
+
# @param string type Data type
|
176
|
+
# @param string value Value to be deserialized
|
177
|
+
# @return [Object] Deserialized data
|
178
|
+
def self._deserialize(type, value)
|
179
|
+
case type.to_sym
|
180
|
+
when :Time
|
181
|
+
Time.parse(value)
|
182
|
+
when :Date
|
183
|
+
Date.parse(value)
|
184
|
+
when :String
|
185
|
+
value.to_s
|
186
|
+
when :Integer
|
187
|
+
value.to_i
|
188
|
+
when :Float
|
189
|
+
value.to_f
|
190
|
+
when :Boolean
|
191
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
192
|
+
true
|
193
|
+
else
|
194
|
+
false
|
195
|
+
end
|
196
|
+
when :Object
|
197
|
+
# generic object (usually a Hash), return directly
|
198
|
+
value
|
199
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
200
|
+
inner_type = Regexp.last_match[:inner_type]
|
201
|
+
value.map { |v| _deserialize(inner_type, v) }
|
202
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
203
|
+
k_type = Regexp.last_match[:k_type]
|
204
|
+
v_type = Regexp.last_match[:v_type]
|
205
|
+
{}.tap do |hash|
|
206
|
+
value.each do |k, v|
|
207
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
208
|
+
end
|
209
|
+
end
|
210
|
+
else # model
|
211
|
+
# models (e.g. Pet) or oneOf
|
212
|
+
klass = Cheminee.const_get(type)
|
213
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
# Returns the string representation of the object
|
218
|
+
# @return [String] String presentation of the object
|
219
|
+
def to_s
|
220
|
+
to_hash.to_s
|
221
|
+
end
|
222
|
+
|
223
|
+
# to_body is an alias to to_hash (backward compatibility)
|
224
|
+
# @return [Hash] Returns the object in the form of hash
|
225
|
+
def to_body
|
226
|
+
to_hash
|
227
|
+
end
|
228
|
+
|
229
|
+
# Returns the object in the form of hash
|
230
|
+
# @return [Hash] Returns the object in the form of hash
|
231
|
+
def to_hash
|
232
|
+
hash = {}
|
233
|
+
self.class.attribute_map.each_pair do |attr, param|
|
234
|
+
value = self.send(attr)
|
235
|
+
if value.nil?
|
236
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
237
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
238
|
+
end
|
239
|
+
|
240
|
+
hash[param] = _to_hash(value)
|
241
|
+
end
|
242
|
+
hash
|
243
|
+
end
|
244
|
+
|
245
|
+
# Outputs non-array value in the form of hash
|
246
|
+
# For object, use to_hash. Otherwise, just return the value
|
247
|
+
# @param [Object] value Any valid value
|
248
|
+
# @return [Hash] Returns the value in the form of hash
|
249
|
+
def _to_hash(value)
|
250
|
+
if value.is_a?(Array)
|
251
|
+
value.compact.map { |v| _to_hash(v) }
|
252
|
+
elsif value.is_a?(Hash)
|
253
|
+
{}.tap do |hash|
|
254
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
255
|
+
end
|
256
|
+
elsif value.respond_to? :to_hash
|
257
|
+
value.to_hash
|
258
|
+
else
|
259
|
+
value
|
260
|
+
end
|
261
|
+
end
|
262
|
+
|
263
|
+
end
|
264
|
+
|
265
|
+
end
|
@@ -0,0 +1,15 @@
|
|
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.3.0-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
module Cheminee
|
14
|
+
VERSION = '0.0.14'
|
15
|
+
end
|
data/lib/cheminee.rb
ADDED
@@ -0,0 +1,57 @@
|
|
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.3.0-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
# Common files
|
14
|
+
require 'cheminee/api_client'
|
15
|
+
require 'cheminee/api_error'
|
16
|
+
require 'cheminee/version'
|
17
|
+
require 'cheminee/configuration'
|
18
|
+
|
19
|
+
# Models
|
20
|
+
require 'cheminee/models/bulk_request'
|
21
|
+
require 'cheminee/models/bulk_request_doc'
|
22
|
+
require 'cheminee/models/create_index_error'
|
23
|
+
require 'cheminee/models/get_indexes_response_error'
|
24
|
+
require 'cheminee/models/index_meta'
|
25
|
+
require 'cheminee/models/index_schema'
|
26
|
+
require 'cheminee/models/list_index_response_err'
|
27
|
+
require 'cheminee/models/post_index_bulk_response_error'
|
28
|
+
require 'cheminee/models/post_index_bulk_response_ok'
|
29
|
+
require 'cheminee/models/post_index_bulk_response_ok_status'
|
30
|
+
require 'cheminee/models/query_response_error'
|
31
|
+
require 'cheminee/models/query_search_hit'
|
32
|
+
require 'cheminee/models/schema'
|
33
|
+
require 'cheminee/models/smiles'
|
34
|
+
require 'cheminee/models/standardized_smiles'
|
35
|
+
require 'cheminee/models/structure_response_error'
|
36
|
+
require 'cheminee/models/structure_search_hit'
|
37
|
+
|
38
|
+
# APIs
|
39
|
+
require 'cheminee/api/default_api'
|
40
|
+
|
41
|
+
module Cheminee
|
42
|
+
class << self
|
43
|
+
# Customize default settings for the SDK using block.
|
44
|
+
# Cheminee.configure do |config|
|
45
|
+
# config.username = "xxx"
|
46
|
+
# config.password = "xxx"
|
47
|
+
# end
|
48
|
+
# If no block given, return the default Configuration object.
|
49
|
+
def configure
|
50
|
+
if block_given?
|
51
|
+
yield(Configuration.default)
|
52
|
+
else
|
53
|
+
Configuration.default
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
data/openapi.json
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
{
|
2
|
+
"openapi": "3.0.0",
|
3
|
+
"info": {
|
4
|
+
"title": "Cheminée",
|
5
|
+
"description": "Cheminée: The Chemical Structure Search Engine",
|
6
|
+
"version": "1.0",
|
7
|
+
"contact": {
|
8
|
+
"url": "https://github.com/rdkit-rs/cheminee"
|
9
|
+
}
|
10
|
+
},
|
11
|
+
"servers": [
|
12
|
+
{
|
13
|
+
"url": "http://localhost:3000/api/v1"
|
14
|
+
}
|
15
|
+
],
|
16
|
+
"tags": [],
|
17
|
+
"paths": {
|
18
|
+
"/standardize": {
|
19
|
+
"post": {
|
20
|
+
"requestBody": {
|
21
|
+
"content": {
|
22
|
+
"application/json; charset=utf-8": {
|
23
|
+
"schema": {
|
24
|
+
"type": "array",
|
25
|
+
"items": {
|
26
|
+
"$ref": "#/components/schemas/Smile"
|
27
|
+
}
|
28
|
+
}
|
29
|
+
}
|
30
|
+
},
|
31
|
+
"required": true
|
32
|
+
},
|
33
|
+
"responses": {
|
34
|
+
"200": {
|
35
|
+
"description": "",
|
36
|
+
"content": {
|
37
|
+
"application/json; charset=utf-8": {
|
38
|
+
"schema": {
|
39
|
+
"type": "array",
|
40
|
+
"items": {
|
41
|
+
"$ref": "#/components/schemas/StandardizedSmile"
|
42
|
+
}
|
43
|
+
}
|
44
|
+
}
|
45
|
+
}
|
46
|
+
}
|
47
|
+
}
|
48
|
+
}
|
49
|
+
}
|
50
|
+
},
|
51
|
+
"components": {
|
52
|
+
"schemas": {
|
53
|
+
"Smile": {
|
54
|
+
"type": "object",
|
55
|
+
"required": [
|
56
|
+
"smile"
|
57
|
+
],
|
58
|
+
"properties": {
|
59
|
+
"smile": {
|
60
|
+
"type": "string"
|
61
|
+
}
|
62
|
+
}
|
63
|
+
},
|
64
|
+
"StandardizedSmile": {
|
65
|
+
"type": "object",
|
66
|
+
"properties": {
|
67
|
+
"smile": {
|
68
|
+
"type": "string"
|
69
|
+
},
|
70
|
+
"error": {
|
71
|
+
"type": "string"
|
72
|
+
}
|
73
|
+
}
|
74
|
+
}
|
75
|
+
}
|
76
|
+
}
|
77
|
+
}
|
Binary file
|