pharmaobservatory 0.1.4 → 0.1.5
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 +8 -4
- data/docs/ApiV1WhoamiGet200Response.md +13 -1
- data/docs/ApiV1WhoamiGet200ResponseLimits.md +32 -0
- data/docs/ApiV1WhoamiGet200ResponseQuota.md +20 -0
- data/docs/ApiV1WhoamiGet200ResponseQuotaBuckets.md +28 -0
- data/docs/ApiV1WhoamiGet200ResponseQuotaBucketsRequestsPerMinute.md +28 -0
- data/docs/CompaniesRow.md +1 -1
- data/docs/ConditionTrialsRow.md +4 -2
- data/docs/LegalEntitiesRow.md +1 -1
- data/docs/SiteTrialsRow.md +3 -1
- data/docs/SponsorTrialsRow.md +4 -2
- data/docs/TrialDeliveryRow.md +7 -5
- data/docs/TrialEnrollmentRateRow.md +5 -3
- data/docs/TrialsRow.md +3 -3
- data/lib/pharmaobservatory/models/api_v1_whoami_get200_response.rb +62 -4
- data/lib/pharmaobservatory/models/api_v1_whoami_get200_response_limits.rb +419 -0
- data/lib/pharmaobservatory/models/api_v1_whoami_get200_response_quota.rb +263 -0
- data/lib/pharmaobservatory/models/api_v1_whoami_get200_response_quota_buckets.rb +367 -0
- data/lib/pharmaobservatory/models/api_v1_whoami_get200_response_quota_buckets_requests_per_minute.rb +367 -0
- data/lib/pharmaobservatory/models/companies_row.rb +1 -1
- data/lib/pharmaobservatory/models/condition_trials_row.rb +14 -3
- data/lib/pharmaobservatory/models/legal_entities_row.rb +1 -1
- data/lib/pharmaobservatory/models/site_trials_row.rb +13 -2
- data/lib/pharmaobservatory/models/sponsor_trials_row.rb +14 -3
- data/lib/pharmaobservatory/models/trial_delivery_row.rb +22 -11
- data/lib/pharmaobservatory/models/trial_enrollment_rate_row.rb +15 -4
- data/lib/pharmaobservatory/models/trials_row.rb +3 -3
- data/lib/pharmaobservatory/version.rb +1 -1
- data/lib/pharmaobservatory.rb +4 -0
- metadata +10 -2
|
@@ -0,0 +1,419 @@
|
|
|
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
|
+
class ApiV1WhoamiGet200ResponseLimits
|
|
18
|
+
attr_accessor :defaults_from
|
|
19
|
+
|
|
20
|
+
attr_accessor :requests_per_minute
|
|
21
|
+
|
|
22
|
+
attr_accessor :requests_per_day
|
|
23
|
+
|
|
24
|
+
attr_accessor :rows_per_day
|
|
25
|
+
|
|
26
|
+
attr_accessor :paging_depth
|
|
27
|
+
|
|
28
|
+
attr_accessor :rwd_catalogue_calls_per_day
|
|
29
|
+
|
|
30
|
+
attr_accessor :benzinga_calls_per_day
|
|
31
|
+
|
|
32
|
+
attr_accessor :query_seconds_per_day
|
|
33
|
+
|
|
34
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
35
|
+
def self.attribute_map
|
|
36
|
+
{
|
|
37
|
+
:'defaults_from' => :'defaults_from',
|
|
38
|
+
:'requests_per_minute' => :'requests_per_minute',
|
|
39
|
+
:'requests_per_day' => :'requests_per_day',
|
|
40
|
+
:'rows_per_day' => :'rows_per_day',
|
|
41
|
+
:'paging_depth' => :'paging_depth',
|
|
42
|
+
:'rwd_catalogue_calls_per_day' => :'rwd_catalogue_calls_per_day',
|
|
43
|
+
:'benzinga_calls_per_day' => :'benzinga_calls_per_day',
|
|
44
|
+
:'query_seconds_per_day' => :'query_seconds_per_day'
|
|
45
|
+
}
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# Returns attribute mapping this model knows about
|
|
49
|
+
def self.acceptable_attribute_map
|
|
50
|
+
attribute_map
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# Returns all the JSON keys this model knows about
|
|
54
|
+
def self.acceptable_attributes
|
|
55
|
+
acceptable_attribute_map.values
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# Attribute type mapping.
|
|
59
|
+
def self.openapi_types
|
|
60
|
+
{
|
|
61
|
+
:'defaults_from' => :'String',
|
|
62
|
+
:'requests_per_minute' => :'Integer',
|
|
63
|
+
:'requests_per_day' => :'Integer',
|
|
64
|
+
:'rows_per_day' => :'Integer',
|
|
65
|
+
:'paging_depth' => :'Integer',
|
|
66
|
+
:'rwd_catalogue_calls_per_day' => :'Integer',
|
|
67
|
+
:'benzinga_calls_per_day' => :'Integer',
|
|
68
|
+
:'query_seconds_per_day' => :'Integer'
|
|
69
|
+
}
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# List of attributes with nullable: true
|
|
73
|
+
def self.openapi_nullable
|
|
74
|
+
Set.new([
|
|
75
|
+
])
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# Initializes the object
|
|
79
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
80
|
+
def initialize(attributes = {})
|
|
81
|
+
if (!attributes.is_a?(Hash))
|
|
82
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `PharmaObservatory::ApiV1WhoamiGet200ResponseLimits` initialize method"
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
86
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
87
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
88
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
89
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `PharmaObservatory::ApiV1WhoamiGet200ResponseLimits`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
90
|
+
end
|
|
91
|
+
h[k.to_sym] = v
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if attributes.key?(:'defaults_from')
|
|
95
|
+
self.defaults_from = attributes[:'defaults_from']
|
|
96
|
+
else
|
|
97
|
+
self.defaults_from = nil
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
if attributes.key?(:'requests_per_minute')
|
|
101
|
+
self.requests_per_minute = attributes[:'requests_per_minute']
|
|
102
|
+
else
|
|
103
|
+
self.requests_per_minute = nil
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
if attributes.key?(:'requests_per_day')
|
|
107
|
+
self.requests_per_day = attributes[:'requests_per_day']
|
|
108
|
+
else
|
|
109
|
+
self.requests_per_day = nil
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
if attributes.key?(:'rows_per_day')
|
|
113
|
+
self.rows_per_day = attributes[:'rows_per_day']
|
|
114
|
+
else
|
|
115
|
+
self.rows_per_day = nil
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
if attributes.key?(:'paging_depth')
|
|
119
|
+
self.paging_depth = attributes[:'paging_depth']
|
|
120
|
+
else
|
|
121
|
+
self.paging_depth = nil
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
if attributes.key?(:'rwd_catalogue_calls_per_day')
|
|
125
|
+
self.rwd_catalogue_calls_per_day = attributes[:'rwd_catalogue_calls_per_day']
|
|
126
|
+
else
|
|
127
|
+
self.rwd_catalogue_calls_per_day = nil
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
if attributes.key?(:'benzinga_calls_per_day')
|
|
131
|
+
self.benzinga_calls_per_day = attributes[:'benzinga_calls_per_day']
|
|
132
|
+
else
|
|
133
|
+
self.benzinga_calls_per_day = nil
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
if attributes.key?(:'query_seconds_per_day')
|
|
137
|
+
self.query_seconds_per_day = attributes[:'query_seconds_per_day']
|
|
138
|
+
else
|
|
139
|
+
self.query_seconds_per_day = nil
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
144
|
+
# @return Array for valid properties with the reasons
|
|
145
|
+
def list_invalid_properties
|
|
146
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
147
|
+
invalid_properties = Array.new
|
|
148
|
+
if @defaults_from.nil?
|
|
149
|
+
invalid_properties.push('invalid value for "defaults_from", defaults_from cannot be nil.')
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
if @requests_per_minute.nil?
|
|
153
|
+
invalid_properties.push('invalid value for "requests_per_minute", requests_per_minute cannot be nil.')
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
if @requests_per_day.nil?
|
|
157
|
+
invalid_properties.push('invalid value for "requests_per_day", requests_per_day cannot be nil.')
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
if @rows_per_day.nil?
|
|
161
|
+
invalid_properties.push('invalid value for "rows_per_day", rows_per_day cannot be nil.')
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
if @paging_depth.nil?
|
|
165
|
+
invalid_properties.push('invalid value for "paging_depth", paging_depth cannot be nil.')
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
if @rwd_catalogue_calls_per_day.nil?
|
|
169
|
+
invalid_properties.push('invalid value for "rwd_catalogue_calls_per_day", rwd_catalogue_calls_per_day cannot be nil.')
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
if @benzinga_calls_per_day.nil?
|
|
173
|
+
invalid_properties.push('invalid value for "benzinga_calls_per_day", benzinga_calls_per_day cannot be nil.')
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
if @query_seconds_per_day.nil?
|
|
177
|
+
invalid_properties.push('invalid value for "query_seconds_per_day", query_seconds_per_day cannot be nil.')
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
invalid_properties
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
# Check to see if the all the properties in the model are valid
|
|
184
|
+
# @return true if the model is valid
|
|
185
|
+
def valid?
|
|
186
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
187
|
+
return false if @defaults_from.nil?
|
|
188
|
+
return false if @requests_per_minute.nil?
|
|
189
|
+
return false if @requests_per_day.nil?
|
|
190
|
+
return false if @rows_per_day.nil?
|
|
191
|
+
return false if @paging_depth.nil?
|
|
192
|
+
return false if @rwd_catalogue_calls_per_day.nil?
|
|
193
|
+
return false if @benzinga_calls_per_day.nil?
|
|
194
|
+
return false if @query_seconds_per_day.nil?
|
|
195
|
+
true
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
# Custom attribute writer method with validation
|
|
199
|
+
# @param [Object] defaults_from Value to be assigned
|
|
200
|
+
def defaults_from=(defaults_from)
|
|
201
|
+
if defaults_from.nil?
|
|
202
|
+
fail ArgumentError, 'defaults_from cannot be nil'
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
@defaults_from = defaults_from
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
# Custom attribute writer method with validation
|
|
209
|
+
# @param [Object] requests_per_minute Value to be assigned
|
|
210
|
+
def requests_per_minute=(requests_per_minute)
|
|
211
|
+
if requests_per_minute.nil?
|
|
212
|
+
fail ArgumentError, 'requests_per_minute cannot be nil'
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
@requests_per_minute = requests_per_minute
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
# Custom attribute writer method with validation
|
|
219
|
+
# @param [Object] requests_per_day Value to be assigned
|
|
220
|
+
def requests_per_day=(requests_per_day)
|
|
221
|
+
if requests_per_day.nil?
|
|
222
|
+
fail ArgumentError, 'requests_per_day cannot be nil'
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
@requests_per_day = requests_per_day
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
# Custom attribute writer method with validation
|
|
229
|
+
# @param [Object] rows_per_day Value to be assigned
|
|
230
|
+
def rows_per_day=(rows_per_day)
|
|
231
|
+
if rows_per_day.nil?
|
|
232
|
+
fail ArgumentError, 'rows_per_day cannot be nil'
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
@rows_per_day = rows_per_day
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
# Custom attribute writer method with validation
|
|
239
|
+
# @param [Object] paging_depth Value to be assigned
|
|
240
|
+
def paging_depth=(paging_depth)
|
|
241
|
+
if paging_depth.nil?
|
|
242
|
+
fail ArgumentError, 'paging_depth cannot be nil'
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
@paging_depth = paging_depth
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
# Custom attribute writer method with validation
|
|
249
|
+
# @param [Object] rwd_catalogue_calls_per_day Value to be assigned
|
|
250
|
+
def rwd_catalogue_calls_per_day=(rwd_catalogue_calls_per_day)
|
|
251
|
+
if rwd_catalogue_calls_per_day.nil?
|
|
252
|
+
fail ArgumentError, 'rwd_catalogue_calls_per_day cannot be nil'
|
|
253
|
+
end
|
|
254
|
+
|
|
255
|
+
@rwd_catalogue_calls_per_day = rwd_catalogue_calls_per_day
|
|
256
|
+
end
|
|
257
|
+
|
|
258
|
+
# Custom attribute writer method with validation
|
|
259
|
+
# @param [Object] benzinga_calls_per_day Value to be assigned
|
|
260
|
+
def benzinga_calls_per_day=(benzinga_calls_per_day)
|
|
261
|
+
if benzinga_calls_per_day.nil?
|
|
262
|
+
fail ArgumentError, 'benzinga_calls_per_day cannot be nil'
|
|
263
|
+
end
|
|
264
|
+
|
|
265
|
+
@benzinga_calls_per_day = benzinga_calls_per_day
|
|
266
|
+
end
|
|
267
|
+
|
|
268
|
+
# Custom attribute writer method with validation
|
|
269
|
+
# @param [Object] query_seconds_per_day Value to be assigned
|
|
270
|
+
def query_seconds_per_day=(query_seconds_per_day)
|
|
271
|
+
if query_seconds_per_day.nil?
|
|
272
|
+
fail ArgumentError, 'query_seconds_per_day cannot be nil'
|
|
273
|
+
end
|
|
274
|
+
|
|
275
|
+
@query_seconds_per_day = query_seconds_per_day
|
|
276
|
+
end
|
|
277
|
+
|
|
278
|
+
# Checks equality by comparing each attribute.
|
|
279
|
+
# @param [Object] Object to be compared
|
|
280
|
+
def ==(o)
|
|
281
|
+
return true if self.equal?(o)
|
|
282
|
+
self.class == o.class &&
|
|
283
|
+
defaults_from == o.defaults_from &&
|
|
284
|
+
requests_per_minute == o.requests_per_minute &&
|
|
285
|
+
requests_per_day == o.requests_per_day &&
|
|
286
|
+
rows_per_day == o.rows_per_day &&
|
|
287
|
+
paging_depth == o.paging_depth &&
|
|
288
|
+
rwd_catalogue_calls_per_day == o.rwd_catalogue_calls_per_day &&
|
|
289
|
+
benzinga_calls_per_day == o.benzinga_calls_per_day &&
|
|
290
|
+
query_seconds_per_day == o.query_seconds_per_day
|
|
291
|
+
end
|
|
292
|
+
|
|
293
|
+
# @see the `==` method
|
|
294
|
+
# @param [Object] Object to be compared
|
|
295
|
+
def eql?(o)
|
|
296
|
+
self == o
|
|
297
|
+
end
|
|
298
|
+
|
|
299
|
+
# Calculates hash code according to all attributes.
|
|
300
|
+
# @return [Integer] Hash code
|
|
301
|
+
def hash
|
|
302
|
+
[defaults_from, requests_per_minute, requests_per_day, rows_per_day, paging_depth, rwd_catalogue_calls_per_day, benzinga_calls_per_day, query_seconds_per_day].hash
|
|
303
|
+
end
|
|
304
|
+
|
|
305
|
+
# Builds the object from hash
|
|
306
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
307
|
+
# @return [Object] Returns the model itself
|
|
308
|
+
def self.build_from_hash(attributes)
|
|
309
|
+
return nil unless attributes.is_a?(Hash)
|
|
310
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
311
|
+
transformed_hash = {}
|
|
312
|
+
openapi_types.each_pair do |key, type|
|
|
313
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
314
|
+
transformed_hash["#{key}"] = nil
|
|
315
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
316
|
+
# check to ensure the input is an array given that the attribute
|
|
317
|
+
# is documented as an array but the input is not
|
|
318
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
319
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
320
|
+
end
|
|
321
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
322
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
323
|
+
end
|
|
324
|
+
end
|
|
325
|
+
new(transformed_hash)
|
|
326
|
+
end
|
|
327
|
+
|
|
328
|
+
# Deserializes the data based on type
|
|
329
|
+
# @param string type Data type
|
|
330
|
+
# @param string value Value to be deserialized
|
|
331
|
+
# @return [Object] Deserialized data
|
|
332
|
+
def self._deserialize(type, value)
|
|
333
|
+
case type.to_sym
|
|
334
|
+
when :Time
|
|
335
|
+
Time.parse(value)
|
|
336
|
+
when :Date
|
|
337
|
+
Date.parse(value)
|
|
338
|
+
when :String
|
|
339
|
+
value.to_s
|
|
340
|
+
when :Integer
|
|
341
|
+
value.to_i
|
|
342
|
+
when :Float
|
|
343
|
+
value.to_f
|
|
344
|
+
when :Boolean
|
|
345
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
346
|
+
true
|
|
347
|
+
else
|
|
348
|
+
false
|
|
349
|
+
end
|
|
350
|
+
when :Object
|
|
351
|
+
# generic object (usually a Hash), return directly
|
|
352
|
+
value
|
|
353
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
354
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
355
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
356
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
357
|
+
k_type = Regexp.last_match[:k_type]
|
|
358
|
+
v_type = Regexp.last_match[:v_type]
|
|
359
|
+
{}.tap do |hash|
|
|
360
|
+
value.each do |k, v|
|
|
361
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
362
|
+
end
|
|
363
|
+
end
|
|
364
|
+
else # model
|
|
365
|
+
# models (e.g. Pet) or oneOf
|
|
366
|
+
klass = PharmaObservatory.const_get(type)
|
|
367
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
368
|
+
end
|
|
369
|
+
end
|
|
370
|
+
|
|
371
|
+
# Returns the string representation of the object
|
|
372
|
+
# @return [String] String presentation of the object
|
|
373
|
+
def to_s
|
|
374
|
+
to_hash.to_s
|
|
375
|
+
end
|
|
376
|
+
|
|
377
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
378
|
+
# @return [Hash] Returns the object in the form of hash
|
|
379
|
+
def to_body
|
|
380
|
+
to_hash
|
|
381
|
+
end
|
|
382
|
+
|
|
383
|
+
# Returns the object in the form of hash
|
|
384
|
+
# @return [Hash] Returns the object in the form of hash
|
|
385
|
+
def to_hash
|
|
386
|
+
hash = {}
|
|
387
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
388
|
+
value = self.send(attr)
|
|
389
|
+
if value.nil?
|
|
390
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
391
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
392
|
+
end
|
|
393
|
+
|
|
394
|
+
hash[param] = _to_hash(value)
|
|
395
|
+
end
|
|
396
|
+
hash
|
|
397
|
+
end
|
|
398
|
+
|
|
399
|
+
# Outputs non-array value in the form of hash
|
|
400
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
401
|
+
# @param [Object] value Any valid value
|
|
402
|
+
# @return [Hash] Returns the value in the form of hash
|
|
403
|
+
def _to_hash(value)
|
|
404
|
+
if value.is_a?(Array)
|
|
405
|
+
value.compact.map { |v| _to_hash(v) }
|
|
406
|
+
elsif value.is_a?(Hash)
|
|
407
|
+
{}.tap do |hash|
|
|
408
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
409
|
+
end
|
|
410
|
+
elsif value.respond_to? :to_hash
|
|
411
|
+
value.to_hash
|
|
412
|
+
else
|
|
413
|
+
value
|
|
414
|
+
end
|
|
415
|
+
end
|
|
416
|
+
|
|
417
|
+
end
|
|
418
|
+
|
|
419
|
+
end
|
|
@@ -0,0 +1,263 @@
|
|
|
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
|
+
class ApiV1WhoamiGet200ResponseQuota
|
|
18
|
+
attr_accessor :keyed_by
|
|
19
|
+
|
|
20
|
+
attr_accessor :buckets
|
|
21
|
+
|
|
22
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
23
|
+
def self.attribute_map
|
|
24
|
+
{
|
|
25
|
+
:'keyed_by' => :'keyed_by',
|
|
26
|
+
:'buckets' => :'buckets'
|
|
27
|
+
}
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Returns attribute mapping this model knows about
|
|
31
|
+
def self.acceptable_attribute_map
|
|
32
|
+
attribute_map
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Returns all the JSON keys this model knows about
|
|
36
|
+
def self.acceptable_attributes
|
|
37
|
+
acceptable_attribute_map.values
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Attribute type mapping.
|
|
41
|
+
def self.openapi_types
|
|
42
|
+
{
|
|
43
|
+
:'keyed_by' => :'String',
|
|
44
|
+
:'buckets' => :'ApiV1WhoamiGet200ResponseQuotaBuckets'
|
|
45
|
+
}
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# List of attributes with nullable: true
|
|
49
|
+
def self.openapi_nullable
|
|
50
|
+
Set.new([
|
|
51
|
+
])
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# Initializes the object
|
|
55
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
56
|
+
def initialize(attributes = {})
|
|
57
|
+
if (!attributes.is_a?(Hash))
|
|
58
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `PharmaObservatory::ApiV1WhoamiGet200ResponseQuota` initialize method"
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
62
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
63
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
64
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
65
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `PharmaObservatory::ApiV1WhoamiGet200ResponseQuota`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
66
|
+
end
|
|
67
|
+
h[k.to_sym] = v
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if attributes.key?(:'keyed_by')
|
|
71
|
+
self.keyed_by = attributes[:'keyed_by']
|
|
72
|
+
else
|
|
73
|
+
self.keyed_by = nil
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
if attributes.key?(:'buckets')
|
|
77
|
+
self.buckets = attributes[:'buckets']
|
|
78
|
+
else
|
|
79
|
+
self.buckets = nil
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
84
|
+
# @return Array for valid properties with the reasons
|
|
85
|
+
def list_invalid_properties
|
|
86
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
87
|
+
invalid_properties = Array.new
|
|
88
|
+
if @keyed_by.nil?
|
|
89
|
+
invalid_properties.push('invalid value for "keyed_by", keyed_by cannot be nil.')
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
if @buckets.nil?
|
|
93
|
+
invalid_properties.push('invalid value for "buckets", buckets cannot be nil.')
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
invalid_properties
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
# Check to see if the all the properties in the model are valid
|
|
100
|
+
# @return true if the model is valid
|
|
101
|
+
def valid?
|
|
102
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
103
|
+
return false if @keyed_by.nil?
|
|
104
|
+
return false if @buckets.nil?
|
|
105
|
+
true
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
# Custom attribute writer method with validation
|
|
109
|
+
# @param [Object] keyed_by Value to be assigned
|
|
110
|
+
def keyed_by=(keyed_by)
|
|
111
|
+
if keyed_by.nil?
|
|
112
|
+
fail ArgumentError, 'keyed_by cannot be nil'
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
@keyed_by = keyed_by
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
# Custom attribute writer method with validation
|
|
119
|
+
# @param [Object] buckets Value to be assigned
|
|
120
|
+
def buckets=(buckets)
|
|
121
|
+
if buckets.nil?
|
|
122
|
+
fail ArgumentError, 'buckets cannot be nil'
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
@buckets = buckets
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
# Checks equality by comparing each attribute.
|
|
129
|
+
# @param [Object] Object to be compared
|
|
130
|
+
def ==(o)
|
|
131
|
+
return true if self.equal?(o)
|
|
132
|
+
self.class == o.class &&
|
|
133
|
+
keyed_by == o.keyed_by &&
|
|
134
|
+
buckets == o.buckets
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
# @see the `==` method
|
|
138
|
+
# @param [Object] Object to be compared
|
|
139
|
+
def eql?(o)
|
|
140
|
+
self == o
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
# Calculates hash code according to all attributes.
|
|
144
|
+
# @return [Integer] Hash code
|
|
145
|
+
def hash
|
|
146
|
+
[keyed_by, buckets].hash
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
# Builds the object from hash
|
|
150
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
151
|
+
# @return [Object] Returns the model itself
|
|
152
|
+
def self.build_from_hash(attributes)
|
|
153
|
+
return nil unless attributes.is_a?(Hash)
|
|
154
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
155
|
+
transformed_hash = {}
|
|
156
|
+
openapi_types.each_pair do |key, type|
|
|
157
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
158
|
+
transformed_hash["#{key}"] = nil
|
|
159
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
160
|
+
# check to ensure the input is an array given that the attribute
|
|
161
|
+
# is documented as an array but the input is not
|
|
162
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
163
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
164
|
+
end
|
|
165
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
166
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
167
|
+
end
|
|
168
|
+
end
|
|
169
|
+
new(transformed_hash)
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
# Deserializes the data based on type
|
|
173
|
+
# @param string type Data type
|
|
174
|
+
# @param string value Value to be deserialized
|
|
175
|
+
# @return [Object] Deserialized data
|
|
176
|
+
def self._deserialize(type, value)
|
|
177
|
+
case type.to_sym
|
|
178
|
+
when :Time
|
|
179
|
+
Time.parse(value)
|
|
180
|
+
when :Date
|
|
181
|
+
Date.parse(value)
|
|
182
|
+
when :String
|
|
183
|
+
value.to_s
|
|
184
|
+
when :Integer
|
|
185
|
+
value.to_i
|
|
186
|
+
when :Float
|
|
187
|
+
value.to_f
|
|
188
|
+
when :Boolean
|
|
189
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
190
|
+
true
|
|
191
|
+
else
|
|
192
|
+
false
|
|
193
|
+
end
|
|
194
|
+
when :Object
|
|
195
|
+
# generic object (usually a Hash), return directly
|
|
196
|
+
value
|
|
197
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
198
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
199
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
200
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
201
|
+
k_type = Regexp.last_match[:k_type]
|
|
202
|
+
v_type = Regexp.last_match[:v_type]
|
|
203
|
+
{}.tap do |hash|
|
|
204
|
+
value.each do |k, v|
|
|
205
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
206
|
+
end
|
|
207
|
+
end
|
|
208
|
+
else # model
|
|
209
|
+
# models (e.g. Pet) or oneOf
|
|
210
|
+
klass = PharmaObservatory.const_get(type)
|
|
211
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
212
|
+
end
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
# Returns the string representation of the object
|
|
216
|
+
# @return [String] String presentation of the object
|
|
217
|
+
def to_s
|
|
218
|
+
to_hash.to_s
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
222
|
+
# @return [Hash] Returns the object in the form of hash
|
|
223
|
+
def to_body
|
|
224
|
+
to_hash
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
# Returns the object in the form of hash
|
|
228
|
+
# @return [Hash] Returns the object in the form of hash
|
|
229
|
+
def to_hash
|
|
230
|
+
hash = {}
|
|
231
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
232
|
+
value = self.send(attr)
|
|
233
|
+
if value.nil?
|
|
234
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
235
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
hash[param] = _to_hash(value)
|
|
239
|
+
end
|
|
240
|
+
hash
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
# Outputs non-array value in the form of hash
|
|
244
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
245
|
+
# @param [Object] value Any valid value
|
|
246
|
+
# @return [Hash] Returns the value in the form of hash
|
|
247
|
+
def _to_hash(value)
|
|
248
|
+
if value.is_a?(Array)
|
|
249
|
+
value.compact.map { |v| _to_hash(v) }
|
|
250
|
+
elsif value.is_a?(Hash)
|
|
251
|
+
{}.tap do |hash|
|
|
252
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
253
|
+
end
|
|
254
|
+
elsif value.respond_to? :to_hash
|
|
255
|
+
value.to_hash
|
|
256
|
+
else
|
|
257
|
+
value
|
|
258
|
+
end
|
|
259
|
+
end
|
|
260
|
+
|
|
261
|
+
end
|
|
262
|
+
|
|
263
|
+
end
|