intrinio-sdk 5.13.0 → 5.13.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -1
- data/docs/ApiResponseCompanyAnswers.md +25 -0
- data/docs/CompanyApi.md +80 -0
- data/docs/TheaEntityAnswer.md +25 -0
- data/docs/TheaSourceDocument.md +24 -0
- data/docs/TheaSourceDocumentTags.md +21 -0
- data/lib/intrinio-sdk.rb +4 -0
- data/lib/intrinio-sdk/api/company_api.rb +60 -0
- data/lib/intrinio-sdk/models/api_response_company_answers.rb +210 -0
- data/lib/intrinio-sdk/models/thea_entity_answer.rb +210 -0
- data/lib/intrinio-sdk/models/thea_source_document.rb +201 -0
- data/lib/intrinio-sdk/models/thea_source_document_tags.rb +199 -0
- data/lib/intrinio-sdk/version.rb +1 -1
- data/spec/api/company_api_spec.rb +13 -0
- data/spec/models/api_response_company_answers_spec.rb +54 -0
- data/spec/models/thea_entity_answer_spec.rb +54 -0
- data/spec/models/thea_source_document_spec.rb +48 -0
- data/spec/models/thea_source_document_tags_spec.rb +48 -0
- metadata +17 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dd475f8d6e1339582f4cc3e43f98a91ecaeefab58b05c87e22a5a5f6b6054a46
|
4
|
+
data.tar.gz: c3b40b9d23c0eaa1a8c1d7cc8d595fcaeb701e3695e959a8fbe35c9f2774dde9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2db6f60ca2a27e023d21735f91dd8e8714f40e606e46e32425171b51eb652d7d620990afae20489f2ecf93372816106dee8d1eb93308a045c4b0a0bf91769b30
|
7
|
+
data.tar.gz: e3ac10f780b7c5c2101e4d7cabbaab75ddcdf83a304a290d24dd54f22edca3e4f4d8e8778c8b09b5dea9bec9b7a2417bafdd0dd9573ed8bf8c0912d9a383d409
|
data/README.md
CHANGED
@@ -9,7 +9,7 @@ Welcome to the Intrinio API! Through our Financial Data Marketplace, we offer a
|
|
9
9
|
This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
|
10
10
|
|
11
11
|
- API version: 2.23.0
|
12
|
-
- Package version: 5.13.
|
12
|
+
- Package version: 5.13.1
|
13
13
|
|
14
14
|
|
15
15
|
## Installation
|
@@ -65,6 +65,7 @@ Class | Method | HTTP request | Description
|
|
65
65
|
*Intrinio::CompanyApi* | [**get_all_companies**](docs/CompanyApi.md#get_all_companies) | **GET** /companies | All Companies
|
66
66
|
*Intrinio::CompanyApi* | [**get_all_company_news**](docs/CompanyApi.md#get_all_company_news) | **GET** /companies/news | All News
|
67
67
|
*Intrinio::CompanyApi* | [**get_company**](docs/CompanyApi.md#get_company) | **GET** /companies/{identifier} | Lookup Company
|
68
|
+
*Intrinio::CompanyApi* | [**get_company_answers**](docs/CompanyApi.md#get_company_answers) | **GET** /companies/{identifier}/answers | Company Answers
|
68
69
|
*Intrinio::CompanyApi* | [**get_company_data_point_number**](docs/CompanyApi.md#get_company_data_point_number) | **GET** /companies/{identifier}/data_point/{tag}/number | Data Point (Number) for Company
|
69
70
|
*Intrinio::CompanyApi* | [**get_company_data_point_text**](docs/CompanyApi.md#get_company_data_point_text) | **GET** /companies/{identifier}/data_point/{tag}/text | Data Point (Text) for Company
|
70
71
|
*Intrinio::CompanyApi* | [**get_company_filings**](docs/CompanyApi.md#get_company_filings) | **GET** /companies/{identifier}/filings | All Filings by Company
|
@@ -252,6 +253,7 @@ Class | Method | HTTP request | Description
|
|
252
253
|
- [Intrinio::ApiResponseBulkDownloadLinks](docs/ApiResponseBulkDownloadLinks.md)
|
253
254
|
- [Intrinio::ApiResponseCompanies](docs/ApiResponseCompanies.md)
|
254
255
|
- [Intrinio::ApiResponseCompaniesSearch](docs/ApiResponseCompaniesSearch.md)
|
256
|
+
- [Intrinio::ApiResponseCompanyAnswers](docs/ApiResponseCompanyAnswers.md)
|
255
257
|
- [Intrinio::ApiResponseCompanyFilings](docs/ApiResponseCompanyFilings.md)
|
256
258
|
- [Intrinio::ApiResponseCompanyFundamentals](docs/ApiResponseCompanyFundamentals.md)
|
257
259
|
- [Intrinio::ApiResponseCompanyHistoricalData](docs/ApiResponseCompanyHistoricalData.md)
|
@@ -455,6 +457,9 @@ Class | Method | HTTP request | Description
|
|
455
457
|
- [Intrinio::StockPriceInterval](docs/StockPriceInterval.md)
|
456
458
|
- [Intrinio::StockPriceSummary](docs/StockPriceSummary.md)
|
457
459
|
- [Intrinio::TechnicalIndicator](docs/TechnicalIndicator.md)
|
460
|
+
- [Intrinio::TheaEntityAnswer](docs/TheaEntityAnswer.md)
|
461
|
+
- [Intrinio::TheaSourceDocument](docs/TheaSourceDocument.md)
|
462
|
+
- [Intrinio::TheaSourceDocumentTags](docs/TheaSourceDocumentTags.md)
|
458
463
|
- [Intrinio::TripleExponentialAverageTechnicalValue](docs/TripleExponentialAverageTechnicalValue.md)
|
459
464
|
- [Intrinio::TrueStrengthIndexTechnicalValue](docs/TrueStrengthIndexTechnicalValue.md)
|
460
465
|
- [Intrinio::UltimateOscillatorTechnicalValue](docs/UltimateOscillatorTechnicalValue.md)
|
@@ -0,0 +1,25 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
[//]: # (CLASS:Intrinio::ApiResponseCompanyAnswers)
|
4
|
+
|
5
|
+
[//]: # (KIND:object)
|
6
|
+
|
7
|
+
### Intrinio::ApiResponseCompanyAnswers
|
8
|
+
|
9
|
+
#### Properties
|
10
|
+
|
11
|
+
[//]: # (START_DEFINITION)
|
12
|
+
|
13
|
+
Name | Type | Description
|
14
|
+
------------ | ------------- | -------------
|
15
|
+
**source** | String | The organziation the answer data was sourced from
|
16
|
+
**query** | String | The query posed to the Thea API
|
17
|
+
**answers** | [**Array<TheaEntityAnswer>**](TheaEntityAnswer.md) |
|
18
|
+
|
19
|
+
[//]: # (END_DEFINITION)
|
20
|
+
|
21
|
+
|
22
|
+
[//]: # (CONTAINED_CLASS:Intrinio::TheaEntityAnswer)
|
23
|
+
|
24
|
+
|
25
|
+
|
data/docs/CompanyApi.md
CHANGED
@@ -7,6 +7,7 @@ Method | HTTP request | Description
|
|
7
7
|
[**get_all_companies**](CompanyApi.md#get_all_companies) | **GET** /companies | All Companies
|
8
8
|
[**get_all_company_news**](CompanyApi.md#get_all_company_news) | **GET** /companies/news | All News
|
9
9
|
[**get_company**](CompanyApi.md#get_company) | **GET** /companies/{identifier} | Lookup Company
|
10
|
+
[**get_company_answers**](CompanyApi.md#get_company_answers) | **GET** /companies/{identifier}/answers | Company Answers
|
10
11
|
[**get_company_data_point_number**](CompanyApi.md#get_company_data_point_number) | **GET** /companies/{identifier}/data_point/{tag}/number | Data Point (Number) for Company
|
11
12
|
[**get_company_data_point_text**](CompanyApi.md#get_company_data_point_text) | **GET** /companies/{identifier}/data_point/{tag}/text | Data Point (Text) for Company
|
12
13
|
[**get_company_filings**](CompanyApi.md#get_company_filings) | **GET** /companies/{identifier}/filings | All Filings by Company
|
@@ -281,6 +282,85 @@ Name | Type | Description | Notes
|
|
281
282
|
[//]: # (END_OPERATION)
|
282
283
|
|
283
284
|
|
285
|
+
[//]: # (START_OPERATION)
|
286
|
+
|
287
|
+
[//]: # (CLASS:Intrinio::CompanyApi)
|
288
|
+
|
289
|
+
[//]: # (METHOD:get_company_answers)
|
290
|
+
|
291
|
+
[//]: # (RETURN_TYPE:Intrinio::ApiResponseCompanyAnswers)
|
292
|
+
|
293
|
+
[//]: # (RETURN_TYPE_KIND:object)
|
294
|
+
|
295
|
+
[//]: # (RETURN_TYPE_DOC:ApiResponseCompanyAnswers.md)
|
296
|
+
|
297
|
+
[//]: # (OPERATION:get_company_answers_v2)
|
298
|
+
|
299
|
+
[//]: # (ENDPOINT:/companies/{identifier}/answers)
|
300
|
+
|
301
|
+
[//]: # (DOCUMENT_LINK:CompanyApi.md#get_company_answers)
|
302
|
+
|
303
|
+
## **get_company_answers**
|
304
|
+
|
305
|
+
[**View Intrinio API Documentation**](https://docs.intrinio.com/documentation/ruby/get_company_answers_v2)
|
306
|
+
|
307
|
+
[//]: # (START_OVERVIEW)
|
308
|
+
|
309
|
+
> ApiResponseCompanyAnswers get_company_answers(identifier, query)
|
310
|
+
|
311
|
+
#### Company Answers
|
312
|
+
|
313
|
+
|
314
|
+
Returns answers for a question about the Company with the given `identifier`
|
315
|
+
|
316
|
+
[//]: # (END_OVERVIEW)
|
317
|
+
|
318
|
+
### Example
|
319
|
+
|
320
|
+
[//]: # (START_CODE_EXAMPLE)
|
321
|
+
|
322
|
+
```ruby
|
323
|
+
# Load the gem
|
324
|
+
require 'intrinio-sdk'
|
325
|
+
require 'pp'
|
326
|
+
|
327
|
+
# Setup authorization
|
328
|
+
Intrinio.configure do |config|
|
329
|
+
config.api_key['api_key'] = 'YOUR_API_KEY'
|
330
|
+
config.allow_retries = true
|
331
|
+
end
|
332
|
+
|
333
|
+
company_api = Intrinio::CompanyApi.new
|
334
|
+
identifier = "AAPL"
|
335
|
+
query = "Where is the company headquartered?"
|
336
|
+
|
337
|
+
result = company_api.get_company_answers(identifier, query)
|
338
|
+
pp result
|
339
|
+
```
|
340
|
+
|
341
|
+
[//]: # (END_CODE_EXAMPLE)
|
342
|
+
|
343
|
+
[//]: # (START_DEFINITION)
|
344
|
+
|
345
|
+
### Parameters
|
346
|
+
|
347
|
+
[//]: # (START_PARAMETERS)
|
348
|
+
|
349
|
+
|
350
|
+
Name | Type | Description | Notes
|
351
|
+
------------- | ------------- | ------------- | -------------
|
352
|
+
**identifier** | String| A Company identifier (Ticker, CIK, LEI, Intrinio ID) |
|
353
|
+
**query** | String| The query to ask the Thea API |
|
354
|
+
|
355
|
+
[//]: # (END_PARAMETERS)
|
356
|
+
|
357
|
+
### Return type
|
358
|
+
|
359
|
+
[**ApiResponseCompanyAnswers**](ApiResponseCompanyAnswers.md)
|
360
|
+
|
361
|
+
[//]: # (END_OPERATION)
|
362
|
+
|
363
|
+
|
284
364
|
[//]: # (START_OPERATION)
|
285
365
|
|
286
366
|
[//]: # (CLASS:Intrinio::CompanyApi)
|
@@ -0,0 +1,25 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
[//]: # (CLASS:Intrinio::TheaEntityAnswer)
|
4
|
+
|
5
|
+
[//]: # (KIND:object)
|
6
|
+
|
7
|
+
### Intrinio::TheaEntityAnswer
|
8
|
+
|
9
|
+
#### Properties
|
10
|
+
|
11
|
+
[//]: # (START_DEFINITION)
|
12
|
+
|
13
|
+
Name | Type | Description
|
14
|
+
------------ | ------------- | -------------
|
15
|
+
**answer** | String | The summarized answer returned from Thea
|
16
|
+
**content** | String | The underlying content the answer was sourced from
|
17
|
+
**source_documents** | [**Array<TheaSourceDocument>**](TheaSourceDocument.md) |
|
18
|
+
|
19
|
+
[//]: # (END_DEFINITION)
|
20
|
+
|
21
|
+
|
22
|
+
[//]: # (CONTAINED_CLASS:Intrinio::TheaSourceDocument)
|
23
|
+
|
24
|
+
|
25
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
[//]: # (CLASS:Intrinio::TheaSourceDocument)
|
4
|
+
|
5
|
+
[//]: # (KIND:object)
|
6
|
+
|
7
|
+
### Intrinio::TheaSourceDocument
|
8
|
+
|
9
|
+
#### Properties
|
10
|
+
|
11
|
+
[//]: # (START_DEFINITION)
|
12
|
+
|
13
|
+
Name | Type | Description
|
14
|
+
------------ | ------------- | -------------
|
15
|
+
**id** | String | The unique id for the Thea source document
|
16
|
+
**tags** | [**Array<TheaSourceDocumentTags>**](TheaSourceDocumentTags.md) | Entity identifying tags associated with the source document
|
17
|
+
|
18
|
+
[//]: # (END_DEFINITION)
|
19
|
+
|
20
|
+
|
21
|
+
[//]: # (CONTAINED_CLASS:Intrinio::TheaSourceDocumentTags)
|
22
|
+
|
23
|
+
|
24
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
[//]: # (CLASS:Intrinio::TheaSourceDocumentTags)
|
4
|
+
|
5
|
+
[//]: # (KIND:object)
|
6
|
+
|
7
|
+
### Intrinio::TheaSourceDocumentTags
|
8
|
+
|
9
|
+
#### Properties
|
10
|
+
|
11
|
+
[//]: # (START_DEFINITION)
|
12
|
+
|
13
|
+
Name | Type | Description
|
14
|
+
------------ | ------------- | -------------
|
15
|
+
**key** | String | Defintes whether the tag is a key or a value
|
16
|
+
**value** | String | The value of the tag
|
17
|
+
|
18
|
+
[//]: # (END_DEFINITION)
|
19
|
+
|
20
|
+
|
21
|
+
|
data/lib/intrinio-sdk.rb
CHANGED
@@ -21,6 +21,7 @@ require 'intrinio-sdk/models/accumulation_distribution_index_technical_value'
|
|
21
21
|
require 'intrinio-sdk/models/api_response_bulk_download_links'
|
22
22
|
require 'intrinio-sdk/models/api_response_companies'
|
23
23
|
require 'intrinio-sdk/models/api_response_companies_search'
|
24
|
+
require 'intrinio-sdk/models/api_response_company_answers'
|
24
25
|
require 'intrinio-sdk/models/api_response_company_filings'
|
25
26
|
require 'intrinio-sdk/models/api_response_company_fundamentals'
|
26
27
|
require 'intrinio-sdk/models/api_response_company_historical_data'
|
@@ -224,6 +225,9 @@ require 'intrinio-sdk/models/stock_price_adjustment_summary'
|
|
224
225
|
require 'intrinio-sdk/models/stock_price_interval'
|
225
226
|
require 'intrinio-sdk/models/stock_price_summary'
|
226
227
|
require 'intrinio-sdk/models/technical_indicator'
|
228
|
+
require 'intrinio-sdk/models/thea_entity_answer'
|
229
|
+
require 'intrinio-sdk/models/thea_source_document'
|
230
|
+
require 'intrinio-sdk/models/thea_source_document_tags'
|
227
231
|
require 'intrinio-sdk/models/triple_exponential_average_technical_value'
|
228
232
|
require 'intrinio-sdk/models/true_strength_index_technical_value'
|
229
233
|
require 'intrinio-sdk/models/ultimate_oscillator_technical_value'
|
@@ -214,6 +214,66 @@ module Intrinio
|
|
214
214
|
return data, status_code, headers
|
215
215
|
end
|
216
216
|
|
217
|
+
# Company Answers
|
218
|
+
# Returns answers for a question about the Company with the given `identifier`
|
219
|
+
# @param identifier A Company identifier (Ticker, CIK, LEI, Intrinio ID)
|
220
|
+
# @param query The query to ask the Thea API
|
221
|
+
# @param [Hash] opts the optional parameters
|
222
|
+
# @return [ApiResponseCompanyAnswers]
|
223
|
+
def get_company_answers(identifier, query, opts = {})
|
224
|
+
data, _status_code, _headers = get_company_answers_with_http_info(identifier, query, opts)
|
225
|
+
return data
|
226
|
+
end
|
227
|
+
|
228
|
+
# Company Answers
|
229
|
+
# Returns answers for a question about the Company with the given `identifier`
|
230
|
+
# @param identifier A Company identifier (Ticker, CIK, LEI, Intrinio ID)
|
231
|
+
# @param query The query to ask the Thea API
|
232
|
+
# @param [Hash] opts the optional parameters
|
233
|
+
# @return [Array<(ApiResponseCompanyAnswers, Fixnum, Hash)>] ApiResponseCompanyAnswers data, response status code and response headers
|
234
|
+
def get_company_answers_with_http_info(identifier, query, opts = {})
|
235
|
+
if @api_client.config.debugging
|
236
|
+
@api_client.config.logger.debug "Calling API: CompanyApi.get_company_answers ..."
|
237
|
+
end
|
238
|
+
# verify the required parameter 'identifier' is set
|
239
|
+
if @api_client.config.client_side_validation && identifier.nil?
|
240
|
+
fail ArgumentError, "Missing the required parameter 'identifier' when calling CompanyApi.get_company_answers"
|
241
|
+
end
|
242
|
+
# verify the required parameter 'query' is set
|
243
|
+
if @api_client.config.client_side_validation && query.nil?
|
244
|
+
fail ArgumentError, "Missing the required parameter 'query' when calling CompanyApi.get_company_answers"
|
245
|
+
end
|
246
|
+
# resource path
|
247
|
+
local_var_path = "/companies/{identifier}/answers".sub('{' + 'identifier' + '}', identifier.to_s)
|
248
|
+
|
249
|
+
# query parameters
|
250
|
+
query_params = {}
|
251
|
+
query_params[:'query'] = query
|
252
|
+
|
253
|
+
# header parameters
|
254
|
+
header_params = {}
|
255
|
+
# HTTP header 'Accept' (if needed)
|
256
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
257
|
+
|
258
|
+
# form parameters
|
259
|
+
form_params = {}
|
260
|
+
|
261
|
+
# http body (model)
|
262
|
+
post_body = nil
|
263
|
+
auth_names = ['ApiKeyAuth']
|
264
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
265
|
+
:header_params => header_params,
|
266
|
+
:query_params => query_params,
|
267
|
+
:form_params => form_params,
|
268
|
+
:body => post_body,
|
269
|
+
:auth_names => auth_names,
|
270
|
+
:return_type => 'ApiResponseCompanyAnswers')
|
271
|
+
if @api_client.config.debugging
|
272
|
+
@api_client.config.logger.debug "API called: CompanyApi#get_company_answers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
273
|
+
end
|
274
|
+
return data, status_code, headers
|
275
|
+
end
|
276
|
+
|
217
277
|
# Data Point (Number) for Company
|
218
278
|
# Returns a numeric value for the given `tag` for the Company with the given `identifier`
|
219
279
|
# @param identifier A Company identifier (Ticker, CIK, LEI, Intrinio ID)
|
@@ -0,0 +1,210 @@
|
|
1
|
+
=begin
|
2
|
+
#Intrinio API
|
3
|
+
|
4
|
+
#Welcome to the Intrinio API! Through our Financial Data Marketplace, we offer a wide selection of financial data feed APIs sourced by our own proprietary processes as well as from many data vendors. For a complete API request / response reference please view the [Intrinio API documentation](https://intrinio.com/documentation/api_v2). If you need additional help in using the API, please visit the [Intrinio website](https://intrinio.com) and click on the chat icon in the lower right corner.
|
5
|
+
|
6
|
+
OpenAPI spec version: 2.23.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: unset
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module Intrinio
|
16
|
+
|
17
|
+
class ApiResponseCompanyAnswers
|
18
|
+
# The organziation the answer data was sourced from
|
19
|
+
attr_accessor :source
|
20
|
+
|
21
|
+
# The query posed to the Thea API
|
22
|
+
attr_accessor :query
|
23
|
+
|
24
|
+
attr_accessor :answers
|
25
|
+
|
26
|
+
|
27
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
28
|
+
def self.attribute_map
|
29
|
+
{
|
30
|
+
:'source' => :'source',
|
31
|
+
:'query' => :'query',
|
32
|
+
:'answers' => :'answers'
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
# Attribute type mapping.
|
37
|
+
def self.swagger_types
|
38
|
+
{
|
39
|
+
:'source' => :'String',
|
40
|
+
:'query' => :'String',
|
41
|
+
:'answers' => :'Array<TheaEntityAnswer>'
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
# Initializes the object
|
46
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
47
|
+
def initialize(attributes = {})
|
48
|
+
return unless attributes.is_a?(Hash)
|
49
|
+
|
50
|
+
# convert string to symbol for hash key
|
51
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
52
|
+
|
53
|
+
if attributes.has_key?(:'source')
|
54
|
+
self.source = attributes[:'source']
|
55
|
+
end
|
56
|
+
|
57
|
+
if attributes.has_key?(:'query')
|
58
|
+
self.query = attributes[:'query']
|
59
|
+
end
|
60
|
+
|
61
|
+
if attributes.has_key?(:'answers')
|
62
|
+
if (value = attributes[:'answers']).is_a?(Array)
|
63
|
+
self.answers = value
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
70
|
+
# @return Array for valid properties with the reasons
|
71
|
+
def list_invalid_properties
|
72
|
+
invalid_properties = Array.new
|
73
|
+
return invalid_properties
|
74
|
+
end
|
75
|
+
|
76
|
+
# Check to see if the all the properties in the model are valid
|
77
|
+
# @return true if the model is valid
|
78
|
+
def valid?
|
79
|
+
return true
|
80
|
+
end
|
81
|
+
|
82
|
+
# Checks equality by comparing each attribute.
|
83
|
+
# @param [Object] Object to be compared
|
84
|
+
def ==(o)
|
85
|
+
return true if self.equal?(o)
|
86
|
+
self.class == o.class &&
|
87
|
+
source == o.source &&
|
88
|
+
query == o.query &&
|
89
|
+
answers == o.answers
|
90
|
+
end
|
91
|
+
|
92
|
+
# @see the `==` method
|
93
|
+
# @param [Object] Object to be compared
|
94
|
+
def eql?(o)
|
95
|
+
self == o
|
96
|
+
end
|
97
|
+
|
98
|
+
# Calculates hash code according to all attributes.
|
99
|
+
# @return [Fixnum] Hash code
|
100
|
+
def hash
|
101
|
+
[source, query, answers].hash
|
102
|
+
end
|
103
|
+
|
104
|
+
# Builds the object from hash
|
105
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
106
|
+
# @return [Object] Returns the model itself
|
107
|
+
def build_from_hash(attributes)
|
108
|
+
return nil unless attributes.is_a?(Hash)
|
109
|
+
self.class.swagger_types.each_pair do |key, type|
|
110
|
+
if type =~ /\AArray<(.*)>/i
|
111
|
+
# check to ensure the input is an array given that the the attribute
|
112
|
+
# is documented as an array but the input is not
|
113
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
114
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
115
|
+
end
|
116
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
117
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
118
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
119
|
+
end
|
120
|
+
|
121
|
+
self
|
122
|
+
end
|
123
|
+
|
124
|
+
# Deserializes the data based on type
|
125
|
+
# @param string type Data type
|
126
|
+
# @param string value Value to be deserialized
|
127
|
+
# @return [Object] Deserialized data
|
128
|
+
def _deserialize(type, value)
|
129
|
+
case type.to_sym
|
130
|
+
when :DateTime
|
131
|
+
DateTime.parse(value)
|
132
|
+
when :Date
|
133
|
+
Date.parse(value)
|
134
|
+
when :String
|
135
|
+
value.to_s
|
136
|
+
when :Integer
|
137
|
+
value.to_i
|
138
|
+
when :Float
|
139
|
+
value.to_f
|
140
|
+
when :BOOLEAN
|
141
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
142
|
+
true
|
143
|
+
else
|
144
|
+
false
|
145
|
+
end
|
146
|
+
when :Object
|
147
|
+
# generic object (usually a Hash), return directly
|
148
|
+
value
|
149
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
150
|
+
inner_type = Regexp.last_match[:inner_type]
|
151
|
+
value.map { |v| _deserialize(inner_type, v) }
|
152
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
153
|
+
k_type = Regexp.last_match[:k_type]
|
154
|
+
v_type = Regexp.last_match[:v_type]
|
155
|
+
{}.tap do |hash|
|
156
|
+
value.each do |k, v|
|
157
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
158
|
+
end
|
159
|
+
end
|
160
|
+
else # model
|
161
|
+
temp_model = Intrinio.const_get(type).new
|
162
|
+
temp_model.build_from_hash(value)
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
# Returns the string representation of the object
|
167
|
+
# @return [String] String presentation of the object
|
168
|
+
def to_s
|
169
|
+
to_hash.to_s
|
170
|
+
end
|
171
|
+
|
172
|
+
# to_body is an alias to to_hash (backward compatibility)
|
173
|
+
# @return [Hash] Returns the object in the form of hash
|
174
|
+
def to_body
|
175
|
+
to_hash
|
176
|
+
end
|
177
|
+
|
178
|
+
# Returns the object in the form of hash
|
179
|
+
# @return [Hash] Returns the object in the form of hash
|
180
|
+
def to_hash
|
181
|
+
hash = {}
|
182
|
+
self.class.attribute_map.each_pair do |attr, param|
|
183
|
+
value = self.send(attr)
|
184
|
+
next if value.nil?
|
185
|
+
hash[param] = _to_hash(value)
|
186
|
+
end
|
187
|
+
hash
|
188
|
+
end
|
189
|
+
|
190
|
+
# Outputs non-array value in the form of hash
|
191
|
+
# For object, use to_hash. Otherwise, just return the value
|
192
|
+
# @param [Object] value Any valid value
|
193
|
+
# @return [Hash] Returns the value in the form of hash
|
194
|
+
def _to_hash(value)
|
195
|
+
if value.is_a?(Array)
|
196
|
+
value.compact.map{ |v| _to_hash(v) }
|
197
|
+
elsif value.is_a?(Hash)
|
198
|
+
{}.tap do |hash|
|
199
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
200
|
+
end
|
201
|
+
elsif value.respond_to? :to_hash
|
202
|
+
value.to_hash
|
203
|
+
else
|
204
|
+
value
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
208
|
+
end
|
209
|
+
|
210
|
+
end
|