finnhub_ruby 1.1.17 → 1.1.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/docs/BondTickData.md +40 -0
  4. data/docs/BondYieldCurve.md +20 -0
  5. data/docs/BondYieldCurveInfo.md +20 -0
  6. data/docs/CompanyProfile.md +5 -1
  7. data/docs/CongressionalTrading.md +20 -0
  8. data/docs/CongressionalTransaction.md +36 -0
  9. data/docs/DefaultApi.md +849 -93
  10. data/docs/Dividends.md +3 -1
  11. data/docs/DocumentResponse.md +28 -0
  12. data/docs/ETFHoldingsData.md +3 -1
  13. data/docs/ETFProfileData.md +8 -2
  14. data/docs/EarningResult.md +5 -1
  15. data/docs/ExcerptResponse.md +24 -0
  16. data/docs/FilingResponse.md +42 -0
  17. data/docs/InFilingResponse.md +44 -0
  18. data/docs/InFilingSearchBody.md +20 -0
  19. data/docs/InstitutionalOwnership.md +22 -0
  20. data/docs/InstitutionalOwnershipGroup.md +20 -0
  21. data/docs/InstitutionalOwnershipInfo.md +36 -0
  22. data/docs/InstitutionalPortfolio.md +22 -0
  23. data/docs/InstitutionalPortfolioGroup.md +22 -0
  24. data/docs/InstitutionalPortfolioInfo.md +38 -0
  25. data/docs/InstitutionalProfile.md +20 -0
  26. data/docs/InstitutionalProfileInfo.md +28 -0
  27. data/docs/IsinChange.md +22 -0
  28. data/docs/IsinChangeInfo.md +22 -0
  29. data/docs/MutualFundEet.md +20 -0
  30. data/docs/MutualFundEetPai.md +20 -0
  31. data/docs/MutualFundHoldingsData.md +3 -1
  32. data/docs/PriceMetrics.md +22 -0
  33. data/docs/SearchBody.md +60 -0
  34. data/docs/SearchFilter.md +20 -0
  35. data/docs/SearchResponse.md +24 -0
  36. data/docs/SymbolChange.md +22 -0
  37. data/docs/SymbolChangeInfo.md +22 -0
  38. data/finnhub_ruby-1.1.17.gem +0 -0
  39. data/finnhub_ruby-1.1.18.gem +0 -0
  40. data/lib/finnhub_ruby/api/default_api.rb +835 -95
  41. data/lib/finnhub_ruby/models/bond_tick_data.rb +347 -0
  42. data/lib/finnhub_ruby/models/bond_yield_curve.rb +231 -0
  43. data/lib/finnhub_ruby/models/bond_yield_curve_info.rb +229 -0
  44. data/lib/finnhub_ruby/models/company_profile.rb +22 -2
  45. data/lib/finnhub_ruby/models/congressional_trading.rb +231 -0
  46. data/lib/finnhub_ruby/models/congressional_transaction.rb +309 -0
  47. data/lib/finnhub_ruby/models/dividends.rb +14 -4
  48. data/lib/finnhub_ruby/models/document_response.rb +271 -0
  49. data/lib/finnhub_ruby/models/earning_result.rb +24 -4
  50. data/lib/finnhub_ruby/models/etf_holdings_data.rb +14 -4
  51. data/lib/finnhub_ruby/models/etf_profile_data.rb +35 -5
  52. data/lib/finnhub_ruby/models/excerpt_response.rb +249 -0
  53. data/lib/finnhub_ruby/models/filing_response.rb +339 -0
  54. data/lib/finnhub_ruby/models/in_filing_response.rb +351 -0
  55. data/lib/finnhub_ruby/models/in_filing_search_body.rb +239 -0
  56. data/lib/finnhub_ruby/models/institutional_ownership.rb +241 -0
  57. data/lib/finnhub_ruby/models/institutional_ownership_group.rb +231 -0
  58. data/lib/finnhub_ruby/models/institutional_ownership_info.rb +309 -0
  59. data/lib/finnhub_ruby/models/institutional_portfolio.rb +241 -0
  60. data/lib/finnhub_ruby/models/institutional_portfolio_group.rb +241 -0
  61. data/lib/finnhub_ruby/models/institutional_portfolio_info.rb +319 -0
  62. data/lib/finnhub_ruby/models/institutional_profile.rb +231 -0
  63. data/lib/finnhub_ruby/models/institutional_profile_info.rb +269 -0
  64. data/lib/finnhub_ruby/models/isin_change.rb +241 -0
  65. data/lib/finnhub_ruby/models/isin_change_info.rb +239 -0
  66. data/lib/finnhub_ruby/models/mutual_fund_eet.rb +228 -0
  67. data/lib/finnhub_ruby/models/mutual_fund_eet_pai.rb +228 -0
  68. data/lib/finnhub_ruby/models/mutual_fund_holdings_data.rb +14 -4
  69. data/lib/finnhub_ruby/models/price_metrics.rb +238 -0
  70. data/lib/finnhub_ruby/models/search_body.rb +434 -0
  71. data/lib/finnhub_ruby/models/search_filter.rb +229 -0
  72. data/lib/finnhub_ruby/models/search_response.rb +251 -0
  73. data/lib/finnhub_ruby/models/symbol_change.rb +241 -0
  74. data/lib/finnhub_ruby/models/symbol_change_info.rb +239 -0
  75. data/lib/finnhub_ruby/version.rb +1 -1
  76. data/lib/finnhub_ruby.rb +28 -0
  77. data/spec/models/bond_tick_data_spec.rb +82 -0
  78. data/spec/models/bond_yield_curve_info_spec.rb +40 -0
  79. data/spec/models/bond_yield_curve_spec.rb +40 -0
  80. data/spec/models/congressional_trading_spec.rb +40 -0
  81. data/spec/models/congressional_transaction_spec.rb +88 -0
  82. data/spec/models/document_response_spec.rb +64 -0
  83. data/spec/models/excerpt_response_spec.rb +52 -0
  84. data/spec/models/filing_response_spec.rb +106 -0
  85. data/spec/models/in_filing_response_spec.rb +112 -0
  86. data/spec/models/in_filing_search_body_spec.rb +40 -0
  87. data/spec/models/institutional_ownership_group_spec.rb +40 -0
  88. data/spec/models/institutional_ownership_info_spec.rb +88 -0
  89. data/spec/models/institutional_ownership_spec.rb +46 -0
  90. data/spec/models/institutional_portfolio_group_spec.rb +46 -0
  91. data/spec/models/institutional_portfolio_info_spec.rb +94 -0
  92. data/spec/models/institutional_portfolio_spec.rb +46 -0
  93. data/spec/models/institutional_profile_info_spec.rb +64 -0
  94. data/spec/models/institutional_profile_spec.rb +40 -0
  95. data/spec/models/isin_change_info_spec.rb +46 -0
  96. data/spec/models/isin_change_spec.rb +46 -0
  97. data/spec/models/mutual_fund_eet_pai_spec.rb +40 -0
  98. data/spec/models/mutual_fund_eet_spec.rb +40 -0
  99. data/spec/models/price_metrics_spec.rb +40 -0
  100. data/spec/models/search_body_spec.rb +160 -0
  101. data/spec/models/search_filter_spec.rb +40 -0
  102. data/spec/models/search_response_spec.rb +52 -0
  103. data/spec/models/symbol_change_info_spec.rb +46 -0
  104. data/spec/models/symbol_change_spec.rb +46 -0
  105. metadata +117 -3
@@ -0,0 +1,309 @@
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.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module FinnhubRuby
17
+ class CongressionalTransaction
18
+ # Transaction amount from.
19
+ attr_accessor :amount_from
20
+
21
+ # Transaction amount to.
22
+ attr_accessor :amount_to
23
+
24
+ # Asset name.
25
+ attr_accessor :asset_name
26
+
27
+ # Filing date.
28
+ attr_accessor :filing_date
29
+
30
+ # Name of the representative.
31
+ attr_accessor :name
32
+
33
+ # Owner Type.
34
+ attr_accessor :owner_type
35
+
36
+ # Position.
37
+ attr_accessor :position
38
+
39
+ # Symbol.
40
+ attr_accessor :symbol
41
+
42
+ # Transaction date.
43
+ attr_accessor :transaction_date
44
+
45
+ # Transaction type <code>Sale</code> or <code>Purchase</code>.
46
+ attr_accessor :transaction_type
47
+
48
+ # Attribute mapping from ruby-style variable name to JSON key.
49
+ def self.attribute_map
50
+ {
51
+ :'amount_from' => :'amountFrom',
52
+ :'amount_to' => :'amountTo',
53
+ :'asset_name' => :'assetName',
54
+ :'filing_date' => :'filingDate',
55
+ :'name' => :'name',
56
+ :'owner_type' => :'ownerType',
57
+ :'position' => :'position',
58
+ :'symbol' => :'symbol',
59
+ :'transaction_date' => :'transactionDate',
60
+ :'transaction_type' => :'transactionType'
61
+ }
62
+ end
63
+
64
+ # Returns all the JSON keys this model knows about
65
+ def self.acceptable_attributes
66
+ attribute_map.values
67
+ end
68
+
69
+ # Attribute type mapping.
70
+ def self.openapi_types
71
+ {
72
+ :'amount_from' => :'Float',
73
+ :'amount_to' => :'Float',
74
+ :'asset_name' => :'String',
75
+ :'filing_date' => :'String',
76
+ :'name' => :'String',
77
+ :'owner_type' => :'String',
78
+ :'position' => :'String',
79
+ :'symbol' => :'String',
80
+ :'transaction_date' => :'String',
81
+ :'transaction_type' => :'String'
82
+ }
83
+ end
84
+
85
+ # List of attributes with nullable: true
86
+ def self.openapi_nullable
87
+ Set.new([
88
+ ])
89
+ end
90
+
91
+ # Initializes the object
92
+ # @param [Hash] attributes Model attributes in the form of hash
93
+ def initialize(attributes = {})
94
+ if (!attributes.is_a?(Hash))
95
+ fail ArgumentError, "The input argument (attributes) must be a hash in `FinnhubRuby::CongressionalTransaction` initialize method"
96
+ end
97
+
98
+ # check to see if the attribute exists and convert string to symbol for hash key
99
+ attributes = attributes.each_with_object({}) { |(k, v), h|
100
+ if (!self.class.attribute_map.key?(k.to_sym))
101
+ fail ArgumentError, "`#{k}` is not a valid attribute in `FinnhubRuby::CongressionalTransaction`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
102
+ end
103
+ h[k.to_sym] = v
104
+ }
105
+
106
+ if attributes.key?(:'amount_from')
107
+ self.amount_from = attributes[:'amount_from']
108
+ end
109
+
110
+ if attributes.key?(:'amount_to')
111
+ self.amount_to = attributes[:'amount_to']
112
+ end
113
+
114
+ if attributes.key?(:'asset_name')
115
+ self.asset_name = attributes[:'asset_name']
116
+ end
117
+
118
+ if attributes.key?(:'filing_date')
119
+ self.filing_date = attributes[:'filing_date']
120
+ end
121
+
122
+ if attributes.key?(:'name')
123
+ self.name = attributes[:'name']
124
+ end
125
+
126
+ if attributes.key?(:'owner_type')
127
+ self.owner_type = attributes[:'owner_type']
128
+ end
129
+
130
+ if attributes.key?(:'position')
131
+ self.position = attributes[:'position']
132
+ end
133
+
134
+ if attributes.key?(:'symbol')
135
+ self.symbol = attributes[:'symbol']
136
+ end
137
+
138
+ if attributes.key?(:'transaction_date')
139
+ self.transaction_date = attributes[:'transaction_date']
140
+ end
141
+
142
+ if attributes.key?(:'transaction_type')
143
+ self.transaction_type = attributes[:'transaction_type']
144
+ end
145
+ end
146
+
147
+ # Show invalid properties with the reasons. Usually used together with valid?
148
+ # @return Array for valid properties with the reasons
149
+ def list_invalid_properties
150
+ invalid_properties = Array.new
151
+ invalid_properties
152
+ end
153
+
154
+ # Check to see if the all the properties in the model are valid
155
+ # @return true if the model is valid
156
+ def valid?
157
+ true
158
+ end
159
+
160
+ # Checks equality by comparing each attribute.
161
+ # @param [Object] Object to be compared
162
+ def ==(o)
163
+ return true if self.equal?(o)
164
+ self.class == o.class &&
165
+ amount_from == o.amount_from &&
166
+ amount_to == o.amount_to &&
167
+ asset_name == o.asset_name &&
168
+ filing_date == o.filing_date &&
169
+ name == o.name &&
170
+ owner_type == o.owner_type &&
171
+ position == o.position &&
172
+ symbol == o.symbol &&
173
+ transaction_date == o.transaction_date &&
174
+ transaction_type == o.transaction_type
175
+ end
176
+
177
+ # @see the `==` method
178
+ # @param [Object] Object to be compared
179
+ def eql?(o)
180
+ self == o
181
+ end
182
+
183
+ # Calculates hash code according to all attributes.
184
+ # @return [Integer] Hash code
185
+ def hash
186
+ [amount_from, amount_to, asset_name, filing_date, name, owner_type, position, symbol, transaction_date, transaction_type].hash
187
+ end
188
+
189
+ # Builds the object from hash
190
+ # @param [Hash] attributes Model attributes in the form of hash
191
+ # @return [Object] Returns the model itself
192
+ def self.build_from_hash(attributes)
193
+ new.build_from_hash(attributes)
194
+ end
195
+
196
+ # Builds the object from hash
197
+ # @param [Hash] attributes Model attributes in the form of hash
198
+ # @return [Object] Returns the model itself
199
+ def build_from_hash(attributes)
200
+ return nil unless attributes.is_a?(Hash)
201
+ self.class.openapi_types.each_pair do |key, type|
202
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
203
+ self.send("#{key}=", nil)
204
+ elsif type =~ /\AArray<(.*)>/i
205
+ # check to ensure the input is an array given that the attribute
206
+ # is documented as an array but the input is not
207
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
208
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
209
+ end
210
+ elsif !attributes[self.class.attribute_map[key]].nil?
211
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
212
+ end
213
+ end
214
+
215
+ self
216
+ end
217
+
218
+ # Deserializes the data based on type
219
+ # @param string type Data type
220
+ # @param string value Value to be deserialized
221
+ # @return [Object] Deserialized data
222
+ def _deserialize(type, value)
223
+ case type.to_sym
224
+ when :Time
225
+ Time.parse(value)
226
+ when :Date
227
+ Date.parse(value)
228
+ when :String
229
+ value.to_s
230
+ when :Integer
231
+ value.to_i
232
+ when :Float
233
+ value.to_f
234
+ when :Boolean
235
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
236
+ true
237
+ else
238
+ false
239
+ end
240
+ when :Object
241
+ # generic object (usually a Hash), return directly
242
+ value
243
+ when /\AArray<(?<inner_type>.+)>\z/
244
+ inner_type = Regexp.last_match[:inner_type]
245
+ value.map { |v| _deserialize(inner_type, v) }
246
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
247
+ k_type = Regexp.last_match[:k_type]
248
+ v_type = Regexp.last_match[:v_type]
249
+ {}.tap do |hash|
250
+ value.each do |k, v|
251
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
252
+ end
253
+ end
254
+ else # model
255
+ # models (e.g. Pet) or oneOf
256
+ klass = FinnhubRuby.const_get(type)
257
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
258
+ end
259
+ end
260
+
261
+ # Returns the string representation of the object
262
+ # @return [String] String presentation of the object
263
+ def to_s
264
+ to_hash.to_s
265
+ end
266
+
267
+ # to_body is an alias to to_hash (backward compatibility)
268
+ # @return [Hash] Returns the object in the form of hash
269
+ def to_body
270
+ to_hash
271
+ end
272
+
273
+ # Returns the object in the form of hash
274
+ # @return [Hash] Returns the object in the form of hash
275
+ def to_hash
276
+ hash = {}
277
+ self.class.attribute_map.each_pair do |attr, param|
278
+ value = self.send(attr)
279
+ if value.nil?
280
+ is_nullable = self.class.openapi_nullable.include?(attr)
281
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
282
+ end
283
+
284
+ hash[param] = _to_hash(value)
285
+ end
286
+ hash
287
+ end
288
+
289
+ # Outputs non-array value in the form of hash
290
+ # For object, use to_hash. Otherwise, just return the value
291
+ # @param [Object] value Any valid value
292
+ # @return [Hash] Returns the value in the form of hash
293
+ def _to_hash(value)
294
+ if value.is_a?(Array)
295
+ value.compact.map { |v| _to_hash(v) }
296
+ elsif value.is_a?(Hash)
297
+ {}.tap do |hash|
298
+ value.each { |k, v| hash[k] = _to_hash(v) }
299
+ end
300
+ elsif value.respond_to? :to_hash
301
+ value.to_hash
302
+ else
303
+ value
304
+ end
305
+ end
306
+
307
+ end
308
+
309
+ end
@@ -39,6 +39,9 @@ module FinnhubRuby
39
39
  # Currency.
40
40
  attr_accessor :currency
41
41
 
42
+ # <p>Dividend frequency. Can be 1 of the following values:</p><ul> <li><code>0: Annually</code></li> <li><code>1: Monthly</code></li> <li><code>2: Quarterly</code></li> <li><code>3: Semi-annually</code></li> <li><code>4: Other/Unknown</code></li> <li><code>5: Bimonthly</code></li> <li><code>6: Trimesterly</code></li> <li><code>7: Weekly</code></li> </ul>
43
+ attr_accessor :freq
44
+
42
45
  # Attribute mapping from ruby-style variable name to JSON key.
43
46
  def self.attribute_map
44
47
  {
@@ -49,7 +52,8 @@ module FinnhubRuby
49
52
  :'pay_date' => :'payDate',
50
53
  :'record_date' => :'recordDate',
51
54
  :'declaration_date' => :'declarationDate',
52
- :'currency' => :'currency'
55
+ :'currency' => :'currency',
56
+ :'freq' => :'freq'
53
57
  }
54
58
  end
55
59
 
@@ -68,7 +72,8 @@ module FinnhubRuby
68
72
  :'pay_date' => :'Date',
69
73
  :'record_date' => :'Date',
70
74
  :'declaration_date' => :'Date',
71
- :'currency' => :'String'
75
+ :'currency' => :'String',
76
+ :'freq' => :'String'
72
77
  }
73
78
  end
74
79
 
@@ -124,6 +129,10 @@ module FinnhubRuby
124
129
  if attributes.key?(:'currency')
125
130
  self.currency = attributes[:'currency']
126
131
  end
132
+
133
+ if attributes.key?(:'freq')
134
+ self.freq = attributes[:'freq']
135
+ end
127
136
  end
128
137
 
129
138
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -151,7 +160,8 @@ module FinnhubRuby
151
160
  pay_date == o.pay_date &&
152
161
  record_date == o.record_date &&
153
162
  declaration_date == o.declaration_date &&
154
- currency == o.currency
163
+ currency == o.currency &&
164
+ freq == o.freq
155
165
  end
156
166
 
157
167
  # @see the `==` method
@@ -163,7 +173,7 @@ module FinnhubRuby
163
173
  # Calculates hash code according to all attributes.
164
174
  # @return [Integer] Hash code
165
175
  def hash
166
- [symbol, date, amount, adjusted_amount, pay_date, record_date, declaration_date, currency].hash
176
+ [symbol, date, amount, adjusted_amount, pay_date, record_date, declaration_date, currency, freq].hash
167
177
  end
168
178
 
169
179
  # Builds the object from hash
@@ -0,0 +1,271 @@
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.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module FinnhubRuby
17
+ class DocumentResponse
18
+ # AlphaResearch internal document id.
19
+ attr_accessor :document_id
20
+
21
+ # Title for this document.
22
+ attr_accessor :title
23
+
24
+ # Number of hit in this document
25
+ attr_accessor :hits
26
+
27
+ # Link to render this document
28
+ attr_accessor :url
29
+
30
+ # Format of this document (can be html or pdf)
31
+ attr_accessor :format
32
+
33
+ # Highlighted excerpts for this document
34
+ attr_accessor :excerpts
35
+
36
+ # Attribute mapping from ruby-style variable name to JSON key.
37
+ def self.attribute_map
38
+ {
39
+ :'document_id' => :'documentId',
40
+ :'title' => :'title',
41
+ :'hits' => :'hits',
42
+ :'url' => :'url',
43
+ :'format' => :'format',
44
+ :'excerpts' => :'excerpts'
45
+ }
46
+ end
47
+
48
+ # Returns all the JSON keys this model knows about
49
+ def self.acceptable_attributes
50
+ attribute_map.values
51
+ end
52
+
53
+ # Attribute type mapping.
54
+ def self.openapi_types
55
+ {
56
+ :'document_id' => :'String',
57
+ :'title' => :'String',
58
+ :'hits' => :'String',
59
+ :'url' => :'String',
60
+ :'format' => :'String',
61
+ :'excerpts' => :'Array<ExcerptResponse>'
62
+ }
63
+ end
64
+
65
+ # List of attributes with nullable: true
66
+ def self.openapi_nullable
67
+ Set.new([
68
+ ])
69
+ end
70
+
71
+ # Initializes the object
72
+ # @param [Hash] attributes Model attributes in the form of hash
73
+ def initialize(attributes = {})
74
+ if (!attributes.is_a?(Hash))
75
+ fail ArgumentError, "The input argument (attributes) must be a hash in `FinnhubRuby::DocumentResponse` initialize method"
76
+ end
77
+
78
+ # check to see if the attribute exists and convert string to symbol for hash key
79
+ attributes = attributes.each_with_object({}) { |(k, v), h|
80
+ if (!self.class.attribute_map.key?(k.to_sym))
81
+ fail ArgumentError, "`#{k}` is not a valid attribute in `FinnhubRuby::DocumentResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
82
+ end
83
+ h[k.to_sym] = v
84
+ }
85
+
86
+ if attributes.key?(:'document_id')
87
+ self.document_id = attributes[:'document_id']
88
+ end
89
+
90
+ if attributes.key?(:'title')
91
+ self.title = attributes[:'title']
92
+ end
93
+
94
+ if attributes.key?(:'hits')
95
+ self.hits = attributes[:'hits']
96
+ end
97
+
98
+ if attributes.key?(:'url')
99
+ self.url = attributes[:'url']
100
+ end
101
+
102
+ if attributes.key?(:'format')
103
+ self.format = attributes[:'format']
104
+ end
105
+
106
+ if attributes.key?(:'excerpts')
107
+ if (value = attributes[:'excerpts']).is_a?(Array)
108
+ self.excerpts = value
109
+ end
110
+ end
111
+ end
112
+
113
+ # Show invalid properties with the reasons. Usually used together with valid?
114
+ # @return Array for valid properties with the reasons
115
+ def list_invalid_properties
116
+ invalid_properties = Array.new
117
+ invalid_properties
118
+ end
119
+
120
+ # Check to see if the all the properties in the model are valid
121
+ # @return true if the model is valid
122
+ def valid?
123
+ true
124
+ end
125
+
126
+ # Checks equality by comparing each attribute.
127
+ # @param [Object] Object to be compared
128
+ def ==(o)
129
+ return true if self.equal?(o)
130
+ self.class == o.class &&
131
+ document_id == o.document_id &&
132
+ title == o.title &&
133
+ hits == o.hits &&
134
+ url == o.url &&
135
+ format == o.format &&
136
+ excerpts == o.excerpts
137
+ end
138
+
139
+ # @see the `==` method
140
+ # @param [Object] Object to be compared
141
+ def eql?(o)
142
+ self == o
143
+ end
144
+
145
+ # Calculates hash code according to all attributes.
146
+ # @return [Integer] Hash code
147
+ def hash
148
+ [document_id, title, hits, url, format, excerpts].hash
149
+ end
150
+
151
+ # Builds the object from hash
152
+ # @param [Hash] attributes Model attributes in the form of hash
153
+ # @return [Object] Returns the model itself
154
+ def self.build_from_hash(attributes)
155
+ new.build_from_hash(attributes)
156
+ end
157
+
158
+ # Builds the object from hash
159
+ # @param [Hash] attributes Model attributes in the form of hash
160
+ # @return [Object] Returns the model itself
161
+ def build_from_hash(attributes)
162
+ return nil unless attributes.is_a?(Hash)
163
+ self.class.openapi_types.each_pair do |key, type|
164
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
165
+ self.send("#{key}=", nil)
166
+ elsif type =~ /\AArray<(.*)>/i
167
+ # check to ensure the input is an array given that the attribute
168
+ # is documented as an array but the input is not
169
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
170
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
171
+ end
172
+ elsif !attributes[self.class.attribute_map[key]].nil?
173
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
174
+ end
175
+ end
176
+
177
+ self
178
+ end
179
+
180
+ # Deserializes the data based on type
181
+ # @param string type Data type
182
+ # @param string value Value to be deserialized
183
+ # @return [Object] Deserialized data
184
+ def _deserialize(type, value)
185
+ case type.to_sym
186
+ when :Time
187
+ Time.parse(value)
188
+ when :Date
189
+ Date.parse(value)
190
+ when :String
191
+ value.to_s
192
+ when :Integer
193
+ value.to_i
194
+ when :Float
195
+ value.to_f
196
+ when :Boolean
197
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
198
+ true
199
+ else
200
+ false
201
+ end
202
+ when :Object
203
+ # generic object (usually a Hash), return directly
204
+ value
205
+ when /\AArray<(?<inner_type>.+)>\z/
206
+ inner_type = Regexp.last_match[:inner_type]
207
+ value.map { |v| _deserialize(inner_type, v) }
208
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
209
+ k_type = Regexp.last_match[:k_type]
210
+ v_type = Regexp.last_match[:v_type]
211
+ {}.tap do |hash|
212
+ value.each do |k, v|
213
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
214
+ end
215
+ end
216
+ else # model
217
+ # models (e.g. Pet) or oneOf
218
+ klass = FinnhubRuby.const_get(type)
219
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
220
+ end
221
+ end
222
+
223
+ # Returns the string representation of the object
224
+ # @return [String] String presentation of the object
225
+ def to_s
226
+ to_hash.to_s
227
+ end
228
+
229
+ # to_body is an alias to to_hash (backward compatibility)
230
+ # @return [Hash] Returns the object in the form of hash
231
+ def to_body
232
+ to_hash
233
+ end
234
+
235
+ # Returns the object in the form of hash
236
+ # @return [Hash] Returns the object in the form of hash
237
+ def to_hash
238
+ hash = {}
239
+ self.class.attribute_map.each_pair do |attr, param|
240
+ value = self.send(attr)
241
+ if value.nil?
242
+ is_nullable = self.class.openapi_nullable.include?(attr)
243
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
244
+ end
245
+
246
+ hash[param] = _to_hash(value)
247
+ end
248
+ hash
249
+ end
250
+
251
+ # Outputs non-array value in the form of hash
252
+ # For object, use to_hash. Otherwise, just return the value
253
+ # @param [Object] value Any valid value
254
+ # @return [Hash] Returns the value in the form of hash
255
+ def _to_hash(value)
256
+ if value.is_a?(Array)
257
+ value.compact.map { |v| _to_hash(v) }
258
+ elsif value.is_a?(Hash)
259
+ {}.tap do |hash|
260
+ value.each { |k, v| hash[k] = _to_hash(v) }
261
+ end
262
+ elsif value.respond_to? :to_hash
263
+ value.to_hash
264
+ else
265
+ value
266
+ end
267
+ end
268
+
269
+ end
270
+
271
+ end
@@ -33,6 +33,12 @@ module FinnhubRuby
33
33
  # Company symbol.
34
34
  attr_accessor :symbol
35
35
 
36
+ # Earnings year.
37
+ attr_accessor :year
38
+
39
+ # Earnings quarter.
40
+ attr_accessor :quarter
41
+
36
42
  # Attribute mapping from ruby-style variable name to JSON key.
37
43
  def self.attribute_map
38
44
  {
@@ -41,7 +47,9 @@ module FinnhubRuby
41
47
  :'surprise' => :'surprise',
42
48
  :'surprise_percent' => :'surprisePercent',
43
49
  :'period' => :'period',
44
- :'symbol' => :'symbol'
50
+ :'symbol' => :'symbol',
51
+ :'year' => :'year',
52
+ :'quarter' => :'quarter'
45
53
  }
46
54
  end
47
55
 
@@ -58,7 +66,9 @@ module FinnhubRuby
58
66
  :'surprise' => :'Float',
59
67
  :'surprise_percent' => :'Float',
60
68
  :'period' => :'Date',
61
- :'symbol' => :'String'
69
+ :'symbol' => :'String',
70
+ :'year' => :'Integer',
71
+ :'quarter' => :'Integer'
62
72
  }
63
73
  end
64
74
 
@@ -106,6 +116,14 @@ module FinnhubRuby
106
116
  if attributes.key?(:'symbol')
107
117
  self.symbol = attributes[:'symbol']
108
118
  end
119
+
120
+ if attributes.key?(:'year')
121
+ self.year = attributes[:'year']
122
+ end
123
+
124
+ if attributes.key?(:'quarter')
125
+ self.quarter = attributes[:'quarter']
126
+ end
109
127
  end
110
128
 
111
129
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -131,7 +149,9 @@ module FinnhubRuby
131
149
  surprise == o.surprise &&
132
150
  surprise_percent == o.surprise_percent &&
133
151
  period == o.period &&
134
- symbol == o.symbol
152
+ symbol == o.symbol &&
153
+ year == o.year &&
154
+ quarter == o.quarter
135
155
  end
136
156
 
137
157
  # @see the `==` method
@@ -143,7 +163,7 @@ module FinnhubRuby
143
163
  # Calculates hash code according to all attributes.
144
164
  # @return [Integer] Hash code
145
165
  def hash
146
- [actual, estimate, surprise, surprise_percent, period, symbol].hash
166
+ [actual, estimate, surprise, surprise_percent, period, symbol, year, quarter].hash
147
167
  end
148
168
 
149
169
  # Builds the object from hash