finnhub_ruby 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +9 -0
- data/LICENSE +201 -0
- data/README.md +164 -0
- data/Rakefile +10 -0
- data/docs/AggregateIndicators.md +19 -0
- data/docs/BasicFinancials.md +21 -0
- data/docs/Company.md +29 -0
- data/docs/CompanyExecutive.md +19 -0
- data/docs/CompanyNewsStatistics.md +21 -0
- data/docs/CompanyProfile.md +71 -0
- data/docs/CompanyProfile2.md +39 -0
- data/docs/CountryMetadata.md +27 -0
- data/docs/CovidInfo.md +23 -0
- data/docs/CryptoCandles.md +29 -0
- data/docs/CryptoSymbol.md +21 -0
- data/docs/DefaultApi.md +2662 -0
- data/docs/Development.md +23 -0
- data/docs/Dividends.md +31 -0
- data/docs/EarningEstimate.md +25 -0
- data/docs/EarningRelease.md +33 -0
- data/docs/EarningResult.md +23 -0
- data/docs/EarningsCalendar.md +17 -0
- data/docs/EarningsCallTranscripts.md +33 -0
- data/docs/EarningsCallTranscriptsList.md +19 -0
- data/docs/EarningsEstimates.md +21 -0
- data/docs/EconomicCalendar.md +17 -0
- data/docs/EconomicCode.md +23 -0
- data/docs/EconomicData.md +19 -0
- data/docs/EconomicEvent.md +31 -0
- data/docs/Estimate.md +25 -0
- data/docs/Filing.md +31 -0
- data/docs/FinancialStatements.md +19 -0
- data/docs/FinancialsAsReported.md +21 -0
- data/docs/ForexCandles.md +29 -0
- data/docs/ForexSymbol.md +21 -0
- data/docs/Forexrates.md +19 -0
- data/docs/FundOwnership.md +19 -0
- data/docs/IPOCalendar.md +17 -0
- data/docs/IPOEvent.md +31 -0
- data/docs/Indicator.md +21 -0
- data/docs/Investor.md +23 -0
- data/docs/InvestorsOwnership.md +19 -0
- data/docs/LastBidAsk.md +25 -0
- data/docs/MajorDevelopments.md +19 -0
- data/docs/News.md +33 -0
- data/docs/NewsSentiment.md +27 -0
- data/docs/PatternRecognition.md +17 -0
- data/docs/PriceTarget.md +27 -0
- data/docs/Quote.md +25 -0
- data/docs/RecommendationTrend.md +29 -0
- data/docs/Report.md +37 -0
- data/docs/RevenueEstimates.md +21 -0
- data/docs/Sentiment.md +19 -0
- data/docs/Split.md +23 -0
- data/docs/Stock.md +21 -0
- data/docs/StockCandles.md +29 -0
- data/docs/StockTranscripts.md +25 -0
- data/docs/SupportResistance.md +17 -0
- data/docs/TechnicalAnalysis.md +19 -0
- data/docs/TickData.md +31 -0
- data/docs/TranscriptContent.md +19 -0
- data/docs/TranscriptParticipant.md +19 -0
- data/docs/Trend.md +17 -0
- data/docs/UpgradeDowngrade.md +27 -0
- data/finnhub_ruby-0.0.1.gem +0 -0
- data/finnhub_ruby-0.0.2.gem +0 -0
- data/finnhub_ruby.gemspec +39 -0
- data/git_push.sh +58 -0
- data/lib/finnhub_ruby.rb +99 -0
- data/lib/finnhub_ruby/api/default_api.rb +3142 -0
- data/lib/finnhub_ruby/api_client.rb +389 -0
- data/lib/finnhub_ruby/api_error.rb +57 -0
- data/lib/finnhub_ruby/configuration.rb +248 -0
- data/lib/finnhub_ruby/models/aggregate_indicators.rb +215 -0
- data/lib/finnhub_ruby/models/basic_financials.rb +226 -0
- data/lib/finnhub_ruby/models/company.rb +267 -0
- data/lib/finnhub_ruby/models/company_executive.rb +219 -0
- data/lib/finnhub_ruby/models/company_news_statistics.rb +227 -0
- data/lib/finnhub_ruby/models/company_profile.rb +477 -0
- data/lib/finnhub_ruby/models/company_profile2.rb +317 -0
- data/lib/finnhub_ruby/models/country_metadata.rb +257 -0
- data/lib/finnhub_ruby/models/covid_info.rb +237 -0
- data/lib/finnhub_ruby/models/crypto_candles.rb +279 -0
- data/lib/finnhub_ruby/models/crypto_symbol.rb +227 -0
- data/lib/finnhub_ruby/models/development.rb +237 -0
- data/lib/finnhub_ruby/models/dividends.rb +277 -0
- data/lib/finnhub_ruby/models/earning_estimate.rb +247 -0
- data/lib/finnhub_ruby/models/earning_release.rb +287 -0
- data/lib/finnhub_ruby/models/earning_result.rb +237 -0
- data/lib/finnhub_ruby/models/earnings_calendar.rb +209 -0
- data/lib/finnhub_ruby/models/earnings_call_transcripts.rb +291 -0
- data/lib/finnhub_ruby/models/earnings_call_transcripts_list.rb +219 -0
- data/lib/finnhub_ruby/models/earnings_estimates.rb +229 -0
- data/lib/finnhub_ruby/models/economic_calendar.rb +209 -0
- data/lib/finnhub_ruby/models/economic_code.rb +237 -0
- data/lib/finnhub_ruby/models/economic_data.rb +219 -0
- data/lib/finnhub_ruby/models/economic_event.rb +277 -0
- data/lib/finnhub_ruby/models/estimate.rb +247 -0
- data/lib/finnhub_ruby/models/filing.rb +277 -0
- data/lib/finnhub_ruby/models/financial_statements.rb +219 -0
- data/lib/finnhub_ruby/models/financials_as_reported.rb +229 -0
- data/lib/finnhub_ruby/models/forex_candles.rb +279 -0
- data/lib/finnhub_ruby/models/forex_symbol.rb +227 -0
- data/lib/finnhub_ruby/models/forexrates.rb +216 -0
- data/lib/finnhub_ruby/models/fund_ownership.rb +219 -0
- data/lib/finnhub_ruby/models/indicator.rb +227 -0
- data/lib/finnhub_ruby/models/investor.rb +237 -0
- data/lib/finnhub_ruby/models/investors_ownership.rb +219 -0
- data/lib/finnhub_ruby/models/ipo_calendar.rb +209 -0
- data/lib/finnhub_ruby/models/ipo_event.rb +277 -0
- data/lib/finnhub_ruby/models/last_bid_ask.rb +247 -0
- data/lib/finnhub_ruby/models/major_developments.rb +219 -0
- data/lib/finnhub_ruby/models/news.rb +287 -0
- data/lib/finnhub_ruby/models/news_sentiment.rb +255 -0
- data/lib/finnhub_ruby/models/pattern_recognition.rb +209 -0
- data/lib/finnhub_ruby/models/price_target.rb +257 -0
- data/lib/finnhub_ruby/models/quote.rb +247 -0
- data/lib/finnhub_ruby/models/recommendation_trend.rb +267 -0
- data/lib/finnhub_ruby/models/report.rb +306 -0
- data/lib/finnhub_ruby/models/revenue_estimates.rb +229 -0
- data/lib/finnhub_ruby/models/sentiment.rb +217 -0
- data/lib/finnhub_ruby/models/split.rb +237 -0
- data/lib/finnhub_ruby/models/stock.rb +227 -0
- data/lib/finnhub_ruby/models/stock_candles.rb +279 -0
- data/lib/finnhub_ruby/models/stock_transcripts.rb +247 -0
- data/lib/finnhub_ruby/models/support_resistance.rb +209 -0
- data/lib/finnhub_ruby/models/technical_analysis.rb +216 -0
- data/lib/finnhub_ruby/models/tick_data.rb +285 -0
- data/lib/finnhub_ruby/models/transcript_content.rb +219 -0
- data/lib/finnhub_ruby/models/transcript_participant.rb +217 -0
- data/lib/finnhub_ruby/models/trend.rb +207 -0
- data/lib/finnhub_ruby/models/upgrade_downgrade.rb +257 -0
- data/lib/finnhub_ruby/version.rb +15 -0
- data/release.sh +2 -0
- data/spec/api/default_api_spec.rb +638 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/aggregate_indicators_spec.rb +47 -0
- data/spec/models/basic_financials_spec.rb +53 -0
- data/spec/models/company_executive_spec.rb +47 -0
- data/spec/models/company_news_statistics_spec.rb +53 -0
- data/spec/models/company_profile2_spec.rb +107 -0
- data/spec/models/company_profile_spec.rb +203 -0
- data/spec/models/company_spec.rb +77 -0
- data/spec/models/country_metadata_spec.rb +71 -0
- data/spec/models/covid_info_spec.rb +59 -0
- data/spec/models/crypto_candles_spec.rb +77 -0
- data/spec/models/crypto_symbol_spec.rb +53 -0
- data/spec/models/development_spec.rb +59 -0
- data/spec/models/dividends_spec.rb +83 -0
- data/spec/models/earning_estimate_spec.rb +65 -0
- data/spec/models/earning_release_spec.rb +89 -0
- data/spec/models/earning_result_spec.rb +59 -0
- data/spec/models/earnings_calendar_spec.rb +41 -0
- data/spec/models/earnings_call_transcripts_list_spec.rb +47 -0
- data/spec/models/earnings_call_transcripts_spec.rb +89 -0
- data/spec/models/earnings_estimates_spec.rb +53 -0
- data/spec/models/economic_calendar_spec.rb +41 -0
- data/spec/models/economic_code_spec.rb +59 -0
- data/spec/models/economic_data_spec.rb +47 -0
- data/spec/models/economic_event_spec.rb +83 -0
- data/spec/models/estimate_spec.rb +65 -0
- data/spec/models/filing_spec.rb +83 -0
- data/spec/models/financial_statements_spec.rb +47 -0
- data/spec/models/financials_as_reported_spec.rb +53 -0
- data/spec/models/forex_candles_spec.rb +77 -0
- data/spec/models/forex_symbol_spec.rb +53 -0
- data/spec/models/forexrates_spec.rb +47 -0
- data/spec/models/fund_ownership_spec.rb +47 -0
- data/spec/models/indicator_spec.rb +53 -0
- data/spec/models/investor_spec.rb +59 -0
- data/spec/models/investors_ownership_spec.rb +47 -0
- data/spec/models/ipo_calendar_spec.rb +41 -0
- data/spec/models/ipo_event_spec.rb +83 -0
- data/spec/models/last_bid_ask_spec.rb +65 -0
- data/spec/models/major_developments_spec.rb +47 -0
- data/spec/models/news_sentiment_spec.rb +71 -0
- data/spec/models/news_spec.rb +89 -0
- data/spec/models/pattern_recognition_spec.rb +41 -0
- data/spec/models/price_target_spec.rb +71 -0
- data/spec/models/quote_spec.rb +65 -0
- data/spec/models/recommendation_trend_spec.rb +77 -0
- data/spec/models/report_spec.rb +101 -0
- data/spec/models/revenue_estimates_spec.rb +53 -0
- data/spec/models/sentiment_spec.rb +47 -0
- data/spec/models/split_spec.rb +59 -0
- data/spec/models/stock_candles_spec.rb +77 -0
- data/spec/models/stock_spec.rb +53 -0
- data/spec/models/stock_transcripts_spec.rb +65 -0
- data/spec/models/support_resistance_spec.rb +41 -0
- data/spec/models/technical_analysis_spec.rb +47 -0
- data/spec/models/tick_data_spec.rb +83 -0
- data/spec/models/transcript_content_spec.rb +47 -0
- data/spec/models/transcript_participant_spec.rb +47 -0
- data/spec/models/trend_spec.rb +41 -0
- data/spec/models/upgrade_downgrade_spec.rb +71 -0
- data/spec/spec_helper.rb +111 -0
- data/test.rb +139 -0
- metadata +364 -0
@@ -0,0 +1,247 @@
|
|
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: 4.3.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module FinnhubRuby
|
16
|
+
class StockTranscripts
|
17
|
+
# Transcript's ID used to get the <a href=\"#transcripts\">full transcript</a>.
|
18
|
+
attr_accessor :id
|
19
|
+
|
20
|
+
# Title.
|
21
|
+
attr_accessor :title
|
22
|
+
|
23
|
+
# Time of the event.
|
24
|
+
attr_accessor :time
|
25
|
+
|
26
|
+
# Year of earnings result in the case of earnings call transcript.
|
27
|
+
attr_accessor :year
|
28
|
+
|
29
|
+
# Quarter of earnings result in the case of earnings call transcript.
|
30
|
+
attr_accessor :quarter
|
31
|
+
|
32
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
33
|
+
def self.attribute_map
|
34
|
+
{
|
35
|
+
:'id' => :'id',
|
36
|
+
:'title' => :'title',
|
37
|
+
:'time' => :'time',
|
38
|
+
:'year' => :'year',
|
39
|
+
:'quarter' => :'quarter'
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
# Attribute type mapping.
|
44
|
+
def self.openapi_types
|
45
|
+
{
|
46
|
+
:'id' => :'String',
|
47
|
+
:'title' => :'String',
|
48
|
+
:'time' => :'DateTime',
|
49
|
+
:'year' => :'Integer',
|
50
|
+
:'quarter' => :'Integer'
|
51
|
+
}
|
52
|
+
end
|
53
|
+
|
54
|
+
# List of attributes with nullable: true
|
55
|
+
def self.openapi_nullable
|
56
|
+
Set.new([
|
57
|
+
])
|
58
|
+
end
|
59
|
+
|
60
|
+
# Initializes the object
|
61
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
62
|
+
def initialize(attributes = {})
|
63
|
+
if (!attributes.is_a?(Hash))
|
64
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `FinnhubRuby::StockTranscripts` initialize method"
|
65
|
+
end
|
66
|
+
|
67
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
68
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
69
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
70
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `FinnhubRuby::StockTranscripts`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
71
|
+
end
|
72
|
+
h[k.to_sym] = v
|
73
|
+
}
|
74
|
+
|
75
|
+
if attributes.key?(:'id')
|
76
|
+
self.id = attributes[:'id']
|
77
|
+
end
|
78
|
+
|
79
|
+
if attributes.key?(:'title')
|
80
|
+
self.title = attributes[:'title']
|
81
|
+
end
|
82
|
+
|
83
|
+
if attributes.key?(:'time')
|
84
|
+
self.time = attributes[:'time']
|
85
|
+
end
|
86
|
+
|
87
|
+
if attributes.key?(:'year')
|
88
|
+
self.year = attributes[:'year']
|
89
|
+
end
|
90
|
+
|
91
|
+
if attributes.key?(:'quarter')
|
92
|
+
self.quarter = attributes[:'quarter']
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
97
|
+
# @return Array for valid properties with the reasons
|
98
|
+
def list_invalid_properties
|
99
|
+
invalid_properties = Array.new
|
100
|
+
invalid_properties
|
101
|
+
end
|
102
|
+
|
103
|
+
# Check to see if the all the properties in the model are valid
|
104
|
+
# @return true if the model is valid
|
105
|
+
def valid?
|
106
|
+
true
|
107
|
+
end
|
108
|
+
|
109
|
+
# Checks equality by comparing each attribute.
|
110
|
+
# @param [Object] Object to be compared
|
111
|
+
def ==(o)
|
112
|
+
return true if self.equal?(o)
|
113
|
+
self.class == o.class &&
|
114
|
+
id == o.id &&
|
115
|
+
title == o.title &&
|
116
|
+
time == o.time &&
|
117
|
+
year == o.year &&
|
118
|
+
quarter == o.quarter
|
119
|
+
end
|
120
|
+
|
121
|
+
# @see the `==` method
|
122
|
+
# @param [Object] Object to be compared
|
123
|
+
def eql?(o)
|
124
|
+
self == o
|
125
|
+
end
|
126
|
+
|
127
|
+
# Calculates hash code according to all attributes.
|
128
|
+
# @return [Integer] Hash code
|
129
|
+
def hash
|
130
|
+
[id, title, time, year, quarter].hash
|
131
|
+
end
|
132
|
+
|
133
|
+
# Builds the object from hash
|
134
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
135
|
+
# @return [Object] Returns the model itself
|
136
|
+
def self.build_from_hash(attributes)
|
137
|
+
new.build_from_hash(attributes)
|
138
|
+
end
|
139
|
+
|
140
|
+
# Builds the object from hash
|
141
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
142
|
+
# @return [Object] Returns the model itself
|
143
|
+
def build_from_hash(attributes)
|
144
|
+
return nil unless attributes.is_a?(Hash)
|
145
|
+
self.class.openapi_types.each_pair do |key, type|
|
146
|
+
if type =~ /\AArray<(.*)>/i
|
147
|
+
# check to ensure the input is an array given that the attribute
|
148
|
+
# is documented as an array but the input is not
|
149
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
150
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
151
|
+
end
|
152
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
153
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
154
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
155
|
+
end
|
156
|
+
|
157
|
+
self
|
158
|
+
end
|
159
|
+
|
160
|
+
# Deserializes the data based on type
|
161
|
+
# @param string type Data type
|
162
|
+
# @param string value Value to be deserialized
|
163
|
+
# @return [Object] Deserialized data
|
164
|
+
def _deserialize(type, value)
|
165
|
+
case type.to_sym
|
166
|
+
when :DateTime
|
167
|
+
DateTime.parse(value)
|
168
|
+
when :Date
|
169
|
+
Date.parse(value)
|
170
|
+
when :String
|
171
|
+
value.to_s
|
172
|
+
when :Integer
|
173
|
+
value.to_i
|
174
|
+
when :Float
|
175
|
+
value.to_f
|
176
|
+
when :Boolean
|
177
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
178
|
+
true
|
179
|
+
else
|
180
|
+
false
|
181
|
+
end
|
182
|
+
when :Object
|
183
|
+
# generic object (usually a Hash), return directly
|
184
|
+
value
|
185
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
186
|
+
inner_type = Regexp.last_match[:inner_type]
|
187
|
+
value.map { |v| _deserialize(inner_type, v) }
|
188
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
189
|
+
k_type = Regexp.last_match[:k_type]
|
190
|
+
v_type = Regexp.last_match[:v_type]
|
191
|
+
{}.tap do |hash|
|
192
|
+
value.each do |k, v|
|
193
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
194
|
+
end
|
195
|
+
end
|
196
|
+
else # model
|
197
|
+
FinnhubRuby.const_get(type).build_from_hash(value)
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
# Returns the string representation of the object
|
202
|
+
# @return [String] String presentation of the object
|
203
|
+
def to_s
|
204
|
+
to_hash.to_s
|
205
|
+
end
|
206
|
+
|
207
|
+
# to_body is an alias to to_hash (backward compatibility)
|
208
|
+
# @return [Hash] Returns the object in the form of hash
|
209
|
+
def to_body
|
210
|
+
to_hash
|
211
|
+
end
|
212
|
+
|
213
|
+
# Returns the object in the form of hash
|
214
|
+
# @return [Hash] Returns the object in the form of hash
|
215
|
+
def to_hash
|
216
|
+
hash = {}
|
217
|
+
self.class.attribute_map.each_pair do |attr, param|
|
218
|
+
value = self.send(attr)
|
219
|
+
if value.nil?
|
220
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
221
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
222
|
+
end
|
223
|
+
|
224
|
+
hash[param] = _to_hash(value)
|
225
|
+
end
|
226
|
+
hash
|
227
|
+
end
|
228
|
+
|
229
|
+
# Outputs non-array value in the form of hash
|
230
|
+
# For object, use to_hash. Otherwise, just return the value
|
231
|
+
# @param [Object] value Any valid value
|
232
|
+
# @return [Hash] Returns the value in the form of hash
|
233
|
+
def _to_hash(value)
|
234
|
+
if value.is_a?(Array)
|
235
|
+
value.compact.map { |v| _to_hash(v) }
|
236
|
+
elsif value.is_a?(Hash)
|
237
|
+
{}.tap do |hash|
|
238
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
239
|
+
end
|
240
|
+
elsif value.respond_to? :to_hash
|
241
|
+
value.to_hash
|
242
|
+
else
|
243
|
+
value
|
244
|
+
end
|
245
|
+
end
|
246
|
+
end
|
247
|
+
end
|
@@ -0,0 +1,209 @@
|
|
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: 4.3.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module FinnhubRuby
|
16
|
+
class SupportResistance
|
17
|
+
# Array of support and resistance levels.
|
18
|
+
attr_accessor :levels
|
19
|
+
|
20
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
21
|
+
def self.attribute_map
|
22
|
+
{
|
23
|
+
:'levels' => :'levels'
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
# Attribute type mapping.
|
28
|
+
def self.openapi_types
|
29
|
+
{
|
30
|
+
:'levels' => :'Array<Float>'
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
# List of attributes with nullable: true
|
35
|
+
def self.openapi_nullable
|
36
|
+
Set.new([
|
37
|
+
])
|
38
|
+
end
|
39
|
+
|
40
|
+
# Initializes the object
|
41
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
42
|
+
def initialize(attributes = {})
|
43
|
+
if (!attributes.is_a?(Hash))
|
44
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `FinnhubRuby::SupportResistance` initialize method"
|
45
|
+
end
|
46
|
+
|
47
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
48
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
49
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
50
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `FinnhubRuby::SupportResistance`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
51
|
+
end
|
52
|
+
h[k.to_sym] = v
|
53
|
+
}
|
54
|
+
|
55
|
+
if attributes.key?(:'levels')
|
56
|
+
if (value = attributes[:'levels']).is_a?(Array)
|
57
|
+
self.levels = value
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
63
|
+
# @return Array for valid properties with the reasons
|
64
|
+
def list_invalid_properties
|
65
|
+
invalid_properties = Array.new
|
66
|
+
invalid_properties
|
67
|
+
end
|
68
|
+
|
69
|
+
# Check to see if the all the properties in the model are valid
|
70
|
+
# @return true if the model is valid
|
71
|
+
def valid?
|
72
|
+
true
|
73
|
+
end
|
74
|
+
|
75
|
+
# Checks equality by comparing each attribute.
|
76
|
+
# @param [Object] Object to be compared
|
77
|
+
def ==(o)
|
78
|
+
return true if self.equal?(o)
|
79
|
+
self.class == o.class &&
|
80
|
+
levels == o.levels
|
81
|
+
end
|
82
|
+
|
83
|
+
# @see the `==` method
|
84
|
+
# @param [Object] Object to be compared
|
85
|
+
def eql?(o)
|
86
|
+
self == o
|
87
|
+
end
|
88
|
+
|
89
|
+
# Calculates hash code according to all attributes.
|
90
|
+
# @return [Integer] Hash code
|
91
|
+
def hash
|
92
|
+
[levels].hash
|
93
|
+
end
|
94
|
+
|
95
|
+
# Builds the object from hash
|
96
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
97
|
+
# @return [Object] Returns the model itself
|
98
|
+
def self.build_from_hash(attributes)
|
99
|
+
new.build_from_hash(attributes)
|
100
|
+
end
|
101
|
+
|
102
|
+
# Builds the object from hash
|
103
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
104
|
+
# @return [Object] Returns the model itself
|
105
|
+
def build_from_hash(attributes)
|
106
|
+
return nil unless attributes.is_a?(Hash)
|
107
|
+
self.class.openapi_types.each_pair do |key, type|
|
108
|
+
if type =~ /\AArray<(.*)>/i
|
109
|
+
# check to ensure the input is an array given that the attribute
|
110
|
+
# is documented as an array but the input is not
|
111
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
112
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
113
|
+
end
|
114
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
115
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
116
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
117
|
+
end
|
118
|
+
|
119
|
+
self
|
120
|
+
end
|
121
|
+
|
122
|
+
# Deserializes the data based on type
|
123
|
+
# @param string type Data type
|
124
|
+
# @param string value Value to be deserialized
|
125
|
+
# @return [Object] Deserialized data
|
126
|
+
def _deserialize(type, value)
|
127
|
+
case type.to_sym
|
128
|
+
when :DateTime
|
129
|
+
DateTime.parse(value)
|
130
|
+
when :Date
|
131
|
+
Date.parse(value)
|
132
|
+
when :String
|
133
|
+
value.to_s
|
134
|
+
when :Integer
|
135
|
+
value.to_i
|
136
|
+
when :Float
|
137
|
+
value.to_f
|
138
|
+
when :Boolean
|
139
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
140
|
+
true
|
141
|
+
else
|
142
|
+
false
|
143
|
+
end
|
144
|
+
when :Object
|
145
|
+
# generic object (usually a Hash), return directly
|
146
|
+
value
|
147
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
148
|
+
inner_type = Regexp.last_match[:inner_type]
|
149
|
+
value.map { |v| _deserialize(inner_type, v) }
|
150
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
151
|
+
k_type = Regexp.last_match[:k_type]
|
152
|
+
v_type = Regexp.last_match[:v_type]
|
153
|
+
{}.tap do |hash|
|
154
|
+
value.each do |k, v|
|
155
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
156
|
+
end
|
157
|
+
end
|
158
|
+
else # model
|
159
|
+
FinnhubRuby.const_get(type).build_from_hash(value)
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
# Returns the string representation of the object
|
164
|
+
# @return [String] String presentation of the object
|
165
|
+
def to_s
|
166
|
+
to_hash.to_s
|
167
|
+
end
|
168
|
+
|
169
|
+
# to_body is an alias to to_hash (backward compatibility)
|
170
|
+
# @return [Hash] Returns the object in the form of hash
|
171
|
+
def to_body
|
172
|
+
to_hash
|
173
|
+
end
|
174
|
+
|
175
|
+
# Returns the object in the form of hash
|
176
|
+
# @return [Hash] Returns the object in the form of hash
|
177
|
+
def to_hash
|
178
|
+
hash = {}
|
179
|
+
self.class.attribute_map.each_pair do |attr, param|
|
180
|
+
value = self.send(attr)
|
181
|
+
if value.nil?
|
182
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
183
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
184
|
+
end
|
185
|
+
|
186
|
+
hash[param] = _to_hash(value)
|
187
|
+
end
|
188
|
+
hash
|
189
|
+
end
|
190
|
+
|
191
|
+
# Outputs non-array value in the form of hash
|
192
|
+
# For object, use to_hash. Otherwise, just return the value
|
193
|
+
# @param [Object] value Any valid value
|
194
|
+
# @return [Hash] Returns the value in the form of hash
|
195
|
+
def _to_hash(value)
|
196
|
+
if value.is_a?(Array)
|
197
|
+
value.compact.map { |v| _to_hash(v) }
|
198
|
+
elsif value.is_a?(Hash)
|
199
|
+
{}.tap do |hash|
|
200
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
201
|
+
end
|
202
|
+
elsif value.respond_to? :to_hash
|
203
|
+
value.to_hash
|
204
|
+
else
|
205
|
+
value
|
206
|
+
end
|
207
|
+
end
|
208
|
+
end
|
209
|
+
end
|