pharmaobservatory 0.1.12 → 0.1.13
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.
- checksums.yaml +4 -4
- data/README.md +15 -4
- data/docs/CompaniesApi.md +328 -0
- data/docs/CompaniesRecordAttributes.md +2 -0
- data/docs/CompanyCompetitorsRow.md +3 -1
- data/docs/CompanyCosponsorsResponse.md +58 -0
- data/docs/CompanyCosponsorsRow.md +58 -0
- data/docs/CompanyPeerProfileResponse.md +58 -0
- data/docs/CompanyPeerProfileRow.md +60 -0
- data/docs/CompanyPeersResponse.md +58 -0
- data/docs/CompanyPeersRow.md +54 -0
- data/docs/InvestorPortfolioRow.md +2 -0
- data/docs/LegalEntitiesApi.md +80 -0
- data/lib/pharmaobservatory/api/companies_api.rb +364 -0
- data/lib/pharmaobservatory/api/legal_entities_api.rb +84 -0
- data/lib/pharmaobservatory/models/companies_record_attributes.rb +10 -1
- data/lib/pharmaobservatory/models/company_competitors_row.rb +16 -5
- data/lib/pharmaobservatory/models/company_cosponsors_response.rb +478 -0
- data/lib/pharmaobservatory/models/company_cosponsors_row.rb +445 -0
- data/lib/pharmaobservatory/models/company_peer_profile_response.rb +478 -0
- data/lib/pharmaobservatory/models/company_peer_profile_row.rb +454 -0
- data/lib/pharmaobservatory/models/company_peers_response.rb +478 -0
- data/lib/pharmaobservatory/models/company_peers_row.rb +421 -0
- data/lib/pharmaobservatory/models/investor_portfolio_row.rb +12 -1
- data/lib/pharmaobservatory/version.rb +1 -1
- data/lib/pharmaobservatory.rb +6 -0
- metadata +14 -2
|
@@ -0,0 +1,445 @@
|
|
|
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 company_cosponsors dataset: one row per company and co-sponsor, at the root level (the co-sponsor's ultimate parent) and at the member level (a company under that root). A grouped request returns the group columns and the measures instead, as additional properties.
|
|
18
|
+
class CompanyCosponsorsRow
|
|
19
|
+
# Company level: the company the row is about; the entry key for the companies object type.
|
|
20
|
+
attr_accessor :company_id
|
|
21
|
+
|
|
22
|
+
# Display name of the company.
|
|
23
|
+
attr_accessor :company_name
|
|
24
|
+
|
|
25
|
+
# Group level: the company's current ultimate parent; a root's group is itself.
|
|
26
|
+
attr_accessor :group_id
|
|
27
|
+
|
|
28
|
+
# Display name of the group.
|
|
29
|
+
attr_accessor :group_name
|
|
30
|
+
|
|
31
|
+
# root: the co-sponsor's ultimate parent company, with the distinct trials any company of that root shares with this company. member: a company under that root that itself co-sponsored, with its own count. Filter on one level; the two do not add.
|
|
32
|
+
attr_accessor :row_level
|
|
33
|
+
|
|
34
|
+
# Company level: the co-sponsoring company. At row_level root this is the root company; at member it is the member company itself.
|
|
35
|
+
attr_accessor :cosponsor_company_id
|
|
36
|
+
|
|
37
|
+
# Display name of the co-sponsoring company.
|
|
38
|
+
attr_accessor :cosponsor_company_name
|
|
39
|
+
|
|
40
|
+
# Group level: the co-sponsor's current ultimate parent; a root's group is itself.
|
|
41
|
+
attr_accessor :cosponsor_group_id
|
|
42
|
+
|
|
43
|
+
# Display name of the co-sponsor's group.
|
|
44
|
+
attr_accessor :cosponsor_group_name
|
|
45
|
+
|
|
46
|
+
# The ultimate parent company of the co-sponsor, the ladder company's `coalesce(ultimate_parent_company_id, company_id)`. Equal to cosponsor_company_id at row_level root, and the root a member row sits under.
|
|
47
|
+
attr_accessor :cosponsor_root_id
|
|
48
|
+
|
|
49
|
+
# The rank of the ROOT among this company's co-sponsor roots by distinct shared trials (1 is the most; ties broken by root id). The same on a root row and on each of its member rows.
|
|
50
|
+
attr_accessor :cosponsor_rank
|
|
51
|
+
|
|
52
|
+
# 0 on a root row; 1 and up on the member rows of that root, by the member's own shared trials. Order by cosponsor_rank then member_rank to list each root followed by its members.
|
|
53
|
+
attr_accessor :member_rank
|
|
54
|
+
|
|
55
|
+
# Member companies of this root that co-sponsored with this company, before the member cut. The same on a root row and its member rows.
|
|
56
|
+
attr_accessor :n_members
|
|
57
|
+
|
|
58
|
+
# Distinct co-sponsor roots for this company before the top-25 cut; the same on every row of a company.
|
|
59
|
+
attr_accessor :n_candidates
|
|
60
|
+
|
|
61
|
+
# Distinct trials that name both. At row_level root, the distinct trials of any company under the root (never a sum over members); at member, that company's own trials.
|
|
62
|
+
attr_accessor :n_shared_trials
|
|
63
|
+
|
|
64
|
+
# Of the shared trials, those where an organization record of this company holds the ClinicalTrials.gov lead sponsor role. At most n_shared_trials; it may overlap n_trials_cosponsor_lead.
|
|
65
|
+
attr_accessor :n_trials_company_lead
|
|
66
|
+
|
|
67
|
+
# Of the shared trials, those where the co-sponsor's organization record holds the lead sponsor role. At most n_shared_trials.
|
|
68
|
+
attr_accessor :n_trials_cosponsor_lead
|
|
69
|
+
|
|
70
|
+
# The earliest registered start year over the shared trials; null when none has a plausible year.
|
|
71
|
+
attr_accessor :first_shared_start_year
|
|
72
|
+
|
|
73
|
+
# The latest registered start year over the shared trials; null when none has a plausible year.
|
|
74
|
+
attr_accessor :last_shared_start_year
|
|
75
|
+
|
|
76
|
+
# Distinct specific MeSH disease areas over the shared trials.
|
|
77
|
+
attr_accessor :n_shared_conditions
|
|
78
|
+
|
|
79
|
+
# Up to 5 MeSH disease names by shared-trial count then name. An empty list when none.
|
|
80
|
+
attr_accessor :top_shared_conditions
|
|
81
|
+
|
|
82
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
83
|
+
def self.attribute_map
|
|
84
|
+
{
|
|
85
|
+
:'company_id' => :'company_id',
|
|
86
|
+
:'company_name' => :'company_name',
|
|
87
|
+
:'group_id' => :'group_id',
|
|
88
|
+
:'group_name' => :'group_name',
|
|
89
|
+
:'row_level' => :'row_level',
|
|
90
|
+
:'cosponsor_company_id' => :'cosponsor_company_id',
|
|
91
|
+
:'cosponsor_company_name' => :'cosponsor_company_name',
|
|
92
|
+
:'cosponsor_group_id' => :'cosponsor_group_id',
|
|
93
|
+
:'cosponsor_group_name' => :'cosponsor_group_name',
|
|
94
|
+
:'cosponsor_root_id' => :'cosponsor_root_id',
|
|
95
|
+
:'cosponsor_rank' => :'cosponsor_rank',
|
|
96
|
+
:'member_rank' => :'member_rank',
|
|
97
|
+
:'n_members' => :'n_members',
|
|
98
|
+
:'n_candidates' => :'n_candidates',
|
|
99
|
+
:'n_shared_trials' => :'n_shared_trials',
|
|
100
|
+
:'n_trials_company_lead' => :'n_trials_company_lead',
|
|
101
|
+
:'n_trials_cosponsor_lead' => :'n_trials_cosponsor_lead',
|
|
102
|
+
:'first_shared_start_year' => :'first_shared_start_year',
|
|
103
|
+
:'last_shared_start_year' => :'last_shared_start_year',
|
|
104
|
+
:'n_shared_conditions' => :'n_shared_conditions',
|
|
105
|
+
:'top_shared_conditions' => :'top_shared_conditions'
|
|
106
|
+
}
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
# Returns attribute mapping this model knows about
|
|
110
|
+
def self.acceptable_attribute_map
|
|
111
|
+
attribute_map
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
# Returns all the JSON keys this model knows about
|
|
115
|
+
def self.acceptable_attributes
|
|
116
|
+
acceptable_attribute_map.values
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
# Attribute type mapping.
|
|
120
|
+
def self.openapi_types
|
|
121
|
+
{
|
|
122
|
+
:'company_id' => :'String',
|
|
123
|
+
:'company_name' => :'String',
|
|
124
|
+
:'group_id' => :'String',
|
|
125
|
+
:'group_name' => :'String',
|
|
126
|
+
:'row_level' => :'String',
|
|
127
|
+
:'cosponsor_company_id' => :'String',
|
|
128
|
+
:'cosponsor_company_name' => :'String',
|
|
129
|
+
:'cosponsor_group_id' => :'String',
|
|
130
|
+
:'cosponsor_group_name' => :'String',
|
|
131
|
+
:'cosponsor_root_id' => :'String',
|
|
132
|
+
:'cosponsor_rank' => :'Integer',
|
|
133
|
+
:'member_rank' => :'Integer',
|
|
134
|
+
:'n_members' => :'Integer',
|
|
135
|
+
:'n_candidates' => :'Integer',
|
|
136
|
+
:'n_shared_trials' => :'Integer',
|
|
137
|
+
:'n_trials_company_lead' => :'Integer',
|
|
138
|
+
:'n_trials_cosponsor_lead' => :'Integer',
|
|
139
|
+
:'first_shared_start_year' => :'Integer',
|
|
140
|
+
:'last_shared_start_year' => :'Integer',
|
|
141
|
+
:'n_shared_conditions' => :'Integer',
|
|
142
|
+
:'top_shared_conditions' => :'Array<String>'
|
|
143
|
+
}
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
# List of attributes with nullable: true
|
|
147
|
+
def self.openapi_nullable
|
|
148
|
+
Set.new([
|
|
149
|
+
:'company_id',
|
|
150
|
+
:'company_name',
|
|
151
|
+
:'group_id',
|
|
152
|
+
:'group_name',
|
|
153
|
+
:'row_level',
|
|
154
|
+
:'cosponsor_company_id',
|
|
155
|
+
:'cosponsor_company_name',
|
|
156
|
+
:'cosponsor_group_id',
|
|
157
|
+
:'cosponsor_group_name',
|
|
158
|
+
:'cosponsor_root_id',
|
|
159
|
+
:'cosponsor_rank',
|
|
160
|
+
:'member_rank',
|
|
161
|
+
:'n_members',
|
|
162
|
+
:'n_candidates',
|
|
163
|
+
:'n_shared_trials',
|
|
164
|
+
:'n_trials_company_lead',
|
|
165
|
+
:'n_trials_cosponsor_lead',
|
|
166
|
+
:'first_shared_start_year',
|
|
167
|
+
:'last_shared_start_year',
|
|
168
|
+
:'n_shared_conditions',
|
|
169
|
+
:'top_shared_conditions'
|
|
170
|
+
])
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
# Initializes the object
|
|
174
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
175
|
+
def initialize(attributes = {})
|
|
176
|
+
if (!attributes.is_a?(Hash))
|
|
177
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `PharmaObservatory::CompanyCosponsorsRow` initialize method"
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
181
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
182
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
183
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
184
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `PharmaObservatory::CompanyCosponsorsRow`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
185
|
+
end
|
|
186
|
+
h[k.to_sym] = v
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
if attributes.key?(:'company_id')
|
|
190
|
+
self.company_id = attributes[:'company_id']
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
if attributes.key?(:'company_name')
|
|
194
|
+
self.company_name = attributes[:'company_name']
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
if attributes.key?(:'group_id')
|
|
198
|
+
self.group_id = attributes[:'group_id']
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
if attributes.key?(:'group_name')
|
|
202
|
+
self.group_name = attributes[:'group_name']
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
if attributes.key?(:'row_level')
|
|
206
|
+
self.row_level = attributes[:'row_level']
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
if attributes.key?(:'cosponsor_company_id')
|
|
210
|
+
self.cosponsor_company_id = attributes[:'cosponsor_company_id']
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
if attributes.key?(:'cosponsor_company_name')
|
|
214
|
+
self.cosponsor_company_name = attributes[:'cosponsor_company_name']
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
if attributes.key?(:'cosponsor_group_id')
|
|
218
|
+
self.cosponsor_group_id = attributes[:'cosponsor_group_id']
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
if attributes.key?(:'cosponsor_group_name')
|
|
222
|
+
self.cosponsor_group_name = attributes[:'cosponsor_group_name']
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
if attributes.key?(:'cosponsor_root_id')
|
|
226
|
+
self.cosponsor_root_id = attributes[:'cosponsor_root_id']
|
|
227
|
+
end
|
|
228
|
+
|
|
229
|
+
if attributes.key?(:'cosponsor_rank')
|
|
230
|
+
self.cosponsor_rank = attributes[:'cosponsor_rank']
|
|
231
|
+
end
|
|
232
|
+
|
|
233
|
+
if attributes.key?(:'member_rank')
|
|
234
|
+
self.member_rank = attributes[:'member_rank']
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
if attributes.key?(:'n_members')
|
|
238
|
+
self.n_members = attributes[:'n_members']
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
if attributes.key?(:'n_candidates')
|
|
242
|
+
self.n_candidates = attributes[:'n_candidates']
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
if attributes.key?(:'n_shared_trials')
|
|
246
|
+
self.n_shared_trials = attributes[:'n_shared_trials']
|
|
247
|
+
end
|
|
248
|
+
|
|
249
|
+
if attributes.key?(:'n_trials_company_lead')
|
|
250
|
+
self.n_trials_company_lead = attributes[:'n_trials_company_lead']
|
|
251
|
+
end
|
|
252
|
+
|
|
253
|
+
if attributes.key?(:'n_trials_cosponsor_lead')
|
|
254
|
+
self.n_trials_cosponsor_lead = attributes[:'n_trials_cosponsor_lead']
|
|
255
|
+
end
|
|
256
|
+
|
|
257
|
+
if attributes.key?(:'first_shared_start_year')
|
|
258
|
+
self.first_shared_start_year = attributes[:'first_shared_start_year']
|
|
259
|
+
end
|
|
260
|
+
|
|
261
|
+
if attributes.key?(:'last_shared_start_year')
|
|
262
|
+
self.last_shared_start_year = attributes[:'last_shared_start_year']
|
|
263
|
+
end
|
|
264
|
+
|
|
265
|
+
if attributes.key?(:'n_shared_conditions')
|
|
266
|
+
self.n_shared_conditions = attributes[:'n_shared_conditions']
|
|
267
|
+
end
|
|
268
|
+
|
|
269
|
+
if attributes.key?(:'top_shared_conditions')
|
|
270
|
+
if (value = attributes[:'top_shared_conditions']).is_a?(Array)
|
|
271
|
+
self.top_shared_conditions = value
|
|
272
|
+
end
|
|
273
|
+
end
|
|
274
|
+
end
|
|
275
|
+
|
|
276
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
277
|
+
# @return Array for valid properties with the reasons
|
|
278
|
+
def list_invalid_properties
|
|
279
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
280
|
+
invalid_properties = Array.new
|
|
281
|
+
invalid_properties
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
# Check to see if the all the properties in the model are valid
|
|
285
|
+
# @return true if the model is valid
|
|
286
|
+
def valid?
|
|
287
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
288
|
+
true
|
|
289
|
+
end
|
|
290
|
+
|
|
291
|
+
# Checks equality by comparing each attribute.
|
|
292
|
+
# @param [Object] Object to be compared
|
|
293
|
+
def ==(o)
|
|
294
|
+
return true if self.equal?(o)
|
|
295
|
+
self.class == o.class &&
|
|
296
|
+
company_id == o.company_id &&
|
|
297
|
+
company_name == o.company_name &&
|
|
298
|
+
group_id == o.group_id &&
|
|
299
|
+
group_name == o.group_name &&
|
|
300
|
+
row_level == o.row_level &&
|
|
301
|
+
cosponsor_company_id == o.cosponsor_company_id &&
|
|
302
|
+
cosponsor_company_name == o.cosponsor_company_name &&
|
|
303
|
+
cosponsor_group_id == o.cosponsor_group_id &&
|
|
304
|
+
cosponsor_group_name == o.cosponsor_group_name &&
|
|
305
|
+
cosponsor_root_id == o.cosponsor_root_id &&
|
|
306
|
+
cosponsor_rank == o.cosponsor_rank &&
|
|
307
|
+
member_rank == o.member_rank &&
|
|
308
|
+
n_members == o.n_members &&
|
|
309
|
+
n_candidates == o.n_candidates &&
|
|
310
|
+
n_shared_trials == o.n_shared_trials &&
|
|
311
|
+
n_trials_company_lead == o.n_trials_company_lead &&
|
|
312
|
+
n_trials_cosponsor_lead == o.n_trials_cosponsor_lead &&
|
|
313
|
+
first_shared_start_year == o.first_shared_start_year &&
|
|
314
|
+
last_shared_start_year == o.last_shared_start_year &&
|
|
315
|
+
n_shared_conditions == o.n_shared_conditions &&
|
|
316
|
+
top_shared_conditions == o.top_shared_conditions
|
|
317
|
+
end
|
|
318
|
+
|
|
319
|
+
# @see the `==` method
|
|
320
|
+
# @param [Object] Object to be compared
|
|
321
|
+
def eql?(o)
|
|
322
|
+
self == o
|
|
323
|
+
end
|
|
324
|
+
|
|
325
|
+
# Calculates hash code according to all attributes.
|
|
326
|
+
# @return [Integer] Hash code
|
|
327
|
+
def hash
|
|
328
|
+
[company_id, company_name, group_id, group_name, row_level, cosponsor_company_id, cosponsor_company_name, cosponsor_group_id, cosponsor_group_name, cosponsor_root_id, cosponsor_rank, member_rank, n_members, n_candidates, n_shared_trials, n_trials_company_lead, n_trials_cosponsor_lead, first_shared_start_year, last_shared_start_year, n_shared_conditions, top_shared_conditions].hash
|
|
329
|
+
end
|
|
330
|
+
|
|
331
|
+
# Builds the object from hash
|
|
332
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
333
|
+
# @return [Object] Returns the model itself
|
|
334
|
+
def self.build_from_hash(attributes)
|
|
335
|
+
return nil unless attributes.is_a?(Hash)
|
|
336
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
337
|
+
transformed_hash = {}
|
|
338
|
+
openapi_types.each_pair do |key, type|
|
|
339
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
340
|
+
transformed_hash["#{key}"] = nil
|
|
341
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
342
|
+
# check to ensure the input is an array given that the attribute
|
|
343
|
+
# is documented as an array but the input is not
|
|
344
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
345
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
346
|
+
end
|
|
347
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
348
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
349
|
+
end
|
|
350
|
+
end
|
|
351
|
+
new(transformed_hash)
|
|
352
|
+
end
|
|
353
|
+
|
|
354
|
+
# Deserializes the data based on type
|
|
355
|
+
# @param string type Data type
|
|
356
|
+
# @param string value Value to be deserialized
|
|
357
|
+
# @return [Object] Deserialized data
|
|
358
|
+
def self._deserialize(type, value)
|
|
359
|
+
case type.to_sym
|
|
360
|
+
when :Time
|
|
361
|
+
Time.parse(value)
|
|
362
|
+
when :Date
|
|
363
|
+
Date.parse(value)
|
|
364
|
+
when :String
|
|
365
|
+
value.to_s
|
|
366
|
+
when :Integer
|
|
367
|
+
value.to_i
|
|
368
|
+
when :Float
|
|
369
|
+
value.to_f
|
|
370
|
+
when :Boolean
|
|
371
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
372
|
+
true
|
|
373
|
+
else
|
|
374
|
+
false
|
|
375
|
+
end
|
|
376
|
+
when :Object
|
|
377
|
+
# generic object (usually a Hash), return directly
|
|
378
|
+
value
|
|
379
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
380
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
381
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
382
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
383
|
+
k_type = Regexp.last_match[:k_type]
|
|
384
|
+
v_type = Regexp.last_match[:v_type]
|
|
385
|
+
{}.tap do |hash|
|
|
386
|
+
value.each do |k, v|
|
|
387
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
388
|
+
end
|
|
389
|
+
end
|
|
390
|
+
else # model
|
|
391
|
+
# models (e.g. Pet) or oneOf
|
|
392
|
+
klass = PharmaObservatory.const_get(type)
|
|
393
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
394
|
+
end
|
|
395
|
+
end
|
|
396
|
+
|
|
397
|
+
# Returns the string representation of the object
|
|
398
|
+
# @return [String] String presentation of the object
|
|
399
|
+
def to_s
|
|
400
|
+
to_hash.to_s
|
|
401
|
+
end
|
|
402
|
+
|
|
403
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
404
|
+
# @return [Hash] Returns the object in the form of hash
|
|
405
|
+
def to_body
|
|
406
|
+
to_hash
|
|
407
|
+
end
|
|
408
|
+
|
|
409
|
+
# Returns the object in the form of hash
|
|
410
|
+
# @return [Hash] Returns the object in the form of hash
|
|
411
|
+
def to_hash
|
|
412
|
+
hash = {}
|
|
413
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
414
|
+
value = self.send(attr)
|
|
415
|
+
if value.nil?
|
|
416
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
417
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
418
|
+
end
|
|
419
|
+
|
|
420
|
+
hash[param] = _to_hash(value)
|
|
421
|
+
end
|
|
422
|
+
hash
|
|
423
|
+
end
|
|
424
|
+
|
|
425
|
+
# Outputs non-array value in the form of hash
|
|
426
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
427
|
+
# @param [Object] value Any valid value
|
|
428
|
+
# @return [Hash] Returns the value in the form of hash
|
|
429
|
+
def _to_hash(value)
|
|
430
|
+
if value.is_a?(Array)
|
|
431
|
+
value.compact.map { |v| _to_hash(v) }
|
|
432
|
+
elsif value.is_a?(Hash)
|
|
433
|
+
{}.tap do |hash|
|
|
434
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
435
|
+
end
|
|
436
|
+
elsif value.respond_to? :to_hash
|
|
437
|
+
value.to_hash
|
|
438
|
+
else
|
|
439
|
+
value
|
|
440
|
+
end
|
|
441
|
+
end
|
|
442
|
+
|
|
443
|
+
end
|
|
444
|
+
|
|
445
|
+
end
|