cheminee 0.0.14 → 0.0.15

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -1,221 +0,0 @@
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 ListIndexResponseErr
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::ListIndexResponseErr` 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::ListIndexResponseErr`. 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
@@ -1,221 +0,0 @@
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 PostIndexBulkResponseError
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::PostIndexBulkResponseError` 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::PostIndexBulkResponseError`. 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
@@ -1,223 +0,0 @@
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 PostIndexBulkResponseOk
18
- attr_accessor :statuses
19
-
20
- # Attribute mapping from ruby-style variable name to JSON key.
21
- def self.attribute_map
22
- {
23
- :'statuses' => :'statuses'
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
- :'statuses' => :'Array<PostIndexBulkResponseOkStatus>'
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::PostIndexBulkResponseOk` 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::PostIndexBulkResponseOk`. 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?(:'statuses')
61
- if (value = attributes[:'statuses']).is_a?(Array)
62
- self.statuses = value
63
- end
64
- else
65
- self.statuses = 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 @statuses.nil?
75
- invalid_properties.push('invalid value for "statuses", statuses 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 @statuses.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
- statuses == o.statuses
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
- [statuses].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_any_of) || 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