finnhub_ruby 1.1.6 → 1.1.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b2da8e821dc78ddc713ed7f8afb8fe28afee96a262cdba9db9200ec37643227c
4
- data.tar.gz: 715d18d743098b7d2eee1409e3e97e8123785092220731bbc9bd50837a3bf245
3
+ metadata.gz: 15ba3be70fe2664addf3a249f9b4074234d80b21c48830995b21337928d86fdb
4
+ data.tar.gz: 0e37b5b3831c051be068ee9e0da640e03feb696fb94d6012f260671bb2265ac2
5
5
  SHA512:
6
- metadata.gz: cfc79554dd04a501384f983da3fe1d675364b0e750a7601bb590ab558e3cf9d417fea7b3a9003eb401a1421ddd6fe043400d071f22c6e9a782230ba6ebad4ee7
7
- data.tar.gz: 11ff59fb347ae3fcd8b56c839b9d5363f3b9922f26cfba9b11f3380e4ac4301e41ab93891a6df6969f1f8ca83819346555b60ad0be8cb6317e79b41e1dc6a1e6
6
+ metadata.gz: 5aec2b83a75b9cb170683ace2fbd27156c841a1e0e232c3af18c118e06dfd28cb1b3eb153c15b146aa3a006182ade2b5e91168b299a6e99ac9adea26958b6116
7
+ data.tar.gz: ad3f505f2afb53046cf21c589598e9f2ce50d03df099ecb8c4cb005e1a58d58ad691bba9665f976108c0fdedcbb2d9418cf7f48d1c0353219cd2d26d2de1a6ad
data/README.md CHANGED
@@ -27,11 +27,12 @@ end
27
27
 
28
28
  finnhub_client = FinnhubRuby::DefaultApi.new
29
29
 
30
- finnhub_client = FinnhubRuby::DefaultApi.new
31
-
32
30
  # Stock candles
33
31
  puts(finnhub_client.stock_candles('AAPL', 'D', 1590988249, 1591852249))
34
32
 
33
+ # Stock symbols
34
+ puts(finnhub_client.stock_symbols('US'))
35
+
35
36
  # Aggregate Indicators
36
37
  puts(finnhub_client.aggregate_indicator('AAPL', 'D'))
37
38
 
@@ -156,7 +157,7 @@ puts(finnhub_client.forex_candles('OANDA:EUR_USD', 'D', 1590988249, 1591852249))
156
157
  puts(finnhub_client.crypto_candles('BINANCE:BTCUSDT', 'D', 1590988249, 1591852249))
157
158
 
158
159
  # Tick Data
159
- puts(finnhub_client.stock_tick_with_http_info('AAPL', '2020-03-25', 500, 0))
160
+ puts(finnhub_client.stock_tick('AAPL', '2020-03-25', 500, 0))
160
161
 
161
162
  # NBBO
162
163
  puts(finnhub_client.stock_nbbo('NFLX', '2020-03-25', 50, 0))
@@ -29,7 +29,7 @@
29
29
  | **ipo** | **Date** | IPO date. | [optional] |
30
30
  | **market_capitalization** | **Float** | Market Capitalization. | [optional] |
31
31
  | **share_outstanding** | **Float** | Number of oustanding shares. | [optional] |
32
- | **employee_total** | **Integer** | Number of employee. | [optional] |
32
+ | **employee_total** | **Float** | Number of employee. | [optional] |
33
33
  | **logo** | **String** | Logo image. | [optional] |
34
34
  | **finnhub_industry** | **String** | Finnhub industry classification. | [optional] |
35
35
 
data/docs/DefaultApi.md CHANGED
@@ -2951,7 +2951,7 @@ end
2951
2951
  api_instance = FinnhubRuby::DefaultApi.new
2952
2952
  category = 'category_example' # String | This parameter can be 1 of the following values <code>general, forex, crypto, merger</code>.
2953
2953
  opts = {
2954
- min_id: 'min_id_example' # String | Use this field to get only news after this ID. Default to 0
2954
+ min_id: 789 # Integer | Use this field to get only news after this ID. Default to 0
2955
2955
  }
2956
2956
 
2957
2957
  begin
@@ -2986,7 +2986,7 @@ end
2986
2986
  | Name | Type | Description | Notes |
2987
2987
  | ---- | ---- | ----------- | ----- |
2988
2988
  | **category** | **String** | This parameter can be 1 of the following values &lt;code&gt;general, forex, crypto, merger&lt;/code&gt;. | |
2989
- | **min_id** | **String** | Use this field to get only news after this ID. Default to 0 | [optional] |
2989
+ | **min_id** | **Integer** | Use this field to get only news after this ID. Default to 0 | [optional] |
2990
2990
 
2991
2991
  ### Return type
2992
2992
 
@@ -4178,11 +4178,11 @@ end
4178
4178
 
4179
4179
  ## stock_candles
4180
4180
 
4181
- > <StockCandles> stock_candles(symbol, resolution, from, to, opts)
4181
+ > <StockCandles> stock_candles(symbol, resolution, from, to)
4182
4182
 
4183
4183
  Stock Candles
4184
4184
 
4185
- <p>Get candlestick data (OHLCV) for stocks
4185
+ <p>Get candlestick data (OHLCV) for stocks.</p><p>Daily data will be adjusted for Splits. Intraday data will remain unadjusted.</p>
4186
4186
 
4187
4187
  ### Examples
4188
4188
 
@@ -4202,13 +4202,10 @@ symbol = 'symbol_example' # String | Symbol.
4202
4202
  resolution = 'resolution_example' # String | Supported resolution includes <code>1, 5, 15, 30, 60, D, W, M </code>.Some timeframes might not be available depending on the exchange.
4203
4203
  from = 789 # Integer | UNIX timestamp. Interval initial value.
4204
4204
  to = 789 # Integer | UNIX timestamp. Interval end value.
4205
- opts = {
4206
- adjusted: 'adjusted_example' # String | DEPRECATED: this option has been deprecated. All Daily data will be adjusted for Splits and intraday data will remain unadjusted.
4207
- }
4208
4205
 
4209
4206
  begin
4210
4207
  # Stock Candles
4211
- result = api_instance.stock_candles(symbol, resolution, from, to, opts)
4208
+ result = api_instance.stock_candles(symbol, resolution, from, to)
4212
4209
  p result
4213
4210
  rescue FinnhubRuby::ApiError => e
4214
4211
  puts "Error when calling DefaultApi->stock_candles: #{e}"
@@ -4219,12 +4216,12 @@ end
4219
4216
 
4220
4217
  This returns an Array which contains the response data, status code and headers.
4221
4218
 
4222
- > <Array(<StockCandles>, Integer, Hash)> stock_candles_with_http_info(symbol, resolution, from, to, opts)
4219
+ > <Array(<StockCandles>, Integer, Hash)> stock_candles_with_http_info(symbol, resolution, from, to)
4223
4220
 
4224
4221
  ```ruby
4225
4222
  begin
4226
4223
  # Stock Candles
4227
- data, status_code, headers = api_instance.stock_candles_with_http_info(symbol, resolution, from, to, opts)
4224
+ data, status_code, headers = api_instance.stock_candles_with_http_info(symbol, resolution, from, to)
4228
4225
  p status_code # => 2xx
4229
4226
  p headers # => { ... }
4230
4227
  p data # => <StockCandles>
@@ -4241,7 +4238,6 @@ end
4241
4238
  | **resolution** | **String** | Supported resolution includes &lt;code&gt;1, 5, 15, 30, 60, D, W, M &lt;/code&gt;.Some timeframes might not be available depending on the exchange. | |
4242
4239
  | **from** | **Integer** | UNIX timestamp. Interval initial value. | |
4243
4240
  | **to** | **Integer** | UNIX timestamp. Interval end value. | |
4244
- | **adjusted** | **String** | DEPRECATED: this option has been deprecated. All Daily data will be adjusted for Splits and intraday data will remain unadjusted. | [optional] |
4245
4241
 
4246
4242
  ### Return type
4247
4243
 
@@ -11,8 +11,8 @@
11
11
  | **quarter** | **Integer** | Earnings quarter. | [optional] |
12
12
  | **eps_estimate** | **Float** | EPS estimate. | [optional] |
13
13
  | **eps_actual** | **Float** | EPS actual. | [optional] |
14
- | **revenue_estimate** | **Integer** | Revenue estimate including Finnhub&#39;s proprietary estimates. | [optional] |
15
- | **revenue_actual** | **Integer** | Revenue actual. | [optional] |
14
+ | **revenue_estimate** | **Float** | Revenue estimate including Finnhub&#39;s proprietary estimates. | [optional] |
15
+ | **revenue_actual** | **Float** | Revenue actual. | [optional] |
16
16
 
17
17
  ## Example
18
18
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  | Name | Type | Description | Notes |
6
6
  | ---- | ---- | ----------- | ----- |
7
- | **data** | [**Array&lt;EarningEstimate&gt;**](EarningEstimate.md) | List of estimates | [optional] |
7
+ | **data** | [**Array&lt;EarningsEstimatesInfo&gt;**](EarningsEstimatesInfo.md) | List of estimates | [optional] |
8
8
  | **freq** | **String** | Frequency: annual or quarterly. | [optional] |
9
9
  | **symbol** | **String** | Company symbol. | [optional] |
10
10
 
@@ -0,0 +1,26 @@
1
+ # FinnhubRuby::EarningsEstimatesInfo
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **eps_avg** | **Float** | Average EPS estimates including Finnhub&#39;s proprietary estimates. | [optional] |
8
+ | **eps_high** | **Float** | Highest estimate. | [optional] |
9
+ | **eps_low** | **Float** | Lowest estimate. | [optional] |
10
+ | **number_analysts** | **Integer** | Number of Analysts. | [optional] |
11
+ | **period** | **Date** | Period. | [optional] |
12
+
13
+ ## Example
14
+
15
+ ```ruby
16
+ require 'finnhub_ruby'
17
+
18
+ instance = FinnhubRuby::EarningsEstimatesInfo.new(
19
+ eps_avg: null,
20
+ eps_high: null,
21
+ eps_low: null,
22
+ number_analysts: null,
23
+ period: null
24
+ )
25
+ ```
26
+
data/docs/IPOEvent.md CHANGED
@@ -10,8 +10,8 @@
10
10
  | **name** | **String** | Company&#39;s name. | [optional] |
11
11
  | **status** | **String** | IPO status. Can take 1 of the following values: &lt;code&gt;expected&lt;/code&gt;,&lt;code&gt;priced&lt;/code&gt;,&lt;code&gt;withdrawn&lt;/code&gt;,&lt;code&gt;filed&lt;/code&gt; | [optional] |
12
12
  | **price** | **String** | Projected price or price range. | [optional] |
13
- | **number_of_shares** | **Integer** | Number of shares offered during the IPO. | [optional] |
14
- | **total_shares_value** | **Integer** | Total shares value. | [optional] |
13
+ | **number_of_shares** | **Float** | Number of shares offered during the IPO. | [optional] |
14
+ | **total_shares_value** | **Float** | Total shares value. | [optional] |
15
15
 
16
16
  ## Example
17
17
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  | Name | Type | Description | Notes |
6
6
  | ---- | ---- | ----------- | ----- |
7
- | **data** | [**Array&lt;Estimate&gt;**](Estimate.md) | List of estimates | [optional] |
7
+ | **data** | [**Array&lt;RevenueEstimatesInfo&gt;**](RevenueEstimatesInfo.md) | List of estimates | [optional] |
8
8
  | **freq** | **String** | Frequency: annual or quarterly. | [optional] |
9
9
  | **symbol** | **String** | Company symbol. | [optional] |
10
10
 
@@ -0,0 +1,26 @@
1
+ # FinnhubRuby::RevenueEstimatesInfo
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **revenue_avg** | **Float** | Average revenue estimates including Finnhub&#39;s proprietary estimates. | [optional] |
8
+ | **revenue_high** | **Float** | Highest estimate. | [optional] |
9
+ | **revenue_low** | **Float** | Lowest estimate. | [optional] |
10
+ | **number_analysts** | **Integer** | Number of Analysts. | [optional] |
11
+ | **period** | **Date** | Period. | [optional] |
12
+
13
+ ## Example
14
+
15
+ ```ruby
16
+ require 'finnhub_ruby'
17
+
18
+ instance = FinnhubRuby::RevenueEstimatesInfo.new(
19
+ revenue_avg: null,
20
+ revenue_high: null,
21
+ revenue_low: null,
22
+ number_analysts: null,
23
+ period: null
24
+ )
25
+ ```
26
+
data/docs/Sentiment.md CHANGED
@@ -4,8 +4,8 @@
4
4
 
5
5
  | Name | Type | Description | Notes |
6
6
  | ---- | ---- | ----------- | ----- |
7
- | **bearish_percent** | **Integer** | | [optional] |
8
- | **bullish_percent** | **Integer** | | [optional] |
7
+ | **bearish_percent** | **Float** | | [optional] |
8
+ | **bullish_percent** | **Float** | | [optional] |
9
9
 
10
10
  ## Example
11
11
 
@@ -6,7 +6,7 @@
6
6
  | ---- | ---- | ----------- | ----- |
7
7
  | **symbol** | **String** | Symbol. | [optional] |
8
8
  | **cik** | **String** | CIK. | [optional] |
9
- | **similarity** | [**Array&lt;Filing&gt;**](Filing.md) | Array of filings with its cosine similarity compared to the same report of the previous year. | [optional] |
9
+ | **similarity** | [**Array&lt;SimilarityIndexInfo&gt;**](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 &lt;code&gt;%Y-%m-%d %H:%M:%S&lt;/code&gt;. | [optional] |
16
+ | **accepted_date** | **String** | Accepted date &lt;code&gt;%Y-%m-%d %H:%M:%S&lt;/code&gt;. | [optional] |
17
+ | **report_url** | **String** | Report&#39;s URL. | [optional] |
18
+ | **filing_url** | **String** | Filing&#39;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/lib/finnhub_ruby.rb CHANGED
@@ -42,19 +42,18 @@ require 'finnhub_ruby/models/etfs_country_exposure'
42
42
  require 'finnhub_ruby/models/etfs_holdings'
43
43
  require 'finnhub_ruby/models/etfs_profile'
44
44
  require 'finnhub_ruby/models/etfs_sector_exposure'
45
- require 'finnhub_ruby/models/earning_estimate'
46
45
  require 'finnhub_ruby/models/earning_release'
47
46
  require 'finnhub_ruby/models/earning_result'
48
47
  require 'finnhub_ruby/models/earnings_calendar'
49
48
  require 'finnhub_ruby/models/earnings_call_transcripts'
50
49
  require 'finnhub_ruby/models/earnings_call_transcripts_list'
51
50
  require 'finnhub_ruby/models/earnings_estimates'
51
+ require 'finnhub_ruby/models/earnings_estimates_info'
52
52
  require 'finnhub_ruby/models/economic_calendar'
53
53
  require 'finnhub_ruby/models/economic_code'
54
54
  require 'finnhub_ruby/models/economic_data'
55
55
  require 'finnhub_ruby/models/economic_data_info'
56
56
  require 'finnhub_ruby/models/economic_event'
57
- require 'finnhub_ruby/models/estimate'
58
57
  require 'finnhub_ruby/models/fda_comittee_meeting'
59
58
  require 'finnhub_ruby/models/filing'
60
59
  require 'finnhub_ruby/models/filing_sentiment'
@@ -99,9 +98,11 @@ require 'finnhub_ruby/models/reddit_sentiment_content'
99
98
  require 'finnhub_ruby/models/report'
100
99
  require 'finnhub_ruby/models/revenue_breakdown'
101
100
  require 'finnhub_ruby/models/revenue_estimates'
101
+ require 'finnhub_ruby/models/revenue_estimates_info'
102
102
  require 'finnhub_ruby/models/sec_sentiment_analysis'
103
103
  require 'finnhub_ruby/models/sentiment'
104
104
  require 'finnhub_ruby/models/similarity_index'
105
+ require 'finnhub_ruby/models/similarity_index_info'
105
106
  require 'finnhub_ruby/models/social_sentiment'
106
107
  require 'finnhub_ruby/models/split'
107
108
  require 'finnhub_ruby/models/stock_candles'
@@ -2600,7 +2600,7 @@ module FinnhubRuby
2600
2600
  # Get latest market news.
2601
2601
  # @param category [String] This parameter can be 1 of the following values &lt;code&gt;general, forex, crypto, merger&lt;/code&gt;.
2602
2602
  # @param [Hash] opts the optional parameters
2603
- # @option opts [String] :min_id Use this field to get only news after this ID. Default to 0
2603
+ # @option opts [Integer] :min_id Use this field to get only news after this ID. Default to 0
2604
2604
  # @return [Array<MarketNews>]
2605
2605
  def market_news(category, opts = {})
2606
2606
  data, _status_code, _headers = market_news_with_http_info(category, opts)
@@ -2611,7 +2611,7 @@ module FinnhubRuby
2611
2611
  # Get latest market news.
2612
2612
  # @param category [String] This parameter can be 1 of the following values &lt;code&gt;general, forex, crypto, merger&lt;/code&gt;.
2613
2613
  # @param [Hash] opts the optional parameters
2614
- # @option opts [String] :min_id Use this field to get only news after this ID. Default to 0
2614
+ # @option opts [Integer] :min_id Use this field to get only news after this ID. Default to 0
2615
2615
  # @return [Array<(Array<MarketNews>, Integer, Hash)>] Array<MarketNews> data, response status code and response headers
2616
2616
  def market_news_with_http_info(category, opts = {})
2617
2617
  if @api_client.config.debugging
@@ -3712,13 +3712,12 @@ module FinnhubRuby
3712
3712
  end
3713
3713
 
3714
3714
  # Stock Candles
3715
- # <p>Get candlestick data (OHLCV) for stocks
3715
+ # <p>Get candlestick data (OHLCV) for stocks.</p><p>Daily data will be adjusted for Splits. Intraday data will remain unadjusted.</p>
3716
3716
  # @param symbol [String] Symbol.
3717
3717
  # @param resolution [String] Supported resolution includes &lt;code&gt;1, 5, 15, 30, 60, D, W, M &lt;/code&gt;.Some timeframes might not be available depending on the exchange.
3718
3718
  # @param from [Integer] UNIX timestamp. Interval initial value.
3719
3719
  # @param to [Integer] UNIX timestamp. Interval end value.
3720
3720
  # @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
3721
  # @return [StockCandles]
3723
3722
  def stock_candles(symbol, resolution, from, to, opts = {})
3724
3723
  data, _status_code, _headers = stock_candles_with_http_info(symbol, resolution, from, to, opts)
@@ -3726,13 +3725,12 @@ module FinnhubRuby
3726
3725
  end
3727
3726
 
3728
3727
  # Stock Candles
3729
- # &lt;p&gt;Get candlestick data (OHLCV) for stocks
3728
+ # &lt;p&gt;Get candlestick data (OHLCV) for stocks.&lt;/p&gt;&lt;p&gt;Daily data will be adjusted for Splits. Intraday data will remain unadjusted.&lt;/p&gt;
3730
3729
  # @param symbol [String] Symbol.
3731
3730
  # @param resolution [String] Supported resolution includes &lt;code&gt;1, 5, 15, 30, 60, D, W, M &lt;/code&gt;.Some timeframes might not be available depending on the exchange.
3732
3731
  # @param from [Integer] UNIX timestamp. Interval initial value.
3733
3732
  # @param to [Integer] UNIX timestamp. Interval end value.
3734
3733
  # @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
3734
  # @return [Array<(StockCandles, Integer, Hash)>] StockCandles data, response status code and response headers
3737
3735
  def stock_candles_with_http_info(symbol, resolution, from, to, opts = {})
3738
3736
  if @api_client.config.debugging
@@ -3763,7 +3761,6 @@ module FinnhubRuby
3763
3761
  query_params[:'resolution'] = resolution
3764
3762
  query_params[:'from'] = from
3765
3763
  query_params[:'to'] = to
3766
- query_params[:'adjusted'] = opts[:'adjusted'] if !opts[:'adjusted'].nil?
3767
3764
 
3768
3765
  # header parameters
3769
3766
  header_params = opts[:header_params] || {}
@@ -166,7 +166,7 @@ module FinnhubRuby
166
166
  :'ipo' => :'Date',
167
167
  :'market_capitalization' => :'Float',
168
168
  :'share_outstanding' => :'Float',
169
- :'employee_total' => :'Integer',
169
+ :'employee_total' => :'Float',
170
170
  :'logo' => :'String',
171
171
  :'finnhub_industry' => :'String'
172
172
  }
@@ -72,8 +72,8 @@ module FinnhubRuby
72
72
  :'quarter' => :'Integer',
73
73
  :'eps_estimate' => :'Float',
74
74
  :'eps_actual' => :'Float',
75
- :'revenue_estimate' => :'Integer',
76
- :'revenue_actual' => :'Integer'
75
+ :'revenue_estimate' => :'Float',
76
+ :'revenue_actual' => :'Float'
77
77
  }
78
78
  end
79
79
 
@@ -41,7 +41,7 @@ module FinnhubRuby
41
41
  # Attribute type mapping.
42
42
  def self.openapi_types
43
43
  {
44
- :'data' => :'Array<EarningEstimate>',
44
+ :'data' => :'Array<EarningsEstimatesInfo>',
45
45
  :'freq' => :'String',
46
46
  :'symbol' => :'String'
47
47
  }
@@ -0,0 +1,259 @@
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.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module FinnhubRuby
17
+ class EarningsEstimatesInfo
18
+ # Average EPS estimates including Finnhub's proprietary estimates.
19
+ attr_accessor :eps_avg
20
+
21
+ # Highest estimate.
22
+ attr_accessor :eps_high
23
+
24
+ # Lowest estimate.
25
+ attr_accessor :eps_low
26
+
27
+ # Number of Analysts.
28
+ attr_accessor :number_analysts
29
+
30
+ # Period.
31
+ attr_accessor :period
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'eps_avg' => :'epsAvg',
37
+ :'eps_high' => :'epsHigh',
38
+ :'eps_low' => :'epsLow',
39
+ :'number_analysts' => :'numberAnalysts',
40
+ :'period' => :'period'
41
+ }
42
+ end
43
+
44
+ # Returns all the JSON keys this model knows about
45
+ def self.acceptable_attributes
46
+ attribute_map.values
47
+ end
48
+
49
+ # Attribute type mapping.
50
+ def self.openapi_types
51
+ {
52
+ :'eps_avg' => :'Float',
53
+ :'eps_high' => :'Float',
54
+ :'eps_low' => :'Float',
55
+ :'number_analysts' => :'Integer',
56
+ :'period' => :'Date'
57
+ }
58
+ end
59
+
60
+ # List of attributes with nullable: true
61
+ def self.openapi_nullable
62
+ Set.new([
63
+ ])
64
+ end
65
+
66
+ # Initializes the object
67
+ # @param [Hash] attributes Model attributes in the form of hash
68
+ def initialize(attributes = {})
69
+ if (!attributes.is_a?(Hash))
70
+ fail ArgumentError, "The input argument (attributes) must be a hash in `FinnhubRuby::EarningsEstimatesInfo` initialize method"
71
+ end
72
+
73
+ # check to see if the attribute exists and convert string to symbol for hash key
74
+ attributes = attributes.each_with_object({}) { |(k, v), h|
75
+ if (!self.class.attribute_map.key?(k.to_sym))
76
+ fail ArgumentError, "`#{k}` is not a valid attribute in `FinnhubRuby::EarningsEstimatesInfo`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
77
+ end
78
+ h[k.to_sym] = v
79
+ }
80
+
81
+ if attributes.key?(:'eps_avg')
82
+ self.eps_avg = attributes[:'eps_avg']
83
+ end
84
+
85
+ if attributes.key?(:'eps_high')
86
+ self.eps_high = attributes[:'eps_high']
87
+ end
88
+
89
+ if attributes.key?(:'eps_low')
90
+ self.eps_low = attributes[:'eps_low']
91
+ end
92
+
93
+ if attributes.key?(:'number_analysts')
94
+ self.number_analysts = attributes[:'number_analysts']
95
+ end
96
+
97
+ if attributes.key?(:'period')
98
+ self.period = attributes[:'period']
99
+ end
100
+ end
101
+
102
+ # Show invalid properties with the reasons. Usually used together with valid?
103
+ # @return Array for valid properties with the reasons
104
+ def list_invalid_properties
105
+ invalid_properties = Array.new
106
+ invalid_properties
107
+ end
108
+
109
+ # Check to see if the all the properties in the model are valid
110
+ # @return true if the model is valid
111
+ def valid?
112
+ true
113
+ end
114
+
115
+ # Checks equality by comparing each attribute.
116
+ # @param [Object] Object to be compared
117
+ def ==(o)
118
+ return true if self.equal?(o)
119
+ self.class == o.class &&
120
+ eps_avg == o.eps_avg &&
121
+ eps_high == o.eps_high &&
122
+ eps_low == o.eps_low &&
123
+ number_analysts == o.number_analysts &&
124
+ period == o.period
125
+ end
126
+
127
+ # @see the `==` method
128
+ # @param [Object] Object to be compared
129
+ def eql?(o)
130
+ self == o
131
+ end
132
+
133
+ # Calculates hash code according to all attributes.
134
+ # @return [Integer] Hash code
135
+ def hash
136
+ [eps_avg, eps_high, eps_low, number_analysts, period].hash
137
+ end
138
+
139
+ # Builds the object from hash
140
+ # @param [Hash] attributes Model attributes in the form of hash
141
+ # @return [Object] Returns the model itself
142
+ def self.build_from_hash(attributes)
143
+ new.build_from_hash(attributes)
144
+ end
145
+
146
+ # Builds the object from hash
147
+ # @param [Hash] attributes Model attributes in the form of hash
148
+ # @return [Object] Returns the model itself
149
+ def build_from_hash(attributes)
150
+ return nil unless attributes.is_a?(Hash)
151
+ self.class.openapi_types.each_pair do |key, type|
152
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
153
+ self.send("#{key}=", nil)
154
+ elsif type =~ /\AArray<(.*)>/i
155
+ # check to ensure the input is an array given that the attribute
156
+ # is documented as an array but the input is not
157
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
158
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
159
+ end
160
+ elsif !attributes[self.class.attribute_map[key]].nil?
161
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
162
+ end
163
+ end
164
+
165
+ self
166
+ end
167
+
168
+ # Deserializes the data based on type
169
+ # @param string type Data type
170
+ # @param string value Value to be deserialized
171
+ # @return [Object] Deserialized data
172
+ def _deserialize(type, value)
173
+ case type.to_sym
174
+ when :Time
175
+ Time.parse(value)
176
+ when :Date
177
+ Date.parse(value)
178
+ when :String
179
+ value.to_s
180
+ when :Integer
181
+ value.to_i
182
+ when :Float
183
+ value.to_f
184
+ when :Boolean
185
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
186
+ true
187
+ else
188
+ false
189
+ end
190
+ when :Object
191
+ # generic object (usually a Hash), return directly
192
+ value
193
+ when /\AArray<(?<inner_type>.+)>\z/
194
+ inner_type = Regexp.last_match[:inner_type]
195
+ value.map { |v| _deserialize(inner_type, v) }
196
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
197
+ k_type = Regexp.last_match[:k_type]
198
+ v_type = Regexp.last_match[:v_type]
199
+ {}.tap do |hash|
200
+ value.each do |k, v|
201
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
202
+ end
203
+ end
204
+ else # model
205
+ # models (e.g. Pet) or oneOf
206
+ klass = FinnhubRuby.const_get(type)
207
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
208
+ end
209
+ end
210
+
211
+ # Returns the string representation of the object
212
+ # @return [String] String presentation of the object
213
+ def to_s
214
+ to_hash.to_s
215
+ end
216
+
217
+ # to_body is an alias to to_hash (backward compatibility)
218
+ # @return [Hash] Returns the object in the form of hash
219
+ def to_body
220
+ to_hash
221
+ end
222
+
223
+ # Returns the object in the form of hash
224
+ # @return [Hash] Returns the object in the form of hash
225
+ def to_hash
226
+ hash = {}
227
+ self.class.attribute_map.each_pair do |attr, param|
228
+ value = self.send(attr)
229
+ if value.nil?
230
+ is_nullable = self.class.openapi_nullable.include?(attr)
231
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
232
+ end
233
+
234
+ hash[param] = _to_hash(value)
235
+ end
236
+ hash
237
+ end
238
+
239
+ # Outputs non-array value in the form of hash
240
+ # For object, use to_hash. Otherwise, just return the value
241
+ # @param [Object] value Any valid value
242
+ # @return [Hash] Returns the value in the form of hash
243
+ def _to_hash(value)
244
+ if value.is_a?(Array)
245
+ value.compact.map { |v| _to_hash(v) }
246
+ elsif value.is_a?(Hash)
247
+ {}.tap do |hash|
248
+ value.each { |k, v| hash[k] = _to_hash(v) }
249
+ end
250
+ elsif value.respond_to? :to_hash
251
+ value.to_hash
252
+ else
253
+ value
254
+ end
255
+ end
256
+
257
+ end
258
+
259
+ end