finnhub_ruby 1.1.2 → 1.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (237) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +42 -12
  3. data/docs/AggregateIndicators.md +10 -9
  4. data/docs/BasicFinancials.md +14 -11
  5. data/docs/BreakdownItem.md +20 -0
  6. data/docs/Company.md +20 -19
  7. data/docs/CompanyExecutive.md +10 -9
  8. data/docs/CompanyNewsStatistics.md +12 -11
  9. data/docs/CompanyProfile.md +62 -61
  10. data/docs/CompanyProfile2.md +30 -29
  11. data/docs/CountryMetadata.md +18 -17
  12. data/docs/CovidInfo.md +14 -13
  13. data/docs/CryptoCandles.md +20 -19
  14. data/docs/CryptoSymbol.md +12 -11
  15. data/docs/DefaultApi.md +2927 -891
  16. data/docs/Development.md +16 -13
  17. data/docs/Dividends.md +22 -21
  18. data/docs/Dividends2Basic.md +20 -0
  19. data/docs/ETFCountryExposureData.md +10 -9
  20. data/docs/ETFHoldingsData.md +20 -11
  21. data/docs/ETFProfileData.md +52 -0
  22. data/docs/ETFSectorExposureData.md +10 -9
  23. data/docs/ETFsCountryExposure.md +10 -9
  24. data/docs/ETFsHoldings.md +14 -9
  25. data/docs/ETFsProfile.md +10 -9
  26. data/docs/ETFsSectorExposure.md +20 -0
  27. data/docs/EarningEstimate.md +16 -15
  28. data/docs/EarningRelease.md +24 -23
  29. data/docs/EarningResult.md +18 -13
  30. data/docs/EarningsCalendar.md +8 -7
  31. data/docs/EarningsCallTranscripts.md +24 -23
  32. data/docs/EarningsCallTranscriptsList.md +10 -9
  33. data/docs/EarningsEstimates.md +12 -11
  34. data/docs/EconomicCalendar.md +8 -7
  35. data/docs/EconomicCode.md +14 -13
  36. data/docs/EconomicData.md +10 -9
  37. data/docs/EconomicEvent.md +22 -21
  38. data/docs/Estimate.md +16 -15
  39. data/docs/FDAComitteeMeeting.md +24 -0
  40. data/docs/Filing.md +22 -21
  41. data/docs/FilingSentiment.md +34 -0
  42. data/docs/FinancialStatements.md +10 -9
  43. data/docs/FinancialsAsReported.md +12 -11
  44. data/docs/ForexCandles.md +20 -19
  45. data/docs/ForexSymbol.md +12 -11
  46. data/docs/Forexrates.md +10 -9
  47. data/docs/FundOwnership.md +10 -9
  48. data/docs/HistoricalNBBO.md +40 -0
  49. data/docs/IPOCalendar.md +8 -7
  50. data/docs/IPOEvent.md +22 -21
  51. data/docs/IndexHistoricalConstituent.md +12 -11
  52. data/docs/Indicator.md +12 -11
  53. data/docs/IndicesConstituents.md +10 -9
  54. data/docs/IndicesHistoricalConstituents.md +10 -9
  55. data/docs/InsiderTransactions.md +20 -0
  56. data/docs/InternationalFiling.md +34 -0
  57. data/docs/InvestmentThemePortfolio.md +18 -0
  58. data/docs/InvestmentThemesThematicInvesting.md +20 -0
  59. data/docs/Investor.md +14 -13
  60. data/docs/KeyCustomersSuppliers.md +24 -0
  61. data/docs/LastBidAsk.md +16 -15
  62. data/docs/MajorPressReleases.md +20 -0
  63. data/docs/MutualFundCountryExposureData.md +20 -0
  64. data/docs/MutualFundSectorExposure.md +20 -0
  65. data/docs/MutualFundSectorExposureData.md +20 -0
  66. data/docs/MutualFundsCountryExposure.md +20 -0
  67. data/docs/MutualFundsHoldings.md +24 -0
  68. data/docs/MutualFundsProfile.md +20 -0
  69. data/docs/News.md +24 -23
  70. data/docs/NewsSentiment.md +18 -17
  71. data/docs/Ownership.md +20 -0
  72. data/docs/PatternRecognition.md +8 -7
  73. data/docs/PriceTarget.md +18 -17
  74. data/docs/Quote.md +20 -15
  75. data/docs/RecommendationTrend.md +20 -19
  76. data/docs/RedditSentimentContent.md +30 -0
  77. data/docs/Report.md +28 -27
  78. data/docs/RevenueBreakdown.md +22 -0
  79. data/docs/RevenueEstimates.md +12 -11
  80. data/docs/SECSentimentAnalysis.md +24 -0
  81. data/docs/Sentiment.md +10 -9
  82. data/docs/SimilarityIndex.md +12 -11
  83. data/docs/SocialSentiment.md +22 -0
  84. data/docs/Split.md +14 -13
  85. data/docs/Stock.md +14 -15
  86. data/docs/StockCandles.md +20 -19
  87. data/docs/StockTranscripts.md +16 -15
  88. data/docs/SupplyChainRelationships.md +20 -0
  89. data/docs/SupportResistance.md +8 -7
  90. data/docs/SymbolLookup.md +20 -0
  91. data/docs/TechnicalAnalysis.md +10 -9
  92. data/docs/TickData.md +24 -21
  93. data/docs/Transactions.md +30 -0
  94. data/docs/TranscriptContent.md +12 -9
  95. data/docs/TranscriptParticipant.md +12 -9
  96. data/docs/Trend.md +10 -9
  97. data/docs/TwitterSentimentContent.md +30 -0
  98. data/docs/UpgradeDowngrade.md +18 -17
  99. data/finnhub_ruby.gemspec +7 -8
  100. data/lib/finnhub_ruby.rb +32 -7
  101. data/lib/finnhub_ruby/api/default_api.rb +1514 -466
  102. data/lib/finnhub_ruby/api_client.rb +52 -49
  103. data/lib/finnhub_ruby/api_error.rb +1 -1
  104. data/lib/finnhub_ruby/configuration.rb +39 -10
  105. data/lib/finnhub_ruby/models/aggregate_indicators.rb +19 -7
  106. data/lib/finnhub_ruby/models/basic_financials.rb +29 -8
  107. data/lib/finnhub_ruby/models/breakdown_item.rb +228 -0
  108. data/lib/finnhub_ruby/models/company.rb +19 -7
  109. data/lib/finnhub_ruby/models/company_executive.rb +19 -7
  110. data/lib/finnhub_ruby/models/company_news_statistics.rb +19 -7
  111. data/lib/finnhub_ruby/models/company_profile.rb +19 -7
  112. data/lib/finnhub_ruby/models/company_profile2.rb +19 -7
  113. data/lib/finnhub_ruby/models/country_metadata.rb +19 -7
  114. data/lib/finnhub_ruby/models/covid_info.rb +20 -8
  115. data/lib/finnhub_ruby/models/crypto_candles.rb +19 -7
  116. data/lib/finnhub_ruby/models/crypto_symbol.rb +19 -7
  117. data/lib/finnhub_ruby/models/development.rb +34 -12
  118. data/lib/finnhub_ruby/models/dividends.rb +19 -7
  119. data/lib/finnhub_ruby/models/dividends2_basic.rb +231 -0
  120. data/lib/finnhub_ruby/models/earning_estimate.rb +20 -8
  121. data/lib/finnhub_ruby/models/earning_release.rb +20 -8
  122. data/lib/finnhub_ruby/models/earning_result.rb +40 -8
  123. data/lib/finnhub_ruby/models/earnings_calendar.rb +19 -7
  124. data/lib/finnhub_ruby/models/earnings_call_transcripts.rb +20 -8
  125. data/lib/finnhub_ruby/models/earnings_call_transcripts_list.rb +19 -7
  126. data/lib/finnhub_ruby/models/earnings_estimates.rb +19 -7
  127. data/lib/finnhub_ruby/models/economic_calendar.rb +19 -7
  128. data/lib/finnhub_ruby/models/economic_code.rb +19 -7
  129. data/lib/finnhub_ruby/models/economic_data.rb +19 -7
  130. data/lib/finnhub_ruby/models/economic_event.rb +19 -7
  131. data/lib/finnhub_ruby/models/estimate.rb +20 -8
  132. data/lib/finnhub_ruby/models/etf_country_exposure_data.rb +20 -8
  133. data/lib/finnhub_ruby/models/etf_holdings_data.rb +63 -11
  134. data/lib/finnhub_ruby/models/etf_profile_data.rb +389 -0
  135. data/lib/finnhub_ruby/models/etf_sector_exposure_data.rb +20 -8
  136. data/lib/finnhub_ruby/models/etfs_country_exposure.rb +231 -0
  137. data/lib/finnhub_ruby/models/etfs_holdings.rb +251 -0
  138. data/lib/finnhub_ruby/models/etfs_profile.rb +228 -0
  139. data/lib/finnhub_ruby/models/etfs_sector_exposure.rb +231 -0
  140. data/lib/finnhub_ruby/models/fda_comittee_meeting.rb +249 -0
  141. data/lib/finnhub_ruby/models/filing.rb +21 -9
  142. data/lib/finnhub_ruby/models/filing_sentiment.rb +299 -0
  143. data/lib/finnhub_ruby/models/financial_statements.rb +19 -7
  144. data/lib/finnhub_ruby/models/financials_as_reported.rb +19 -7
  145. data/lib/finnhub_ruby/models/forex_candles.rb +19 -7
  146. data/lib/finnhub_ruby/models/forex_symbol.rb +19 -7
  147. data/lib/finnhub_ruby/models/forexrates.rb +19 -7
  148. data/lib/finnhub_ruby/models/fund_ownership.rb +19 -7
  149. data/lib/finnhub_ruby/models/historical_nbbo.rb +345 -0
  150. data/lib/finnhub_ruby/models/index_historical_constituent.rb +19 -7
  151. data/lib/finnhub_ruby/models/indicator.rb +19 -7
  152. data/lib/finnhub_ruby/models/indices_constituents.rb +19 -7
  153. data/lib/finnhub_ruby/models/indices_historical_constituents.rb +19 -7
  154. data/lib/finnhub_ruby/models/insider_transactions.rb +231 -0
  155. data/lib/finnhub_ruby/models/international_filing.rb +299 -0
  156. data/lib/finnhub_ruby/models/investment_theme_portfolio.rb +219 -0
  157. data/lib/finnhub_ruby/models/investment_themes_thematic_investing.rb +231 -0
  158. data/lib/finnhub_ruby/models/investor.rb +19 -7
  159. data/lib/finnhub_ruby/models/ipo_calendar.rb +19 -7
  160. data/lib/finnhub_ruby/models/ipo_event.rb +19 -7
  161. data/lib/finnhub_ruby/models/key_customers_suppliers.rb +249 -0
  162. data/lib/finnhub_ruby/models/last_bid_ask.rb +19 -7
  163. data/lib/finnhub_ruby/models/major_press_releases.rb +231 -0
  164. data/lib/finnhub_ruby/models/mutual_fund_country_exposure_data.rb +229 -0
  165. data/lib/finnhub_ruby/models/mutual_fund_sector_exposure.rb +231 -0
  166. data/lib/finnhub_ruby/models/mutual_fund_sector_exposure_data.rb +229 -0
  167. data/lib/finnhub_ruby/models/mutual_funds_country_exposure.rb +231 -0
  168. data/lib/finnhub_ruby/models/mutual_funds_holdings.rb +251 -0
  169. data/lib/finnhub_ruby/models/mutual_funds_profile.rb +228 -0
  170. data/lib/finnhub_ruby/models/news.rb +19 -7
  171. data/lib/finnhub_ruby/models/news_sentiment.rb +19 -7
  172. data/lib/finnhub_ruby/models/ownership.rb +231 -0
  173. data/lib/finnhub_ruby/models/pattern_recognition.rb +19 -7
  174. data/lib/finnhub_ruby/models/price_target.rb +20 -8
  175. data/lib/finnhub_ruby/models/quote.rb +43 -11
  176. data/lib/finnhub_ruby/models/recommendation_trend.rb +19 -7
  177. data/lib/finnhub_ruby/models/reddit_sentiment_content.rb +279 -0
  178. data/lib/finnhub_ruby/models/report.rb +23 -11
  179. data/lib/finnhub_ruby/models/revenue_breakdown.rb +241 -0
  180. data/lib/finnhub_ruby/models/revenue_estimates.rb +19 -7
  181. data/lib/finnhub_ruby/models/sec_sentiment_analysis.rb +248 -0
  182. data/lib/finnhub_ruby/models/sentiment.rb +19 -7
  183. data/lib/finnhub_ruby/models/similarity_index.rb +19 -7
  184. data/lib/finnhub_ruby/models/social_sentiment.rb +243 -0
  185. data/lib/finnhub_ruby/models/split.rb +19 -7
  186. data/lib/finnhub_ruby/models/stock.rb +23 -21
  187. data/lib/finnhub_ruby/models/stock_candles.rb +19 -7
  188. data/lib/finnhub_ruby/models/stock_transcripts.rb +20 -8
  189. data/lib/finnhub_ruby/models/supply_chain_relationships.rb +231 -0
  190. data/lib/finnhub_ruby/models/support_resistance.rb +19 -7
  191. data/lib/finnhub_ruby/models/symbol_lookup.rb +231 -0
  192. data/lib/finnhub_ruby/models/technical_analysis.rb +19 -7
  193. data/lib/finnhub_ruby/models/tick_data.rb +36 -12
  194. data/lib/finnhub_ruby/models/transactions.rb +279 -0
  195. data/lib/finnhub_ruby/models/transcript_content.rb +33 -11
  196. data/lib/finnhub_ruby/models/transcript_participant.rb +33 -11
  197. data/lib/finnhub_ruby/models/trend.rb +19 -7
  198. data/lib/finnhub_ruby/models/twitter_sentiment_content.rb +279 -0
  199. data/lib/finnhub_ruby/models/upgrade_downgrade.rb +19 -7
  200. data/lib/finnhub_ruby/version.rb +2 -2
  201. data/release.sh +1 -1
  202. data/spec/api_client_spec.rb +1 -1
  203. data/spec/configuration_spec.rb +1 -1
  204. data/spec/models/breakdown_item_spec.rb +40 -0
  205. data/spec/models/dividends2_basic_spec.rb +40 -0
  206. data/spec/models/etf_profile_data_spec.rb +136 -0
  207. data/spec/models/etfs_country_exposure_spec.rb +40 -0
  208. data/spec/models/etfs_holdings_spec.rb +52 -0
  209. data/spec/models/etfs_profile_spec.rb +40 -0
  210. data/spec/models/etfs_sector_exposure_spec.rb +40 -0
  211. data/spec/models/fda_comittee_meeting_spec.rb +52 -0
  212. data/spec/models/filing_sentiment_spec.rb +82 -0
  213. data/spec/models/historical_nbbo_spec.rb +100 -0
  214. data/spec/models/insider_transactions_spec.rb +40 -0
  215. data/spec/models/international_filing_spec.rb +82 -0
  216. data/spec/models/investment_theme_portfolio_spec.rb +34 -0
  217. data/spec/models/investment_themes_thematic_investing_spec.rb +40 -0
  218. data/spec/models/key_customers_suppliers_spec.rb +52 -0
  219. data/spec/models/major_press_releases_spec.rb +40 -0
  220. data/spec/models/mutual_fund_country_exposure_data_spec.rb +40 -0
  221. data/spec/models/mutual_fund_sector_exposure_data_spec.rb +40 -0
  222. data/spec/models/mutual_fund_sector_exposure_spec.rb +40 -0
  223. data/spec/models/mutual_funds_country_exposure_spec.rb +40 -0
  224. data/spec/models/mutual_funds_holdings_spec.rb +52 -0
  225. data/spec/models/mutual_funds_profile_spec.rb +40 -0
  226. data/spec/models/ownership_spec.rb +40 -0
  227. data/spec/models/reddit_sentiment_content_spec.rb +70 -0
  228. data/spec/models/revenue_breakdown_spec.rb +46 -0
  229. data/spec/models/sec_sentiment_analysis_spec.rb +52 -0
  230. data/spec/models/social_sentiment_spec.rb +46 -0
  231. data/spec/models/supply_chain_relationships_spec.rb +40 -0
  232. data/spec/models/symbol_lookup_spec.rb +40 -0
  233. data/spec/models/transactions_spec.rb +70 -0
  234. data/spec/models/twitter_sentiment_content_spec.rb +70 -0
  235. data/spec/spec_helper.rb +1 -1
  236. metadata +129 -29
  237. data/test.rb +0 -157
@@ -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: 4.3.1
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 LastBidAsk
@@ -40,6 +41,11 @@ module FinnhubRuby
40
41
  }
41
42
  end
42
43
 
44
+ # Returns all the JSON keys this model knows about
45
+ def self.acceptable_attributes
46
+ attribute_map.values
47
+ end
48
+
43
49
  # Attribute type mapping.
44
50
  def self.openapi_types
45
51
  {
@@ -143,7 +149,9 @@ module FinnhubRuby
143
149
  def build_from_hash(attributes)
144
150
  return nil unless attributes.is_a?(Hash)
145
151
  self.class.openapi_types.each_pair do |key, type|
146
- if type =~ /\AArray<(.*)>/i
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
147
155
  # check to ensure the input is an array given that the attribute
148
156
  # is documented as an array but the input is not
149
157
  if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -151,7 +159,7 @@ module FinnhubRuby
151
159
  end
152
160
  elsif !attributes[self.class.attribute_map[key]].nil?
153
161
  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
162
+ end
155
163
  end
156
164
 
157
165
  self
@@ -163,8 +171,8 @@ module FinnhubRuby
163
171
  # @return [Object] Deserialized data
164
172
  def _deserialize(type, value)
165
173
  case type.to_sym
166
- when :DateTime
167
- DateTime.parse(value)
174
+ when :Time
175
+ Time.parse(value)
168
176
  when :Date
169
177
  Date.parse(value)
170
178
  when :String
@@ -194,7 +202,9 @@ module FinnhubRuby
194
202
  end
195
203
  end
196
204
  else # model
197
- FinnhubRuby.const_get(type).build_from_hash(value)
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)
198
208
  end
199
209
  end
200
210
 
@@ -220,7 +230,7 @@ module FinnhubRuby
220
230
  is_nullable = self.class.openapi_nullable.include?(attr)
221
231
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
222
232
  end
223
-
233
+
224
234
  hash[param] = _to_hash(value)
225
235
  end
226
236
  hash
@@ -243,5 +253,7 @@ module FinnhubRuby
243
253
  value
244
254
  end
245
255
  end
256
+
246
257
  end
258
+
247
259
  end
@@ -0,0 +1,231 @@
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 MajorPressReleases
18
+ # Company symbol.
19
+ attr_accessor :symbol
20
+
21
+ # Array of major developments.
22
+ attr_accessor :major_development
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'symbol' => :'symbol',
28
+ :'major_development' => :'majorDevelopment'
29
+ }
30
+ end
31
+
32
+ # Returns all the JSON keys this model knows about
33
+ def self.acceptable_attributes
34
+ attribute_map.values
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.openapi_types
39
+ {
40
+ :'symbol' => :'String',
41
+ :'major_development' => :'Array<Object>'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ ])
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ if (!attributes.is_a?(Hash))
55
+ fail ArgumentError, "The input argument (attributes) must be a hash in `FinnhubRuby::MajorPressReleases` initialize method"
56
+ end
57
+
58
+ # check to see if the attribute exists and convert string to symbol for hash key
59
+ attributes = attributes.each_with_object({}) { |(k, v), h|
60
+ if (!self.class.attribute_map.key?(k.to_sym))
61
+ fail ArgumentError, "`#{k}` is not a valid attribute in `FinnhubRuby::MajorPressReleases`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
62
+ end
63
+ h[k.to_sym] = v
64
+ }
65
+
66
+ if attributes.key?(:'symbol')
67
+ self.symbol = attributes[:'symbol']
68
+ end
69
+
70
+ if attributes.key?(:'major_development')
71
+ if (value = attributes[:'major_development']).is_a?(Array)
72
+ self.major_development = value
73
+ end
74
+ end
75
+ end
76
+
77
+ # Show invalid properties with the reasons. Usually used together with valid?
78
+ # @return Array for valid properties with the reasons
79
+ def list_invalid_properties
80
+ invalid_properties = Array.new
81
+ invalid_properties
82
+ end
83
+
84
+ # Check to see if the all the properties in the model are valid
85
+ # @return true if the model is valid
86
+ def valid?
87
+ true
88
+ end
89
+
90
+ # Checks equality by comparing each attribute.
91
+ # @param [Object] Object to be compared
92
+ def ==(o)
93
+ return true if self.equal?(o)
94
+ self.class == o.class &&
95
+ symbol == o.symbol &&
96
+ major_development == o.major_development
97
+ end
98
+
99
+ # @see the `==` method
100
+ # @param [Object] Object to be compared
101
+ def eql?(o)
102
+ self == o
103
+ end
104
+
105
+ # Calculates hash code according to all attributes.
106
+ # @return [Integer] Hash code
107
+ def hash
108
+ [symbol, major_development].hash
109
+ end
110
+
111
+ # Builds the object from hash
112
+ # @param [Hash] attributes Model attributes in the form of hash
113
+ # @return [Object] Returns the model itself
114
+ def self.build_from_hash(attributes)
115
+ new.build_from_hash(attributes)
116
+ end
117
+
118
+ # Builds the object from hash
119
+ # @param [Hash] attributes Model attributes in the form of hash
120
+ # @return [Object] Returns the model itself
121
+ def build_from_hash(attributes)
122
+ return nil unless attributes.is_a?(Hash)
123
+ self.class.openapi_types.each_pair do |key, type|
124
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
125
+ self.send("#{key}=", nil)
126
+ elsif type =~ /\AArray<(.*)>/i
127
+ # check to ensure the input is an array given that the attribute
128
+ # is documented as an array but the input is not
129
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
130
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
131
+ end
132
+ elsif !attributes[self.class.attribute_map[key]].nil?
133
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
134
+ end
135
+ end
136
+
137
+ self
138
+ end
139
+
140
+ # Deserializes the data based on type
141
+ # @param string type Data type
142
+ # @param string value Value to be deserialized
143
+ # @return [Object] Deserialized data
144
+ def _deserialize(type, value)
145
+ case type.to_sym
146
+ when :Time
147
+ Time.parse(value)
148
+ when :Date
149
+ Date.parse(value)
150
+ when :String
151
+ value.to_s
152
+ when :Integer
153
+ value.to_i
154
+ when :Float
155
+ value.to_f
156
+ when :Boolean
157
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
158
+ true
159
+ else
160
+ false
161
+ end
162
+ when :Object
163
+ # generic object (usually a Hash), return directly
164
+ value
165
+ when /\AArray<(?<inner_type>.+)>\z/
166
+ inner_type = Regexp.last_match[:inner_type]
167
+ value.map { |v| _deserialize(inner_type, v) }
168
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
169
+ k_type = Regexp.last_match[:k_type]
170
+ v_type = Regexp.last_match[:v_type]
171
+ {}.tap do |hash|
172
+ value.each do |k, v|
173
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
174
+ end
175
+ end
176
+ else # model
177
+ # models (e.g. Pet) or oneOf
178
+ klass = FinnhubRuby.const_get(type)
179
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
180
+ end
181
+ end
182
+
183
+ # Returns the string representation of the object
184
+ # @return [String] String presentation of the object
185
+ def to_s
186
+ to_hash.to_s
187
+ end
188
+
189
+ # to_body is an alias to to_hash (backward compatibility)
190
+ # @return [Hash] Returns the object in the form of hash
191
+ def to_body
192
+ to_hash
193
+ end
194
+
195
+ # Returns the object in the form of hash
196
+ # @return [Hash] Returns the object in the form of hash
197
+ def to_hash
198
+ hash = {}
199
+ self.class.attribute_map.each_pair do |attr, param|
200
+ value = self.send(attr)
201
+ if value.nil?
202
+ is_nullable = self.class.openapi_nullable.include?(attr)
203
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
204
+ end
205
+
206
+ hash[param] = _to_hash(value)
207
+ end
208
+ hash
209
+ end
210
+
211
+ # Outputs non-array value in the form of hash
212
+ # For object, use to_hash. Otherwise, just return the value
213
+ # @param [Object] value Any valid value
214
+ # @return [Hash] Returns the value in the form of hash
215
+ def _to_hash(value)
216
+ if value.is_a?(Array)
217
+ value.compact.map { |v| _to_hash(v) }
218
+ elsif value.is_a?(Hash)
219
+ {}.tap do |hash|
220
+ value.each { |k, v| hash[k] = _to_hash(v) }
221
+ end
222
+ elsif value.respond_to? :to_hash
223
+ value.to_hash
224
+ else
225
+ value
226
+ end
227
+ end
228
+
229
+ end
230
+
231
+ end
@@ -0,0 +1,229 @@
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 MutualFundCountryExposureData
18
+ # Country
19
+ attr_accessor :country
20
+
21
+ # Percent of exposure.
22
+ attr_accessor :exposure
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'country' => :'country',
28
+ :'exposure' => :'exposure'
29
+ }
30
+ end
31
+
32
+ # Returns all the JSON keys this model knows about
33
+ def self.acceptable_attributes
34
+ attribute_map.values
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.openapi_types
39
+ {
40
+ :'country' => :'String',
41
+ :'exposure' => :'Float'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ ])
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ if (!attributes.is_a?(Hash))
55
+ fail ArgumentError, "The input argument (attributes) must be a hash in `FinnhubRuby::MutualFundCountryExposureData` initialize method"
56
+ end
57
+
58
+ # check to see if the attribute exists and convert string to symbol for hash key
59
+ attributes = attributes.each_with_object({}) { |(k, v), h|
60
+ if (!self.class.attribute_map.key?(k.to_sym))
61
+ fail ArgumentError, "`#{k}` is not a valid attribute in `FinnhubRuby::MutualFundCountryExposureData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
62
+ end
63
+ h[k.to_sym] = v
64
+ }
65
+
66
+ if attributes.key?(:'country')
67
+ self.country = attributes[:'country']
68
+ end
69
+
70
+ if attributes.key?(:'exposure')
71
+ self.exposure = attributes[:'exposure']
72
+ end
73
+ end
74
+
75
+ # Show invalid properties with the reasons. Usually used together with valid?
76
+ # @return Array for valid properties with the reasons
77
+ def list_invalid_properties
78
+ invalid_properties = Array.new
79
+ invalid_properties
80
+ end
81
+
82
+ # Check to see if the all the properties in the model are valid
83
+ # @return true if the model is valid
84
+ def valid?
85
+ true
86
+ end
87
+
88
+ # Checks equality by comparing each attribute.
89
+ # @param [Object] Object to be compared
90
+ def ==(o)
91
+ return true if self.equal?(o)
92
+ self.class == o.class &&
93
+ country == o.country &&
94
+ exposure == o.exposure
95
+ end
96
+
97
+ # @see the `==` method
98
+ # @param [Object] Object to be compared
99
+ def eql?(o)
100
+ self == o
101
+ end
102
+
103
+ # Calculates hash code according to all attributes.
104
+ # @return [Integer] Hash code
105
+ def hash
106
+ [country, exposure].hash
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 self.build_from_hash(attributes)
113
+ new.build_from_hash(attributes)
114
+ end
115
+
116
+ # Builds the object from hash
117
+ # @param [Hash] attributes Model attributes in the form of hash
118
+ # @return [Object] Returns the model itself
119
+ def build_from_hash(attributes)
120
+ return nil unless attributes.is_a?(Hash)
121
+ self.class.openapi_types.each_pair do |key, type|
122
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
123
+ self.send("#{key}=", nil)
124
+ elsif type =~ /\AArray<(.*)>/i
125
+ # check to ensure the input is an array given that the attribute
126
+ # is documented as an array but the input is not
127
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
128
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
129
+ end
130
+ elsif !attributes[self.class.attribute_map[key]].nil?
131
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
132
+ end
133
+ end
134
+
135
+ self
136
+ end
137
+
138
+ # Deserializes the data based on type
139
+ # @param string type Data type
140
+ # @param string value Value to be deserialized
141
+ # @return [Object] Deserialized data
142
+ def _deserialize(type, value)
143
+ case type.to_sym
144
+ when :Time
145
+ Time.parse(value)
146
+ when :Date
147
+ Date.parse(value)
148
+ when :String
149
+ value.to_s
150
+ when :Integer
151
+ value.to_i
152
+ when :Float
153
+ value.to_f
154
+ when :Boolean
155
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
156
+ true
157
+ else
158
+ false
159
+ end
160
+ when :Object
161
+ # generic object (usually a Hash), return directly
162
+ value
163
+ when /\AArray<(?<inner_type>.+)>\z/
164
+ inner_type = Regexp.last_match[:inner_type]
165
+ value.map { |v| _deserialize(inner_type, v) }
166
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
167
+ k_type = Regexp.last_match[:k_type]
168
+ v_type = Regexp.last_match[:v_type]
169
+ {}.tap do |hash|
170
+ value.each do |k, v|
171
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
172
+ end
173
+ end
174
+ else # model
175
+ # models (e.g. Pet) or oneOf
176
+ klass = FinnhubRuby.const_get(type)
177
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
178
+ end
179
+ end
180
+
181
+ # Returns the string representation of the object
182
+ # @return [String] String presentation of the object
183
+ def to_s
184
+ to_hash.to_s
185
+ end
186
+
187
+ # to_body is an alias to to_hash (backward compatibility)
188
+ # @return [Hash] Returns the object in the form of hash
189
+ def to_body
190
+ to_hash
191
+ end
192
+
193
+ # Returns the object in the form of hash
194
+ # @return [Hash] Returns the object in the form of hash
195
+ def to_hash
196
+ hash = {}
197
+ self.class.attribute_map.each_pair do |attr, param|
198
+ value = self.send(attr)
199
+ if value.nil?
200
+ is_nullable = self.class.openapi_nullable.include?(attr)
201
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
202
+ end
203
+
204
+ hash[param] = _to_hash(value)
205
+ end
206
+ hash
207
+ end
208
+
209
+ # Outputs non-array value in the form of hash
210
+ # For object, use to_hash. Otherwise, just return the value
211
+ # @param [Object] value Any valid value
212
+ # @return [Hash] Returns the value in the form of hash
213
+ def _to_hash(value)
214
+ if value.is_a?(Array)
215
+ value.compact.map { |v| _to_hash(v) }
216
+ elsif value.is_a?(Hash)
217
+ {}.tap do |hash|
218
+ value.each { |k, v| hash[k] = _to_hash(v) }
219
+ end
220
+ elsif value.respond_to? :to_hash
221
+ value.to_hash
222
+ else
223
+ value
224
+ end
225
+ end
226
+
227
+ end
228
+
229
+ end