pharmaobservatory 0.1.13 → 0.1.15

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 (47) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +25 -5
  3. data/docs/BiomarkerValidationRow.md +1 -1
  4. data/docs/ChangesList200Response.md +26 -0
  5. data/docs/ChangesList200ResponseBuildState.md +20 -0
  6. data/docs/ChangesList200ResponseItemsInner.md +48 -0
  7. data/docs/ChangesList200ResponseItemsInnerEntryKeys.md +18 -0
  8. data/docs/CompaniesApi.md +86 -4
  9. data/docs/CompanyAssetCollisionsResponse.md +58 -0
  10. data/docs/CompanyAssetCollisionsRow.md +68 -0
  11. data/docs/CompanyCompetitorsRow.md +16 -32
  12. data/docs/CompanyFinancialsRow.md +18 -0
  13. data/docs/ConditionAdverseEventsRow.md +5 -1
  14. data/docs/SubscriptionsApi.md +282 -0
  15. data/docs/SubscriptionsCreate201Response.md +22 -0
  16. data/docs/SubscriptionsCreate201ResponseSubscription.md +28 -0
  17. data/docs/SubscriptionsCreate201ResponseSubscriptionTarget.md +22 -0
  18. data/docs/SubscriptionsCreateRequest.md +20 -0
  19. data/docs/SubscriptionsDelete200Response.md +24 -0
  20. data/docs/SubscriptionsList200Response.md +22 -0
  21. data/docs/SubscriptionsList200ResponseSubscriptionsInner.md +28 -0
  22. data/docs/SubscriptionsList200ResponseSubscriptionsInnerTarget.md +26 -0
  23. data/docs/SubscriptionsList200ResponseSubscriptionsInnerTargetFilters.md +18 -0
  24. data/lib/pharmaobservatory/api/companies_api.rb +93 -2
  25. data/lib/pharmaobservatory/api/subscriptions_api.rb +261 -0
  26. data/lib/pharmaobservatory/models/biomarker_validation_row.rb +1 -1
  27. data/lib/pharmaobservatory/models/changes_list200_response.rb +343 -0
  28. data/lib/pharmaobservatory/models/changes_list200_response_build_state.rb +263 -0
  29. data/lib/pharmaobservatory/models/changes_list200_response_items_inner.rb +627 -0
  30. data/lib/pharmaobservatory/models/changes_list200_response_items_inner_entry_keys.rb +237 -0
  31. data/lib/pharmaobservatory/models/company_asset_collisions_response.rb +478 -0
  32. data/lib/pharmaobservatory/models/company_asset_collisions_row.rb +502 -0
  33. data/lib/pharmaobservatory/models/company_competitors_row.rb +61 -153
  34. data/lib/pharmaobservatory/models/company_financials_row.rb +100 -1
  35. data/lib/pharmaobservatory/models/condition_adverse_events_row.rb +27 -5
  36. data/lib/pharmaobservatory/models/subscriptions_create201_response.rb +289 -0
  37. data/lib/pharmaobservatory/models/subscriptions_create201_response_subscription.rb +369 -0
  38. data/lib/pharmaobservatory/models/subscriptions_create201_response_subscription_target.rb +289 -0
  39. data/lib/pharmaobservatory/models/subscriptions_create_request.rb +263 -0
  40. data/lib/pharmaobservatory/models/subscriptions_delete200_response.rb +315 -0
  41. data/lib/pharmaobservatory/models/subscriptions_list200_response.rb +291 -0
  42. data/lib/pharmaobservatory/models/subscriptions_list200_response_subscriptions_inner.rb +369 -0
  43. data/lib/pharmaobservatory/models/subscriptions_list200_response_subscriptions_inner_target.rb +277 -0
  44. data/lib/pharmaobservatory/models/subscriptions_list200_response_subscriptions_inner_target_filters.rb +237 -0
  45. data/lib/pharmaobservatory/version.rb +1 -1
  46. data/lib/pharmaobservatory.rb +16 -0
  47. metadata +34 -2
@@ -0,0 +1,261 @@
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 'cgi'
14
+
15
+ module PharmaObservatory
16
+ class SubscriptionsApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Changes since a cursor
23
+ # @param [Hash] opts the optional parameters
24
+ # @option opts [String] :cursor
25
+ # @option opts [Integer] :limit
26
+ # @return [ChangesList200Response]
27
+ def changes_list(opts = {})
28
+ data, _status_code, _headers = changes_list_with_http_info(opts)
29
+ data
30
+ end
31
+
32
+ # Changes since a cursor
33
+ # @param [Hash] opts the optional parameters
34
+ # @option opts [String] :cursor
35
+ # @option opts [Integer] :limit
36
+ # @return [Array<(ChangesList200Response, Integer, Hash)>] ChangesList200Response data, response status code and response headers
37
+ def changes_list_with_http_info(opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: SubscriptionsApi.changes_list ...'
40
+ end
41
+ # resource path
42
+ local_var_path = '/api/v1/changes'
43
+
44
+ # query parameters
45
+ query_params = opts[:query_params] || {}
46
+ query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
47
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
48
+
49
+ # header parameters
50
+ header_params = opts[:header_params] || {}
51
+ # HTTP header 'Accept' (if needed)
52
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
53
+
54
+ # form parameters
55
+ form_params = opts[:form_params] || {}
56
+
57
+ # http body (model)
58
+ post_body = opts[:debug_body]
59
+
60
+ # return_type
61
+ return_type = opts[:debug_return_type] || 'ChangesList200Response'
62
+
63
+ # auth_names
64
+ auth_names = opts[:debug_auth_names] || ['ApiBearerJwt']
65
+
66
+ new_options = opts.merge(
67
+ :operation => :"SubscriptionsApi.changes_list",
68
+ :header_params => header_params,
69
+ :query_params => query_params,
70
+ :form_params => form_params,
71
+ :body => post_body,
72
+ :auth_names => auth_names,
73
+ :return_type => return_type
74
+ )
75
+
76
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
77
+ if @api_client.config.debugging
78
+ @api_client.config.logger.debug "API called: SubscriptionsApi#changes_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
79
+ end
80
+ return data, status_code, headers
81
+ end
82
+
83
+ # Follow an entity or a dataset query
84
+ # @param [Hash] opts the optional parameters
85
+ # @option opts [SubscriptionsCreateRequest] :subscriptions_create_request
86
+ # @return [SubscriptionsCreate201Response]
87
+ def subscriptions_create(opts = {})
88
+ data, _status_code, _headers = subscriptions_create_with_http_info(opts)
89
+ data
90
+ end
91
+
92
+ # Follow an entity or a dataset query
93
+ # @param [Hash] opts the optional parameters
94
+ # @option opts [SubscriptionsCreateRequest] :subscriptions_create_request
95
+ # @return [Array<(SubscriptionsCreate201Response, Integer, Hash)>] SubscriptionsCreate201Response data, response status code and response headers
96
+ def subscriptions_create_with_http_info(opts = {})
97
+ if @api_client.config.debugging
98
+ @api_client.config.logger.debug 'Calling API: SubscriptionsApi.subscriptions_create ...'
99
+ end
100
+ # resource path
101
+ local_var_path = '/api/v1/subscriptions'
102
+
103
+ # query parameters
104
+ query_params = opts[:query_params] || {}
105
+
106
+ # header parameters
107
+ header_params = opts[:header_params] || {}
108
+ # HTTP header 'Accept' (if needed)
109
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
110
+ # HTTP header 'Content-Type'
111
+ content_type = @api_client.select_header_content_type(['application/json'])
112
+ if !content_type.nil?
113
+ header_params['Content-Type'] = content_type
114
+ end
115
+
116
+ # form parameters
117
+ form_params = opts[:form_params] || {}
118
+
119
+ # http body (model)
120
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'subscriptions_create_request'])
121
+
122
+ # return_type
123
+ return_type = opts[:debug_return_type] || 'SubscriptionsCreate201Response'
124
+
125
+ # auth_names
126
+ auth_names = opts[:debug_auth_names] || ['ApiBearerJwt']
127
+
128
+ new_options = opts.merge(
129
+ :operation => :"SubscriptionsApi.subscriptions_create",
130
+ :header_params => header_params,
131
+ :query_params => query_params,
132
+ :form_params => form_params,
133
+ :body => post_body,
134
+ :auth_names => auth_names,
135
+ :return_type => return_type
136
+ )
137
+
138
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
139
+ if @api_client.config.debugging
140
+ @api_client.config.logger.debug "API called: SubscriptionsApi#subscriptions_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
141
+ end
142
+ return data, status_code, headers
143
+ end
144
+
145
+ # Stop following
146
+ # @param id [Integer]
147
+ # @param [Hash] opts the optional parameters
148
+ # @return [SubscriptionsDelete200Response]
149
+ def subscriptions_delete(id, opts = {})
150
+ data, _status_code, _headers = subscriptions_delete_with_http_info(id, opts)
151
+ data
152
+ end
153
+
154
+ # Stop following
155
+ # @param id [Integer]
156
+ # @param [Hash] opts the optional parameters
157
+ # @return [Array<(SubscriptionsDelete200Response, Integer, Hash)>] SubscriptionsDelete200Response data, response status code and response headers
158
+ def subscriptions_delete_with_http_info(id, opts = {})
159
+ if @api_client.config.debugging
160
+ @api_client.config.logger.debug 'Calling API: SubscriptionsApi.subscriptions_delete ...'
161
+ end
162
+ # verify the required parameter 'id' is set
163
+ if @api_client.config.client_side_validation && id.nil?
164
+ fail ArgumentError, "Missing the required parameter 'id' when calling SubscriptionsApi.subscriptions_delete"
165
+ end
166
+ # resource path
167
+ local_var_path = '/api/v1/subscriptions/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
168
+
169
+ # query parameters
170
+ query_params = opts[:query_params] || {}
171
+
172
+ # header parameters
173
+ header_params = opts[:header_params] || {}
174
+ # HTTP header 'Accept' (if needed)
175
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
176
+
177
+ # form parameters
178
+ form_params = opts[:form_params] || {}
179
+
180
+ # http body (model)
181
+ post_body = opts[:debug_body]
182
+
183
+ # return_type
184
+ return_type = opts[:debug_return_type] || 'SubscriptionsDelete200Response'
185
+
186
+ # auth_names
187
+ auth_names = opts[:debug_auth_names] || ['ApiBearerJwt']
188
+
189
+ new_options = opts.merge(
190
+ :operation => :"SubscriptionsApi.subscriptions_delete",
191
+ :header_params => header_params,
192
+ :query_params => query_params,
193
+ :form_params => form_params,
194
+ :body => post_body,
195
+ :auth_names => auth_names,
196
+ :return_type => return_type
197
+ )
198
+
199
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
200
+ if @api_client.config.debugging
201
+ @api_client.config.logger.debug "API called: SubscriptionsApi#subscriptions_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
202
+ end
203
+ return data, status_code, headers
204
+ end
205
+
206
+ # List your subscriptions
207
+ # @param [Hash] opts the optional parameters
208
+ # @return [SubscriptionsList200Response]
209
+ def subscriptions_list(opts = {})
210
+ data, _status_code, _headers = subscriptions_list_with_http_info(opts)
211
+ data
212
+ end
213
+
214
+ # List your subscriptions
215
+ # @param [Hash] opts the optional parameters
216
+ # @return [Array<(SubscriptionsList200Response, Integer, Hash)>] SubscriptionsList200Response data, response status code and response headers
217
+ def subscriptions_list_with_http_info(opts = {})
218
+ if @api_client.config.debugging
219
+ @api_client.config.logger.debug 'Calling API: SubscriptionsApi.subscriptions_list ...'
220
+ end
221
+ # resource path
222
+ local_var_path = '/api/v1/subscriptions'
223
+
224
+ # query parameters
225
+ query_params = opts[:query_params] || {}
226
+
227
+ # header parameters
228
+ header_params = opts[:header_params] || {}
229
+ # HTTP header 'Accept' (if needed)
230
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
231
+
232
+ # form parameters
233
+ form_params = opts[:form_params] || {}
234
+
235
+ # http body (model)
236
+ post_body = opts[:debug_body]
237
+
238
+ # return_type
239
+ return_type = opts[:debug_return_type] || 'SubscriptionsList200Response'
240
+
241
+ # auth_names
242
+ auth_names = opts[:debug_auth_names] || ['ApiBearerJwt']
243
+
244
+ new_options = opts.merge(
245
+ :operation => :"SubscriptionsApi.subscriptions_list",
246
+ :header_params => header_params,
247
+ :query_params => query_params,
248
+ :form_params => form_params,
249
+ :body => post_body,
250
+ :auth_names => auth_names,
251
+ :return_type => return_type
252
+ )
253
+
254
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
255
+ if @api_client.config.debugging
256
+ @api_client.config.logger.debug "API called: SubscriptionsApi#subscriptions_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
257
+ end
258
+ return data, status_code, headers
259
+ end
260
+ end
261
+ end
@@ -82,7 +82,7 @@ module PharmaObservatory
82
82
  # A link to the cited record.
83
83
  attr_accessor :citation_url
84
84
 
85
- # False for the FDA Biomarker Qualification Program arm, whose captured links are known to go stale; true otherwise. A link marked false may not resolve.
85
+ # True on every row. Kept for contract stability; the FDA Biomarker Qualification Program links were rebuilt on the current FDA host (#5778).
86
86
  attr_accessor :citation_verified
87
87
 
88
88
  # The text span the evidence rests on, where the source gives one.
@@ -0,0 +1,343 @@
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 ChangesList200Response
18
+ attr_accessor :items
19
+
20
+ attr_accessor :count
21
+
22
+ attr_accessor :next_cursor
23
+
24
+ attr_accessor :has_more
25
+
26
+ attr_accessor :build_state
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'items' => :'items',
32
+ :'count' => :'count',
33
+ :'next_cursor' => :'next_cursor',
34
+ :'has_more' => :'has_more',
35
+ :'build_state' => :'build_state'
36
+ }
37
+ end
38
+
39
+ # Returns attribute mapping this model knows about
40
+ def self.acceptable_attribute_map
41
+ attribute_map
42
+ end
43
+
44
+ # Returns all the JSON keys this model knows about
45
+ def self.acceptable_attributes
46
+ acceptable_attribute_map.values
47
+ end
48
+
49
+ # Attribute type mapping.
50
+ def self.openapi_types
51
+ {
52
+ :'items' => :'Array<ChangesList200ResponseItemsInner>',
53
+ :'count' => :'Integer',
54
+ :'next_cursor' => :'String',
55
+ :'has_more' => :'Boolean',
56
+ :'build_state' => :'ChangesList200ResponseBuildState'
57
+ }
58
+ end
59
+
60
+ # List of attributes with nullable: true
61
+ def self.openapi_nullable
62
+ Set.new([
63
+ ])
64
+ end
65
+
66
+ # Initializes the object
67
+ # @param [Hash] attributes Model attributes in the form of hash
68
+ def initialize(attributes = {})
69
+ if (!attributes.is_a?(Hash))
70
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PharmaObservatory::ChangesList200Response` initialize method"
71
+ end
72
+
73
+ # check to see if the attribute exists and convert string to symbol for hash key
74
+ acceptable_attribute_map = self.class.acceptable_attribute_map
75
+ attributes = attributes.each_with_object({}) { |(k, v), h|
76
+ if (!acceptable_attribute_map.key?(k.to_sym))
77
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PharmaObservatory::ChangesList200Response`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
78
+ end
79
+ h[k.to_sym] = v
80
+ }
81
+
82
+ if attributes.key?(:'items')
83
+ if (value = attributes[:'items']).is_a?(Array)
84
+ self.items = value
85
+ end
86
+ else
87
+ self.items = nil
88
+ end
89
+
90
+ if attributes.key?(:'count')
91
+ self.count = attributes[:'count']
92
+ else
93
+ self.count = nil
94
+ end
95
+
96
+ if attributes.key?(:'next_cursor')
97
+ self.next_cursor = attributes[:'next_cursor']
98
+ else
99
+ self.next_cursor = nil
100
+ end
101
+
102
+ if attributes.key?(:'has_more')
103
+ self.has_more = attributes[:'has_more']
104
+ else
105
+ self.has_more = nil
106
+ end
107
+
108
+ if attributes.key?(:'build_state')
109
+ self.build_state = attributes[:'build_state']
110
+ else
111
+ self.build_state = nil
112
+ end
113
+ end
114
+
115
+ # Show invalid properties with the reasons. Usually used together with valid?
116
+ # @return Array for valid properties with the reasons
117
+ def list_invalid_properties
118
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
119
+ invalid_properties = Array.new
120
+ if @items.nil?
121
+ invalid_properties.push('invalid value for "items", items cannot be nil.')
122
+ end
123
+
124
+ if @count.nil?
125
+ invalid_properties.push('invalid value for "count", count cannot be nil.')
126
+ end
127
+
128
+ if @next_cursor.nil?
129
+ invalid_properties.push('invalid value for "next_cursor", next_cursor cannot be nil.')
130
+ end
131
+
132
+ if @has_more.nil?
133
+ invalid_properties.push('invalid value for "has_more", has_more cannot be nil.')
134
+ end
135
+
136
+ if @build_state.nil?
137
+ invalid_properties.push('invalid value for "build_state", build_state cannot be nil.')
138
+ end
139
+
140
+ invalid_properties
141
+ end
142
+
143
+ # Check to see if the all the properties in the model are valid
144
+ # @return true if the model is valid
145
+ def valid?
146
+ warn '[DEPRECATED] the `valid?` method is obsolete'
147
+ return false if @items.nil?
148
+ return false if @count.nil?
149
+ return false if @next_cursor.nil?
150
+ return false if @has_more.nil?
151
+ return false if @build_state.nil?
152
+ true
153
+ end
154
+
155
+ # Custom attribute writer method with validation
156
+ # @param [Object] items Value to be assigned
157
+ def items=(items)
158
+ if items.nil?
159
+ fail ArgumentError, 'items cannot be nil'
160
+ end
161
+
162
+ @items = items
163
+ end
164
+
165
+ # Custom attribute writer method with validation
166
+ # @param [Object] count Value to be assigned
167
+ def count=(count)
168
+ if count.nil?
169
+ fail ArgumentError, 'count cannot be nil'
170
+ end
171
+
172
+ @count = count
173
+ end
174
+
175
+ # Custom attribute writer method with validation
176
+ # @param [Object] next_cursor Value to be assigned
177
+ def next_cursor=(next_cursor)
178
+ if next_cursor.nil?
179
+ fail ArgumentError, 'next_cursor cannot be nil'
180
+ end
181
+
182
+ @next_cursor = next_cursor
183
+ end
184
+
185
+ # Custom attribute writer method with validation
186
+ # @param [Object] has_more Value to be assigned
187
+ def has_more=(has_more)
188
+ if has_more.nil?
189
+ fail ArgumentError, 'has_more cannot be nil'
190
+ end
191
+
192
+ @has_more = has_more
193
+ end
194
+
195
+ # Custom attribute writer method with validation
196
+ # @param [Object] build_state Value to be assigned
197
+ def build_state=(build_state)
198
+ if build_state.nil?
199
+ fail ArgumentError, 'build_state cannot be nil'
200
+ end
201
+
202
+ @build_state = build_state
203
+ end
204
+
205
+ # Checks equality by comparing each attribute.
206
+ # @param [Object] Object to be compared
207
+ def ==(o)
208
+ return true if self.equal?(o)
209
+ self.class == o.class &&
210
+ items == o.items &&
211
+ count == o.count &&
212
+ next_cursor == o.next_cursor &&
213
+ has_more == o.has_more &&
214
+ build_state == o.build_state
215
+ end
216
+
217
+ # @see the `==` method
218
+ # @param [Object] Object to be compared
219
+ def eql?(o)
220
+ self == o
221
+ end
222
+
223
+ # Calculates hash code according to all attributes.
224
+ # @return [Integer] Hash code
225
+ def hash
226
+ [items, count, next_cursor, has_more, build_state].hash
227
+ end
228
+
229
+ # Builds the object from hash
230
+ # @param [Hash] attributes Model attributes in the form of hash
231
+ # @return [Object] Returns the model itself
232
+ def self.build_from_hash(attributes)
233
+ return nil unless attributes.is_a?(Hash)
234
+ attributes = attributes.transform_keys(&:to_sym)
235
+ transformed_hash = {}
236
+ openapi_types.each_pair do |key, type|
237
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
238
+ transformed_hash["#{key}"] = nil
239
+ elsif type =~ /\AArray<(.*)>/i
240
+ # check to ensure the input is an array given that the attribute
241
+ # is documented as an array but the input is not
242
+ if attributes[attribute_map[key]].is_a?(Array)
243
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
244
+ end
245
+ elsif !attributes[attribute_map[key]].nil?
246
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
247
+ end
248
+ end
249
+ new(transformed_hash)
250
+ end
251
+
252
+ # Deserializes the data based on type
253
+ # @param string type Data type
254
+ # @param string value Value to be deserialized
255
+ # @return [Object] Deserialized data
256
+ def self._deserialize(type, value)
257
+ case type.to_sym
258
+ when :Time
259
+ Time.parse(value)
260
+ when :Date
261
+ Date.parse(value)
262
+ when :String
263
+ value.to_s
264
+ when :Integer
265
+ value.to_i
266
+ when :Float
267
+ value.to_f
268
+ when :Boolean
269
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
270
+ true
271
+ else
272
+ false
273
+ end
274
+ when :Object
275
+ # generic object (usually a Hash), return directly
276
+ value
277
+ when /\AArray<(?<inner_type>.+)>\z/
278
+ inner_type = Regexp.last_match[:inner_type]
279
+ value.map { |v| _deserialize(inner_type, v) }
280
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
281
+ k_type = Regexp.last_match[:k_type]
282
+ v_type = Regexp.last_match[:v_type]
283
+ {}.tap do |hash|
284
+ value.each do |k, v|
285
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
286
+ end
287
+ end
288
+ else # model
289
+ # models (e.g. Pet) or oneOf
290
+ klass = PharmaObservatory.const_get(type)
291
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
292
+ end
293
+ end
294
+
295
+ # Returns the string representation of the object
296
+ # @return [String] String presentation of the object
297
+ def to_s
298
+ to_hash.to_s
299
+ end
300
+
301
+ # to_body is an alias to to_hash (backward compatibility)
302
+ # @return [Hash] Returns the object in the form of hash
303
+ def to_body
304
+ to_hash
305
+ end
306
+
307
+ # Returns the object in the form of hash
308
+ # @return [Hash] Returns the object in the form of hash
309
+ def to_hash
310
+ hash = {}
311
+ self.class.attribute_map.each_pair do |attr, param|
312
+ value = self.send(attr)
313
+ if value.nil?
314
+ is_nullable = self.class.openapi_nullable.include?(attr)
315
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
316
+ end
317
+
318
+ hash[param] = _to_hash(value)
319
+ end
320
+ hash
321
+ end
322
+
323
+ # Outputs non-array value in the form of hash
324
+ # For object, use to_hash. Otherwise, just return the value
325
+ # @param [Object] value Any valid value
326
+ # @return [Hash] Returns the value in the form of hash
327
+ def _to_hash(value)
328
+ if value.is_a?(Array)
329
+ value.compact.map { |v| _to_hash(v) }
330
+ elsif value.is_a?(Hash)
331
+ {}.tap do |hash|
332
+ value.each { |k, v| hash[k] = _to_hash(v) }
333
+ end
334
+ elsif value.respond_to? :to_hash
335
+ value.to_hash
336
+ else
337
+ value
338
+ end
339
+ end
340
+
341
+ end
342
+
343
+ end