pharmaobservatory 0.1.13 → 0.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +21 -4
  3. data/docs/BiomarkerValidationRow.md +1 -1
  4. data/docs/ChangesList200Response.md +26 -0
  5. data/docs/ChangesList200ResponseBuildState.md +20 -0
  6. data/docs/ChangesList200ResponseItemsInner.md +48 -0
  7. data/docs/ChangesList200ResponseItemsInnerEntryKeys.md +18 -0
  8. data/docs/CompanyFinancialsRow.md +18 -0
  9. data/docs/ConditionAdverseEventsRow.md +5 -1
  10. data/docs/SubscriptionsApi.md +282 -0
  11. data/docs/SubscriptionsCreate201Response.md +22 -0
  12. data/docs/SubscriptionsCreate201ResponseSubscription.md +28 -0
  13. data/docs/SubscriptionsCreate201ResponseSubscriptionTarget.md +22 -0
  14. data/docs/SubscriptionsCreateRequest.md +20 -0
  15. data/docs/SubscriptionsDelete200Response.md +24 -0
  16. data/docs/SubscriptionsList200Response.md +22 -0
  17. data/docs/SubscriptionsList200ResponseSubscriptionsInner.md +28 -0
  18. data/docs/SubscriptionsList200ResponseSubscriptionsInnerTarget.md +26 -0
  19. data/docs/SubscriptionsList200ResponseSubscriptionsInnerTargetFilters.md +18 -0
  20. data/lib/pharmaobservatory/api/subscriptions_api.rb +261 -0
  21. data/lib/pharmaobservatory/models/biomarker_validation_row.rb +1 -1
  22. data/lib/pharmaobservatory/models/changes_list200_response.rb +343 -0
  23. data/lib/pharmaobservatory/models/changes_list200_response_build_state.rb +263 -0
  24. data/lib/pharmaobservatory/models/changes_list200_response_items_inner.rb +627 -0
  25. data/lib/pharmaobservatory/models/changes_list200_response_items_inner_entry_keys.rb +237 -0
  26. data/lib/pharmaobservatory/models/company_financials_row.rb +100 -1
  27. data/lib/pharmaobservatory/models/condition_adverse_events_row.rb +27 -5
  28. data/lib/pharmaobservatory/models/subscriptions_create201_response.rb +289 -0
  29. data/lib/pharmaobservatory/models/subscriptions_create201_response_subscription.rb +369 -0
  30. data/lib/pharmaobservatory/models/subscriptions_create201_response_subscription_target.rb +289 -0
  31. data/lib/pharmaobservatory/models/subscriptions_create_request.rb +263 -0
  32. data/lib/pharmaobservatory/models/subscriptions_delete200_response.rb +315 -0
  33. data/lib/pharmaobservatory/models/subscriptions_list200_response.rb +291 -0
  34. data/lib/pharmaobservatory/models/subscriptions_list200_response_subscriptions_inner.rb +369 -0
  35. data/lib/pharmaobservatory/models/subscriptions_list200_response_subscriptions_inner_target.rb +277 -0
  36. data/lib/pharmaobservatory/models/subscriptions_list200_response_subscriptions_inner_target_filters.rb +237 -0
  37. data/lib/pharmaobservatory/version.rb +1 -1
  38. data/lib/pharmaobservatory.rb +14 -0
  39. metadata +30 -2
@@ -0,0 +1,289 @@
1
+ =begin
2
+ #Pharma Observatory Public REST API
3
+
4
+ #Read-only REST API over the Pharma Observatory biomedical data platform. Reference: https://pharmaobservatory.com/api-reference
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.13.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module PharmaObservatory
17
+ class SubscriptionsCreate201Response
18
+ attr_accessor :subscription
19
+
20
+ attr_accessor :created
21
+
22
+ attr_accessor :build_state
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'subscription' => :'subscription',
28
+ :'created' => :'created',
29
+ :'build_state' => :'build_state'
30
+ }
31
+ end
32
+
33
+ # Returns attribute mapping this model knows about
34
+ def self.acceptable_attribute_map
35
+ attribute_map
36
+ end
37
+
38
+ # Returns all the JSON keys this model knows about
39
+ def self.acceptable_attributes
40
+ acceptable_attribute_map.values
41
+ end
42
+
43
+ # Attribute type mapping.
44
+ def self.openapi_types
45
+ {
46
+ :'subscription' => :'SubscriptionsCreate201ResponseSubscription',
47
+ :'created' => :'Boolean',
48
+ :'build_state' => :'ChangesList200ResponseBuildState'
49
+ }
50
+ end
51
+
52
+ # List of attributes with nullable: true
53
+ def self.openapi_nullable
54
+ Set.new([
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 `PharmaObservatory::SubscriptionsCreate201Response` initialize method"
63
+ end
64
+
65
+ # check to see if the attribute exists and convert string to symbol for hash key
66
+ acceptable_attribute_map = self.class.acceptable_attribute_map
67
+ attributes = attributes.each_with_object({}) { |(k, v), h|
68
+ if (!acceptable_attribute_map.key?(k.to_sym))
69
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PharmaObservatory::SubscriptionsCreate201Response`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
70
+ end
71
+ h[k.to_sym] = v
72
+ }
73
+
74
+ if attributes.key?(:'subscription')
75
+ self.subscription = attributes[:'subscription']
76
+ else
77
+ self.subscription = nil
78
+ end
79
+
80
+ if attributes.key?(:'created')
81
+ self.created = attributes[:'created']
82
+ else
83
+ self.created = nil
84
+ end
85
+
86
+ if attributes.key?(:'build_state')
87
+ self.build_state = attributes[:'build_state']
88
+ else
89
+ self.build_state = nil
90
+ end
91
+ end
92
+
93
+ # Show invalid properties with the reasons. Usually used together with valid?
94
+ # @return Array for valid properties with the reasons
95
+ def list_invalid_properties
96
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
97
+ invalid_properties = Array.new
98
+ if @subscription.nil?
99
+ invalid_properties.push('invalid value for "subscription", subscription cannot be nil.')
100
+ end
101
+
102
+ if @created.nil?
103
+ invalid_properties.push('invalid value for "created", created cannot be nil.')
104
+ end
105
+
106
+ if @build_state.nil?
107
+ invalid_properties.push('invalid value for "build_state", build_state cannot be nil.')
108
+ end
109
+
110
+ invalid_properties
111
+ end
112
+
113
+ # Check to see if the all the properties in the model are valid
114
+ # @return true if the model is valid
115
+ def valid?
116
+ warn '[DEPRECATED] the `valid?` method is obsolete'
117
+ return false if @subscription.nil?
118
+ return false if @created.nil?
119
+ return false if @build_state.nil?
120
+ true
121
+ end
122
+
123
+ # Custom attribute writer method with validation
124
+ # @param [Object] subscription Value to be assigned
125
+ def subscription=(subscription)
126
+ if subscription.nil?
127
+ fail ArgumentError, 'subscription cannot be nil'
128
+ end
129
+
130
+ @subscription = subscription
131
+ end
132
+
133
+ # Custom attribute writer method with validation
134
+ # @param [Object] created Value to be assigned
135
+ def created=(created)
136
+ if created.nil?
137
+ fail ArgumentError, 'created cannot be nil'
138
+ end
139
+
140
+ @created = created
141
+ end
142
+
143
+ # Custom attribute writer method with validation
144
+ # @param [Object] build_state Value to be assigned
145
+ def build_state=(build_state)
146
+ if build_state.nil?
147
+ fail ArgumentError, 'build_state cannot be nil'
148
+ end
149
+
150
+ @build_state = build_state
151
+ end
152
+
153
+ # Checks equality by comparing each attribute.
154
+ # @param [Object] Object to be compared
155
+ def ==(o)
156
+ return true if self.equal?(o)
157
+ self.class == o.class &&
158
+ subscription == o.subscription &&
159
+ created == o.created &&
160
+ build_state == o.build_state
161
+ end
162
+
163
+ # @see the `==` method
164
+ # @param [Object] Object to be compared
165
+ def eql?(o)
166
+ self == o
167
+ end
168
+
169
+ # Calculates hash code according to all attributes.
170
+ # @return [Integer] Hash code
171
+ def hash
172
+ [subscription, created, build_state].hash
173
+ end
174
+
175
+ # Builds the object from hash
176
+ # @param [Hash] attributes Model attributes in the form of hash
177
+ # @return [Object] Returns the model itself
178
+ def self.build_from_hash(attributes)
179
+ return nil unless attributes.is_a?(Hash)
180
+ attributes = attributes.transform_keys(&:to_sym)
181
+ transformed_hash = {}
182
+ openapi_types.each_pair do |key, type|
183
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
184
+ transformed_hash["#{key}"] = nil
185
+ elsif type =~ /\AArray<(.*)>/i
186
+ # check to ensure the input is an array given that the attribute
187
+ # is documented as an array but the input is not
188
+ if attributes[attribute_map[key]].is_a?(Array)
189
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
190
+ end
191
+ elsif !attributes[attribute_map[key]].nil?
192
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
193
+ end
194
+ end
195
+ new(transformed_hash)
196
+ end
197
+
198
+ # Deserializes the data based on type
199
+ # @param string type Data type
200
+ # @param string value Value to be deserialized
201
+ # @return [Object] Deserialized data
202
+ def self._deserialize(type, value)
203
+ case type.to_sym
204
+ when :Time
205
+ Time.parse(value)
206
+ when :Date
207
+ Date.parse(value)
208
+ when :String
209
+ value.to_s
210
+ when :Integer
211
+ value.to_i
212
+ when :Float
213
+ value.to_f
214
+ when :Boolean
215
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
216
+ true
217
+ else
218
+ false
219
+ end
220
+ when :Object
221
+ # generic object (usually a Hash), return directly
222
+ value
223
+ when /\AArray<(?<inner_type>.+)>\z/
224
+ inner_type = Regexp.last_match[:inner_type]
225
+ value.map { |v| _deserialize(inner_type, v) }
226
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
227
+ k_type = Regexp.last_match[:k_type]
228
+ v_type = Regexp.last_match[:v_type]
229
+ {}.tap do |hash|
230
+ value.each do |k, v|
231
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
232
+ end
233
+ end
234
+ else # model
235
+ # models (e.g. Pet) or oneOf
236
+ klass = PharmaObservatory.const_get(type)
237
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
238
+ end
239
+ end
240
+
241
+ # Returns the string representation of the object
242
+ # @return [String] String presentation of the object
243
+ def to_s
244
+ to_hash.to_s
245
+ end
246
+
247
+ # to_body is an alias to to_hash (backward compatibility)
248
+ # @return [Hash] Returns the object in the form of hash
249
+ def to_body
250
+ to_hash
251
+ end
252
+
253
+ # Returns the object in the form of hash
254
+ # @return [Hash] Returns the object in the form of hash
255
+ def to_hash
256
+ hash = {}
257
+ self.class.attribute_map.each_pair do |attr, param|
258
+ value = self.send(attr)
259
+ if value.nil?
260
+ is_nullable = self.class.openapi_nullable.include?(attr)
261
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
262
+ end
263
+
264
+ hash[param] = _to_hash(value)
265
+ end
266
+ hash
267
+ end
268
+
269
+ # Outputs non-array value in the form of hash
270
+ # For object, use to_hash. Otherwise, just return the value
271
+ # @param [Object] value Any valid value
272
+ # @return [Hash] Returns the value in the form of hash
273
+ def _to_hash(value)
274
+ if value.is_a?(Array)
275
+ value.compact.map { |v| _to_hash(v) }
276
+ elsif value.is_a?(Hash)
277
+ {}.tap do |hash|
278
+ value.each { |k, v| hash[k] = _to_hash(v) }
279
+ end
280
+ elsif value.respond_to? :to_hash
281
+ value.to_hash
282
+ else
283
+ value
284
+ end
285
+ end
286
+
287
+ end
288
+
289
+ end
@@ -0,0 +1,369 @@
1
+ =begin
2
+ #Pharma Observatory Public REST API
3
+
4
+ #Read-only REST API over the Pharma Observatory biomedical data platform. Reference: https://pharmaobservatory.com/api-reference
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.13.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module PharmaObservatory
17
+ class SubscriptionsCreate201ResponseSubscription
18
+ attr_accessor :id
19
+
20
+ attr_accessor :label
21
+
22
+ attr_accessor :target
23
+
24
+ attr_accessor :event_types
25
+
26
+ attr_accessor :paused
27
+
28
+ attr_accessor :created_at
29
+
30
+ # Attribute mapping from ruby-style variable name to JSON key.
31
+ def self.attribute_map
32
+ {
33
+ :'id' => :'id',
34
+ :'label' => :'label',
35
+ :'target' => :'target',
36
+ :'event_types' => :'event_types',
37
+ :'paused' => :'paused',
38
+ :'created_at' => :'created_at'
39
+ }
40
+ end
41
+
42
+ # Returns attribute mapping this model knows about
43
+ def self.acceptable_attribute_map
44
+ attribute_map
45
+ end
46
+
47
+ # Returns all the JSON keys this model knows about
48
+ def self.acceptable_attributes
49
+ acceptable_attribute_map.values
50
+ end
51
+
52
+ # Attribute type mapping.
53
+ def self.openapi_types
54
+ {
55
+ :'id' => :'Integer',
56
+ :'label' => :'String',
57
+ :'target' => :'SubscriptionsCreate201ResponseSubscriptionTarget',
58
+ :'event_types' => :'Array<String>',
59
+ :'paused' => :'Boolean',
60
+ :'created_at' => :'String'
61
+ }
62
+ end
63
+
64
+ # List of attributes with nullable: true
65
+ def self.openapi_nullable
66
+ Set.new([
67
+ ])
68
+ end
69
+
70
+ # Initializes the object
71
+ # @param [Hash] attributes Model attributes in the form of hash
72
+ def initialize(attributes = {})
73
+ if (!attributes.is_a?(Hash))
74
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PharmaObservatory::SubscriptionsCreate201ResponseSubscription` initialize method"
75
+ end
76
+
77
+ # check to see if the attribute exists and convert string to symbol for hash key
78
+ acceptable_attribute_map = self.class.acceptable_attribute_map
79
+ attributes = attributes.each_with_object({}) { |(k, v), h|
80
+ if (!acceptable_attribute_map.key?(k.to_sym))
81
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PharmaObservatory::SubscriptionsCreate201ResponseSubscription`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
82
+ end
83
+ h[k.to_sym] = v
84
+ }
85
+
86
+ if attributes.key?(:'id')
87
+ self.id = attributes[:'id']
88
+ else
89
+ self.id = nil
90
+ end
91
+
92
+ if attributes.key?(:'label')
93
+ self.label = attributes[:'label']
94
+ else
95
+ self.label = nil
96
+ end
97
+
98
+ if attributes.key?(:'target')
99
+ self.target = attributes[:'target']
100
+ else
101
+ self.target = nil
102
+ end
103
+
104
+ if attributes.key?(:'event_types')
105
+ if (value = attributes[:'event_types']).is_a?(Array)
106
+ self.event_types = value
107
+ end
108
+ else
109
+ self.event_types = nil
110
+ end
111
+
112
+ if attributes.key?(:'paused')
113
+ self.paused = attributes[:'paused']
114
+ else
115
+ self.paused = nil
116
+ end
117
+
118
+ if attributes.key?(:'created_at')
119
+ self.created_at = attributes[:'created_at']
120
+ else
121
+ self.created_at = nil
122
+ end
123
+ end
124
+
125
+ # Show invalid properties with the reasons. Usually used together with valid?
126
+ # @return Array for valid properties with the reasons
127
+ def list_invalid_properties
128
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
129
+ invalid_properties = Array.new
130
+ if @id.nil?
131
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
132
+ end
133
+
134
+ if @label.nil?
135
+ invalid_properties.push('invalid value for "label", label cannot be nil.')
136
+ end
137
+
138
+ if @target.nil?
139
+ invalid_properties.push('invalid value for "target", target cannot be nil.')
140
+ end
141
+
142
+ if @event_types.nil?
143
+ invalid_properties.push('invalid value for "event_types", event_types cannot be nil.')
144
+ end
145
+
146
+ if @paused.nil?
147
+ invalid_properties.push('invalid value for "paused", paused cannot be nil.')
148
+ end
149
+
150
+ if @created_at.nil?
151
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
152
+ end
153
+
154
+ invalid_properties
155
+ end
156
+
157
+ # Check to see if the all the properties in the model are valid
158
+ # @return true if the model is valid
159
+ def valid?
160
+ warn '[DEPRECATED] the `valid?` method is obsolete'
161
+ return false if @id.nil?
162
+ return false if @label.nil?
163
+ return false if @target.nil?
164
+ return false if @event_types.nil?
165
+ return false if @paused.nil?
166
+ return false if @created_at.nil?
167
+ true
168
+ end
169
+
170
+ # Custom attribute writer method with validation
171
+ # @param [Object] id Value to be assigned
172
+ def id=(id)
173
+ if id.nil?
174
+ fail ArgumentError, 'id cannot be nil'
175
+ end
176
+
177
+ @id = id
178
+ end
179
+
180
+ # Custom attribute writer method with validation
181
+ # @param [Object] label Value to be assigned
182
+ def label=(label)
183
+ if label.nil?
184
+ fail ArgumentError, 'label cannot be nil'
185
+ end
186
+
187
+ @label = label
188
+ end
189
+
190
+ # Custom attribute writer method with validation
191
+ # @param [Object] target Value to be assigned
192
+ def target=(target)
193
+ if target.nil?
194
+ fail ArgumentError, 'target cannot be nil'
195
+ end
196
+
197
+ @target = target
198
+ end
199
+
200
+ # Custom attribute writer method with validation
201
+ # @param [Object] event_types Value to be assigned
202
+ def event_types=(event_types)
203
+ if event_types.nil?
204
+ fail ArgumentError, 'event_types cannot be nil'
205
+ end
206
+
207
+ @event_types = event_types
208
+ end
209
+
210
+ # Custom attribute writer method with validation
211
+ # @param [Object] paused Value to be assigned
212
+ def paused=(paused)
213
+ if paused.nil?
214
+ fail ArgumentError, 'paused cannot be nil'
215
+ end
216
+
217
+ @paused = paused
218
+ end
219
+
220
+ # Custom attribute writer method with validation
221
+ # @param [Object] created_at Value to be assigned
222
+ def created_at=(created_at)
223
+ if created_at.nil?
224
+ fail ArgumentError, 'created_at cannot be nil'
225
+ end
226
+
227
+ @created_at = created_at
228
+ end
229
+
230
+ # Checks equality by comparing each attribute.
231
+ # @param [Object] Object to be compared
232
+ def ==(o)
233
+ return true if self.equal?(o)
234
+ self.class == o.class &&
235
+ id == o.id &&
236
+ label == o.label &&
237
+ target == o.target &&
238
+ event_types == o.event_types &&
239
+ paused == o.paused &&
240
+ created_at == o.created_at
241
+ end
242
+
243
+ # @see the `==` method
244
+ # @param [Object] Object to be compared
245
+ def eql?(o)
246
+ self == o
247
+ end
248
+
249
+ # Calculates hash code according to all attributes.
250
+ # @return [Integer] Hash code
251
+ def hash
252
+ [id, label, target, event_types, paused, created_at].hash
253
+ end
254
+
255
+ # Builds the object from hash
256
+ # @param [Hash] attributes Model attributes in the form of hash
257
+ # @return [Object] Returns the model itself
258
+ def self.build_from_hash(attributes)
259
+ return nil unless attributes.is_a?(Hash)
260
+ attributes = attributes.transform_keys(&:to_sym)
261
+ transformed_hash = {}
262
+ openapi_types.each_pair do |key, type|
263
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
264
+ transformed_hash["#{key}"] = nil
265
+ elsif type =~ /\AArray<(.*)>/i
266
+ # check to ensure the input is an array given that the attribute
267
+ # is documented as an array but the input is not
268
+ if attributes[attribute_map[key]].is_a?(Array)
269
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
270
+ end
271
+ elsif !attributes[attribute_map[key]].nil?
272
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
273
+ end
274
+ end
275
+ new(transformed_hash)
276
+ end
277
+
278
+ # Deserializes the data based on type
279
+ # @param string type Data type
280
+ # @param string value Value to be deserialized
281
+ # @return [Object] Deserialized data
282
+ def self._deserialize(type, value)
283
+ case type.to_sym
284
+ when :Time
285
+ Time.parse(value)
286
+ when :Date
287
+ Date.parse(value)
288
+ when :String
289
+ value.to_s
290
+ when :Integer
291
+ value.to_i
292
+ when :Float
293
+ value.to_f
294
+ when :Boolean
295
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
296
+ true
297
+ else
298
+ false
299
+ end
300
+ when :Object
301
+ # generic object (usually a Hash), return directly
302
+ value
303
+ when /\AArray<(?<inner_type>.+)>\z/
304
+ inner_type = Regexp.last_match[:inner_type]
305
+ value.map { |v| _deserialize(inner_type, v) }
306
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
307
+ k_type = Regexp.last_match[:k_type]
308
+ v_type = Regexp.last_match[:v_type]
309
+ {}.tap do |hash|
310
+ value.each do |k, v|
311
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
312
+ end
313
+ end
314
+ else # model
315
+ # models (e.g. Pet) or oneOf
316
+ klass = PharmaObservatory.const_get(type)
317
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
318
+ end
319
+ end
320
+
321
+ # Returns the string representation of the object
322
+ # @return [String] String presentation of the object
323
+ def to_s
324
+ to_hash.to_s
325
+ end
326
+
327
+ # to_body is an alias to to_hash (backward compatibility)
328
+ # @return [Hash] Returns the object in the form of hash
329
+ def to_body
330
+ to_hash
331
+ end
332
+
333
+ # Returns the object in the form of hash
334
+ # @return [Hash] Returns the object in the form of hash
335
+ def to_hash
336
+ hash = {}
337
+ self.class.attribute_map.each_pair do |attr, param|
338
+ value = self.send(attr)
339
+ if value.nil?
340
+ is_nullable = self.class.openapi_nullable.include?(attr)
341
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
342
+ end
343
+
344
+ hash[param] = _to_hash(value)
345
+ end
346
+ hash
347
+ end
348
+
349
+ # Outputs non-array value in the form of hash
350
+ # For object, use to_hash. Otherwise, just return the value
351
+ # @param [Object] value Any valid value
352
+ # @return [Hash] Returns the value in the form of hash
353
+ def _to_hash(value)
354
+ if value.is_a?(Array)
355
+ value.compact.map { |v| _to_hash(v) }
356
+ elsif value.is_a?(Hash)
357
+ {}.tap do |hash|
358
+ value.each { |k, v| hash[k] = _to_hash(v) }
359
+ end
360
+ elsif value.respond_to? :to_hash
361
+ value.to_hash
362
+ else
363
+ value
364
+ end
365
+ end
366
+
367
+ end
368
+
369
+ end