finnhub_ruby 1.0.0

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