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