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,564 @@
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 rwd_us_network_projects dataset: one row per N3C project. A grouped request returns the group columns and the measures instead, as additional properties.
18
+ class RwdUsNetworkProjectsRow
19
+ # The N3C project id (a Data Use Request uid), the grain.
20
+ attr_accessor :project_id
21
+
22
+ # The network key, the entry key of the rwd_us_networks object type.
23
+ attr_accessor :network_key
24
+
25
+ # The project title as N3C publishes it.
26
+ attr_accessor :title
27
+
28
+ # The accessing institution as published.
29
+ attr_accessor :institution_name
30
+
31
+ # The normalized name key; joins to rwd_us_network_memberships.institution_name_key.
32
+ attr_accessor :institution_name_key
33
+
34
+ # Personal data: the principal investigator's name as N3C's public dashboard publishes it. Landed whole, tagged, never a gate (#5143).
35
+ attr_accessor :pi_name
36
+
37
+ # The project's workspace status as N3C publishes it.
38
+ attr_accessor :workspace_status
39
+
40
+ # The project type as N3C publishes it.
41
+ attr_accessor :project_type
42
+
43
+ # Whether N3C marks the project as a task team.
44
+ attr_accessor :is_task_team
45
+
46
+ # True wherever pi_name is populated. A tag, never a gate (#5143).
47
+ attr_accessor :contains_personal_data
48
+
49
+ # The personal-data columns of the row, as a JSON list: [\"pi_name\"].
50
+ attr_accessor :personal_data_fields
51
+
52
+ # The retrieval date of the roster snapshot.
53
+ attr_accessor :as_of
54
+
55
+ # The API endpoint the roster came from.
56
+ attr_accessor :source_url
57
+
58
+ # When the snapshot was retrieved, in UTC.
59
+ attr_accessor :retrieved_at
60
+
61
+ # The organization spine id of the accessing institution, or null. Carried, never minted.
62
+ attr_accessor :org_id
63
+
64
+ # The spine organization's name.
65
+ attr_accessor :org_name
66
+
67
+ # The bare ROR id N3C published for the institution where it is a network member; null otherwise.
68
+ attr_accessor :institution_ror_id
69
+
70
+ # How the institution reached the organization: ror_exact, xref, match_keys, ambiguous or unresolved.
71
+ attr_accessor :org_match_rung
72
+
73
+ # The tier of the organization match.
74
+ attr_accessor :org_match_tier
75
+
76
+ # The organization match confidence.
77
+ attr_accessor :org_match_confidence
78
+
79
+ # Whether the accessing institution itself holds a published agreement.
80
+ attr_accessor :institution_is_network_member
81
+
82
+ # A resolved person on the spine, by name plus organization; see pi_match_method. The entry key of the investigators object type; null when unresolved.
83
+ attr_accessor :pi_person_id
84
+
85
+ # How the PI was matched: name_org_spine (name and organization agreed with one spine person), name_org_reporter (a unique NIH RePORTER PI at the same organization), ambiguous (more than one candidate, never picked) or unresolved.
86
+ attr_accessor :pi_match_method
87
+
88
+ # False on every row: no shared trial or paper corroborates the name-plus-organization match.
89
+ attr_accessor :pi_corroborated
90
+
91
+ # NIH RePORTER's persistent PI_ID, an external key published as a labelled attribute, never as a resolved person; set where a unique RePORTER PI shares the name and organization.
92
+ attr_accessor :pi_reporter_pi_id
93
+
94
+ # On an ambiguous row, the number of distinct spine persons the evidence could not choose between; otherwise 0.
95
+ attr_accessor :candidate_person_count
96
+
97
+ # True on a name_org_spine row whose person the RePORTER arm also reached.
98
+ attr_accessor :also_matched_by_reporter
99
+
100
+ # Projects in the roster, the denominator of the resolution rate.
101
+ attr_accessor :project_total
102
+
103
+ # Projects whose institution resolved to a spine organization.
104
+ attr_accessor :projects_with_institution_on_spine
105
+
106
+ # Projects whose PI resolved to a spine person; over project_total it is the measured resolution rate.
107
+ attr_accessor :projects_with_resolved_pi
108
+
109
+ # Projects carrying a RePORTER PI_ID.
110
+ attr_accessor :projects_with_reporter_pi_id
111
+
112
+ # The credit line every surface carrying this data prints.
113
+ attr_accessor :attribution
114
+
115
+ # Attribute mapping from ruby-style variable name to JSON key.
116
+ def self.attribute_map
117
+ {
118
+ :'project_id' => :'project_id',
119
+ :'network_key' => :'network_key',
120
+ :'title' => :'title',
121
+ :'institution_name' => :'institution_name',
122
+ :'institution_name_key' => :'institution_name_key',
123
+ :'pi_name' => :'pi_name',
124
+ :'workspace_status' => :'workspace_status',
125
+ :'project_type' => :'project_type',
126
+ :'is_task_team' => :'is_task_team',
127
+ :'contains_personal_data' => :'contains_personal_data',
128
+ :'personal_data_fields' => :'personal_data_fields',
129
+ :'as_of' => :'as_of',
130
+ :'source_url' => :'source_url',
131
+ :'retrieved_at' => :'retrieved_at',
132
+ :'org_id' => :'org_id',
133
+ :'org_name' => :'org_name',
134
+ :'institution_ror_id' => :'institution_ror_id',
135
+ :'org_match_rung' => :'org_match_rung',
136
+ :'org_match_tier' => :'org_match_tier',
137
+ :'org_match_confidence' => :'org_match_confidence',
138
+ :'institution_is_network_member' => :'institution_is_network_member',
139
+ :'pi_person_id' => :'pi_person_id',
140
+ :'pi_match_method' => :'pi_match_method',
141
+ :'pi_corroborated' => :'pi_corroborated',
142
+ :'pi_reporter_pi_id' => :'pi_reporter_pi_id',
143
+ :'candidate_person_count' => :'candidate_person_count',
144
+ :'also_matched_by_reporter' => :'also_matched_by_reporter',
145
+ :'project_total' => :'project_total',
146
+ :'projects_with_institution_on_spine' => :'projects_with_institution_on_spine',
147
+ :'projects_with_resolved_pi' => :'projects_with_resolved_pi',
148
+ :'projects_with_reporter_pi_id' => :'projects_with_reporter_pi_id',
149
+ :'attribution' => :'attribution'
150
+ }
151
+ end
152
+
153
+ # Returns attribute mapping this model knows about
154
+ def self.acceptable_attribute_map
155
+ attribute_map
156
+ end
157
+
158
+ # Returns all the JSON keys this model knows about
159
+ def self.acceptable_attributes
160
+ acceptable_attribute_map.values
161
+ end
162
+
163
+ # Attribute type mapping.
164
+ def self.openapi_types
165
+ {
166
+ :'project_id' => :'String',
167
+ :'network_key' => :'String',
168
+ :'title' => :'String',
169
+ :'institution_name' => :'String',
170
+ :'institution_name_key' => :'String',
171
+ :'pi_name' => :'String',
172
+ :'workspace_status' => :'String',
173
+ :'project_type' => :'String',
174
+ :'is_task_team' => :'Boolean',
175
+ :'contains_personal_data' => :'Boolean',
176
+ :'personal_data_fields' => :'String',
177
+ :'as_of' => :'Date',
178
+ :'source_url' => :'String',
179
+ :'retrieved_at' => :'Time',
180
+ :'org_id' => :'String',
181
+ :'org_name' => :'String',
182
+ :'institution_ror_id' => :'String',
183
+ :'org_match_rung' => :'String',
184
+ :'org_match_tier' => :'String',
185
+ :'org_match_confidence' => :'Float',
186
+ :'institution_is_network_member' => :'Boolean',
187
+ :'pi_person_id' => :'String',
188
+ :'pi_match_method' => :'String',
189
+ :'pi_corroborated' => :'Boolean',
190
+ :'pi_reporter_pi_id' => :'String',
191
+ :'candidate_person_count' => :'Integer',
192
+ :'also_matched_by_reporter' => :'Boolean',
193
+ :'project_total' => :'Integer',
194
+ :'projects_with_institution_on_spine' => :'Integer',
195
+ :'projects_with_resolved_pi' => :'Integer',
196
+ :'projects_with_reporter_pi_id' => :'Integer',
197
+ :'attribution' => :'String'
198
+ }
199
+ end
200
+
201
+ # List of attributes with nullable: true
202
+ def self.openapi_nullable
203
+ Set.new([
204
+ :'project_id',
205
+ :'network_key',
206
+ :'title',
207
+ :'institution_name',
208
+ :'institution_name_key',
209
+ :'pi_name',
210
+ :'workspace_status',
211
+ :'project_type',
212
+ :'is_task_team',
213
+ :'contains_personal_data',
214
+ :'personal_data_fields',
215
+ :'as_of',
216
+ :'source_url',
217
+ :'retrieved_at',
218
+ :'org_id',
219
+ :'org_name',
220
+ :'institution_ror_id',
221
+ :'org_match_rung',
222
+ :'org_match_tier',
223
+ :'org_match_confidence',
224
+ :'institution_is_network_member',
225
+ :'pi_person_id',
226
+ :'pi_match_method',
227
+ :'pi_corroborated',
228
+ :'pi_reporter_pi_id',
229
+ :'candidate_person_count',
230
+ :'also_matched_by_reporter',
231
+ :'project_total',
232
+ :'projects_with_institution_on_spine',
233
+ :'projects_with_resolved_pi',
234
+ :'projects_with_reporter_pi_id',
235
+ :'attribution'
236
+ ])
237
+ end
238
+
239
+ # Initializes the object
240
+ # @param [Hash] attributes Model attributes in the form of hash
241
+ def initialize(attributes = {})
242
+ if (!attributes.is_a?(Hash))
243
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PharmaObservatory::RwdUsNetworkProjectsRow` initialize method"
244
+ end
245
+
246
+ # check to see if the attribute exists and convert string to symbol for hash key
247
+ acceptable_attribute_map = self.class.acceptable_attribute_map
248
+ attributes = attributes.each_with_object({}) { |(k, v), h|
249
+ if (!acceptable_attribute_map.key?(k.to_sym))
250
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PharmaObservatory::RwdUsNetworkProjectsRow`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
251
+ end
252
+ h[k.to_sym] = v
253
+ }
254
+
255
+ if attributes.key?(:'project_id')
256
+ self.project_id = attributes[:'project_id']
257
+ end
258
+
259
+ if attributes.key?(:'network_key')
260
+ self.network_key = attributes[:'network_key']
261
+ end
262
+
263
+ if attributes.key?(:'title')
264
+ self.title = attributes[:'title']
265
+ end
266
+
267
+ if attributes.key?(:'institution_name')
268
+ self.institution_name = attributes[:'institution_name']
269
+ end
270
+
271
+ if attributes.key?(:'institution_name_key')
272
+ self.institution_name_key = attributes[:'institution_name_key']
273
+ end
274
+
275
+ if attributes.key?(:'pi_name')
276
+ self.pi_name = attributes[:'pi_name']
277
+ end
278
+
279
+ if attributes.key?(:'workspace_status')
280
+ self.workspace_status = attributes[:'workspace_status']
281
+ end
282
+
283
+ if attributes.key?(:'project_type')
284
+ self.project_type = attributes[:'project_type']
285
+ end
286
+
287
+ if attributes.key?(:'is_task_team')
288
+ self.is_task_team = attributes[:'is_task_team']
289
+ end
290
+
291
+ if attributes.key?(:'contains_personal_data')
292
+ self.contains_personal_data = attributes[:'contains_personal_data']
293
+ end
294
+
295
+ if attributes.key?(:'personal_data_fields')
296
+ self.personal_data_fields = attributes[:'personal_data_fields']
297
+ end
298
+
299
+ if attributes.key?(:'as_of')
300
+ self.as_of = attributes[:'as_of']
301
+ end
302
+
303
+ if attributes.key?(:'source_url')
304
+ self.source_url = attributes[:'source_url']
305
+ end
306
+
307
+ if attributes.key?(:'retrieved_at')
308
+ self.retrieved_at = attributes[:'retrieved_at']
309
+ end
310
+
311
+ if attributes.key?(:'org_id')
312
+ self.org_id = attributes[:'org_id']
313
+ end
314
+
315
+ if attributes.key?(:'org_name')
316
+ self.org_name = attributes[:'org_name']
317
+ end
318
+
319
+ if attributes.key?(:'institution_ror_id')
320
+ self.institution_ror_id = attributes[:'institution_ror_id']
321
+ end
322
+
323
+ if attributes.key?(:'org_match_rung')
324
+ self.org_match_rung = attributes[:'org_match_rung']
325
+ end
326
+
327
+ if attributes.key?(:'org_match_tier')
328
+ self.org_match_tier = attributes[:'org_match_tier']
329
+ end
330
+
331
+ if attributes.key?(:'org_match_confidence')
332
+ self.org_match_confidence = attributes[:'org_match_confidence']
333
+ end
334
+
335
+ if attributes.key?(:'institution_is_network_member')
336
+ self.institution_is_network_member = attributes[:'institution_is_network_member']
337
+ end
338
+
339
+ if attributes.key?(:'pi_person_id')
340
+ self.pi_person_id = attributes[:'pi_person_id']
341
+ end
342
+
343
+ if attributes.key?(:'pi_match_method')
344
+ self.pi_match_method = attributes[:'pi_match_method']
345
+ end
346
+
347
+ if attributes.key?(:'pi_corroborated')
348
+ self.pi_corroborated = attributes[:'pi_corroborated']
349
+ end
350
+
351
+ if attributes.key?(:'pi_reporter_pi_id')
352
+ self.pi_reporter_pi_id = attributes[:'pi_reporter_pi_id']
353
+ end
354
+
355
+ if attributes.key?(:'candidate_person_count')
356
+ self.candidate_person_count = attributes[:'candidate_person_count']
357
+ end
358
+
359
+ if attributes.key?(:'also_matched_by_reporter')
360
+ self.also_matched_by_reporter = attributes[:'also_matched_by_reporter']
361
+ end
362
+
363
+ if attributes.key?(:'project_total')
364
+ self.project_total = attributes[:'project_total']
365
+ end
366
+
367
+ if attributes.key?(:'projects_with_institution_on_spine')
368
+ self.projects_with_institution_on_spine = attributes[:'projects_with_institution_on_spine']
369
+ end
370
+
371
+ if attributes.key?(:'projects_with_resolved_pi')
372
+ self.projects_with_resolved_pi = attributes[:'projects_with_resolved_pi']
373
+ end
374
+
375
+ if attributes.key?(:'projects_with_reporter_pi_id')
376
+ self.projects_with_reporter_pi_id = attributes[:'projects_with_reporter_pi_id']
377
+ end
378
+
379
+ if attributes.key?(:'attribution')
380
+ self.attribution = attributes[:'attribution']
381
+ end
382
+ end
383
+
384
+ # Show invalid properties with the reasons. Usually used together with valid?
385
+ # @return Array for valid properties with the reasons
386
+ def list_invalid_properties
387
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
388
+ invalid_properties = Array.new
389
+ invalid_properties
390
+ end
391
+
392
+ # Check to see if the all the properties in the model are valid
393
+ # @return true if the model is valid
394
+ def valid?
395
+ warn '[DEPRECATED] the `valid?` method is obsolete'
396
+ true
397
+ end
398
+
399
+ # Checks equality by comparing each attribute.
400
+ # @param [Object] Object to be compared
401
+ def ==(o)
402
+ return true if self.equal?(o)
403
+ self.class == o.class &&
404
+ project_id == o.project_id &&
405
+ network_key == o.network_key &&
406
+ title == o.title &&
407
+ institution_name == o.institution_name &&
408
+ institution_name_key == o.institution_name_key &&
409
+ pi_name == o.pi_name &&
410
+ workspace_status == o.workspace_status &&
411
+ project_type == o.project_type &&
412
+ is_task_team == o.is_task_team &&
413
+ contains_personal_data == o.contains_personal_data &&
414
+ personal_data_fields == o.personal_data_fields &&
415
+ as_of == o.as_of &&
416
+ source_url == o.source_url &&
417
+ retrieved_at == o.retrieved_at &&
418
+ org_id == o.org_id &&
419
+ org_name == o.org_name &&
420
+ institution_ror_id == o.institution_ror_id &&
421
+ org_match_rung == o.org_match_rung &&
422
+ org_match_tier == o.org_match_tier &&
423
+ org_match_confidence == o.org_match_confidence &&
424
+ institution_is_network_member == o.institution_is_network_member &&
425
+ pi_person_id == o.pi_person_id &&
426
+ pi_match_method == o.pi_match_method &&
427
+ pi_corroborated == o.pi_corroborated &&
428
+ pi_reporter_pi_id == o.pi_reporter_pi_id &&
429
+ candidate_person_count == o.candidate_person_count &&
430
+ also_matched_by_reporter == o.also_matched_by_reporter &&
431
+ project_total == o.project_total &&
432
+ projects_with_institution_on_spine == o.projects_with_institution_on_spine &&
433
+ projects_with_resolved_pi == o.projects_with_resolved_pi &&
434
+ projects_with_reporter_pi_id == o.projects_with_reporter_pi_id &&
435
+ attribution == o.attribution
436
+ end
437
+
438
+ # @see the `==` method
439
+ # @param [Object] Object to be compared
440
+ def eql?(o)
441
+ self == o
442
+ end
443
+
444
+ # Calculates hash code according to all attributes.
445
+ # @return [Integer] Hash code
446
+ def hash
447
+ [project_id, network_key, title, institution_name, institution_name_key, pi_name, workspace_status, project_type, is_task_team, contains_personal_data, personal_data_fields, as_of, source_url, retrieved_at, org_id, org_name, institution_ror_id, org_match_rung, org_match_tier, org_match_confidence, institution_is_network_member, pi_person_id, pi_match_method, pi_corroborated, pi_reporter_pi_id, candidate_person_count, also_matched_by_reporter, project_total, projects_with_institution_on_spine, projects_with_resolved_pi, projects_with_reporter_pi_id, attribution].hash
448
+ end
449
+
450
+ # Builds the object from hash
451
+ # @param [Hash] attributes Model attributes in the form of hash
452
+ # @return [Object] Returns the model itself
453
+ def self.build_from_hash(attributes)
454
+ return nil unless attributes.is_a?(Hash)
455
+ attributes = attributes.transform_keys(&:to_sym)
456
+ transformed_hash = {}
457
+ openapi_types.each_pair do |key, type|
458
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
459
+ transformed_hash["#{key}"] = nil
460
+ elsif type =~ /\AArray<(.*)>/i
461
+ # check to ensure the input is an array given that the attribute
462
+ # is documented as an array but the input is not
463
+ if attributes[attribute_map[key]].is_a?(Array)
464
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
465
+ end
466
+ elsif !attributes[attribute_map[key]].nil?
467
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
468
+ end
469
+ end
470
+ new(transformed_hash)
471
+ end
472
+
473
+ # Deserializes the data based on type
474
+ # @param string type Data type
475
+ # @param string value Value to be deserialized
476
+ # @return [Object] Deserialized data
477
+ def self._deserialize(type, value)
478
+ case type.to_sym
479
+ when :Time
480
+ Time.parse(value)
481
+ when :Date
482
+ Date.parse(value)
483
+ when :String
484
+ value.to_s
485
+ when :Integer
486
+ value.to_i
487
+ when :Float
488
+ value.to_f
489
+ when :Boolean
490
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
491
+ true
492
+ else
493
+ false
494
+ end
495
+ when :Object
496
+ # generic object (usually a Hash), return directly
497
+ value
498
+ when /\AArray<(?<inner_type>.+)>\z/
499
+ inner_type = Regexp.last_match[:inner_type]
500
+ value.map { |v| _deserialize(inner_type, v) }
501
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
502
+ k_type = Regexp.last_match[:k_type]
503
+ v_type = Regexp.last_match[:v_type]
504
+ {}.tap do |hash|
505
+ value.each do |k, v|
506
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
507
+ end
508
+ end
509
+ else # model
510
+ # models (e.g. Pet) or oneOf
511
+ klass = PharmaObservatory.const_get(type)
512
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
513
+ end
514
+ end
515
+
516
+ # Returns the string representation of the object
517
+ # @return [String] String presentation of the object
518
+ def to_s
519
+ to_hash.to_s
520
+ end
521
+
522
+ # to_body is an alias to to_hash (backward compatibility)
523
+ # @return [Hash] Returns the object in the form of hash
524
+ def to_body
525
+ to_hash
526
+ end
527
+
528
+ # Returns the object in the form of hash
529
+ # @return [Hash] Returns the object in the form of hash
530
+ def to_hash
531
+ hash = {}
532
+ self.class.attribute_map.each_pair do |attr, param|
533
+ value = self.send(attr)
534
+ if value.nil?
535
+ is_nullable = self.class.openapi_nullable.include?(attr)
536
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
537
+ end
538
+
539
+ hash[param] = _to_hash(value)
540
+ end
541
+ hash
542
+ end
543
+
544
+ # Outputs non-array value in the form of hash
545
+ # For object, use to_hash. Otherwise, just return the value
546
+ # @param [Object] value Any valid value
547
+ # @return [Hash] Returns the value in the form of hash
548
+ def _to_hash(value)
549
+ if value.is_a?(Array)
550
+ value.compact.map { |v| _to_hash(v) }
551
+ elsif value.is_a?(Hash)
552
+ {}.tap do |hash|
553
+ value.each { |k, v| hash[k] = _to_hash(v) }
554
+ end
555
+ elsif value.respond_to? :to_hash
556
+ value.to_hash
557
+ else
558
+ value
559
+ end
560
+ end
561
+
562
+ end
563
+
564
+ end