pharmaobservatory 0.1.20 → 0.1.21

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 (37) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +26 -4
  3. data/docs/BiomarkersApi.md +80 -0
  4. data/docs/CompaniesApi.md +246 -0
  5. data/docs/HospitalsRow.md +11 -1
  6. data/docs/InvestmentGraphEdgesResponse.md +58 -0
  7. data/docs/InvestmentGraphEdgesRow.md +90 -0
  8. data/docs/InvestmentGraphNodeEdgesResponse.md +58 -0
  9. data/docs/InvestmentGraphNodeEdgesRow.md +88 -0
  10. data/docs/InvestmentGraphNodesResponse.md +58 -0
  11. data/docs/InvestmentGraphNodesRow.md +52 -0
  12. data/docs/InvestorsApi.md +240 -0
  13. data/docs/LegalEntitiesApi.md +240 -0
  14. data/docs/ProviderBiomarkerCapabilityResponse.md +58 -0
  15. data/docs/ProviderBiomarkerCapabilityRow.md +86 -0
  16. data/docs/ProviderCliaLicensureResponse.md +58 -0
  17. data/docs/ProviderCliaLicensureRow.md +80 -0
  18. data/docs/SuppliersApi.md +160 -0
  19. data/lib/pharmaobservatory/api/biomarkers_api.rb +84 -0
  20. data/lib/pharmaobservatory/api/companies_api.rb +273 -0
  21. data/lib/pharmaobservatory/api/investors_api.rb +252 -0
  22. data/lib/pharmaobservatory/api/legal_entities_api.rb +252 -0
  23. data/lib/pharmaobservatory/api/suppliers_api.rb +168 -0
  24. data/lib/pharmaobservatory/models/hospitals_row.rb +60 -5
  25. data/lib/pharmaobservatory/models/investment_graph_edges_response.rb +478 -0
  26. data/lib/pharmaobservatory/models/investment_graph_edges_row.rb +619 -0
  27. data/lib/pharmaobservatory/models/investment_graph_node_edges_response.rb +478 -0
  28. data/lib/pharmaobservatory/models/investment_graph_node_edges_row.rb +608 -0
  29. data/lib/pharmaobservatory/models/investment_graph_nodes_response.rb +478 -0
  30. data/lib/pharmaobservatory/models/investment_graph_nodes_row.rb +412 -0
  31. data/lib/pharmaobservatory/models/provider_biomarker_capability_response.rb +478 -0
  32. data/lib/pharmaobservatory/models/provider_biomarker_capability_row.rb +601 -0
  33. data/lib/pharmaobservatory/models/provider_clia_licensure_response.rb +478 -0
  34. data/lib/pharmaobservatory/models/provider_clia_licensure_row.rb +568 -0
  35. data/lib/pharmaobservatory/version.rb +1 -1
  36. data/lib/pharmaobservatory.rb +10 -0
  37. metadata +22 -2
@@ -0,0 +1,619 @@
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 investment_graph_edges dataset: one row per directed edge: from node, to node, edge type, source and source reference. A grouped request returns the group columns and the measures instead, as additional properties.
18
+ class InvestmentGraphEdgesRow
19
+ # The stable handle of one edge row: md5 of from_node_id, to_node_id, edge_type, source and source_ref.
20
+ attr_accessor :edge_key
21
+
22
+ # The node the edge starts at: an investor id or a company id (the resolved parent organization, or investor_site: and the normalized name for a website-only company the organization spine has not admitted).
23
+ attr_accessor :from_node_id
24
+
25
+ # The node the edge ends at. Same id forms as from_node_id. invested_in goes from an investor to a company; co_invested is stored in both directions between investors.
26
+ attr_accessor :to_node_id
27
+
28
+ # The investor key when the from node is an investor (every edge today), null otherwise.
29
+ attr_accessor :from_investor_id
30
+
31
+ # The investor key when the to node is an investor (a co_invested edge), null otherwise.
32
+ attr_accessor :to_investor_id
33
+
34
+ # invested_in, co_invested, acquired, merged_with or licensed. acquired, merged_with and licensed have no rows until the M&A events dataset lands. There is no exited type: a listing that disappears from a website is never an end.
35
+ attr_accessor :edge_type
36
+
37
+ # The lane's own word for the relationship, so a public-market holding is never read as a venture round: portfolio_listed (investor website), holder_5pct and selling_stockholder (offering holder tables), institutional_position (13F), beneficial_owner (13D/G), co_appearance (co_invested).
38
+ attr_accessor :relationship_type
39
+
40
+ # The lane that states the edge: investor_site, sec_edgar_holder_table (also the lane of the derived co_invested edges), sec_13f, sec_13dg, sec_form_d, sec_8k, company_press_release or reconciled. sec_form_d, sec_8k and company_press_release have no rows yet; reconciled carries the press-release and SEC deal metadata for the pairs it enriches and is the preferred lane of such a pair.
41
+ attr_accessor :source
42
+
43
+ # The evidence key within the lane: the portfolio company key for the website and holder-table lanes, the ownership observation id for 13F and 13D/G, and the literal co_invested_pairs for a derived co-investment.
44
+ attr_accessor :source_ref
45
+
46
+ # The page the edge was read from. Null for a derived co_invested edge, which has no page of its own.
47
+ attr_accessor :source_url
48
+
49
+ # The date the lane states, of the kind in event_date_kind. Null exactly when event_date_kind is unknown.
50
+ attr_accessor :event_date
51
+
52
+ # What event_date is: transaction (a date the lane states for the deal itself), announcement, filing (the filing date), as_of (a report period end, as 13F states), form_d_filing (the filing date of a Form D offering by the company, never an investment date), first_observed (the first crawl that saw a website listing, never an investment date) or unknown (no date, event_date null).
53
+ attr_accessor :event_date_kind
54
+
55
+ # The latest date the relationship was still observed in the lane (the last crawl, the last filing). Null when the lane gives none. Not an end date.
56
+ attr_accessor :observed_through
57
+
58
+ # Where a deal stands (announced, signed, closed, completed or terminated), so an announced acquisition is never drawn as a completed one. Null for every lane today.
59
+ attr_accessor :event_stage
60
+
61
+ # The funding round named by the company's own press release (reconciled lane); null for every lane that does not state one.
62
+ attr_accessor :round_label
63
+
64
+ # The ROUND amount in amount_currency, never the investor's own cheque (reconciled lane): the press-release round total, else the amount sold in a Form D offering. Null for every lane that does not state one.
65
+ attr_accessor :amount_value
66
+
67
+ # The currency of amount_value as the source states it, never defaulted to USD. Null while amount_value is null.
68
+ attr_accessor :amount_currency
69
+
70
+ # Whether the investor led or co-led the round per the company's press release (reconciled lane): true for lead or co-lead, false for a named participant, null where the role is unstated or the lane does not state it.
71
+ attr_accessor :is_lead
72
+
73
+ # For a derived co_invested edge, the companies the two investors are both named against in offering filings. Null for every other edge.
74
+ attr_accessor :shared_company_count
75
+
76
+ # True for an edge computed from other rows (co_invested), false for an edge a source states.
77
+ attr_accessor :is_derived
78
+
79
+ # from_node_id, to_node_id and edge_type joined with a pipe: every lane that states the same relationship shares one pair_key.
80
+ attr_accessor :pair_key
81
+
82
+ # The lane's precedence when several lanes state one pair (lower wins): 13D/G 1, 13F 2, offering filings and derived co-investment 3, investor website 7.
83
+ attr_accessor :lane_rank
84
+
85
+ # True on exactly one row per pair_key, the lowest lane_rank (then the latest event_date): the row a picture draws. The other rows stay as evidence.
86
+ attr_accessor :is_preferred
87
+
88
+ # The license class of the lane: public_domain_us_government or first_party_website_facts.
89
+ attr_accessor :source_license
90
+
91
+ # The plain credit line for the lane. Show it with the edge for every reader.
92
+ attr_accessor :attribution
93
+
94
+ # Display name of the from node.
95
+ attr_accessor :from_name
96
+
97
+ # Legal-entity level: the from node's organization record (null for an investor with none and for an unadmitted website-only company).
98
+ attr_accessor :from_org_id
99
+
100
+ # Company level: the from node's company record (null where unresolved).
101
+ attr_accessor :from_company_id
102
+
103
+ # Display name of the from node's company.
104
+ attr_accessor :from_company_name
105
+
106
+ # Group level: the from node's company's current ultimate parent; a root's group is itself.
107
+ attr_accessor :from_group_id
108
+
109
+ # Display name of the from node's group.
110
+ attr_accessor :from_group_name
111
+
112
+ # Display name of the to node.
113
+ attr_accessor :to_name
114
+
115
+ # Legal-entity level: the to node's organization record (null for an investor with none and for an unadmitted website-only company).
116
+ attr_accessor :to_org_id
117
+
118
+ # Company level: the to node's company record (null where unresolved).
119
+ attr_accessor :to_company_id
120
+
121
+ # Display name of the to node's company.
122
+ attr_accessor :to_company_name
123
+
124
+ # Group level: the to node's company's current ultimate parent; a root's group is itself.
125
+ attr_accessor :to_group_id
126
+
127
+ # Display name of the to node's group.
128
+ attr_accessor :to_group_name
129
+
130
+ # Attribute mapping from ruby-style variable name to JSON key.
131
+ def self.attribute_map
132
+ {
133
+ :'edge_key' => :'edge_key',
134
+ :'from_node_id' => :'from_node_id',
135
+ :'to_node_id' => :'to_node_id',
136
+ :'from_investor_id' => :'from_investor_id',
137
+ :'to_investor_id' => :'to_investor_id',
138
+ :'edge_type' => :'edge_type',
139
+ :'relationship_type' => :'relationship_type',
140
+ :'source' => :'source',
141
+ :'source_ref' => :'source_ref',
142
+ :'source_url' => :'source_url',
143
+ :'event_date' => :'event_date',
144
+ :'event_date_kind' => :'event_date_kind',
145
+ :'observed_through' => :'observed_through',
146
+ :'event_stage' => :'event_stage',
147
+ :'round_label' => :'round_label',
148
+ :'amount_value' => :'amount_value',
149
+ :'amount_currency' => :'amount_currency',
150
+ :'is_lead' => :'is_lead',
151
+ :'shared_company_count' => :'shared_company_count',
152
+ :'is_derived' => :'is_derived',
153
+ :'pair_key' => :'pair_key',
154
+ :'lane_rank' => :'lane_rank',
155
+ :'is_preferred' => :'is_preferred',
156
+ :'source_license' => :'source_license',
157
+ :'attribution' => :'attribution',
158
+ :'from_name' => :'from_name',
159
+ :'from_org_id' => :'from_org_id',
160
+ :'from_company_id' => :'from_company_id',
161
+ :'from_company_name' => :'from_company_name',
162
+ :'from_group_id' => :'from_group_id',
163
+ :'from_group_name' => :'from_group_name',
164
+ :'to_name' => :'to_name',
165
+ :'to_org_id' => :'to_org_id',
166
+ :'to_company_id' => :'to_company_id',
167
+ :'to_company_name' => :'to_company_name',
168
+ :'to_group_id' => :'to_group_id',
169
+ :'to_group_name' => :'to_group_name'
170
+ }
171
+ end
172
+
173
+ # Returns attribute mapping this model knows about
174
+ def self.acceptable_attribute_map
175
+ attribute_map
176
+ end
177
+
178
+ # Returns all the JSON keys this model knows about
179
+ def self.acceptable_attributes
180
+ acceptable_attribute_map.values
181
+ end
182
+
183
+ # Attribute type mapping.
184
+ def self.openapi_types
185
+ {
186
+ :'edge_key' => :'String',
187
+ :'from_node_id' => :'String',
188
+ :'to_node_id' => :'String',
189
+ :'from_investor_id' => :'String',
190
+ :'to_investor_id' => :'String',
191
+ :'edge_type' => :'String',
192
+ :'relationship_type' => :'String',
193
+ :'source' => :'String',
194
+ :'source_ref' => :'String',
195
+ :'source_url' => :'String',
196
+ :'event_date' => :'Date',
197
+ :'event_date_kind' => :'String',
198
+ :'observed_through' => :'Date',
199
+ :'event_stage' => :'String',
200
+ :'round_label' => :'String',
201
+ :'amount_value' => :'Float',
202
+ :'amount_currency' => :'String',
203
+ :'is_lead' => :'Boolean',
204
+ :'shared_company_count' => :'Integer',
205
+ :'is_derived' => :'Boolean',
206
+ :'pair_key' => :'String',
207
+ :'lane_rank' => :'Integer',
208
+ :'is_preferred' => :'Boolean',
209
+ :'source_license' => :'String',
210
+ :'attribution' => :'String',
211
+ :'from_name' => :'String',
212
+ :'from_org_id' => :'String',
213
+ :'from_company_id' => :'String',
214
+ :'from_company_name' => :'String',
215
+ :'from_group_id' => :'String',
216
+ :'from_group_name' => :'String',
217
+ :'to_name' => :'String',
218
+ :'to_org_id' => :'String',
219
+ :'to_company_id' => :'String',
220
+ :'to_company_name' => :'String',
221
+ :'to_group_id' => :'String',
222
+ :'to_group_name' => :'String'
223
+ }
224
+ end
225
+
226
+ # List of attributes with nullable: true
227
+ def self.openapi_nullable
228
+ Set.new([
229
+ :'edge_key',
230
+ :'from_node_id',
231
+ :'to_node_id',
232
+ :'from_investor_id',
233
+ :'to_investor_id',
234
+ :'edge_type',
235
+ :'relationship_type',
236
+ :'source',
237
+ :'source_ref',
238
+ :'source_url',
239
+ :'event_date',
240
+ :'event_date_kind',
241
+ :'observed_through',
242
+ :'event_stage',
243
+ :'round_label',
244
+ :'amount_value',
245
+ :'amount_currency',
246
+ :'is_lead',
247
+ :'shared_company_count',
248
+ :'is_derived',
249
+ :'pair_key',
250
+ :'lane_rank',
251
+ :'is_preferred',
252
+ :'source_license',
253
+ :'attribution',
254
+ :'from_name',
255
+ :'from_org_id',
256
+ :'from_company_id',
257
+ :'from_company_name',
258
+ :'from_group_id',
259
+ :'from_group_name',
260
+ :'to_name',
261
+ :'to_org_id',
262
+ :'to_company_id',
263
+ :'to_company_name',
264
+ :'to_group_id',
265
+ :'to_group_name'
266
+ ])
267
+ end
268
+
269
+ # Initializes the object
270
+ # @param [Hash] attributes Model attributes in the form of hash
271
+ def initialize(attributes = {})
272
+ if (!attributes.is_a?(Hash))
273
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PharmaObservatory::InvestmentGraphEdgesRow` initialize method"
274
+ end
275
+
276
+ # check to see if the attribute exists and convert string to symbol for hash key
277
+ acceptable_attribute_map = self.class.acceptable_attribute_map
278
+ attributes = attributes.each_with_object({}) { |(k, v), h|
279
+ if (!acceptable_attribute_map.key?(k.to_sym))
280
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PharmaObservatory::InvestmentGraphEdgesRow`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
281
+ end
282
+ h[k.to_sym] = v
283
+ }
284
+
285
+ if attributes.key?(:'edge_key')
286
+ self.edge_key = attributes[:'edge_key']
287
+ end
288
+
289
+ if attributes.key?(:'from_node_id')
290
+ self.from_node_id = attributes[:'from_node_id']
291
+ end
292
+
293
+ if attributes.key?(:'to_node_id')
294
+ self.to_node_id = attributes[:'to_node_id']
295
+ end
296
+
297
+ if attributes.key?(:'from_investor_id')
298
+ self.from_investor_id = attributes[:'from_investor_id']
299
+ end
300
+
301
+ if attributes.key?(:'to_investor_id')
302
+ self.to_investor_id = attributes[:'to_investor_id']
303
+ end
304
+
305
+ if attributes.key?(:'edge_type')
306
+ self.edge_type = attributes[:'edge_type']
307
+ end
308
+
309
+ if attributes.key?(:'relationship_type')
310
+ self.relationship_type = attributes[:'relationship_type']
311
+ end
312
+
313
+ if attributes.key?(:'source')
314
+ self.source = attributes[:'source']
315
+ end
316
+
317
+ if attributes.key?(:'source_ref')
318
+ self.source_ref = attributes[:'source_ref']
319
+ end
320
+
321
+ if attributes.key?(:'source_url')
322
+ self.source_url = attributes[:'source_url']
323
+ end
324
+
325
+ if attributes.key?(:'event_date')
326
+ self.event_date = attributes[:'event_date']
327
+ end
328
+
329
+ if attributes.key?(:'event_date_kind')
330
+ self.event_date_kind = attributes[:'event_date_kind']
331
+ end
332
+
333
+ if attributes.key?(:'observed_through')
334
+ self.observed_through = attributes[:'observed_through']
335
+ end
336
+
337
+ if attributes.key?(:'event_stage')
338
+ self.event_stage = attributes[:'event_stage']
339
+ end
340
+
341
+ if attributes.key?(:'round_label')
342
+ self.round_label = attributes[:'round_label']
343
+ end
344
+
345
+ if attributes.key?(:'amount_value')
346
+ self.amount_value = attributes[:'amount_value']
347
+ end
348
+
349
+ if attributes.key?(:'amount_currency')
350
+ self.amount_currency = attributes[:'amount_currency']
351
+ end
352
+
353
+ if attributes.key?(:'is_lead')
354
+ self.is_lead = attributes[:'is_lead']
355
+ end
356
+
357
+ if attributes.key?(:'shared_company_count')
358
+ self.shared_company_count = attributes[:'shared_company_count']
359
+ end
360
+
361
+ if attributes.key?(:'is_derived')
362
+ self.is_derived = attributes[:'is_derived']
363
+ end
364
+
365
+ if attributes.key?(:'pair_key')
366
+ self.pair_key = attributes[:'pair_key']
367
+ end
368
+
369
+ if attributes.key?(:'lane_rank')
370
+ self.lane_rank = attributes[:'lane_rank']
371
+ end
372
+
373
+ if attributes.key?(:'is_preferred')
374
+ self.is_preferred = attributes[:'is_preferred']
375
+ end
376
+
377
+ if attributes.key?(:'source_license')
378
+ self.source_license = attributes[:'source_license']
379
+ end
380
+
381
+ if attributes.key?(:'attribution')
382
+ self.attribution = attributes[:'attribution']
383
+ end
384
+
385
+ if attributes.key?(:'from_name')
386
+ self.from_name = attributes[:'from_name']
387
+ end
388
+
389
+ if attributes.key?(:'from_org_id')
390
+ self.from_org_id = attributes[:'from_org_id']
391
+ end
392
+
393
+ if attributes.key?(:'from_company_id')
394
+ self.from_company_id = attributes[:'from_company_id']
395
+ end
396
+
397
+ if attributes.key?(:'from_company_name')
398
+ self.from_company_name = attributes[:'from_company_name']
399
+ end
400
+
401
+ if attributes.key?(:'from_group_id')
402
+ self.from_group_id = attributes[:'from_group_id']
403
+ end
404
+
405
+ if attributes.key?(:'from_group_name')
406
+ self.from_group_name = attributes[:'from_group_name']
407
+ end
408
+
409
+ if attributes.key?(:'to_name')
410
+ self.to_name = attributes[:'to_name']
411
+ end
412
+
413
+ if attributes.key?(:'to_org_id')
414
+ self.to_org_id = attributes[:'to_org_id']
415
+ end
416
+
417
+ if attributes.key?(:'to_company_id')
418
+ self.to_company_id = attributes[:'to_company_id']
419
+ end
420
+
421
+ if attributes.key?(:'to_company_name')
422
+ self.to_company_name = attributes[:'to_company_name']
423
+ end
424
+
425
+ if attributes.key?(:'to_group_id')
426
+ self.to_group_id = attributes[:'to_group_id']
427
+ end
428
+
429
+ if attributes.key?(:'to_group_name')
430
+ self.to_group_name = attributes[:'to_group_name']
431
+ end
432
+ end
433
+
434
+ # Show invalid properties with the reasons. Usually used together with valid?
435
+ # @return Array for valid properties with the reasons
436
+ def list_invalid_properties
437
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
438
+ invalid_properties = Array.new
439
+ invalid_properties
440
+ end
441
+
442
+ # Check to see if the all the properties in the model are valid
443
+ # @return true if the model is valid
444
+ def valid?
445
+ warn '[DEPRECATED] the `valid?` method is obsolete'
446
+ true
447
+ end
448
+
449
+ # Checks equality by comparing each attribute.
450
+ # @param [Object] Object to be compared
451
+ def ==(o)
452
+ return true if self.equal?(o)
453
+ self.class == o.class &&
454
+ edge_key == o.edge_key &&
455
+ from_node_id == o.from_node_id &&
456
+ to_node_id == o.to_node_id &&
457
+ from_investor_id == o.from_investor_id &&
458
+ to_investor_id == o.to_investor_id &&
459
+ edge_type == o.edge_type &&
460
+ relationship_type == o.relationship_type &&
461
+ source == o.source &&
462
+ source_ref == o.source_ref &&
463
+ source_url == o.source_url &&
464
+ event_date == o.event_date &&
465
+ event_date_kind == o.event_date_kind &&
466
+ observed_through == o.observed_through &&
467
+ event_stage == o.event_stage &&
468
+ round_label == o.round_label &&
469
+ amount_value == o.amount_value &&
470
+ amount_currency == o.amount_currency &&
471
+ is_lead == o.is_lead &&
472
+ shared_company_count == o.shared_company_count &&
473
+ is_derived == o.is_derived &&
474
+ pair_key == o.pair_key &&
475
+ lane_rank == o.lane_rank &&
476
+ is_preferred == o.is_preferred &&
477
+ source_license == o.source_license &&
478
+ attribution == o.attribution &&
479
+ from_name == o.from_name &&
480
+ from_org_id == o.from_org_id &&
481
+ from_company_id == o.from_company_id &&
482
+ from_company_name == o.from_company_name &&
483
+ from_group_id == o.from_group_id &&
484
+ from_group_name == o.from_group_name &&
485
+ to_name == o.to_name &&
486
+ to_org_id == o.to_org_id &&
487
+ to_company_id == o.to_company_id &&
488
+ to_company_name == o.to_company_name &&
489
+ to_group_id == o.to_group_id &&
490
+ to_group_name == o.to_group_name
491
+ end
492
+
493
+ # @see the `==` method
494
+ # @param [Object] Object to be compared
495
+ def eql?(o)
496
+ self == o
497
+ end
498
+
499
+ # Calculates hash code according to all attributes.
500
+ # @return [Integer] Hash code
501
+ def hash
502
+ [edge_key, from_node_id, to_node_id, from_investor_id, to_investor_id, edge_type, relationship_type, source, source_ref, source_url, event_date, event_date_kind, observed_through, event_stage, round_label, amount_value, amount_currency, is_lead, shared_company_count, is_derived, pair_key, lane_rank, is_preferred, source_license, attribution, from_name, from_org_id, from_company_id, from_company_name, from_group_id, from_group_name, to_name, to_org_id, to_company_id, to_company_name, to_group_id, to_group_name].hash
503
+ end
504
+
505
+ # Builds the object from hash
506
+ # @param [Hash] attributes Model attributes in the form of hash
507
+ # @return [Object] Returns the model itself
508
+ def self.build_from_hash(attributes)
509
+ return nil unless attributes.is_a?(Hash)
510
+ attributes = attributes.transform_keys(&:to_sym)
511
+ transformed_hash = {}
512
+ openapi_types.each_pair do |key, type|
513
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
514
+ transformed_hash["#{key}"] = nil
515
+ elsif type =~ /\AArray<(.*)>/i
516
+ # check to ensure the input is an array given that the attribute
517
+ # is documented as an array but the input is not
518
+ if attributes[attribute_map[key]].is_a?(Array)
519
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
520
+ end
521
+ elsif !attributes[attribute_map[key]].nil?
522
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
523
+ end
524
+ end
525
+ new(transformed_hash)
526
+ end
527
+
528
+ # Deserializes the data based on type
529
+ # @param string type Data type
530
+ # @param string value Value to be deserialized
531
+ # @return [Object] Deserialized data
532
+ def self._deserialize(type, value)
533
+ case type.to_sym
534
+ when :Time
535
+ Time.parse(value)
536
+ when :Date
537
+ Date.parse(value)
538
+ when :String
539
+ value.to_s
540
+ when :Integer
541
+ value.to_i
542
+ when :Float
543
+ value.to_f
544
+ when :Boolean
545
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
546
+ true
547
+ else
548
+ false
549
+ end
550
+ when :Object
551
+ # generic object (usually a Hash), return directly
552
+ value
553
+ when /\AArray<(?<inner_type>.+)>\z/
554
+ inner_type = Regexp.last_match[:inner_type]
555
+ value.map { |v| _deserialize(inner_type, v) }
556
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
557
+ k_type = Regexp.last_match[:k_type]
558
+ v_type = Regexp.last_match[:v_type]
559
+ {}.tap do |hash|
560
+ value.each do |k, v|
561
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
562
+ end
563
+ end
564
+ else # model
565
+ # models (e.g. Pet) or oneOf
566
+ klass = PharmaObservatory.const_get(type)
567
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
568
+ end
569
+ end
570
+
571
+ # Returns the string representation of the object
572
+ # @return [String] String presentation of the object
573
+ def to_s
574
+ to_hash.to_s
575
+ end
576
+
577
+ # to_body is an alias to to_hash (backward compatibility)
578
+ # @return [Hash] Returns the object in the form of hash
579
+ def to_body
580
+ to_hash
581
+ end
582
+
583
+ # Returns the object in the form of hash
584
+ # @return [Hash] Returns the object in the form of hash
585
+ def to_hash
586
+ hash = {}
587
+ self.class.attribute_map.each_pair do |attr, param|
588
+ value = self.send(attr)
589
+ if value.nil?
590
+ is_nullable = self.class.openapi_nullable.include?(attr)
591
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
592
+ end
593
+
594
+ hash[param] = _to_hash(value)
595
+ end
596
+ hash
597
+ end
598
+
599
+ # Outputs non-array value in the form of hash
600
+ # For object, use to_hash. Otherwise, just return the value
601
+ # @param [Object] value Any valid value
602
+ # @return [Hash] Returns the value in the form of hash
603
+ def _to_hash(value)
604
+ if value.is_a?(Array)
605
+ value.compact.map { |v| _to_hash(v) }
606
+ elsif value.is_a?(Hash)
607
+ {}.tap do |hash|
608
+ value.each { |k, v| hash[k] = _to_hash(v) }
609
+ end
610
+ elsif value.respond_to? :to_hash
611
+ value.to_hash
612
+ else
613
+ value
614
+ end
615
+ end
616
+
617
+ end
618
+
619
+ end