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.
- checksums.yaml +4 -4
- data/README.md +40 -4
- data/docs/BiomarkersApi.md +80 -0
- data/docs/InvestigatorsApi.md +80 -0
- data/docs/ProviderBiomarkerCapabilityRow.md +9 -9
- data/docs/ProviderBiomarkerCapabilitySummaryResponse.md +58 -0
- data/docs/ProviderBiomarkerCapabilitySummaryRow.md +70 -0
- data/docs/ProviderCliaLicensureRow.md +1 -1
- data/docs/ProviderRwdDeliveryResponse.md +58 -0
- data/docs/ProviderRwdDeliveryRow.md +76 -0
- data/docs/ProviderRwdDeliveryStudyResponse.md +58 -0
- data/docs/ProviderRwdDeliveryStudyRow.md +60 -0
- data/docs/ProviderRwdFootprintResponse.md +58 -0
- data/docs/ProviderRwdFootprintRow.md +74 -0
- data/docs/RwdConductorsApi.md +160 -0
- data/docs/RwdInstitutionsApi.md +80 -0
- data/docs/RwdSourcesRow.md +1 -1
- data/docs/RwdStudiesApi.md +80 -0
- data/docs/RwdUsNetworkMembershipsResponse.md +58 -0
- data/docs/RwdUsNetworkMembershipsRow.md +98 -0
- data/docs/RwdUsNetworkProjectsResponse.md +58 -0
- data/docs/RwdUsNetworkProjectsRow.md +80 -0
- data/docs/RwdUsNetworksApi.md +313 -0
- data/docs/RwdUsNetworksRecord.md +38 -0
- data/docs/RwdUsNetworksResponse.md +58 -0
- data/docs/RwdUsNetworksRow.md +60 -0
- data/docs/SupplierRwdDeclarationsResponse.md +58 -0
- data/docs/SupplierRwdDeclarationsRow.md +74 -0
- data/docs/SuppliersApi.md +480 -0
- data/docs/TrialPublicationsResponse.md +58 -0
- data/docs/TrialPublicationsRow.md +34 -0
- data/docs/TrialsApi.md +80 -0
- data/lib/pharmaobservatory/api/biomarkers_api.rb +84 -0
- data/lib/pharmaobservatory/api/investigators_api.rb +84 -0
- data/lib/pharmaobservatory/api/rwd_conductors_api.rb +168 -0
- data/lib/pharmaobservatory/api/rwd_institutions_api.rb +84 -0
- data/lib/pharmaobservatory/api/rwd_studies_api.rb +84 -0
- data/lib/pharmaobservatory/api/rwd_us_networks_api.rb +329 -0
- data/lib/pharmaobservatory/api/suppliers_api.rb +504 -0
- data/lib/pharmaobservatory/api/trials_api.rb +84 -0
- data/lib/pharmaobservatory/models/provider_biomarker_capability_row.rb +9 -9
- data/lib/pharmaobservatory/models/provider_biomarker_capability_summary_response.rb +478 -0
- data/lib/pharmaobservatory/models/provider_biomarker_capability_summary_row.rb +509 -0
- data/lib/pharmaobservatory/models/provider_clia_licensure_row.rb +1 -1
- data/lib/pharmaobservatory/models/provider_rwd_delivery_response.rb +478 -0
- data/lib/pharmaobservatory/models/provider_rwd_delivery_row.rb +546 -0
- data/lib/pharmaobservatory/models/provider_rwd_delivery_study_response.rb +478 -0
- data/lib/pharmaobservatory/models/provider_rwd_delivery_study_row.rb +454 -0
- data/lib/pharmaobservatory/models/provider_rwd_footprint_response.rb +478 -0
- data/lib/pharmaobservatory/models/provider_rwd_footprint_row.rb +539 -0
- data/lib/pharmaobservatory/models/rwd_sources_row.rb +1 -1
- data/lib/pharmaobservatory/models/rwd_us_network_memberships_response.rb +478 -0
- data/lib/pharmaobservatory/models/rwd_us_network_memberships_row.rb +663 -0
- data/lib/pharmaobservatory/models/rwd_us_network_projects_response.rb +478 -0
- data/lib/pharmaobservatory/models/rwd_us_network_projects_row.rb +564 -0
- data/lib/pharmaobservatory/models/rwd_us_networks_record.rb +385 -0
- data/lib/pharmaobservatory/models/rwd_us_networks_response.rb +478 -0
- data/lib/pharmaobservatory/models/rwd_us_networks_row.rb +454 -0
- data/lib/pharmaobservatory/models/supplier_rwd_declarations_response.rb +478 -0
- data/lib/pharmaobservatory/models/supplier_rwd_declarations_row.rb +539 -0
- data/lib/pharmaobservatory/models/trial_publications_response.rb +478 -0
- data/lib/pharmaobservatory/models/trial_publications_row.rb +313 -0
- data/lib/pharmaobservatory/version.rb +1 -1
- data/lib/pharmaobservatory.rb +20 -0
- metadata +42 -2
|
@@ -0,0 +1,454 @@
|
|
|
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_networks dataset: one row per US RWD network. A grouped request returns the group columns and the measures instead, as additional properties.
|
|
18
|
+
class RwdUsNetworksRow
|
|
19
|
+
# The network key, the entry key of the rwd_us_networks object type (n3c today).
|
|
20
|
+
attr_accessor :network_key
|
|
21
|
+
|
|
22
|
+
# The source the network rows come from.
|
|
23
|
+
attr_accessor :network_source
|
|
24
|
+
|
|
25
|
+
# The network's name.
|
|
26
|
+
attr_accessor :network_name
|
|
27
|
+
|
|
28
|
+
# The operating body.
|
|
29
|
+
attr_accessor :network_operator
|
|
30
|
+
|
|
31
|
+
# Institutions holding at least one published agreement, our count of the register.
|
|
32
|
+
attr_accessor :member_total
|
|
33
|
+
|
|
34
|
+
# Institutions holding a Data Transfer Agreement.
|
|
35
|
+
attr_accessor :members_with_dta
|
|
36
|
+
|
|
37
|
+
# Institutions with a DTA row whose published term end is on or after the retrieval date.
|
|
38
|
+
attr_accessor :members_with_current_dta
|
|
39
|
+
|
|
40
|
+
# Institutions holding a Data Use Agreement.
|
|
41
|
+
attr_accessor :members_with_dua
|
|
42
|
+
|
|
43
|
+
# Institutions with a DUA row within its published term.
|
|
44
|
+
attr_accessor :members_with_current_dua
|
|
45
|
+
|
|
46
|
+
# Institutions holding an agreement published with the type code LHBA.
|
|
47
|
+
attr_accessor :members_with_lhba
|
|
48
|
+
|
|
49
|
+
# Members resolved to an organization on the spine.
|
|
50
|
+
attr_accessor :members_resolved_org
|
|
51
|
+
|
|
52
|
+
# Members matched to at least one RX provider, by an exact method visible in rwd_us_network_memberships.
|
|
53
|
+
attr_accessor :members_matched_rx
|
|
54
|
+
|
|
55
|
+
# N3C's own published count of DTAs, as N3C labels it. Differs from ours; not reconciled.
|
|
56
|
+
attr_accessor :published_dta_count
|
|
57
|
+
|
|
58
|
+
# N3C's own published count of DUAs. Differs from ours; not reconciled.
|
|
59
|
+
attr_accessor :published_dua_count
|
|
60
|
+
|
|
61
|
+
# N3C's own published count of institutions. Differs from ours; not reconciled.
|
|
62
|
+
attr_accessor :published_institution_count
|
|
63
|
+
|
|
64
|
+
# N3C's own published count of projects. Differs from ours; not reconciled.
|
|
65
|
+
attr_accessor :published_project_count
|
|
66
|
+
|
|
67
|
+
# The retrieval date of the agreement snapshot.
|
|
68
|
+
attr_accessor :as_of
|
|
69
|
+
|
|
70
|
+
# The API endpoint the agreements came from.
|
|
71
|
+
attr_accessor :source_url
|
|
72
|
+
|
|
73
|
+
# The public N3C dashboard.
|
|
74
|
+
attr_accessor :agreements_url
|
|
75
|
+
|
|
76
|
+
# N3C's HTML signatories page, kept as a documented reconciliation and not ingested.
|
|
77
|
+
attr_accessor :signatories_page_url
|
|
78
|
+
|
|
79
|
+
# When the snapshot was retrieved, in UTC.
|
|
80
|
+
attr_accessor :retrieved_at
|
|
81
|
+
|
|
82
|
+
# The credit line every surface carrying this data prints.
|
|
83
|
+
attr_accessor :attribution
|
|
84
|
+
|
|
85
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
86
|
+
def self.attribute_map
|
|
87
|
+
{
|
|
88
|
+
:'network_key' => :'network_key',
|
|
89
|
+
:'network_source' => :'network_source',
|
|
90
|
+
:'network_name' => :'network_name',
|
|
91
|
+
:'network_operator' => :'network_operator',
|
|
92
|
+
:'member_total' => :'member_total',
|
|
93
|
+
:'members_with_dta' => :'members_with_dta',
|
|
94
|
+
:'members_with_current_dta' => :'members_with_current_dta',
|
|
95
|
+
:'members_with_dua' => :'members_with_dua',
|
|
96
|
+
:'members_with_current_dua' => :'members_with_current_dua',
|
|
97
|
+
:'members_with_lhba' => :'members_with_lhba',
|
|
98
|
+
:'members_resolved_org' => :'members_resolved_org',
|
|
99
|
+
:'members_matched_rx' => :'members_matched_rx',
|
|
100
|
+
:'published_dta_count' => :'published_dta_count',
|
|
101
|
+
:'published_dua_count' => :'published_dua_count',
|
|
102
|
+
:'published_institution_count' => :'published_institution_count',
|
|
103
|
+
:'published_project_count' => :'published_project_count',
|
|
104
|
+
:'as_of' => :'as_of',
|
|
105
|
+
:'source_url' => :'source_url',
|
|
106
|
+
:'agreements_url' => :'agreements_url',
|
|
107
|
+
:'signatories_page_url' => :'signatories_page_url',
|
|
108
|
+
:'retrieved_at' => :'retrieved_at',
|
|
109
|
+
:'attribution' => :'attribution'
|
|
110
|
+
}
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
# Returns attribute mapping this model knows about
|
|
114
|
+
def self.acceptable_attribute_map
|
|
115
|
+
attribute_map
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
# Returns all the JSON keys this model knows about
|
|
119
|
+
def self.acceptable_attributes
|
|
120
|
+
acceptable_attribute_map.values
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
# Attribute type mapping.
|
|
124
|
+
def self.openapi_types
|
|
125
|
+
{
|
|
126
|
+
:'network_key' => :'String',
|
|
127
|
+
:'network_source' => :'String',
|
|
128
|
+
:'network_name' => :'String',
|
|
129
|
+
:'network_operator' => :'String',
|
|
130
|
+
:'member_total' => :'Integer',
|
|
131
|
+
:'members_with_dta' => :'Integer',
|
|
132
|
+
:'members_with_current_dta' => :'Integer',
|
|
133
|
+
:'members_with_dua' => :'Integer',
|
|
134
|
+
:'members_with_current_dua' => :'Integer',
|
|
135
|
+
:'members_with_lhba' => :'Integer',
|
|
136
|
+
:'members_resolved_org' => :'Integer',
|
|
137
|
+
:'members_matched_rx' => :'Integer',
|
|
138
|
+
:'published_dta_count' => :'Integer',
|
|
139
|
+
:'published_dua_count' => :'Integer',
|
|
140
|
+
:'published_institution_count' => :'Integer',
|
|
141
|
+
:'published_project_count' => :'Integer',
|
|
142
|
+
:'as_of' => :'Date',
|
|
143
|
+
:'source_url' => :'String',
|
|
144
|
+
:'agreements_url' => :'String',
|
|
145
|
+
:'signatories_page_url' => :'String',
|
|
146
|
+
:'retrieved_at' => :'Time',
|
|
147
|
+
:'attribution' => :'String'
|
|
148
|
+
}
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
# List of attributes with nullable: true
|
|
152
|
+
def self.openapi_nullable
|
|
153
|
+
Set.new([
|
|
154
|
+
:'network_key',
|
|
155
|
+
:'network_source',
|
|
156
|
+
:'network_name',
|
|
157
|
+
:'network_operator',
|
|
158
|
+
:'member_total',
|
|
159
|
+
:'members_with_dta',
|
|
160
|
+
:'members_with_current_dta',
|
|
161
|
+
:'members_with_dua',
|
|
162
|
+
:'members_with_current_dua',
|
|
163
|
+
:'members_with_lhba',
|
|
164
|
+
:'members_resolved_org',
|
|
165
|
+
:'members_matched_rx',
|
|
166
|
+
:'published_dta_count',
|
|
167
|
+
:'published_dua_count',
|
|
168
|
+
:'published_institution_count',
|
|
169
|
+
:'published_project_count',
|
|
170
|
+
:'as_of',
|
|
171
|
+
:'source_url',
|
|
172
|
+
:'agreements_url',
|
|
173
|
+
:'signatories_page_url',
|
|
174
|
+
:'retrieved_at',
|
|
175
|
+
:'attribution'
|
|
176
|
+
])
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
# Initializes the object
|
|
180
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
181
|
+
def initialize(attributes = {})
|
|
182
|
+
if (!attributes.is_a?(Hash))
|
|
183
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `PharmaObservatory::RwdUsNetworksRow` initialize method"
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
187
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
188
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
189
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
190
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `PharmaObservatory::RwdUsNetworksRow`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
191
|
+
end
|
|
192
|
+
h[k.to_sym] = v
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
if attributes.key?(:'network_key')
|
|
196
|
+
self.network_key = attributes[:'network_key']
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
if attributes.key?(:'network_source')
|
|
200
|
+
self.network_source = attributes[:'network_source']
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
if attributes.key?(:'network_name')
|
|
204
|
+
self.network_name = attributes[:'network_name']
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
if attributes.key?(:'network_operator')
|
|
208
|
+
self.network_operator = attributes[:'network_operator']
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
if attributes.key?(:'member_total')
|
|
212
|
+
self.member_total = attributes[:'member_total']
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
if attributes.key?(:'members_with_dta')
|
|
216
|
+
self.members_with_dta = attributes[:'members_with_dta']
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
if attributes.key?(:'members_with_current_dta')
|
|
220
|
+
self.members_with_current_dta = attributes[:'members_with_current_dta']
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
if attributes.key?(:'members_with_dua')
|
|
224
|
+
self.members_with_dua = attributes[:'members_with_dua']
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
if attributes.key?(:'members_with_current_dua')
|
|
228
|
+
self.members_with_current_dua = attributes[:'members_with_current_dua']
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
if attributes.key?(:'members_with_lhba')
|
|
232
|
+
self.members_with_lhba = attributes[:'members_with_lhba']
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
if attributes.key?(:'members_resolved_org')
|
|
236
|
+
self.members_resolved_org = attributes[:'members_resolved_org']
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
if attributes.key?(:'members_matched_rx')
|
|
240
|
+
self.members_matched_rx = attributes[:'members_matched_rx']
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
if attributes.key?(:'published_dta_count')
|
|
244
|
+
self.published_dta_count = attributes[:'published_dta_count']
|
|
245
|
+
end
|
|
246
|
+
|
|
247
|
+
if attributes.key?(:'published_dua_count')
|
|
248
|
+
self.published_dua_count = attributes[:'published_dua_count']
|
|
249
|
+
end
|
|
250
|
+
|
|
251
|
+
if attributes.key?(:'published_institution_count')
|
|
252
|
+
self.published_institution_count = attributes[:'published_institution_count']
|
|
253
|
+
end
|
|
254
|
+
|
|
255
|
+
if attributes.key?(:'published_project_count')
|
|
256
|
+
self.published_project_count = attributes[:'published_project_count']
|
|
257
|
+
end
|
|
258
|
+
|
|
259
|
+
if attributes.key?(:'as_of')
|
|
260
|
+
self.as_of = attributes[:'as_of']
|
|
261
|
+
end
|
|
262
|
+
|
|
263
|
+
if attributes.key?(:'source_url')
|
|
264
|
+
self.source_url = attributes[:'source_url']
|
|
265
|
+
end
|
|
266
|
+
|
|
267
|
+
if attributes.key?(:'agreements_url')
|
|
268
|
+
self.agreements_url = attributes[:'agreements_url']
|
|
269
|
+
end
|
|
270
|
+
|
|
271
|
+
if attributes.key?(:'signatories_page_url')
|
|
272
|
+
self.signatories_page_url = attributes[:'signatories_page_url']
|
|
273
|
+
end
|
|
274
|
+
|
|
275
|
+
if attributes.key?(:'retrieved_at')
|
|
276
|
+
self.retrieved_at = attributes[:'retrieved_at']
|
|
277
|
+
end
|
|
278
|
+
|
|
279
|
+
if attributes.key?(:'attribution')
|
|
280
|
+
self.attribution = attributes[:'attribution']
|
|
281
|
+
end
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
285
|
+
# @return Array for valid properties with the reasons
|
|
286
|
+
def list_invalid_properties
|
|
287
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
288
|
+
invalid_properties = Array.new
|
|
289
|
+
invalid_properties
|
|
290
|
+
end
|
|
291
|
+
|
|
292
|
+
# Check to see if the all the properties in the model are valid
|
|
293
|
+
# @return true if the model is valid
|
|
294
|
+
def valid?
|
|
295
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
296
|
+
true
|
|
297
|
+
end
|
|
298
|
+
|
|
299
|
+
# Checks equality by comparing each attribute.
|
|
300
|
+
# @param [Object] Object to be compared
|
|
301
|
+
def ==(o)
|
|
302
|
+
return true if self.equal?(o)
|
|
303
|
+
self.class == o.class &&
|
|
304
|
+
network_key == o.network_key &&
|
|
305
|
+
network_source == o.network_source &&
|
|
306
|
+
network_name == o.network_name &&
|
|
307
|
+
network_operator == o.network_operator &&
|
|
308
|
+
member_total == o.member_total &&
|
|
309
|
+
members_with_dta == o.members_with_dta &&
|
|
310
|
+
members_with_current_dta == o.members_with_current_dta &&
|
|
311
|
+
members_with_dua == o.members_with_dua &&
|
|
312
|
+
members_with_current_dua == o.members_with_current_dua &&
|
|
313
|
+
members_with_lhba == o.members_with_lhba &&
|
|
314
|
+
members_resolved_org == o.members_resolved_org &&
|
|
315
|
+
members_matched_rx == o.members_matched_rx &&
|
|
316
|
+
published_dta_count == o.published_dta_count &&
|
|
317
|
+
published_dua_count == o.published_dua_count &&
|
|
318
|
+
published_institution_count == o.published_institution_count &&
|
|
319
|
+
published_project_count == o.published_project_count &&
|
|
320
|
+
as_of == o.as_of &&
|
|
321
|
+
source_url == o.source_url &&
|
|
322
|
+
agreements_url == o.agreements_url &&
|
|
323
|
+
signatories_page_url == o.signatories_page_url &&
|
|
324
|
+
retrieved_at == o.retrieved_at &&
|
|
325
|
+
attribution == o.attribution
|
|
326
|
+
end
|
|
327
|
+
|
|
328
|
+
# @see the `==` method
|
|
329
|
+
# @param [Object] Object to be compared
|
|
330
|
+
def eql?(o)
|
|
331
|
+
self == o
|
|
332
|
+
end
|
|
333
|
+
|
|
334
|
+
# Calculates hash code according to all attributes.
|
|
335
|
+
# @return [Integer] Hash code
|
|
336
|
+
def hash
|
|
337
|
+
[network_key, network_source, network_name, network_operator, member_total, members_with_dta, members_with_current_dta, members_with_dua, members_with_current_dua, members_with_lhba, members_resolved_org, members_matched_rx, published_dta_count, published_dua_count, published_institution_count, published_project_count, as_of, source_url, agreements_url, signatories_page_url, retrieved_at, attribution].hash
|
|
338
|
+
end
|
|
339
|
+
|
|
340
|
+
# Builds the object from hash
|
|
341
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
342
|
+
# @return [Object] Returns the model itself
|
|
343
|
+
def self.build_from_hash(attributes)
|
|
344
|
+
return nil unless attributes.is_a?(Hash)
|
|
345
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
346
|
+
transformed_hash = {}
|
|
347
|
+
openapi_types.each_pair do |key, type|
|
|
348
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
349
|
+
transformed_hash["#{key}"] = nil
|
|
350
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
351
|
+
# check to ensure the input is an array given that the attribute
|
|
352
|
+
# is documented as an array but the input is not
|
|
353
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
354
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
355
|
+
end
|
|
356
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
357
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
358
|
+
end
|
|
359
|
+
end
|
|
360
|
+
new(transformed_hash)
|
|
361
|
+
end
|
|
362
|
+
|
|
363
|
+
# Deserializes the data based on type
|
|
364
|
+
# @param string type Data type
|
|
365
|
+
# @param string value Value to be deserialized
|
|
366
|
+
# @return [Object] Deserialized data
|
|
367
|
+
def self._deserialize(type, value)
|
|
368
|
+
case type.to_sym
|
|
369
|
+
when :Time
|
|
370
|
+
Time.parse(value)
|
|
371
|
+
when :Date
|
|
372
|
+
Date.parse(value)
|
|
373
|
+
when :String
|
|
374
|
+
value.to_s
|
|
375
|
+
when :Integer
|
|
376
|
+
value.to_i
|
|
377
|
+
when :Float
|
|
378
|
+
value.to_f
|
|
379
|
+
when :Boolean
|
|
380
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
381
|
+
true
|
|
382
|
+
else
|
|
383
|
+
false
|
|
384
|
+
end
|
|
385
|
+
when :Object
|
|
386
|
+
# generic object (usually a Hash), return directly
|
|
387
|
+
value
|
|
388
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
389
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
390
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
391
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
392
|
+
k_type = Regexp.last_match[:k_type]
|
|
393
|
+
v_type = Regexp.last_match[:v_type]
|
|
394
|
+
{}.tap do |hash|
|
|
395
|
+
value.each do |k, v|
|
|
396
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
397
|
+
end
|
|
398
|
+
end
|
|
399
|
+
else # model
|
|
400
|
+
# models (e.g. Pet) or oneOf
|
|
401
|
+
klass = PharmaObservatory.const_get(type)
|
|
402
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
403
|
+
end
|
|
404
|
+
end
|
|
405
|
+
|
|
406
|
+
# Returns the string representation of the object
|
|
407
|
+
# @return [String] String presentation of the object
|
|
408
|
+
def to_s
|
|
409
|
+
to_hash.to_s
|
|
410
|
+
end
|
|
411
|
+
|
|
412
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
413
|
+
# @return [Hash] Returns the object in the form of hash
|
|
414
|
+
def to_body
|
|
415
|
+
to_hash
|
|
416
|
+
end
|
|
417
|
+
|
|
418
|
+
# Returns the object in the form of hash
|
|
419
|
+
# @return [Hash] Returns the object in the form of hash
|
|
420
|
+
def to_hash
|
|
421
|
+
hash = {}
|
|
422
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
423
|
+
value = self.send(attr)
|
|
424
|
+
if value.nil?
|
|
425
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
426
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
427
|
+
end
|
|
428
|
+
|
|
429
|
+
hash[param] = _to_hash(value)
|
|
430
|
+
end
|
|
431
|
+
hash
|
|
432
|
+
end
|
|
433
|
+
|
|
434
|
+
# Outputs non-array value in the form of hash
|
|
435
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
436
|
+
# @param [Object] value Any valid value
|
|
437
|
+
# @return [Hash] Returns the value in the form of hash
|
|
438
|
+
def _to_hash(value)
|
|
439
|
+
if value.is_a?(Array)
|
|
440
|
+
value.compact.map { |v| _to_hash(v) }
|
|
441
|
+
elsif value.is_a?(Hash)
|
|
442
|
+
{}.tap do |hash|
|
|
443
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
444
|
+
end
|
|
445
|
+
elsif value.respond_to? :to_hash
|
|
446
|
+
value.to_hash
|
|
447
|
+
else
|
|
448
|
+
value
|
|
449
|
+
end
|
|
450
|
+
end
|
|
451
|
+
|
|
452
|
+
end
|
|
453
|
+
|
|
454
|
+
end
|