pharmaobservatory 0.1.21 → 0.1.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +40 -4
  3. data/docs/BiomarkersApi.md +80 -0
  4. data/docs/InvestigatorsApi.md +80 -0
  5. data/docs/ProviderBiomarkerCapabilityRow.md +9 -9
  6. data/docs/ProviderBiomarkerCapabilitySummaryResponse.md +58 -0
  7. data/docs/ProviderBiomarkerCapabilitySummaryRow.md +70 -0
  8. data/docs/ProviderCliaLicensureRow.md +1 -1
  9. data/docs/ProviderRwdDeliveryResponse.md +58 -0
  10. data/docs/ProviderRwdDeliveryRow.md +76 -0
  11. data/docs/ProviderRwdDeliveryStudyResponse.md +58 -0
  12. data/docs/ProviderRwdDeliveryStudyRow.md +60 -0
  13. data/docs/ProviderRwdFootprintResponse.md +58 -0
  14. data/docs/ProviderRwdFootprintRow.md +74 -0
  15. data/docs/RwdConductorsApi.md +160 -0
  16. data/docs/RwdInstitutionsApi.md +80 -0
  17. data/docs/RwdSourcesRow.md +1 -1
  18. data/docs/RwdStudiesApi.md +80 -0
  19. data/docs/RwdUsNetworkMembershipsResponse.md +58 -0
  20. data/docs/RwdUsNetworkMembershipsRow.md +98 -0
  21. data/docs/RwdUsNetworkProjectsResponse.md +58 -0
  22. data/docs/RwdUsNetworkProjectsRow.md +80 -0
  23. data/docs/RwdUsNetworksApi.md +313 -0
  24. data/docs/RwdUsNetworksRecord.md +38 -0
  25. data/docs/RwdUsNetworksResponse.md +58 -0
  26. data/docs/RwdUsNetworksRow.md +60 -0
  27. data/docs/SupplierRwdDeclarationsResponse.md +58 -0
  28. data/docs/SupplierRwdDeclarationsRow.md +74 -0
  29. data/docs/SuppliersApi.md +480 -0
  30. data/docs/TrialPublicationsResponse.md +58 -0
  31. data/docs/TrialPublicationsRow.md +34 -0
  32. data/docs/TrialsApi.md +80 -0
  33. data/lib/pharmaobservatory/api/biomarkers_api.rb +84 -0
  34. data/lib/pharmaobservatory/api/investigators_api.rb +84 -0
  35. data/lib/pharmaobservatory/api/rwd_conductors_api.rb +168 -0
  36. data/lib/pharmaobservatory/api/rwd_institutions_api.rb +84 -0
  37. data/lib/pharmaobservatory/api/rwd_studies_api.rb +84 -0
  38. data/lib/pharmaobservatory/api/rwd_us_networks_api.rb +329 -0
  39. data/lib/pharmaobservatory/api/suppliers_api.rb +504 -0
  40. data/lib/pharmaobservatory/api/trials_api.rb +84 -0
  41. data/lib/pharmaobservatory/models/provider_biomarker_capability_row.rb +9 -9
  42. data/lib/pharmaobservatory/models/provider_biomarker_capability_summary_response.rb +478 -0
  43. data/lib/pharmaobservatory/models/provider_biomarker_capability_summary_row.rb +509 -0
  44. data/lib/pharmaobservatory/models/provider_clia_licensure_row.rb +1 -1
  45. data/lib/pharmaobservatory/models/provider_rwd_delivery_response.rb +478 -0
  46. data/lib/pharmaobservatory/models/provider_rwd_delivery_row.rb +546 -0
  47. data/lib/pharmaobservatory/models/provider_rwd_delivery_study_response.rb +478 -0
  48. data/lib/pharmaobservatory/models/provider_rwd_delivery_study_row.rb +454 -0
  49. data/lib/pharmaobservatory/models/provider_rwd_footprint_response.rb +478 -0
  50. data/lib/pharmaobservatory/models/provider_rwd_footprint_row.rb +539 -0
  51. data/lib/pharmaobservatory/models/rwd_sources_row.rb +1 -1
  52. data/lib/pharmaobservatory/models/rwd_us_network_memberships_response.rb +478 -0
  53. data/lib/pharmaobservatory/models/rwd_us_network_memberships_row.rb +663 -0
  54. data/lib/pharmaobservatory/models/rwd_us_network_projects_response.rb +478 -0
  55. data/lib/pharmaobservatory/models/rwd_us_network_projects_row.rb +564 -0
  56. data/lib/pharmaobservatory/models/rwd_us_networks_record.rb +385 -0
  57. data/lib/pharmaobservatory/models/rwd_us_networks_response.rb +478 -0
  58. data/lib/pharmaobservatory/models/rwd_us_networks_row.rb +454 -0
  59. data/lib/pharmaobservatory/models/supplier_rwd_declarations_response.rb +478 -0
  60. data/lib/pharmaobservatory/models/supplier_rwd_declarations_row.rb +539 -0
  61. data/lib/pharmaobservatory/models/trial_publications_response.rb +478 -0
  62. data/lib/pharmaobservatory/models/trial_publications_row.rb +313 -0
  63. data/lib/pharmaobservatory/version.rb +1 -1
  64. data/lib/pharmaobservatory.rb +20 -0
  65. metadata +42 -2
@@ -0,0 +1,539 @@
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
+ # One row of the supplier_rwd_declarations dataset: one row per fact a supplier declares on the questionnaire. A grouped request returns the group columns and the measures instead, as additional properties.
18
+ class SupplierRwdDeclarationsRow
19
+ # The fact id: a hash of the supplier uuid, the fact kind and the fact reference.
20
+ attr_accessor :provider_rwd_declared_source_id
21
+
22
+ # The supplier id: the Scientist.com provider id as text, the entry key of the suppliers object type. A supplier is not a company.
23
+ attr_accessor :provider_id
24
+
25
+ # The Scientist.com public provider uuid, the join key to the RX marketplace.
26
+ attr_accessor :provider_uuid
27
+
28
+ # The supplier's marketplace slug.
29
+ attr_accessor :provider_slug
30
+
31
+ # The supplier's name.
32
+ attr_accessor :provider_name
33
+
34
+ # Always supplier_declared: the supplier said it, on the Scientist.com questionnaire. It is never a register role.
35
+ attr_accessor :role
36
+
37
+ # Which kind of fact the row is: rx_rfi_owned_database (a database the supplier lists), rx_rfi_data_access (countries and regions it declares data access in, naming no source) or rx_rfi_therapeutic_experience (rare-disease and therapeutic-area experience).
38
+ attr_accessor :evidence_ref_kind
39
+
40
+ # The fact reference, per evidence_ref_kind: the questionnaire id with the item position for a database, the questionnaire id otherwise. Read it with evidence_ref_kind.
41
+ attr_accessor :evidence_ref
42
+
43
+ # The database short name the supplier gave (capped at 120 characters), or a fixed label for the two other kinds.
44
+ attr_accessor :evidence_label
45
+
46
+ # How the fact was tied to the supplier: rx_provider_direct, the questionnaire carries the supplier id and nothing was inferred.
47
+ attr_accessor :match_method
48
+
49
+ # Database rows: the database country. Access rows: the countries the supplier declares access in. Null on therapeutic rows.
50
+ attr_accessor :country_names
51
+
52
+ # Access rows: the regions the supplier declares access in, as the questionnaire writes them. Null elsewhere.
53
+ attr_accessor :declared_regions
54
+
55
+ # The data types, mapped to the current label of each option (a label with no mapping is kept as ticked). Database rows: types the source holds. Access rows: types the supplier declares experience with.
56
+ attr_accessor :data_types
57
+
58
+ # data_types joined with ' | '.
59
+ attr_accessor :data_source_type
60
+
61
+ # What data_types means: source_holds (database rows) or supplier_experience (access rows, which name no source). Null where there are no data types.
62
+ attr_accessor :data_types_basis
63
+
64
+ # Database rows: the supplier's own statement of validation, declared_validated, declared_not_validated or declared_validation_in_progress.
65
+ attr_accessor :declared_validation
66
+
67
+ # Database rows: the first-collection year the supplier gave, kept where it is between 1950 and the build year, else null.
68
+ attr_accessor :declared_first_collection_year
69
+
70
+ # Database rows: true where the supplier gave a year outside 1950 to the build year (declared_first_collection_year is then null).
71
+ attr_accessor :year_implausible
72
+
73
+ # Database rows: whether the supplier says the database can be linked; null where it did not answer.
74
+ attr_accessor :declared_linkable
75
+
76
+ # Therapeutic rows: the therapeutic areas ticked, current labels. An empty list is a declared negative, not missing data.
77
+ attr_accessor :therapeutic_areas
78
+
79
+ # Therapeutic rows: true where the supplier says it has rare-disease experience, false where it says it has none (a declared negative), null where it did not answer.
80
+ attr_accessor :declared_rare_disease_experience
81
+
82
+ # The date the questionnaire was submitted.
83
+ attr_accessor :as_of
84
+
85
+ # Whether the questionnaire is past its 730-day validity at build time.
86
+ attr_accessor :is_expired
87
+
88
+ # When the questionnaire validity ends.
89
+ attr_accessor :expired_at
90
+
91
+ # The questionnaire version the fact came from: rwe_current, or rwe_2019 on a database row.
92
+ attr_accessor :questionnaire_key
93
+
94
+ # The questionnaire version as a label.
95
+ attr_accessor :questionnaire_label
96
+
97
+ # The license restriction tier of the source: none, a first-party source with no license restriction.
98
+ attr_accessor :restriction_tier
99
+
100
+ # The plain source line to show with a row.
101
+ attr_accessor :attribution
102
+
103
+ # Always declared: the supplier's own statement, not verified.
104
+ attr_accessor :authority_class
105
+
106
+ # Attribute mapping from ruby-style variable name to JSON key.
107
+ def self.attribute_map
108
+ {
109
+ :'provider_rwd_declared_source_id' => :'provider_rwd_declared_source_id',
110
+ :'provider_id' => :'provider_id',
111
+ :'provider_uuid' => :'provider_uuid',
112
+ :'provider_slug' => :'provider_slug',
113
+ :'provider_name' => :'provider_name',
114
+ :'role' => :'role',
115
+ :'evidence_ref_kind' => :'evidence_ref_kind',
116
+ :'evidence_ref' => :'evidence_ref',
117
+ :'evidence_label' => :'evidence_label',
118
+ :'match_method' => :'match_method',
119
+ :'country_names' => :'country_names',
120
+ :'declared_regions' => :'declared_regions',
121
+ :'data_types' => :'data_types',
122
+ :'data_source_type' => :'data_source_type',
123
+ :'data_types_basis' => :'data_types_basis',
124
+ :'declared_validation' => :'declared_validation',
125
+ :'declared_first_collection_year' => :'declared_first_collection_year',
126
+ :'year_implausible' => :'year_implausible',
127
+ :'declared_linkable' => :'declared_linkable',
128
+ :'therapeutic_areas' => :'therapeutic_areas',
129
+ :'declared_rare_disease_experience' => :'declared_rare_disease_experience',
130
+ :'as_of' => :'as_of',
131
+ :'is_expired' => :'is_expired',
132
+ :'expired_at' => :'expired_at',
133
+ :'questionnaire_key' => :'questionnaire_key',
134
+ :'questionnaire_label' => :'questionnaire_label',
135
+ :'restriction_tier' => :'restriction_tier',
136
+ :'attribution' => :'attribution',
137
+ :'authority_class' => :'authority_class'
138
+ }
139
+ end
140
+
141
+ # Returns attribute mapping this model knows about
142
+ def self.acceptable_attribute_map
143
+ attribute_map
144
+ end
145
+
146
+ # Returns all the JSON keys this model knows about
147
+ def self.acceptable_attributes
148
+ acceptable_attribute_map.values
149
+ end
150
+
151
+ # Attribute type mapping.
152
+ def self.openapi_types
153
+ {
154
+ :'provider_rwd_declared_source_id' => :'String',
155
+ :'provider_id' => :'String',
156
+ :'provider_uuid' => :'String',
157
+ :'provider_slug' => :'String',
158
+ :'provider_name' => :'String',
159
+ :'role' => :'String',
160
+ :'evidence_ref_kind' => :'String',
161
+ :'evidence_ref' => :'String',
162
+ :'evidence_label' => :'String',
163
+ :'match_method' => :'String',
164
+ :'country_names' => :'Array<String>',
165
+ :'declared_regions' => :'Array<String>',
166
+ :'data_types' => :'Array<String>',
167
+ :'data_source_type' => :'String',
168
+ :'data_types_basis' => :'String',
169
+ :'declared_validation' => :'String',
170
+ :'declared_first_collection_year' => :'Integer',
171
+ :'year_implausible' => :'Boolean',
172
+ :'declared_linkable' => :'Boolean',
173
+ :'therapeutic_areas' => :'Array<String>',
174
+ :'declared_rare_disease_experience' => :'Boolean',
175
+ :'as_of' => :'Date',
176
+ :'is_expired' => :'Boolean',
177
+ :'expired_at' => :'Time',
178
+ :'questionnaire_key' => :'String',
179
+ :'questionnaire_label' => :'String',
180
+ :'restriction_tier' => :'String',
181
+ :'attribution' => :'String',
182
+ :'authority_class' => :'String'
183
+ }
184
+ end
185
+
186
+ # List of attributes with nullable: true
187
+ def self.openapi_nullable
188
+ Set.new([
189
+ :'provider_rwd_declared_source_id',
190
+ :'provider_id',
191
+ :'provider_uuid',
192
+ :'provider_slug',
193
+ :'provider_name',
194
+ :'role',
195
+ :'evidence_ref_kind',
196
+ :'evidence_ref',
197
+ :'evidence_label',
198
+ :'match_method',
199
+ :'country_names',
200
+ :'declared_regions',
201
+ :'data_types',
202
+ :'data_source_type',
203
+ :'data_types_basis',
204
+ :'declared_validation',
205
+ :'declared_first_collection_year',
206
+ :'year_implausible',
207
+ :'declared_linkable',
208
+ :'therapeutic_areas',
209
+ :'declared_rare_disease_experience',
210
+ :'as_of',
211
+ :'is_expired',
212
+ :'expired_at',
213
+ :'questionnaire_key',
214
+ :'questionnaire_label',
215
+ :'restriction_tier',
216
+ :'attribution',
217
+ :'authority_class'
218
+ ])
219
+ end
220
+
221
+ # Initializes the object
222
+ # @param [Hash] attributes Model attributes in the form of hash
223
+ def initialize(attributes = {})
224
+ if (!attributes.is_a?(Hash))
225
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PharmaObservatory::SupplierRwdDeclarationsRow` initialize method"
226
+ end
227
+
228
+ # check to see if the attribute exists and convert string to symbol for hash key
229
+ acceptable_attribute_map = self.class.acceptable_attribute_map
230
+ attributes = attributes.each_with_object({}) { |(k, v), h|
231
+ if (!acceptable_attribute_map.key?(k.to_sym))
232
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PharmaObservatory::SupplierRwdDeclarationsRow`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
233
+ end
234
+ h[k.to_sym] = v
235
+ }
236
+
237
+ if attributes.key?(:'provider_rwd_declared_source_id')
238
+ self.provider_rwd_declared_source_id = attributes[:'provider_rwd_declared_source_id']
239
+ end
240
+
241
+ if attributes.key?(:'provider_id')
242
+ self.provider_id = attributes[:'provider_id']
243
+ end
244
+
245
+ if attributes.key?(:'provider_uuid')
246
+ self.provider_uuid = attributes[:'provider_uuid']
247
+ end
248
+
249
+ if attributes.key?(:'provider_slug')
250
+ self.provider_slug = attributes[:'provider_slug']
251
+ end
252
+
253
+ if attributes.key?(:'provider_name')
254
+ self.provider_name = attributes[:'provider_name']
255
+ end
256
+
257
+ if attributes.key?(:'role')
258
+ self.role = attributes[:'role']
259
+ end
260
+
261
+ if attributes.key?(:'evidence_ref_kind')
262
+ self.evidence_ref_kind = attributes[:'evidence_ref_kind']
263
+ end
264
+
265
+ if attributes.key?(:'evidence_ref')
266
+ self.evidence_ref = attributes[:'evidence_ref']
267
+ end
268
+
269
+ if attributes.key?(:'evidence_label')
270
+ self.evidence_label = attributes[:'evidence_label']
271
+ end
272
+
273
+ if attributes.key?(:'match_method')
274
+ self.match_method = attributes[:'match_method']
275
+ end
276
+
277
+ if attributes.key?(:'country_names')
278
+ if (value = attributes[:'country_names']).is_a?(Array)
279
+ self.country_names = value
280
+ end
281
+ end
282
+
283
+ if attributes.key?(:'declared_regions')
284
+ if (value = attributes[:'declared_regions']).is_a?(Array)
285
+ self.declared_regions = value
286
+ end
287
+ end
288
+
289
+ if attributes.key?(:'data_types')
290
+ if (value = attributes[:'data_types']).is_a?(Array)
291
+ self.data_types = value
292
+ end
293
+ end
294
+
295
+ if attributes.key?(:'data_source_type')
296
+ self.data_source_type = attributes[:'data_source_type']
297
+ end
298
+
299
+ if attributes.key?(:'data_types_basis')
300
+ self.data_types_basis = attributes[:'data_types_basis']
301
+ end
302
+
303
+ if attributes.key?(:'declared_validation')
304
+ self.declared_validation = attributes[:'declared_validation']
305
+ end
306
+
307
+ if attributes.key?(:'declared_first_collection_year')
308
+ self.declared_first_collection_year = attributes[:'declared_first_collection_year']
309
+ end
310
+
311
+ if attributes.key?(:'year_implausible')
312
+ self.year_implausible = attributes[:'year_implausible']
313
+ end
314
+
315
+ if attributes.key?(:'declared_linkable')
316
+ self.declared_linkable = attributes[:'declared_linkable']
317
+ end
318
+
319
+ if attributes.key?(:'therapeutic_areas')
320
+ if (value = attributes[:'therapeutic_areas']).is_a?(Array)
321
+ self.therapeutic_areas = value
322
+ end
323
+ end
324
+
325
+ if attributes.key?(:'declared_rare_disease_experience')
326
+ self.declared_rare_disease_experience = attributes[:'declared_rare_disease_experience']
327
+ end
328
+
329
+ if attributes.key?(:'as_of')
330
+ self.as_of = attributes[:'as_of']
331
+ end
332
+
333
+ if attributes.key?(:'is_expired')
334
+ self.is_expired = attributes[:'is_expired']
335
+ end
336
+
337
+ if attributes.key?(:'expired_at')
338
+ self.expired_at = attributes[:'expired_at']
339
+ end
340
+
341
+ if attributes.key?(:'questionnaire_key')
342
+ self.questionnaire_key = attributes[:'questionnaire_key']
343
+ end
344
+
345
+ if attributes.key?(:'questionnaire_label')
346
+ self.questionnaire_label = attributes[:'questionnaire_label']
347
+ end
348
+
349
+ if attributes.key?(:'restriction_tier')
350
+ self.restriction_tier = attributes[:'restriction_tier']
351
+ end
352
+
353
+ if attributes.key?(:'attribution')
354
+ self.attribution = attributes[:'attribution']
355
+ end
356
+
357
+ if attributes.key?(:'authority_class')
358
+ self.authority_class = attributes[:'authority_class']
359
+ end
360
+ end
361
+
362
+ # Show invalid properties with the reasons. Usually used together with valid?
363
+ # @return Array for valid properties with the reasons
364
+ def list_invalid_properties
365
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
366
+ invalid_properties = Array.new
367
+ invalid_properties
368
+ end
369
+
370
+ # Check to see if the all the properties in the model are valid
371
+ # @return true if the model is valid
372
+ def valid?
373
+ warn '[DEPRECATED] the `valid?` method is obsolete'
374
+ true
375
+ end
376
+
377
+ # Checks equality by comparing each attribute.
378
+ # @param [Object] Object to be compared
379
+ def ==(o)
380
+ return true if self.equal?(o)
381
+ self.class == o.class &&
382
+ provider_rwd_declared_source_id == o.provider_rwd_declared_source_id &&
383
+ provider_id == o.provider_id &&
384
+ provider_uuid == o.provider_uuid &&
385
+ provider_slug == o.provider_slug &&
386
+ provider_name == o.provider_name &&
387
+ role == o.role &&
388
+ evidence_ref_kind == o.evidence_ref_kind &&
389
+ evidence_ref == o.evidence_ref &&
390
+ evidence_label == o.evidence_label &&
391
+ match_method == o.match_method &&
392
+ country_names == o.country_names &&
393
+ declared_regions == o.declared_regions &&
394
+ data_types == o.data_types &&
395
+ data_source_type == o.data_source_type &&
396
+ data_types_basis == o.data_types_basis &&
397
+ declared_validation == o.declared_validation &&
398
+ declared_first_collection_year == o.declared_first_collection_year &&
399
+ year_implausible == o.year_implausible &&
400
+ declared_linkable == o.declared_linkable &&
401
+ therapeutic_areas == o.therapeutic_areas &&
402
+ declared_rare_disease_experience == o.declared_rare_disease_experience &&
403
+ as_of == o.as_of &&
404
+ is_expired == o.is_expired &&
405
+ expired_at == o.expired_at &&
406
+ questionnaire_key == o.questionnaire_key &&
407
+ questionnaire_label == o.questionnaire_label &&
408
+ restriction_tier == o.restriction_tier &&
409
+ attribution == o.attribution &&
410
+ authority_class == o.authority_class
411
+ end
412
+
413
+ # @see the `==` method
414
+ # @param [Object] Object to be compared
415
+ def eql?(o)
416
+ self == o
417
+ end
418
+
419
+ # Calculates hash code according to all attributes.
420
+ # @return [Integer] Hash code
421
+ def hash
422
+ [provider_rwd_declared_source_id, provider_id, provider_uuid, provider_slug, provider_name, role, evidence_ref_kind, evidence_ref, evidence_label, match_method, country_names, declared_regions, data_types, data_source_type, data_types_basis, declared_validation, declared_first_collection_year, year_implausible, declared_linkable, therapeutic_areas, declared_rare_disease_experience, as_of, is_expired, expired_at, questionnaire_key, questionnaire_label, restriction_tier, attribution, authority_class].hash
423
+ end
424
+
425
+ # Builds the object from hash
426
+ # @param [Hash] attributes Model attributes in the form of hash
427
+ # @return [Object] Returns the model itself
428
+ def self.build_from_hash(attributes)
429
+ return nil unless attributes.is_a?(Hash)
430
+ attributes = attributes.transform_keys(&:to_sym)
431
+ transformed_hash = {}
432
+ openapi_types.each_pair do |key, type|
433
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
434
+ transformed_hash["#{key}"] = nil
435
+ elsif type =~ /\AArray<(.*)>/i
436
+ # check to ensure the input is an array given that the attribute
437
+ # is documented as an array but the input is not
438
+ if attributes[attribute_map[key]].is_a?(Array)
439
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
440
+ end
441
+ elsif !attributes[attribute_map[key]].nil?
442
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
443
+ end
444
+ end
445
+ new(transformed_hash)
446
+ end
447
+
448
+ # Deserializes the data based on type
449
+ # @param string type Data type
450
+ # @param string value Value to be deserialized
451
+ # @return [Object] Deserialized data
452
+ def self._deserialize(type, value)
453
+ case type.to_sym
454
+ when :Time
455
+ Time.parse(value)
456
+ when :Date
457
+ Date.parse(value)
458
+ when :String
459
+ value.to_s
460
+ when :Integer
461
+ value.to_i
462
+ when :Float
463
+ value.to_f
464
+ when :Boolean
465
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
466
+ true
467
+ else
468
+ false
469
+ end
470
+ when :Object
471
+ # generic object (usually a Hash), return directly
472
+ value
473
+ when /\AArray<(?<inner_type>.+)>\z/
474
+ inner_type = Regexp.last_match[:inner_type]
475
+ value.map { |v| _deserialize(inner_type, v) }
476
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
477
+ k_type = Regexp.last_match[:k_type]
478
+ v_type = Regexp.last_match[:v_type]
479
+ {}.tap do |hash|
480
+ value.each do |k, v|
481
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
482
+ end
483
+ end
484
+ else # model
485
+ # models (e.g. Pet) or oneOf
486
+ klass = PharmaObservatory.const_get(type)
487
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
488
+ end
489
+ end
490
+
491
+ # Returns the string representation of the object
492
+ # @return [String] String presentation of the object
493
+ def to_s
494
+ to_hash.to_s
495
+ end
496
+
497
+ # to_body is an alias to to_hash (backward compatibility)
498
+ # @return [Hash] Returns the object in the form of hash
499
+ def to_body
500
+ to_hash
501
+ end
502
+
503
+ # Returns the object in the form of hash
504
+ # @return [Hash] Returns the object in the form of hash
505
+ def to_hash
506
+ hash = {}
507
+ self.class.attribute_map.each_pair do |attr, param|
508
+ value = self.send(attr)
509
+ if value.nil?
510
+ is_nullable = self.class.openapi_nullable.include?(attr)
511
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
512
+ end
513
+
514
+ hash[param] = _to_hash(value)
515
+ end
516
+ hash
517
+ end
518
+
519
+ # Outputs non-array value in the form of hash
520
+ # For object, use to_hash. Otherwise, just return the value
521
+ # @param [Object] value Any valid value
522
+ # @return [Hash] Returns the value in the form of hash
523
+ def _to_hash(value)
524
+ if value.is_a?(Array)
525
+ value.compact.map { |v| _to_hash(v) }
526
+ elsif value.is_a?(Hash)
527
+ {}.tap do |hash|
528
+ value.each { |k, v| hash[k] = _to_hash(v) }
529
+ end
530
+ elsif value.respond_to? :to_hash
531
+ value.to_hash
532
+ else
533
+ value
534
+ end
535
+ end
536
+
537
+ end
538
+
539
+ end