finnhub_ruby 1.1.5 → 1.1.9
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 +48 -11
- data/docs/CompanyESG.md +28 -0
- data/docs/CompanyEarningsQualityScore.md +22 -0
- data/docs/CompanyEarningsQualityScoreData.md +30 -0
- data/docs/CompanyProfile.md +5 -5
- data/docs/CountryMetadata.md +5 -1
- data/docs/DefaultApi.md +155 -13
- data/docs/EarningRelease.md +2 -2
- data/docs/EarningsEstimates.md +1 -1
- data/docs/EarningsEstimatesInfo.md +26 -0
- data/docs/IPOEvent.md +2 -2
- data/docs/KeyCustomersSuppliers.md +13 -1
- data/docs/RevenueEstimates.md +1 -1
- data/docs/RevenueEstimatesInfo.md +26 -0
- data/docs/Sentiment.md +2 -2
- data/docs/SimilarityIndex.md +1 -1
- data/docs/SimilarityIndexInfo.md +40 -0
- data/docs/Transactions.md +1 -1
- data/finnhub_ruby-1.1.7.gem +0 -0
- data/finnhub_ruby-1.1.8.gem +0 -0
- data/finnhub_ruby.gemspec +1 -1
- data/lib/finnhub_ruby/api/default_api.rb +144 -12
- data/lib/finnhub_ruby/api_client.rb +1 -1
- data/lib/finnhub_ruby/api_error.rb +1 -1
- data/lib/finnhub_ruby/configuration.rb +1 -1
- data/lib/finnhub_ruby/models/aggregate_indicators.rb +1 -1
- data/lib/finnhub_ruby/models/basic_financials.rb +1 -1
- data/lib/finnhub_ruby/models/breakdown_item.rb +1 -1
- data/lib/finnhub_ruby/models/company.rb +1 -1
- data/lib/finnhub_ruby/models/company_earnings_quality_score.rb +241 -0
- data/lib/finnhub_ruby/models/company_earnings_quality_score_data.rb +279 -0
- data/lib/finnhub_ruby/models/company_esg.rb +268 -0
- data/lib/finnhub_ruby/models/company_executive.rb +1 -1
- data/lib/finnhub_ruby/models/company_news.rb +1 -1
- data/lib/finnhub_ruby/models/company_news_statistics.rb +1 -1
- data/lib/finnhub_ruby/models/company_profile.rb +6 -6
- data/lib/finnhub_ruby/models/company_profile2.rb +1 -1
- data/lib/finnhub_ruby/models/country_metadata.rb +25 -5
- data/lib/finnhub_ruby/models/covid_info.rb +1 -1
- data/lib/finnhub_ruby/models/crypto_candles.rb +1 -1
- data/lib/finnhub_ruby/models/crypto_symbol.rb +1 -1
- data/lib/finnhub_ruby/models/development.rb +1 -1
- data/lib/finnhub_ruby/models/dividends.rb +1 -1
- data/lib/finnhub_ruby/models/dividends2.rb +1 -1
- data/lib/finnhub_ruby/models/dividends2_info.rb +1 -1
- data/lib/finnhub_ruby/models/earning_release.rb +3 -3
- data/lib/finnhub_ruby/models/earning_result.rb +1 -1
- data/lib/finnhub_ruby/models/earnings_calendar.rb +1 -1
- data/lib/finnhub_ruby/models/earnings_call_transcripts.rb +1 -1
- data/lib/finnhub_ruby/models/earnings_call_transcripts_list.rb +1 -1
- data/lib/finnhub_ruby/models/earnings_estimates.rb +2 -2
- data/lib/finnhub_ruby/models/earnings_estimates_info.rb +259 -0
- data/lib/finnhub_ruby/models/economic_calendar.rb +1 -1
- data/lib/finnhub_ruby/models/economic_code.rb +1 -1
- data/lib/finnhub_ruby/models/economic_data.rb +1 -1
- data/lib/finnhub_ruby/models/economic_data_info.rb +1 -1
- data/lib/finnhub_ruby/models/economic_event.rb +1 -1
- data/lib/finnhub_ruby/models/etf_country_exposure_data.rb +1 -1
- data/lib/finnhub_ruby/models/etf_holdings_data.rb +1 -1
- data/lib/finnhub_ruby/models/etf_profile_data.rb +1 -1
- data/lib/finnhub_ruby/models/etf_sector_exposure_data.rb +1 -1
- data/lib/finnhub_ruby/models/etfs_country_exposure.rb +1 -1
- data/lib/finnhub_ruby/models/etfs_holdings.rb +1 -1
- data/lib/finnhub_ruby/models/etfs_profile.rb +1 -1
- data/lib/finnhub_ruby/models/etfs_sector_exposure.rb +1 -1
- data/lib/finnhub_ruby/models/fda_comittee_meeting.rb +1 -1
- data/lib/finnhub_ruby/models/filing.rb +1 -1
- data/lib/finnhub_ruby/models/filing_sentiment.rb +1 -1
- data/lib/finnhub_ruby/models/financial_statements.rb +1 -1
- data/lib/finnhub_ruby/models/financials_as_reported.rb +1 -1
- data/lib/finnhub_ruby/models/forex_candles.rb +1 -1
- data/lib/finnhub_ruby/models/forex_symbol.rb +1 -1
- data/lib/finnhub_ruby/models/forexrates.rb +1 -1
- data/lib/finnhub_ruby/models/fund_ownership.rb +1 -1
- data/lib/finnhub_ruby/models/fund_ownership_info.rb +1 -1
- data/lib/finnhub_ruby/models/historical_nbbo.rb +1 -1
- data/lib/finnhub_ruby/models/index_historical_constituent.rb +1 -1
- data/lib/finnhub_ruby/models/indicator.rb +1 -1
- data/lib/finnhub_ruby/models/indices_constituents.rb +1 -1
- data/lib/finnhub_ruby/models/indices_historical_constituents.rb +1 -1
- data/lib/finnhub_ruby/models/insider_transactions.rb +1 -1
- data/lib/finnhub_ruby/models/international_filing.rb +1 -1
- data/lib/finnhub_ruby/models/investment_theme_portfolio.rb +1 -1
- data/lib/finnhub_ruby/models/investment_themes.rb +1 -1
- data/lib/finnhub_ruby/models/ipo_calendar.rb +1 -1
- data/lib/finnhub_ruby/models/ipo_event.rb +3 -3
- data/lib/finnhub_ruby/models/key_customers_suppliers.rb +65 -5
- data/lib/finnhub_ruby/models/last_bid_ask.rb +1 -1
- data/lib/finnhub_ruby/models/market_news.rb +1 -1
- data/lib/finnhub_ruby/models/mutual_fund_country_exposure.rb +1 -1
- data/lib/finnhub_ruby/models/mutual_fund_country_exposure_data.rb +1 -1
- data/lib/finnhub_ruby/models/mutual_fund_holdings.rb +1 -1
- data/lib/finnhub_ruby/models/mutual_fund_holdings_data.rb +1 -1
- data/lib/finnhub_ruby/models/mutual_fund_profile.rb +1 -1
- data/lib/finnhub_ruby/models/mutual_fund_profile_data.rb +1 -1
- data/lib/finnhub_ruby/models/mutual_fund_sector_exposure.rb +1 -1
- data/lib/finnhub_ruby/models/mutual_fund_sector_exposure_data.rb +1 -1
- data/lib/finnhub_ruby/models/news_sentiment.rb +1 -1
- data/lib/finnhub_ruby/models/ownership.rb +1 -1
- data/lib/finnhub_ruby/models/ownership_info.rb +1 -1
- data/lib/finnhub_ruby/models/pattern_recognition.rb +1 -1
- data/lib/finnhub_ruby/models/press_release.rb +1 -1
- data/lib/finnhub_ruby/models/price_target.rb +1 -1
- data/lib/finnhub_ruby/models/quote.rb +1 -1
- data/lib/finnhub_ruby/models/recommendation_trend.rb +1 -1
- data/lib/finnhub_ruby/models/reddit_sentiment_content.rb +1 -1
- data/lib/finnhub_ruby/models/report.rb +1 -1
- data/lib/finnhub_ruby/models/revenue_breakdown.rb +1 -1
- data/lib/finnhub_ruby/models/revenue_estimates.rb +2 -2
- data/lib/finnhub_ruby/models/revenue_estimates_info.rb +259 -0
- data/lib/finnhub_ruby/models/sec_sentiment_analysis.rb +1 -1
- data/lib/finnhub_ruby/models/sentiment.rb +3 -3
- data/lib/finnhub_ruby/models/similarity_index.rb +2 -2
- data/lib/finnhub_ruby/models/similarity_index_info.rb +329 -0
- data/lib/finnhub_ruby/models/social_sentiment.rb +1 -1
- data/lib/finnhub_ruby/models/split.rb +1 -1
- data/lib/finnhub_ruby/models/stock_candles.rb +1 -1
- data/lib/finnhub_ruby/models/stock_symbol.rb +1 -1
- data/lib/finnhub_ruby/models/stock_transcripts.rb +1 -1
- data/lib/finnhub_ruby/models/supply_chain_relationships.rb +1 -1
- data/lib/finnhub_ruby/models/support_resistance.rb +1 -1
- data/lib/finnhub_ruby/models/symbol_lookup.rb +1 -1
- data/lib/finnhub_ruby/models/symbol_lookup_info.rb +1 -1
- data/lib/finnhub_ruby/models/technical_analysis.rb +1 -1
- data/lib/finnhub_ruby/models/tick_data.rb +1 -1
- data/lib/finnhub_ruby/models/transactions.rb +2 -2
- data/lib/finnhub_ruby/models/transcript_content.rb +1 -1
- data/lib/finnhub_ruby/models/transcript_participant.rb +1 -1
- data/lib/finnhub_ruby/models/trend.rb +1 -1
- data/lib/finnhub_ruby/models/twitter_sentiment_content.rb +1 -1
- data/lib/finnhub_ruby/models/upgrade_downgrade.rb +1 -1
- data/lib/finnhub_ruby/version.rb +2 -2
- data/lib/finnhub_ruby.rb +7 -3
- data/release.sh +12 -7
- data/spec/api_client_spec.rb +1 -1
- data/spec/configuration_spec.rb +1 -1
- data/spec/models/company_earnings_quality_score_data_spec.rb +70 -0
- data/spec/models/company_earnings_quality_score_spec.rb +46 -0
- data/spec/models/company_esg_spec.rb +64 -0
- data/spec/models/earnings_estimates_info_spec.rb +58 -0
- data/spec/models/revenue_estimates_info_spec.rb +58 -0
- data/spec/models/similarity_index_info_spec.rb +100 -0
- data/spec/spec_helper.rb +1 -1
- metadata +28 -3
- data/finnhub_ruby-1.1.4.gem +0 -0
data/docs/SimilarityIndex.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
| ---- | ---- | ----------- | ----- |
|
|
7
7
|
| **symbol** | **String** | Symbol. | [optional] |
|
|
8
8
|
| **cik** | **String** | CIK. | [optional] |
|
|
9
|
-
| **similarity** | [**Array<
|
|
9
|
+
| **similarity** | [**Array<SimilarityIndexInfo>**](SimilarityIndexInfo.md) | Array of filings with its cosine similarity compared to the same report of the previous year. | [optional] |
|
|
10
10
|
|
|
11
11
|
## Example
|
|
12
12
|
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# FinnhubRuby::SimilarityIndexInfo
|
|
2
|
+
|
|
3
|
+
## Properties
|
|
4
|
+
|
|
5
|
+
| Name | Type | Description | Notes |
|
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
|
7
|
+
| **cik** | **String** | CIK. | [optional] |
|
|
8
|
+
| **item1** | **Float** | Cosine similarity of Item 1 (Business). This number is only available for Annual reports. | [optional] |
|
|
9
|
+
| **item1a** | **Float** | Cosine similarity of Item 1A (Risk Factors). This number is available for both Annual and Quarterly reports. | [optional] |
|
|
10
|
+
| **item2** | **Float** | Cosine similarity of Item 2 (Management’s Discussion and Analysis of Financial Condition and Results of Operations). This number is only available for Quarterly reports. | [optional] |
|
|
11
|
+
| **item7** | **Float** | Cosine similarity of Item 7 (Management’s Discussion and Analysis of Financial Condition and Results of Operations). This number is only available for Annual reports. | [optional] |
|
|
12
|
+
| **item7a** | **Float** | Cosine similarity of Item 7A (Quantitative and Qualitative Disclosures About Market Risk). This number is only available for Annual reports. | [optional] |
|
|
13
|
+
| **access_number** | **String** | Access number. | [optional] |
|
|
14
|
+
| **form** | **String** | Form type. | [optional] |
|
|
15
|
+
| **filed_date** | **String** | Filed date <code>%Y-%m-%d %H:%M:%S</code>. | [optional] |
|
|
16
|
+
| **accepted_date** | **String** | Accepted date <code>%Y-%m-%d %H:%M:%S</code>. | [optional] |
|
|
17
|
+
| **report_url** | **String** | Report's URL. | [optional] |
|
|
18
|
+
| **filing_url** | **String** | Filing's URL. | [optional] |
|
|
19
|
+
|
|
20
|
+
## Example
|
|
21
|
+
|
|
22
|
+
```ruby
|
|
23
|
+
require 'finnhub_ruby'
|
|
24
|
+
|
|
25
|
+
instance = FinnhubRuby::SimilarityIndexInfo.new(
|
|
26
|
+
cik: null,
|
|
27
|
+
item1: null,
|
|
28
|
+
item1a: null,
|
|
29
|
+
item2: null,
|
|
30
|
+
item7: null,
|
|
31
|
+
item7a: null,
|
|
32
|
+
access_number: null,
|
|
33
|
+
form: null,
|
|
34
|
+
filed_date: null,
|
|
35
|
+
accepted_date: null,
|
|
36
|
+
report_url: null,
|
|
37
|
+
filing_url: null
|
|
38
|
+
)
|
|
39
|
+
```
|
|
40
|
+
|
data/docs/Transactions.md
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
| **filing_date** | **Date** | Filing date. | [optional] |
|
|
11
11
|
| **transaction_date** | **Date** | Transaction date. | [optional] |
|
|
12
12
|
| **transaction_price** | **Float** | Average transaction price. | [optional] |
|
|
13
|
-
| **transaction_code** | **
|
|
13
|
+
| **transaction_code** | **String** | Transaction code. A list of codes and their meanings can be found <a href=\"https://www.sec.gov/about/forms/form4data.pdf\" target=\"_blank\" rel=\"noopener\">here</a>. | [optional] |
|
|
14
14
|
|
|
15
15
|
## Example
|
|
16
16
|
|
|
Binary file
|
|
Binary file
|
data/finnhub_ruby.gemspec
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
The version of the OpenAPI document: 1.0.0
|
|
7
7
|
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
|
-
OpenAPI Generator version: 5.2.
|
|
9
|
+
OpenAPI Generator version: 5.2.1
|
|
10
10
|
|
|
11
11
|
=end
|
|
12
12
|
|
|
@@ -228,6 +228,77 @@ module FinnhubRuby
|
|
|
228
228
|
return data, status_code, headers
|
|
229
229
|
end
|
|
230
230
|
|
|
231
|
+
# Company Earnings Quality Score
|
|
232
|
+
# <p>This endpoint provides Earnings Quality Score for global companies.</p><p> Earnings quality refers to the extent to which current earnings predict future earnings. \"High-quality\" earnings are expected to persist, while \"low-quality\" earnings do not. A higher score means a higher earnings quality</p><p>Finnhub uses a proprietary model which takes into consideration 4 criteria:</p> <ul style=\"list-style-type: unset; margin-left: 30px;\"><li>Profitability</li><li>Growth</li><li>Cash Generation & Capital Allocation</li><li>Leverage</li></ul><br/><p>We then compare the metrics of each company in each category against its peers in the same industry to gauge how quality its earnings is.</p>
|
|
233
|
+
# @param symbol [String] Symbol.
|
|
234
|
+
# @param freq [String] Frequency. Currently only support <code>quarterly</code>
|
|
235
|
+
# @param [Hash] opts the optional parameters
|
|
236
|
+
# @return [CompanyEarningsQualityScore]
|
|
237
|
+
def company_earnings_quality_score(symbol, freq, opts = {})
|
|
238
|
+
data, _status_code, _headers = company_earnings_quality_score_with_http_info(symbol, freq, opts)
|
|
239
|
+
data
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
# Company Earnings Quality Score
|
|
243
|
+
# <p>This endpoint provides Earnings Quality Score for global companies.</p><p> Earnings quality refers to the extent to which current earnings predict future earnings. \"High-quality\" earnings are expected to persist, while \"low-quality\" earnings do not. A higher score means a higher earnings quality</p><p>Finnhub uses a proprietary model which takes into consideration 4 criteria:</p> <ul style=\"list-style-type: unset; margin-left: 30px;\"><li>Profitability</li><li>Growth</li><li>Cash Generation & Capital Allocation</li><li>Leverage</li></ul><br/><p>We then compare the metrics of each company in each category against its peers in the same industry to gauge how quality its earnings is.</p>
|
|
244
|
+
# @param symbol [String] Symbol.
|
|
245
|
+
# @param freq [String] Frequency. Currently only support <code>quarterly</code>
|
|
246
|
+
# @param [Hash] opts the optional parameters
|
|
247
|
+
# @return [Array<(CompanyEarningsQualityScore, Integer, Hash)>] CompanyEarningsQualityScore data, response status code and response headers
|
|
248
|
+
def company_earnings_quality_score_with_http_info(symbol, freq, opts = {})
|
|
249
|
+
if @api_client.config.debugging
|
|
250
|
+
@api_client.config.logger.debug 'Calling API: DefaultApi.company_earnings_quality_score ...'
|
|
251
|
+
end
|
|
252
|
+
# verify the required parameter 'symbol' is set
|
|
253
|
+
if @api_client.config.client_side_validation && symbol.nil?
|
|
254
|
+
fail ArgumentError, "Missing the required parameter 'symbol' when calling DefaultApi.company_earnings_quality_score"
|
|
255
|
+
end
|
|
256
|
+
# verify the required parameter 'freq' is set
|
|
257
|
+
if @api_client.config.client_side_validation && freq.nil?
|
|
258
|
+
fail ArgumentError, "Missing the required parameter 'freq' when calling DefaultApi.company_earnings_quality_score"
|
|
259
|
+
end
|
|
260
|
+
# resource path
|
|
261
|
+
local_var_path = '/stock/earnings-quality-score'
|
|
262
|
+
|
|
263
|
+
# query parameters
|
|
264
|
+
query_params = opts[:query_params] || {}
|
|
265
|
+
query_params[:'symbol'] = symbol
|
|
266
|
+
query_params[:'freq'] = freq
|
|
267
|
+
|
|
268
|
+
# header parameters
|
|
269
|
+
header_params = opts[:header_params] || {}
|
|
270
|
+
# HTTP header 'Accept' (if needed)
|
|
271
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
272
|
+
|
|
273
|
+
# form parameters
|
|
274
|
+
form_params = opts[:form_params] || {}
|
|
275
|
+
|
|
276
|
+
# http body (model)
|
|
277
|
+
post_body = opts[:debug_body]
|
|
278
|
+
|
|
279
|
+
# return_type
|
|
280
|
+
return_type = opts[:debug_return_type] || 'CompanyEarningsQualityScore'
|
|
281
|
+
|
|
282
|
+
# auth_names
|
|
283
|
+
auth_names = opts[:debug_auth_names] || ['api_key']
|
|
284
|
+
|
|
285
|
+
new_options = opts.merge(
|
|
286
|
+
:operation => :"DefaultApi.company_earnings_quality_score",
|
|
287
|
+
:header_params => header_params,
|
|
288
|
+
:query_params => query_params,
|
|
289
|
+
:form_params => form_params,
|
|
290
|
+
:body => post_body,
|
|
291
|
+
:auth_names => auth_names,
|
|
292
|
+
:return_type => return_type
|
|
293
|
+
)
|
|
294
|
+
|
|
295
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
296
|
+
if @api_client.config.debugging
|
|
297
|
+
@api_client.config.logger.debug "API called: DefaultApi#company_earnings_quality_score\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
298
|
+
end
|
|
299
|
+
return data, status_code, headers
|
|
300
|
+
end
|
|
301
|
+
|
|
231
302
|
# Earnings Estimates
|
|
232
303
|
# Get company's EPS estimates.
|
|
233
304
|
# @param symbol [String] Symbol of the company: AAPL.
|
|
@@ -295,6 +366,70 @@ module FinnhubRuby
|
|
|
295
366
|
return data, status_code, headers
|
|
296
367
|
end
|
|
297
368
|
|
|
369
|
+
# Company ESG Scores
|
|
370
|
+
# <p>This endpoint provides ESG scores and important indicators for 1000+ global companies. The data is collected through company's public ESG disclosure and public sources.</p><p>Our ESG scoring models takes into account more than 150 different inputs to calculate the level of ESG risks and how well a company is managing them. A higher score means lower ESG risk or better ESG management. ESG scores are in the the range of 0-100. Some key indicators might contain letter-grade score from C- to A+ with C- is the lowest score and A+ is the highest score.</p>
|
|
371
|
+
# @param symbol [String] Symbol.
|
|
372
|
+
# @param [Hash] opts the optional parameters
|
|
373
|
+
# @return [CompanyESG]
|
|
374
|
+
def company_esg_score(symbol, opts = {})
|
|
375
|
+
data, _status_code, _headers = company_esg_score_with_http_info(symbol, opts)
|
|
376
|
+
data
|
|
377
|
+
end
|
|
378
|
+
|
|
379
|
+
# Company ESG Scores
|
|
380
|
+
# <p>This endpoint provides ESG scores and important indicators for 1000+ global companies. The data is collected through company's public ESG disclosure and public sources.</p><p>Our ESG scoring models takes into account more than 150 different inputs to calculate the level of ESG risks and how well a company is managing them. A higher score means lower ESG risk or better ESG management. ESG scores are in the the range of 0-100. Some key indicators might contain letter-grade score from C- to A+ with C- is the lowest score and A+ is the highest score.</p>
|
|
381
|
+
# @param symbol [String] Symbol.
|
|
382
|
+
# @param [Hash] opts the optional parameters
|
|
383
|
+
# @return [Array<(CompanyESG, Integer, Hash)>] CompanyESG data, response status code and response headers
|
|
384
|
+
def company_esg_score_with_http_info(symbol, opts = {})
|
|
385
|
+
if @api_client.config.debugging
|
|
386
|
+
@api_client.config.logger.debug 'Calling API: DefaultApi.company_esg_score ...'
|
|
387
|
+
end
|
|
388
|
+
# verify the required parameter 'symbol' is set
|
|
389
|
+
if @api_client.config.client_side_validation && symbol.nil?
|
|
390
|
+
fail ArgumentError, "Missing the required parameter 'symbol' when calling DefaultApi.company_esg_score"
|
|
391
|
+
end
|
|
392
|
+
# resource path
|
|
393
|
+
local_var_path = '/stock/esg'
|
|
394
|
+
|
|
395
|
+
# query parameters
|
|
396
|
+
query_params = opts[:query_params] || {}
|
|
397
|
+
query_params[:'symbol'] = symbol
|
|
398
|
+
|
|
399
|
+
# header parameters
|
|
400
|
+
header_params = opts[:header_params] || {}
|
|
401
|
+
# HTTP header 'Accept' (if needed)
|
|
402
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
403
|
+
|
|
404
|
+
# form parameters
|
|
405
|
+
form_params = opts[:form_params] || {}
|
|
406
|
+
|
|
407
|
+
# http body (model)
|
|
408
|
+
post_body = opts[:debug_body]
|
|
409
|
+
|
|
410
|
+
# return_type
|
|
411
|
+
return_type = opts[:debug_return_type] || 'CompanyESG'
|
|
412
|
+
|
|
413
|
+
# auth_names
|
|
414
|
+
auth_names = opts[:debug_auth_names] || ['api_key']
|
|
415
|
+
|
|
416
|
+
new_options = opts.merge(
|
|
417
|
+
:operation => :"DefaultApi.company_esg_score",
|
|
418
|
+
:header_params => header_params,
|
|
419
|
+
:query_params => query_params,
|
|
420
|
+
:form_params => form_params,
|
|
421
|
+
:body => post_body,
|
|
422
|
+
:auth_names => auth_names,
|
|
423
|
+
:return_type => return_type
|
|
424
|
+
)
|
|
425
|
+
|
|
426
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
427
|
+
if @api_client.config.debugging
|
|
428
|
+
@api_client.config.logger.debug "API called: DefaultApi#company_esg_score\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
429
|
+
end
|
|
430
|
+
return data, status_code, headers
|
|
431
|
+
end
|
|
432
|
+
|
|
298
433
|
# Company Executive
|
|
299
434
|
# Get a list of company's executives and members of the Board.
|
|
300
435
|
# @param symbol [String] Symbol of the company: AAPL.
|
|
@@ -438,7 +573,7 @@ module FinnhubRuby
|
|
|
438
573
|
end
|
|
439
574
|
|
|
440
575
|
# Peers
|
|
441
|
-
# Get company peers. Return a list of peers in the same country and
|
|
576
|
+
# Get company peers. Return a list of peers in the same country and sub-industry
|
|
442
577
|
# @param symbol [String] Symbol of the company: AAPL.
|
|
443
578
|
# @param [Hash] opts the optional parameters
|
|
444
579
|
# @return [Array<String>]
|
|
@@ -448,7 +583,7 @@ module FinnhubRuby
|
|
|
448
583
|
end
|
|
449
584
|
|
|
450
585
|
# Peers
|
|
451
|
-
# Get company peers. Return a list of peers in the same country and
|
|
586
|
+
# Get company peers. Return a list of peers in the same country and sub-industry
|
|
452
587
|
# @param symbol [String] Symbol of the company: AAPL.
|
|
453
588
|
# @param [Hash] opts the optional parameters
|
|
454
589
|
# @return [Array<(Array<String>, Integer, Hash)>] Array<String> data, response status code and response headers
|
|
@@ -2600,7 +2735,7 @@ module FinnhubRuby
|
|
|
2600
2735
|
# Get latest market news.
|
|
2601
2736
|
# @param category [String] This parameter can be 1 of the following values <code>general, forex, crypto, merger</code>.
|
|
2602
2737
|
# @param [Hash] opts the optional parameters
|
|
2603
|
-
# @option opts [
|
|
2738
|
+
# @option opts [Integer] :min_id Use this field to get only news after this ID. Default to 0
|
|
2604
2739
|
# @return [Array<MarketNews>]
|
|
2605
2740
|
def market_news(category, opts = {})
|
|
2606
2741
|
data, _status_code, _headers = market_news_with_http_info(category, opts)
|
|
@@ -2611,7 +2746,7 @@ module FinnhubRuby
|
|
|
2611
2746
|
# Get latest market news.
|
|
2612
2747
|
# @param category [String] This parameter can be 1 of the following values <code>general, forex, crypto, merger</code>.
|
|
2613
2748
|
# @param [Hash] opts the optional parameters
|
|
2614
|
-
# @option opts [
|
|
2749
|
+
# @option opts [Integer] :min_id Use this field to get only news after this ID. Default to 0
|
|
2615
2750
|
# @return [Array<(Array<MarketNews>, Integer, Hash)>] Array<MarketNews> data, response status code and response headers
|
|
2616
2751
|
def market_news_with_http_info(category, opts = {})
|
|
2617
2752
|
if @api_client.config.debugging
|
|
@@ -3712,13 +3847,12 @@ module FinnhubRuby
|
|
|
3712
3847
|
end
|
|
3713
3848
|
|
|
3714
3849
|
# Stock Candles
|
|
3715
|
-
# <p>Get candlestick data (OHLCV) for stocks
|
|
3850
|
+
# <p>Get candlestick data (OHLCV) for stocks.</p><p>Daily data will be adjusted for Splits. Intraday data will remain unadjusted.</p>
|
|
3716
3851
|
# @param symbol [String] Symbol.
|
|
3717
3852
|
# @param resolution [String] Supported resolution includes <code>1, 5, 15, 30, 60, D, W, M </code>.Some timeframes might not be available depending on the exchange.
|
|
3718
3853
|
# @param from [Integer] UNIX timestamp. Interval initial value.
|
|
3719
3854
|
# @param to [Integer] UNIX timestamp. Interval end value.
|
|
3720
3855
|
# @param [Hash] opts the optional parameters
|
|
3721
|
-
# @option opts [String] :adjusted DEPRECATED: this option has been deprecated. All Daily data will be adjusted for Splits and intraday data will remain unadjusted.
|
|
3722
3856
|
# @return [StockCandles]
|
|
3723
3857
|
def stock_candles(symbol, resolution, from, to, opts = {})
|
|
3724
3858
|
data, _status_code, _headers = stock_candles_with_http_info(symbol, resolution, from, to, opts)
|
|
@@ -3726,13 +3860,12 @@ module FinnhubRuby
|
|
|
3726
3860
|
end
|
|
3727
3861
|
|
|
3728
3862
|
# Stock Candles
|
|
3729
|
-
# <p>Get candlestick data (OHLCV) for stocks
|
|
3863
|
+
# <p>Get candlestick data (OHLCV) for stocks.</p><p>Daily data will be adjusted for Splits. Intraday data will remain unadjusted.</p>
|
|
3730
3864
|
# @param symbol [String] Symbol.
|
|
3731
3865
|
# @param resolution [String] Supported resolution includes <code>1, 5, 15, 30, 60, D, W, M </code>.Some timeframes might not be available depending on the exchange.
|
|
3732
3866
|
# @param from [Integer] UNIX timestamp. Interval initial value.
|
|
3733
3867
|
# @param to [Integer] UNIX timestamp. Interval end value.
|
|
3734
3868
|
# @param [Hash] opts the optional parameters
|
|
3735
|
-
# @option opts [String] :adjusted DEPRECATED: this option has been deprecated. All Daily data will be adjusted for Splits and intraday data will remain unadjusted.
|
|
3736
3869
|
# @return [Array<(StockCandles, Integer, Hash)>] StockCandles data, response status code and response headers
|
|
3737
3870
|
def stock_candles_with_http_info(symbol, resolution, from, to, opts = {})
|
|
3738
3871
|
if @api_client.config.debugging
|
|
@@ -3763,7 +3896,6 @@ module FinnhubRuby
|
|
|
3763
3896
|
query_params[:'resolution'] = resolution
|
|
3764
3897
|
query_params[:'from'] = from
|
|
3765
3898
|
query_params[:'to'] = to
|
|
3766
|
-
query_params[:'adjusted'] = opts[:'adjusted'] if !opts[:'adjusted'].nil?
|
|
3767
3899
|
|
|
3768
3900
|
# header parameters
|
|
3769
3901
|
header_params = opts[:header_params] || {}
|
|
@@ -4114,7 +4246,7 @@ module FinnhubRuby
|
|
|
4114
4246
|
end
|
|
4115
4247
|
|
|
4116
4248
|
# Tick Data
|
|
4117
|
-
# <p>Get historical tick data for global exchanges. You can send the request directly to our tick server at <a href=\"https://tick.finnhub.io/\">https://tick.finnhub.io/</a> with the same path and parameters or get redirected there if you call our main server.</p><p>For US market, you can visit our bulk download page in the Dashboard <a target=\"_blank\" href=\"/dashboard/download\",>here</a> to speed up the download process.</p><
|
|
4249
|
+
# <p>Get historical tick data for global exchanges. You can send the request directly to our tick server at <a href=\"https://tick.finnhub.io/\">https://tick.finnhub.io/</a> with the same path and parameters or get redirected there if you call our main server.</p><p>For US market, you can visit our bulk download page in the Dashboard <a target=\"_blank\" href=\"/dashboard/download\",>here</a> to speed up the download process.</p><table class=\"table table-hover\"> <thead> <tr> <th>Exchange</th> <th>Segment</th> <th>Delay</th> </tr> </thead> <tbody> <tr> <td class=\"text-blue\">US CTA/UTP</th> <td>Full SIP</td> <td>15 minute</td> </tr> <tr> <td class=\"text-blue\">TSX</th> <td><ul><li>TSX</li><li>TSX Venture</li><li>Index</li></ul></td> <td>End-of-day</td> </tr> <tr> <td class=\"text-blue\">LSE</th> <td><ul><li>London Stock Exchange (L)</li><li>LSE International (L)</li><li>LSE European (L)</li></ul></td> <td>15 minute</td> </tr> <tr> <td class=\"text-blue\">Euronext</th> <td><ul> <li>Euronext Paris (PA)</li> <li>Euronext Amsterdam (AS)</li> <li>Euronext Lisbon (LS)</li> <li>Euronext Brussels (BR)</li> <li>Euronext Oslo (OL)</li> <li>Euronext London (LN)</li> <li>Euronext Dublin (IR)</li> <li>Index</li> <li>Warrant</li></ul></td> <td>End-of-day</td> </tr> <tr> <td class=\"text-blue\">Deutsche Börse</th> <td><ul> <li>Frankfurt (F)</li> <li>Xetra (DE)</li> <li>Duesseldorf (DU)</li> <li>Hamburg (HM)</li> <li>Berlin (BE)</li> <li>Hanover (HA)</li> <li>Stoxx (SX)</li> <li>TradeGate (TG)</li> <li>Zertifikate (SC)</li> <li>Index</li> <li>Warrant</li></ul></td> <td>End-of-day</td> </tr> <tr> <td class=\"text-blue\">Nasdaq Nordic & Baltic</th> <td> <ul> <li>Copenhagen (CO)</li> <li>Stockholm (ST)</li> <li>Helsinki (HE)</li> <li>Iceland (IC)</li> <li>Riga (RG)</li> <li>Tallinn (TL)</li> <li>Vilnius(VS)</li> <li>Fixed Income</li> <li>Derivatives</li> <li>Commodities</li></ul></td> <td>End-of-day</td> </tr> </tbody> </table>
|
|
4118
4250
|
# @param symbol [String] Symbol.
|
|
4119
4251
|
# @param date [Date] Date: 2020-04-02.
|
|
4120
4252
|
# @param limit [Integer] Limit number of ticks returned. Maximum value: <code>25000</code>
|
|
@@ -4127,7 +4259,7 @@ module FinnhubRuby
|
|
|
4127
4259
|
end
|
|
4128
4260
|
|
|
4129
4261
|
# Tick Data
|
|
4130
|
-
# <p>Get historical tick data for global exchanges. You can send the request directly to our tick server at <a href=\"https://tick.finnhub.io/\">https://tick.finnhub.io/</a> with the same path and parameters or get redirected there if you call our main server.</p><p>For US market, you can visit our bulk download page in the Dashboard <a target=\"_blank\" href=\"/dashboard/download\",>here</a> to speed up the download process.</p><
|
|
4262
|
+
# <p>Get historical tick data for global exchanges. You can send the request directly to our tick server at <a href=\"https://tick.finnhub.io/\">https://tick.finnhub.io/</a> with the same path and parameters or get redirected there if you call our main server.</p><p>For US market, you can visit our bulk download page in the Dashboard <a target=\"_blank\" href=\"/dashboard/download\",>here</a> to speed up the download process.</p><table class=\"table table-hover\"> <thead> <tr> <th>Exchange</th> <th>Segment</th> <th>Delay</th> </tr> </thead> <tbody> <tr> <td class=\"text-blue\">US CTA/UTP</th> <td>Full SIP</td> <td>15 minute</td> </tr> <tr> <td class=\"text-blue\">TSX</th> <td><ul><li>TSX</li><li>TSX Venture</li><li>Index</li></ul></td> <td>End-of-day</td> </tr> <tr> <td class=\"text-blue\">LSE</th> <td><ul><li>London Stock Exchange (L)</li><li>LSE International (L)</li><li>LSE European (L)</li></ul></td> <td>15 minute</td> </tr> <tr> <td class=\"text-blue\">Euronext</th> <td><ul> <li>Euronext Paris (PA)</li> <li>Euronext Amsterdam (AS)</li> <li>Euronext Lisbon (LS)</li> <li>Euronext Brussels (BR)</li> <li>Euronext Oslo (OL)</li> <li>Euronext London (LN)</li> <li>Euronext Dublin (IR)</li> <li>Index</li> <li>Warrant</li></ul></td> <td>End-of-day</td> </tr> <tr> <td class=\"text-blue\">Deutsche Börse</th> <td><ul> <li>Frankfurt (F)</li> <li>Xetra (DE)</li> <li>Duesseldorf (DU)</li> <li>Hamburg (HM)</li> <li>Berlin (BE)</li> <li>Hanover (HA)</li> <li>Stoxx (SX)</li> <li>TradeGate (TG)</li> <li>Zertifikate (SC)</li> <li>Index</li> <li>Warrant</li></ul></td> <td>End-of-day</td> </tr> <tr> <td class=\"text-blue\">Nasdaq Nordic & Baltic</th> <td> <ul> <li>Copenhagen (CO)</li> <li>Stockholm (ST)</li> <li>Helsinki (HE)</li> <li>Iceland (IC)</li> <li>Riga (RG)</li> <li>Tallinn (TL)</li> <li>Vilnius(VS)</li> <li>Fixed Income</li> <li>Derivatives</li> <li>Commodities</li></ul></td> <td>End-of-day</td> </tr> </tbody> </table>
|
|
4131
4263
|
# @param symbol [String] Symbol.
|
|
4132
4264
|
# @param date [Date] Date: 2020-04-02.
|
|
4133
4265
|
# @param limit [Integer] Limit number of ticks returned. Maximum value: <code>25000</code>
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Finnhub API
|
|
3
|
+
|
|
4
|
+
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
OpenAPI Generator version: 5.2.1
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module FinnhubRuby
|
|
17
|
+
class CompanyEarningsQualityScore
|
|
18
|
+
# Symbol
|
|
19
|
+
attr_accessor :symbol
|
|
20
|
+
|
|
21
|
+
# Frequency
|
|
22
|
+
attr_accessor :freq
|
|
23
|
+
|
|
24
|
+
# Array of earnings quality score.
|
|
25
|
+
attr_accessor :data
|
|
26
|
+
|
|
27
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
28
|
+
def self.attribute_map
|
|
29
|
+
{
|
|
30
|
+
:'symbol' => :'symbol',
|
|
31
|
+
:'freq' => :'freq',
|
|
32
|
+
:'data' => :'data'
|
|
33
|
+
}
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Returns all the JSON keys this model knows about
|
|
37
|
+
def self.acceptable_attributes
|
|
38
|
+
attribute_map.values
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# Attribute type mapping.
|
|
42
|
+
def self.openapi_types
|
|
43
|
+
{
|
|
44
|
+
:'symbol' => :'String',
|
|
45
|
+
:'freq' => :'String',
|
|
46
|
+
:'data' => :'Array<CompanyEarningsQualityScoreData>'
|
|
47
|
+
}
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# List of attributes with nullable: true
|
|
51
|
+
def self.openapi_nullable
|
|
52
|
+
Set.new([
|
|
53
|
+
])
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Initializes the object
|
|
57
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
58
|
+
def initialize(attributes = {})
|
|
59
|
+
if (!attributes.is_a?(Hash))
|
|
60
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `FinnhubRuby::CompanyEarningsQualityScore` initialize method"
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
64
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
65
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
66
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `FinnhubRuby::CompanyEarningsQualityScore`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
67
|
+
end
|
|
68
|
+
h[k.to_sym] = v
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if attributes.key?(:'symbol')
|
|
72
|
+
self.symbol = attributes[:'symbol']
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
if attributes.key?(:'freq')
|
|
76
|
+
self.freq = attributes[:'freq']
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
if attributes.key?(:'data')
|
|
80
|
+
if (value = attributes[:'data']).is_a?(Array)
|
|
81
|
+
self.data = value
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
87
|
+
# @return Array for valid properties with the reasons
|
|
88
|
+
def list_invalid_properties
|
|
89
|
+
invalid_properties = Array.new
|
|
90
|
+
invalid_properties
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
# Check to see if the all the properties in the model are valid
|
|
94
|
+
# @return true if the model is valid
|
|
95
|
+
def valid?
|
|
96
|
+
true
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
# Checks equality by comparing each attribute.
|
|
100
|
+
# @param [Object] Object to be compared
|
|
101
|
+
def ==(o)
|
|
102
|
+
return true if self.equal?(o)
|
|
103
|
+
self.class == o.class &&
|
|
104
|
+
symbol == o.symbol &&
|
|
105
|
+
freq == o.freq &&
|
|
106
|
+
data == o.data
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
# @see the `==` method
|
|
110
|
+
# @param [Object] Object to be compared
|
|
111
|
+
def eql?(o)
|
|
112
|
+
self == o
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
# Calculates hash code according to all attributes.
|
|
116
|
+
# @return [Integer] Hash code
|
|
117
|
+
def hash
|
|
118
|
+
[symbol, freq, data].hash
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
# Builds the object from hash
|
|
122
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
123
|
+
# @return [Object] Returns the model itself
|
|
124
|
+
def self.build_from_hash(attributes)
|
|
125
|
+
new.build_from_hash(attributes)
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
# Builds the object from hash
|
|
129
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
130
|
+
# @return [Object] Returns the model itself
|
|
131
|
+
def build_from_hash(attributes)
|
|
132
|
+
return nil unless attributes.is_a?(Hash)
|
|
133
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
134
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
135
|
+
self.send("#{key}=", nil)
|
|
136
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
137
|
+
# check to ensure the input is an array given that the attribute
|
|
138
|
+
# is documented as an array but the input is not
|
|
139
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
140
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
141
|
+
end
|
|
142
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
143
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
144
|
+
end
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
self
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
# Deserializes the data based on type
|
|
151
|
+
# @param string type Data type
|
|
152
|
+
# @param string value Value to be deserialized
|
|
153
|
+
# @return [Object] Deserialized data
|
|
154
|
+
def _deserialize(type, value)
|
|
155
|
+
case type.to_sym
|
|
156
|
+
when :Time
|
|
157
|
+
Time.parse(value)
|
|
158
|
+
when :Date
|
|
159
|
+
Date.parse(value)
|
|
160
|
+
when :String
|
|
161
|
+
value.to_s
|
|
162
|
+
when :Integer
|
|
163
|
+
value.to_i
|
|
164
|
+
when :Float
|
|
165
|
+
value.to_f
|
|
166
|
+
when :Boolean
|
|
167
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
168
|
+
true
|
|
169
|
+
else
|
|
170
|
+
false
|
|
171
|
+
end
|
|
172
|
+
when :Object
|
|
173
|
+
# generic object (usually a Hash), return directly
|
|
174
|
+
value
|
|
175
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
176
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
177
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
178
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
179
|
+
k_type = Regexp.last_match[:k_type]
|
|
180
|
+
v_type = Regexp.last_match[:v_type]
|
|
181
|
+
{}.tap do |hash|
|
|
182
|
+
value.each do |k, v|
|
|
183
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
184
|
+
end
|
|
185
|
+
end
|
|
186
|
+
else # model
|
|
187
|
+
# models (e.g. Pet) or oneOf
|
|
188
|
+
klass = FinnhubRuby.const_get(type)
|
|
189
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
190
|
+
end
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
# Returns the string representation of the object
|
|
194
|
+
# @return [String] String presentation of the object
|
|
195
|
+
def to_s
|
|
196
|
+
to_hash.to_s
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
200
|
+
# @return [Hash] Returns the object in the form of hash
|
|
201
|
+
def to_body
|
|
202
|
+
to_hash
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
# Returns the object in the form of hash
|
|
206
|
+
# @return [Hash] Returns the object in the form of hash
|
|
207
|
+
def to_hash
|
|
208
|
+
hash = {}
|
|
209
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
210
|
+
value = self.send(attr)
|
|
211
|
+
if value.nil?
|
|
212
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
213
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
hash[param] = _to_hash(value)
|
|
217
|
+
end
|
|
218
|
+
hash
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
# Outputs non-array value in the form of hash
|
|
222
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
223
|
+
# @param [Object] value Any valid value
|
|
224
|
+
# @return [Hash] Returns the value in the form of hash
|
|
225
|
+
def _to_hash(value)
|
|
226
|
+
if value.is_a?(Array)
|
|
227
|
+
value.compact.map { |v| _to_hash(v) }
|
|
228
|
+
elsif value.is_a?(Hash)
|
|
229
|
+
{}.tap do |hash|
|
|
230
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
231
|
+
end
|
|
232
|
+
elsif value.respond_to? :to_hash
|
|
233
|
+
value.to_hash
|
|
234
|
+
else
|
|
235
|
+
value
|
|
236
|
+
end
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
end
|