finnhub_ruby 1.0.1 → 1.1.6
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 +60 -8
- data/docs/AggregateIndicators.md +10 -9
- data/docs/BasicFinancials.md +14 -11
- data/docs/BreakdownItem.md +20 -0
- data/docs/Company.md +20 -19
- data/docs/CompanyExecutive.md +10 -9
- data/docs/CompanyNews.md +34 -0
- data/docs/CompanyNewsStatistics.md +12 -11
- data/docs/CompanyProfile.md +62 -61
- data/docs/CompanyProfile2.md +30 -29
- data/docs/CountryMetadata.md +18 -17
- data/docs/CovidInfo.md +14 -13
- data/docs/CryptoCandles.md +20 -19
- data/docs/CryptoSymbol.md +12 -11
- data/docs/DefaultApi.md +3288 -792
- data/docs/Development.md +16 -13
- data/docs/Dividends.md +22 -21
- data/docs/Dividends2.md +20 -0
- data/docs/Dividends2Info.md +20 -0
- data/docs/ETFCountryExposureData.md +20 -0
- data/docs/ETFHoldingsData.md +30 -0
- data/docs/ETFProfileData.md +52 -0
- data/docs/ETFSectorExposureData.md +20 -0
- data/docs/ETFsCountryExposure.md +20 -0
- data/docs/ETFsHoldings.md +24 -0
- data/docs/ETFsProfile.md +20 -0
- data/docs/ETFsSectorExposure.md +20 -0
- data/docs/EarningEstimate.md +16 -15
- data/docs/EarningRelease.md +24 -23
- data/docs/EarningResult.md +18 -13
- data/docs/EarningsCalendar.md +8 -7
- data/docs/EarningsCallTranscripts.md +24 -23
- data/docs/EarningsCallTranscriptsList.md +10 -9
- data/docs/EarningsEstimates.md +12 -11
- data/docs/EconomicCalendar.md +8 -7
- data/docs/EconomicCode.md +14 -13
- data/docs/EconomicData.md +10 -9
- data/docs/EconomicDataInfo.md +20 -0
- data/docs/EconomicEvent.md +22 -21
- data/docs/Estimate.md +16 -15
- data/docs/FDAComitteeMeeting.md +24 -0
- data/docs/Filing.md +22 -21
- data/docs/FilingSentiment.md +34 -0
- data/docs/FinancialStatements.md +10 -9
- data/docs/FinancialsAsReported.md +12 -11
- data/docs/ForexCandles.md +20 -19
- data/docs/ForexSymbol.md +12 -11
- data/docs/Forexrates.md +10 -9
- data/docs/FundOwnership.md +10 -9
- data/docs/FundOwnershipInfo.md +26 -0
- data/docs/HistoricalNBBO.md +40 -0
- data/docs/IPOCalendar.md +8 -7
- data/docs/IPOEvent.md +22 -21
- data/docs/IndexHistoricalConstituent.md +22 -0
- data/docs/Indicator.md +12 -11
- data/docs/IndicesConstituents.md +20 -0
- data/docs/IndicesHistoricalConstituents.md +20 -0
- data/docs/InsiderTransactions.md +20 -0
- data/docs/InternationalFiling.md +34 -0
- data/docs/InvestmentThemePortfolio.md +18 -0
- data/docs/InvestmentThemes.md +20 -0
- data/docs/KeyCustomersSuppliers.md +24 -0
- data/docs/LastBidAsk.md +16 -15
- data/docs/MarketNews.md +34 -0
- data/docs/MutualFundCountryExposure.md +20 -0
- data/docs/MutualFundCountryExposureData.md +20 -0
- data/docs/MutualFundHoldings.md +24 -0
- data/docs/MutualFundHoldingsData.md +30 -0
- data/docs/MutualFundProfile.md +20 -0
- data/docs/MutualFundProfileData.md +58 -0
- data/docs/MutualFundSectorExposure.md +20 -0
- data/docs/MutualFundSectorExposureData.md +20 -0
- data/docs/NewsSentiment.md +18 -17
- data/docs/Ownership.md +20 -0
- data/docs/OwnershipInfo.md +24 -0
- data/docs/PatternRecognition.md +8 -7
- data/docs/PressRelease.md +20 -0
- data/docs/PriceTarget.md +18 -17
- data/docs/Quote.md +20 -15
- data/docs/RecommendationTrend.md +20 -19
- data/docs/RedditSentimentContent.md +30 -0
- data/docs/Report.md +28 -27
- data/docs/RevenueBreakdown.md +22 -0
- data/docs/RevenueEstimates.md +12 -11
- data/docs/SECSentimentAnalysis.md +24 -0
- data/docs/Sentiment.md +10 -9
- data/docs/SimilarityIndex.md +22 -0
- data/docs/SocialSentiment.md +22 -0
- data/docs/Split.md +14 -13
- data/docs/StockCandles.md +20 -19
- data/docs/StockSymbol.md +30 -0
- data/docs/StockTranscripts.md +16 -15
- data/docs/SupplyChainRelationships.md +20 -0
- data/docs/SupportResistance.md +8 -7
- data/docs/SymbolLookup.md +20 -0
- data/docs/SymbolLookupInfo.md +24 -0
- data/docs/TechnicalAnalysis.md +10 -9
- data/docs/TickData.md +24 -21
- data/docs/Transactions.md +30 -0
- data/docs/TranscriptContent.md +12 -9
- data/docs/TranscriptParticipant.md +12 -9
- data/docs/Trend.md +10 -7
- data/docs/TwitterSentimentContent.md +30 -0
- data/docs/UpgradeDowngrade.md +18 -17
- data/finnhub_ruby-1.1.5.gem +0 -0
- data/finnhub_ruby.gemspec +7 -8
- data/lib/finnhub_ruby.rb +49 -6
- data/lib/finnhub_ruby/api/default_api.rb +2063 -515
- data/lib/finnhub_ruby/api_client.rb +50 -48
- data/lib/finnhub_ruby/api_error.rb +1 -1
- data/lib/finnhub_ruby/configuration.rb +39 -10
- data/lib/finnhub_ruby/models/aggregate_indicators.rb +19 -7
- data/lib/finnhub_ruby/models/basic_financials.rb +29 -8
- data/lib/finnhub_ruby/models/breakdown_item.rb +228 -0
- data/lib/finnhub_ruby/models/company.rb +19 -7
- data/lib/finnhub_ruby/models/company_executive.rb +20 -8
- data/lib/finnhub_ruby/models/company_news.rb +299 -0
- data/lib/finnhub_ruby/models/company_news_statistics.rb +19 -7
- data/lib/finnhub_ruby/models/company_profile.rb +20 -8
- data/lib/finnhub_ruby/models/company_profile2.rb +19 -7
- data/lib/finnhub_ruby/models/country_metadata.rb +19 -7
- data/lib/finnhub_ruby/models/covid_info.rb +20 -8
- data/lib/finnhub_ruby/models/crypto_candles.rb +19 -7
- data/lib/finnhub_ruby/models/crypto_symbol.rb +19 -7
- data/lib/finnhub_ruby/models/development.rb +34 -12
- data/lib/finnhub_ruby/models/dividends.rb +19 -7
- data/lib/finnhub_ruby/models/dividends2.rb +231 -0
- data/lib/finnhub_ruby/models/dividends2_basic.rb +231 -0
- data/lib/finnhub_ruby/models/dividends2_info.rb +229 -0
- data/lib/finnhub_ruby/models/earning_estimate.rb +20 -8
- data/lib/finnhub_ruby/models/earning_release.rb +20 -8
- data/lib/finnhub_ruby/models/earning_result.rb +40 -8
- data/lib/finnhub_ruby/models/earnings_calendar.rb +20 -8
- data/lib/finnhub_ruby/models/earnings_call_transcripts.rb +22 -10
- data/lib/finnhub_ruby/models/earnings_call_transcripts_list.rb +20 -8
- data/lib/finnhub_ruby/models/earnings_estimates.rb +20 -8
- data/lib/finnhub_ruby/models/economic_calendar.rb +20 -8
- data/lib/finnhub_ruby/models/economic_code.rb +19 -7
- data/lib/finnhub_ruby/models/economic_data.rb +20 -8
- data/lib/finnhub_ruby/models/economic_data_info.rb +229 -0
- data/lib/finnhub_ruby/models/economic_event.rb +19 -7
- data/lib/finnhub_ruby/models/estimate.rb +20 -8
- data/lib/finnhub_ruby/models/et_fs_country_exposure.rb +219 -0
- data/lib/finnhub_ruby/models/et_fs_holdings.rb +219 -0
- data/lib/finnhub_ruby/models/et_fs_industry_exposure.rb +219 -0
- data/lib/finnhub_ruby/models/et_fs_profile.rb +216 -0
- data/lib/finnhub_ruby/models/etf_country_exposure_data.rb +229 -0
- data/lib/finnhub_ruby/models/etf_holdings_data.rb +279 -0
- data/lib/finnhub_ruby/models/etf_profile_data.rb +389 -0
- data/lib/finnhub_ruby/models/etf_sector_exposure_data.rb +229 -0
- data/lib/finnhub_ruby/models/etfs_country_exposure.rb +231 -0
- data/lib/finnhub_ruby/models/etfs_holdings.rb +251 -0
- data/lib/finnhub_ruby/models/etfs_profile.rb +228 -0
- data/lib/finnhub_ruby/models/etfs_sector_exposure.rb +231 -0
- data/lib/finnhub_ruby/models/fda_comittee_meeting.rb +249 -0
- data/lib/finnhub_ruby/models/filing.rb +21 -9
- data/lib/finnhub_ruby/models/filing_sentiment.rb +299 -0
- data/lib/finnhub_ruby/models/financial_statements.rb +19 -7
- data/lib/finnhub_ruby/models/financials_as_reported.rb +20 -8
- data/lib/finnhub_ruby/models/forex_candles.rb +19 -7
- data/lib/finnhub_ruby/models/forex_symbol.rb +19 -7
- data/lib/finnhub_ruby/models/forexrates.rb +19 -7
- data/lib/finnhub_ruby/models/fund_ownership.rb +20 -8
- data/lib/finnhub_ruby/models/fund_ownership_info.rb +259 -0
- data/lib/finnhub_ruby/models/historical_nbbo.rb +345 -0
- data/lib/finnhub_ruby/models/index_historical_constituent.rb +239 -0
- data/lib/finnhub_ruby/models/indicator.rb +19 -7
- data/lib/finnhub_ruby/models/indices_constituents.rb +231 -0
- data/lib/finnhub_ruby/models/indices_historical_constituents.rb +231 -0
- data/lib/finnhub_ruby/models/insider_transactions.rb +231 -0
- data/lib/finnhub_ruby/models/international_filing.rb +299 -0
- data/lib/finnhub_ruby/models/investment_theme_portfolio.rb +219 -0
- data/lib/finnhub_ruby/models/investment_themes.rb +231 -0
- data/lib/finnhub_ruby/models/investment_themes_thematic_investing.rb +231 -0
- data/lib/finnhub_ruby/models/investor.rb +19 -7
- data/lib/finnhub_ruby/models/ipo_calendar.rb +20 -8
- data/lib/finnhub_ruby/models/ipo_event.rb +19 -7
- data/lib/finnhub_ruby/models/key_customers_suppliers.rb +249 -0
- data/lib/finnhub_ruby/models/last_bid_ask.rb +19 -7
- data/lib/finnhub_ruby/models/major_press_releases.rb +231 -0
- data/lib/finnhub_ruby/models/market_news.rb +299 -0
- data/lib/finnhub_ruby/models/mutual_fund_country_exposure.rb +231 -0
- data/lib/finnhub_ruby/models/mutual_fund_country_exposure_data.rb +229 -0
- data/lib/finnhub_ruby/models/mutual_fund_holdings.rb +251 -0
- data/lib/finnhub_ruby/models/mutual_fund_holdings_data.rb +279 -0
- data/lib/finnhub_ruby/models/mutual_fund_profile.rb +228 -0
- data/lib/finnhub_ruby/models/mutual_fund_profile_data.rb +419 -0
- data/lib/finnhub_ruby/models/mutual_fund_sector_exposure.rb +231 -0
- data/lib/finnhub_ruby/models/mutual_fund_sector_exposure_data.rb +229 -0
- data/lib/finnhub_ruby/models/mutual_funds_country_exposure.rb +231 -0
- data/lib/finnhub_ruby/models/mutual_funds_holdings.rb +251 -0
- data/lib/finnhub_ruby/models/mutual_funds_profile.rb +228 -0
- data/lib/finnhub_ruby/models/news.rb +19 -7
- data/lib/finnhub_ruby/models/news_sentiment.rb +19 -7
- data/lib/finnhub_ruby/models/ownership.rb +231 -0
- data/lib/finnhub_ruby/models/ownership_info.rb +249 -0
- data/lib/finnhub_ruby/models/pattern_recognition.rb +19 -7
- data/lib/finnhub_ruby/models/press_release.rb +231 -0
- data/lib/finnhub_ruby/models/price_target.rb +20 -8
- data/lib/finnhub_ruby/models/quote.rb +43 -11
- data/lib/finnhub_ruby/models/recommendation_trend.rb +19 -7
- data/lib/finnhub_ruby/models/reddit_sentiment_content.rb +279 -0
- data/lib/finnhub_ruby/models/report.rb +23 -11
- data/lib/finnhub_ruby/models/revenue_breakdown.rb +241 -0
- data/lib/finnhub_ruby/models/revenue_estimates.rb +20 -8
- data/lib/finnhub_ruby/models/sec_sentiment_analysis.rb +248 -0
- data/lib/finnhub_ruby/models/sentiment.rb +19 -7
- data/lib/finnhub_ruby/models/similarity_index.rb +241 -0
- data/lib/finnhub_ruby/models/social_sentiment.rb +243 -0
- data/lib/finnhub_ruby/models/split.rb +19 -7
- data/lib/finnhub_ruby/models/stock.rb +33 -11
- data/lib/finnhub_ruby/models/stock_candles.rb +19 -7
- data/lib/finnhub_ruby/models/stock_symbol.rb +279 -0
- data/lib/finnhub_ruby/models/stock_transcripts.rb +20 -8
- data/lib/finnhub_ruby/models/supply_chain_relationships.rb +231 -0
- data/lib/finnhub_ruby/models/support_resistance.rb +19 -7
- data/lib/finnhub_ruby/models/symbol_lookup.rb +231 -0
- data/lib/finnhub_ruby/models/symbol_lookup_info.rb +249 -0
- data/lib/finnhub_ruby/models/technical_analysis.rb +19 -7
- data/lib/finnhub_ruby/models/tick_data.rb +36 -12
- data/lib/finnhub_ruby/models/transactions.rb +279 -0
- data/lib/finnhub_ruby/models/transcript_content.rb +33 -11
- data/lib/finnhub_ruby/models/transcript_participant.rb +33 -11
- data/lib/finnhub_ruby/models/trend.rb +33 -11
- data/lib/finnhub_ruby/models/twitter_sentiment_content.rb +279 -0
- data/lib/finnhub_ruby/models/upgrade_downgrade.rb +19 -7
- data/lib/finnhub_ruby/version.rb +2 -2
- data/release.sh +12 -2
- data/spec/api/default_api_spec.rb +88 -2
- data/spec/api_client_spec.rb +1 -1
- data/spec/configuration_spec.rb +1 -1
- data/spec/models/aggregate_indicators_spec.rb +4 -11
- data/spec/models/basic_financials_spec.rb +10 -11
- data/spec/models/breakdown_item_spec.rb +40 -0
- data/spec/models/company_executive_spec.rb +4 -11
- data/spec/models/{news_spec.rb → company_news_spec.rb} +7 -14
- data/spec/models/company_news_statistics_spec.rb +4 -11
- data/spec/models/company_profile2_spec.rb +4 -11
- data/spec/models/company_profile_spec.rb +4 -11
- data/spec/models/company_spec.rb +4 -11
- data/spec/models/country_metadata_spec.rb +4 -11
- data/spec/models/covid_info_spec.rb +4 -11
- data/spec/models/crypto_candles_spec.rb +4 -11
- data/spec/models/crypto_symbol_spec.rb +4 -11
- data/spec/models/development_spec.rb +10 -11
- data/spec/models/dividends2_info_spec.rb +40 -0
- data/spec/models/dividends2_spec.rb +40 -0
- data/spec/models/dividends_spec.rb +4 -11
- data/spec/models/earning_estimate_spec.rb +4 -11
- data/spec/models/earning_release_spec.rb +4 -11
- data/spec/models/earning_result_spec.rb +16 -11
- data/spec/models/earnings_calendar_spec.rb +4 -11
- data/spec/models/earnings_call_transcripts_list_spec.rb +4 -11
- data/spec/models/earnings_call_transcripts_spec.rb +4 -11
- data/spec/models/earnings_estimates_spec.rb +4 -11
- data/spec/models/economic_calendar_spec.rb +4 -11
- data/spec/models/economic_code_spec.rb +4 -11
- data/spec/models/economic_data_info_spec.rb +40 -0
- data/spec/models/economic_data_spec.rb +4 -11
- data/spec/models/economic_event_spec.rb +4 -11
- data/spec/models/estimate_spec.rb +4 -11
- data/spec/models/etf_country_exposure_data_spec.rb +40 -0
- data/spec/models/etf_holdings_data_spec.rb +70 -0
- data/spec/models/etf_profile_data_spec.rb +136 -0
- data/spec/models/etf_sector_exposure_data_spec.rb +40 -0
- data/spec/models/etfs_country_exposure_spec.rb +40 -0
- data/spec/models/etfs_holdings_spec.rb +52 -0
- data/spec/models/etfs_profile_spec.rb +40 -0
- data/spec/models/etfs_sector_exposure_spec.rb +40 -0
- data/spec/models/fda_comittee_meeting_spec.rb +52 -0
- data/spec/models/filing_sentiment_spec.rb +82 -0
- data/spec/models/filing_spec.rb +4 -11
- data/spec/models/financial_statements_spec.rb +4 -11
- data/spec/models/financials_as_reported_spec.rb +4 -11
- data/spec/models/forex_candles_spec.rb +4 -11
- data/spec/models/forex_symbol_spec.rb +4 -11
- data/spec/models/forexrates_spec.rb +4 -11
- data/spec/models/fund_ownership_info_spec.rb +58 -0
- data/spec/models/fund_ownership_spec.rb +4 -11
- data/spec/models/historical_nbbo_spec.rb +100 -0
- data/spec/models/index_historical_constituent_spec.rb +46 -0
- data/spec/models/indicator_spec.rb +4 -11
- data/spec/models/indices_constituents_spec.rb +40 -0
- data/spec/models/indices_historical_constituents_spec.rb +40 -0
- data/spec/models/insider_transactions_spec.rb +40 -0
- data/spec/models/international_filing_spec.rb +82 -0
- data/spec/models/investment_theme_portfolio_spec.rb +34 -0
- data/spec/models/investment_themes_spec.rb +40 -0
- data/spec/models/ipo_calendar_spec.rb +4 -11
- data/spec/models/ipo_event_spec.rb +4 -11
- data/spec/models/key_customers_suppliers_spec.rb +52 -0
- data/spec/models/last_bid_ask_spec.rb +4 -11
- data/spec/models/market_news_spec.rb +82 -0
- data/spec/models/mutual_fund_country_exposure_data_spec.rb +40 -0
- data/spec/models/mutual_fund_country_exposure_spec.rb +40 -0
- data/spec/models/mutual_fund_holdings_data_spec.rb +70 -0
- data/spec/models/mutual_fund_holdings_spec.rb +52 -0
- data/spec/models/mutual_fund_profile_data_spec.rb +154 -0
- data/spec/models/mutual_fund_profile_spec.rb +40 -0
- data/spec/models/mutual_fund_sector_exposure_data_spec.rb +40 -0
- data/spec/models/mutual_fund_sector_exposure_spec.rb +40 -0
- data/spec/models/news_sentiment_spec.rb +4 -11
- data/spec/models/{investor_spec.rb → ownership_info_spec.rb} +7 -14
- data/spec/models/{investors_ownership_spec.rb → ownership_spec.rb} +7 -14
- data/spec/models/pattern_recognition_spec.rb +4 -11
- data/spec/models/{major_developments_spec.rb → press_release_spec.rb} +7 -14
- data/spec/models/price_target_spec.rb +4 -11
- data/spec/models/quote_spec.rb +16 -11
- data/spec/models/recommendation_trend_spec.rb +4 -11
- data/spec/models/reddit_sentiment_content_spec.rb +70 -0
- data/spec/models/report_spec.rb +4 -11
- data/spec/models/{stock_spec.rb → revenue_breakdown_spec.rb} +10 -17
- data/spec/models/revenue_estimates_spec.rb +4 -11
- data/spec/models/sec_sentiment_analysis_spec.rb +52 -0
- data/spec/models/sentiment_spec.rb +4 -11
- data/spec/models/similarity_index_spec.rb +46 -0
- data/spec/models/social_sentiment_spec.rb +46 -0
- data/spec/models/split_spec.rb +4 -11
- data/spec/models/stock_candles_spec.rb +4 -11
- data/spec/models/stock_symbol_spec.rb +70 -0
- data/spec/models/stock_transcripts_spec.rb +4 -11
- data/spec/models/supply_chain_relationships_spec.rb +40 -0
- data/spec/models/support_resistance_spec.rb +4 -11
- data/spec/models/symbol_lookup_info_spec.rb +52 -0
- data/spec/models/symbol_lookup_spec.rb +40 -0
- data/spec/models/technical_analysis_spec.rb +4 -11
- data/spec/models/tick_data_spec.rb +10 -11
- data/spec/models/transactions_spec.rb +70 -0
- data/spec/models/transcript_content_spec.rb +10 -11
- data/spec/models/transcript_participant_spec.rb +10 -11
- data/spec/models/trend_spec.rb +10 -11
- data/spec/models/twitter_sentiment_content_spec.rb +70 -0
- data/spec/models/upgrade_downgrade_spec.rb +4 -11
- data/spec/spec_helper.rb +1 -1
- metadata +211 -45
- data/docs/Investor.md +0 -23
- data/docs/InvestorsOwnership.md +0 -19
- data/docs/MajorDevelopments.md +0 -19
- data/docs/News.md +0 -33
- data/docs/Stock.md +0 -21
- data/finnhub_ruby-1.0.0.gem +0 -0
- data/test.rb +0 -139
|
@@ -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:
|
|
9
|
+
OpenAPI Generator version: 5.2.0
|
|
10
10
|
|
|
11
11
|
=end
|
|
12
12
|
|
|
@@ -14,6 +14,7 @@ require 'date'
|
|
|
14
14
|
require 'json'
|
|
15
15
|
require 'logger'
|
|
16
16
|
require 'tempfile'
|
|
17
|
+
require 'time'
|
|
17
18
|
require 'typhoeus'
|
|
18
19
|
|
|
19
20
|
module FinnhubRuby
|
|
@@ -86,7 +87,7 @@ module FinnhubRuby
|
|
|
86
87
|
# @option opts [Object] :body HTTP body (JSON/XML)
|
|
87
88
|
# @return [Typhoeus::Request] A Typhoeus Request
|
|
88
89
|
def build_request(http_method, path, opts = {})
|
|
89
|
-
url = build_request_url(path)
|
|
90
|
+
url = build_request_url(path, opts)
|
|
90
91
|
http_method = http_method.to_sym.downcase
|
|
91
92
|
|
|
92
93
|
header_params = @default_headers.merge(opts[:header_params] || {})
|
|
@@ -156,6 +157,44 @@ module FinnhubRuby
|
|
|
156
157
|
data
|
|
157
158
|
end
|
|
158
159
|
|
|
160
|
+
# Save response body into a file in (the defined) temporary folder, using the filename
|
|
161
|
+
# from the "Content-Disposition" header if provided, otherwise a random filename.
|
|
162
|
+
# The response body is written to the file in chunks in order to handle files which
|
|
163
|
+
# size is larger than maximum Ruby String or even larger than the maximum memory a Ruby
|
|
164
|
+
# process can use.
|
|
165
|
+
#
|
|
166
|
+
# @see Configuration#temp_folder_path
|
|
167
|
+
def download_file(request)
|
|
168
|
+
tempfile = nil
|
|
169
|
+
encoding = nil
|
|
170
|
+
request.on_headers do |response|
|
|
171
|
+
content_disposition = response.headers['Content-Disposition']
|
|
172
|
+
if content_disposition && content_disposition =~ /filename=/i
|
|
173
|
+
filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
|
|
174
|
+
prefix = sanitize_filename(filename)
|
|
175
|
+
else
|
|
176
|
+
prefix = 'download-'
|
|
177
|
+
end
|
|
178
|
+
prefix = prefix + '-' unless prefix.end_with?('-')
|
|
179
|
+
encoding = response.body.encoding
|
|
180
|
+
tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
|
|
181
|
+
@tempfile = tempfile
|
|
182
|
+
end
|
|
183
|
+
request.on_body do |chunk|
|
|
184
|
+
chunk.force_encoding(encoding)
|
|
185
|
+
tempfile.write(chunk)
|
|
186
|
+
end
|
|
187
|
+
request.on_complete do |response|
|
|
188
|
+
if tempfile
|
|
189
|
+
tempfile.close
|
|
190
|
+
@config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
|
|
191
|
+
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
|
|
192
|
+
"will be deleted automatically with GC. It's also recommended to delete the temp file "\
|
|
193
|
+
"explicitly with `tempfile.delete`"
|
|
194
|
+
end
|
|
195
|
+
end
|
|
196
|
+
end
|
|
197
|
+
|
|
159
198
|
# Check if the given MIME is a JSON MIME.
|
|
160
199
|
# JSON MIME examples:
|
|
161
200
|
# application/json
|
|
@@ -192,7 +231,7 @@ module FinnhubRuby
|
|
|
192
231
|
begin
|
|
193
232
|
data = JSON.parse("[#{body}]", :symbolize_names => true)[0]
|
|
194
233
|
rescue JSON::ParserError => e
|
|
195
|
-
if %w(String Date
|
|
234
|
+
if %w(String Date Time).include?(return_type)
|
|
196
235
|
data = body
|
|
197
236
|
else
|
|
198
237
|
raise e
|
|
@@ -217,9 +256,9 @@ module FinnhubRuby
|
|
|
217
256
|
data.to_f
|
|
218
257
|
when 'Boolean'
|
|
219
258
|
data == true
|
|
220
|
-
when '
|
|
259
|
+
when 'Time'
|
|
221
260
|
# parse date time (expecting ISO 8601 format)
|
|
222
|
-
|
|
261
|
+
Time.parse data
|
|
223
262
|
when 'Date'
|
|
224
263
|
# parse date time (expecting ISO 8601 format)
|
|
225
264
|
Date.parse data
|
|
@@ -237,46 +276,9 @@ module FinnhubRuby
|
|
|
237
276
|
data.each { |k, v| hash[k] = convert_to_type(v, sub_type) }
|
|
238
277
|
end
|
|
239
278
|
else
|
|
240
|
-
# models
|
|
241
|
-
FinnhubRuby.const_get(return_type)
|
|
242
|
-
|
|
243
|
-
end
|
|
244
|
-
|
|
245
|
-
# Save response body into a file in (the defined) temporary folder, using the filename
|
|
246
|
-
# from the "Content-Disposition" header if provided, otherwise a random filename.
|
|
247
|
-
# The response body is written to the file in chunks in order to handle files which
|
|
248
|
-
# size is larger than maximum Ruby String or even larger than the maximum memory a Ruby
|
|
249
|
-
# process can use.
|
|
250
|
-
#
|
|
251
|
-
# @see Configuration#temp_folder_path
|
|
252
|
-
def download_file(request)
|
|
253
|
-
tempfile = nil
|
|
254
|
-
encoding = nil
|
|
255
|
-
request.on_headers do |response|
|
|
256
|
-
content_disposition = response.headers['Content-Disposition']
|
|
257
|
-
if content_disposition && content_disposition =~ /filename=/i
|
|
258
|
-
filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
|
|
259
|
-
prefix = sanitize_filename(filename)
|
|
260
|
-
else
|
|
261
|
-
prefix = 'download-'
|
|
262
|
-
end
|
|
263
|
-
prefix = prefix + '-' unless prefix.end_with?('-')
|
|
264
|
-
encoding = response.body.encoding
|
|
265
|
-
tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
|
|
266
|
-
@tempfile = tempfile
|
|
267
|
-
end
|
|
268
|
-
request.on_body do |chunk|
|
|
269
|
-
chunk.force_encoding(encoding)
|
|
270
|
-
tempfile.write(chunk)
|
|
271
|
-
end
|
|
272
|
-
request.on_complete do |response|
|
|
273
|
-
if tempfile
|
|
274
|
-
tempfile.close
|
|
275
|
-
@config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
|
|
276
|
-
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
|
|
277
|
-
"will be deleted automatically with GC. It's also recommended to delete the temp file "\
|
|
278
|
-
"explicitly with `tempfile.delete`"
|
|
279
|
-
end
|
|
279
|
+
# models (e.g. Pet) or oneOf
|
|
280
|
+
klass = FinnhubRuby.const_get(return_type)
|
|
281
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data)
|
|
280
282
|
end
|
|
281
283
|
end
|
|
282
284
|
|
|
@@ -289,10 +291,10 @@ module FinnhubRuby
|
|
|
289
291
|
filename.gsub(/.*[\/\\]/, '')
|
|
290
292
|
end
|
|
291
293
|
|
|
292
|
-
def build_request_url(path)
|
|
294
|
+
def build_request_url(path, opts = {})
|
|
293
295
|
# Add leading and trailing slashes to path
|
|
294
296
|
path = "/#{path}".gsub(/\/+/, '/')
|
|
295
|
-
@config.base_url + path
|
|
297
|
+
@config.base_url(opts[:operation]) + path
|
|
296
298
|
end
|
|
297
299
|
|
|
298
300
|
# Update hearder and query params based on authentication settings.
|
|
@@ -307,7 +309,7 @@ module FinnhubRuby
|
|
|
307
309
|
case auth_setting[:in]
|
|
308
310
|
when 'header' then header_params[auth_setting[:key]] = auth_setting[:value]
|
|
309
311
|
when 'query' then query_params[auth_setting[:key]] = auth_setting[:value]
|
|
310
|
-
else fail ArgumentError, 'Authentication token must be in `query`
|
|
312
|
+
else fail ArgumentError, 'Authentication token must be in `query` or `header`'
|
|
311
313
|
end
|
|
312
314
|
end
|
|
313
315
|
end
|
|
@@ -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:
|
|
9
|
+
OpenAPI Generator version: 5.2.0
|
|
10
10
|
|
|
11
11
|
=end
|
|
12
12
|
|
|
@@ -21,6 +21,18 @@ module FinnhubRuby
|
|
|
21
21
|
# Defines url base path
|
|
22
22
|
attr_accessor :base_path
|
|
23
23
|
|
|
24
|
+
# Define server configuration index
|
|
25
|
+
attr_accessor :server_index
|
|
26
|
+
|
|
27
|
+
# Define server operation configuration index
|
|
28
|
+
attr_accessor :server_operation_index
|
|
29
|
+
|
|
30
|
+
# Default server variables
|
|
31
|
+
attr_accessor :server_variables
|
|
32
|
+
|
|
33
|
+
# Default server operation variables
|
|
34
|
+
attr_accessor :server_operation_variables
|
|
35
|
+
|
|
24
36
|
# Defines API keys used with API Key authentications.
|
|
25
37
|
#
|
|
26
38
|
# @return [Hash] key: parameter name, value: parameter value (API key)
|
|
@@ -129,6 +141,10 @@ module FinnhubRuby
|
|
|
129
141
|
@scheme = 'https'
|
|
130
142
|
@host = 'finnhub.io'
|
|
131
143
|
@base_path = '/api/v1'
|
|
144
|
+
@server_index = 0
|
|
145
|
+
@server_operation_index = {}
|
|
146
|
+
@server_variables = {}
|
|
147
|
+
@server_operation_variables = {}
|
|
132
148
|
@api_key = {}
|
|
133
149
|
@api_key_prefix = {}
|
|
134
150
|
@timeout = 0
|
|
@@ -171,17 +187,23 @@ module FinnhubRuby
|
|
|
171
187
|
@base_path = '' if @base_path == '/'
|
|
172
188
|
end
|
|
173
189
|
|
|
174
|
-
|
|
175
|
-
|
|
190
|
+
# Returns base URL for specified operation based on server settings
|
|
191
|
+
def base_url(operation = nil)
|
|
192
|
+
index = server_operation_index.fetch(operation, server_index)
|
|
193
|
+
return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if index == nil
|
|
194
|
+
|
|
195
|
+
server_url(index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
|
|
176
196
|
end
|
|
177
197
|
|
|
178
198
|
# Gets API key (with prefix if set).
|
|
179
199
|
# @param [String] param_name the parameter name of API key auth
|
|
180
|
-
def api_key_with_prefix(param_name)
|
|
200
|
+
def api_key_with_prefix(param_name, param_alias = nil)
|
|
201
|
+
key = @api_key[param_name]
|
|
202
|
+
key = @api_key.fetch(param_alias, key) unless param_alias.nil?
|
|
181
203
|
if @api_key_prefix[param_name]
|
|
182
|
-
"#{@api_key_prefix[param_name]} #{
|
|
204
|
+
"#{@api_key_prefix[param_name]} #{key}"
|
|
183
205
|
else
|
|
184
|
-
|
|
206
|
+
key
|
|
185
207
|
end
|
|
186
208
|
end
|
|
187
209
|
|
|
@@ -198,7 +220,7 @@ module FinnhubRuby
|
|
|
198
220
|
type: 'api_key',
|
|
199
221
|
in: 'query',
|
|
200
222
|
key: 'token',
|
|
201
|
-
value: api_key_with_prefix('
|
|
223
|
+
value: api_key_with_prefix('api_key')
|
|
202
224
|
},
|
|
203
225
|
}
|
|
204
226
|
end
|
|
@@ -213,12 +235,17 @@ module FinnhubRuby
|
|
|
213
235
|
]
|
|
214
236
|
end
|
|
215
237
|
|
|
238
|
+
def operation_server_settings
|
|
239
|
+
{
|
|
240
|
+
}
|
|
241
|
+
end
|
|
242
|
+
|
|
216
243
|
# Returns URL based on server settings
|
|
217
244
|
#
|
|
218
245
|
# @param index array index of the server settings
|
|
219
246
|
# @param variables hash of variable and the corresponding value
|
|
220
|
-
def server_url(index, variables = {})
|
|
221
|
-
servers = server_settings
|
|
247
|
+
def server_url(index, variables = {}, servers = nil)
|
|
248
|
+
servers = server_settings if servers == nil
|
|
222
249
|
|
|
223
250
|
# check array index out of bound
|
|
224
251
|
if (index < 0 || index >= servers.size)
|
|
@@ -228,10 +255,12 @@ module FinnhubRuby
|
|
|
228
255
|
server = servers[index]
|
|
229
256
|
url = server[:url]
|
|
230
257
|
|
|
258
|
+
return url unless server.key? :variables
|
|
259
|
+
|
|
231
260
|
# go through variable and assign a value
|
|
232
261
|
server[:variables].each do |name, variable|
|
|
233
262
|
if variables.key?(name)
|
|
234
|
-
if (server[:variables][name][:enum_values].include?
|
|
263
|
+
if (!server[:variables][name].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name]))
|
|
235
264
|
url.gsub! "{" + name.to_s + "}", variables[name]
|
|
236
265
|
else
|
|
237
266
|
fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}."
|
|
@@ -6,11 +6,12 @@
|
|
|
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:
|
|
9
|
+
OpenAPI Generator version: 5.2.0
|
|
10
10
|
|
|
11
11
|
=end
|
|
12
12
|
|
|
13
13
|
require 'date'
|
|
14
|
+
require 'time'
|
|
14
15
|
|
|
15
16
|
module FinnhubRuby
|
|
16
17
|
class AggregateIndicators
|
|
@@ -26,6 +27,11 @@ module FinnhubRuby
|
|
|
26
27
|
}
|
|
27
28
|
end
|
|
28
29
|
|
|
30
|
+
# Returns all the JSON keys this model knows about
|
|
31
|
+
def self.acceptable_attributes
|
|
32
|
+
attribute_map.values
|
|
33
|
+
end
|
|
34
|
+
|
|
29
35
|
# Attribute type mapping.
|
|
30
36
|
def self.openapi_types
|
|
31
37
|
{
|
|
@@ -111,7 +117,9 @@ module FinnhubRuby
|
|
|
111
117
|
def build_from_hash(attributes)
|
|
112
118
|
return nil unless attributes.is_a?(Hash)
|
|
113
119
|
self.class.openapi_types.each_pair do |key, type|
|
|
114
|
-
if
|
|
120
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
121
|
+
self.send("#{key}=", nil)
|
|
122
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
115
123
|
# check to ensure the input is an array given that the attribute
|
|
116
124
|
# is documented as an array but the input is not
|
|
117
125
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
@@ -119,7 +127,7 @@ module FinnhubRuby
|
|
|
119
127
|
end
|
|
120
128
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
121
129
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
122
|
-
end
|
|
130
|
+
end
|
|
123
131
|
end
|
|
124
132
|
|
|
125
133
|
self
|
|
@@ -131,8 +139,8 @@ module FinnhubRuby
|
|
|
131
139
|
# @return [Object] Deserialized data
|
|
132
140
|
def _deserialize(type, value)
|
|
133
141
|
case type.to_sym
|
|
134
|
-
when :
|
|
135
|
-
|
|
142
|
+
when :Time
|
|
143
|
+
Time.parse(value)
|
|
136
144
|
when :Date
|
|
137
145
|
Date.parse(value)
|
|
138
146
|
when :String
|
|
@@ -162,7 +170,9 @@ module FinnhubRuby
|
|
|
162
170
|
end
|
|
163
171
|
end
|
|
164
172
|
else # model
|
|
165
|
-
|
|
173
|
+
# models (e.g. Pet) or oneOf
|
|
174
|
+
klass = FinnhubRuby.const_get(type)
|
|
175
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
166
176
|
end
|
|
167
177
|
end
|
|
168
178
|
|
|
@@ -188,7 +198,7 @@ module FinnhubRuby
|
|
|
188
198
|
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
189
199
|
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
190
200
|
end
|
|
191
|
-
|
|
201
|
+
|
|
192
202
|
hash[param] = _to_hash(value)
|
|
193
203
|
end
|
|
194
204
|
hash
|
|
@@ -211,5 +221,7 @@ module FinnhubRuby
|
|
|
211
221
|
value
|
|
212
222
|
end
|
|
213
223
|
end
|
|
224
|
+
|
|
214
225
|
end
|
|
226
|
+
|
|
215
227
|
end
|
|
@@ -6,11 +6,12 @@
|
|
|
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:
|
|
9
|
+
OpenAPI Generator version: 5.2.0
|
|
10
10
|
|
|
11
11
|
=end
|
|
12
12
|
|
|
13
13
|
require 'date'
|
|
14
|
+
require 'time'
|
|
14
15
|
|
|
15
16
|
module FinnhubRuby
|
|
16
17
|
class BasicFinancials
|
|
@@ -20,6 +21,8 @@ module FinnhubRuby
|
|
|
20
21
|
# Metric type.
|
|
21
22
|
attr_accessor :metric_type
|
|
22
23
|
|
|
24
|
+
attr_accessor :series
|
|
25
|
+
|
|
23
26
|
attr_accessor :metric
|
|
24
27
|
|
|
25
28
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
@@ -27,15 +30,22 @@ module FinnhubRuby
|
|
|
27
30
|
{
|
|
28
31
|
:'symbol' => :'symbol',
|
|
29
32
|
:'metric_type' => :'metricType',
|
|
33
|
+
:'series' => :'series',
|
|
30
34
|
:'metric' => :'metric'
|
|
31
35
|
}
|
|
32
36
|
end
|
|
33
37
|
|
|
38
|
+
# Returns all the JSON keys this model knows about
|
|
39
|
+
def self.acceptable_attributes
|
|
40
|
+
attribute_map.values
|
|
41
|
+
end
|
|
42
|
+
|
|
34
43
|
# Attribute type mapping.
|
|
35
44
|
def self.openapi_types
|
|
36
45
|
{
|
|
37
46
|
:'symbol' => :'String',
|
|
38
47
|
:'metric_type' => :'String',
|
|
48
|
+
:'series' => :'Object',
|
|
39
49
|
:'metric' => :'Object'
|
|
40
50
|
}
|
|
41
51
|
end
|
|
@@ -69,6 +79,10 @@ module FinnhubRuby
|
|
|
69
79
|
self.metric_type = attributes[:'metric_type']
|
|
70
80
|
end
|
|
71
81
|
|
|
82
|
+
if attributes.key?(:'series')
|
|
83
|
+
self.series = attributes[:'series']
|
|
84
|
+
end
|
|
85
|
+
|
|
72
86
|
if attributes.key?(:'metric')
|
|
73
87
|
self.metric = attributes[:'metric']
|
|
74
88
|
end
|
|
@@ -94,6 +108,7 @@ module FinnhubRuby
|
|
|
94
108
|
self.class == o.class &&
|
|
95
109
|
symbol == o.symbol &&
|
|
96
110
|
metric_type == o.metric_type &&
|
|
111
|
+
series == o.series &&
|
|
97
112
|
metric == o.metric
|
|
98
113
|
end
|
|
99
114
|
|
|
@@ -106,7 +121,7 @@ module FinnhubRuby
|
|
|
106
121
|
# Calculates hash code according to all attributes.
|
|
107
122
|
# @return [Integer] Hash code
|
|
108
123
|
def hash
|
|
109
|
-
[symbol, metric_type, metric].hash
|
|
124
|
+
[symbol, metric_type, series, metric].hash
|
|
110
125
|
end
|
|
111
126
|
|
|
112
127
|
# Builds the object from hash
|
|
@@ -122,7 +137,9 @@ module FinnhubRuby
|
|
|
122
137
|
def build_from_hash(attributes)
|
|
123
138
|
return nil unless attributes.is_a?(Hash)
|
|
124
139
|
self.class.openapi_types.each_pair do |key, type|
|
|
125
|
-
if
|
|
140
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
141
|
+
self.send("#{key}=", nil)
|
|
142
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
126
143
|
# check to ensure the input is an array given that the attribute
|
|
127
144
|
# is documented as an array but the input is not
|
|
128
145
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
@@ -130,7 +147,7 @@ module FinnhubRuby
|
|
|
130
147
|
end
|
|
131
148
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
132
149
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
133
|
-
end
|
|
150
|
+
end
|
|
134
151
|
end
|
|
135
152
|
|
|
136
153
|
self
|
|
@@ -142,8 +159,8 @@ module FinnhubRuby
|
|
|
142
159
|
# @return [Object] Deserialized data
|
|
143
160
|
def _deserialize(type, value)
|
|
144
161
|
case type.to_sym
|
|
145
|
-
when :
|
|
146
|
-
|
|
162
|
+
when :Time
|
|
163
|
+
Time.parse(value)
|
|
147
164
|
when :Date
|
|
148
165
|
Date.parse(value)
|
|
149
166
|
when :String
|
|
@@ -173,7 +190,9 @@ module FinnhubRuby
|
|
|
173
190
|
end
|
|
174
191
|
end
|
|
175
192
|
else # model
|
|
176
|
-
|
|
193
|
+
# models (e.g. Pet) or oneOf
|
|
194
|
+
klass = FinnhubRuby.const_get(type)
|
|
195
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
177
196
|
end
|
|
178
197
|
end
|
|
179
198
|
|
|
@@ -199,7 +218,7 @@ module FinnhubRuby
|
|
|
199
218
|
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
200
219
|
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
201
220
|
end
|
|
202
|
-
|
|
221
|
+
|
|
203
222
|
hash[param] = _to_hash(value)
|
|
204
223
|
end
|
|
205
224
|
hash
|
|
@@ -222,5 +241,7 @@ module FinnhubRuby
|
|
|
222
241
|
value
|
|
223
242
|
end
|
|
224
243
|
end
|
|
244
|
+
|
|
225
245
|
end
|
|
246
|
+
|
|
226
247
|
end
|