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