finnhub_ruby 1.1.17 → 1.1.19

Sign up to get free protection for your applications and to get access to all the features.
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,339 @@
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 FilingResponse
18
+ # Filing Id in Alpharesearch platform
19
+ attr_accessor :filing_id
20
+
21
+ # Filing title
22
+ attr_accessor :title
23
+
24
+ # Id of the entity submitted the filing
25
+ attr_accessor :filer_id
26
+
27
+ # List of symbol associate with this filing
28
+ attr_accessor :symbol
29
+
30
+ # Filer name
31
+ attr_accessor :name
32
+
33
+ # Date the filing is submitted.
34
+ attr_accessor :acceptance_date
35
+
36
+ # Date the filing is make available to the public
37
+ attr_accessor :filed_date
38
+
39
+ # Date as which the filing is reported
40
+ attr_accessor :report_date
41
+
42
+ # Filing Form
43
+ attr_accessor :form
44
+
45
+ # Amendment
46
+ attr_accessor :amend
47
+
48
+ # Filing Source
49
+ attr_accessor :source
50
+
51
+ # Estimate number of page when printing
52
+ attr_accessor :page_count
53
+
54
+ # Number of document in this filing
55
+ attr_accessor :document_count
56
+
57
+ # Attribute mapping from ruby-style variable name to JSON key.
58
+ def self.attribute_map
59
+ {
60
+ :'filing_id' => :'filingId',
61
+ :'title' => :'title',
62
+ :'filer_id' => :'filerId',
63
+ :'symbol' => :'symbol',
64
+ :'name' => :'name',
65
+ :'acceptance_date' => :'acceptanceDate',
66
+ :'filed_date' => :'filedDate',
67
+ :'report_date' => :'reportDate',
68
+ :'form' => :'form',
69
+ :'amend' => :'amend',
70
+ :'source' => :'source',
71
+ :'page_count' => :'pageCount',
72
+ :'document_count' => :'documentCount'
73
+ }
74
+ end
75
+
76
+ # Returns all the JSON keys this model knows about
77
+ def self.acceptable_attributes
78
+ attribute_map.values
79
+ end
80
+
81
+ # Attribute type mapping.
82
+ def self.openapi_types
83
+ {
84
+ :'filing_id' => :'String',
85
+ :'title' => :'String',
86
+ :'filer_id' => :'String',
87
+ :'symbol' => :'Object',
88
+ :'name' => :'String',
89
+ :'acceptance_date' => :'String',
90
+ :'filed_date' => :'String',
91
+ :'report_date' => :'String',
92
+ :'form' => :'String',
93
+ :'amend' => :'Boolean',
94
+ :'source' => :'String',
95
+ :'page_count' => :'Integer',
96
+ :'document_count' => :'Integer'
97
+ }
98
+ end
99
+
100
+ # List of attributes with nullable: true
101
+ def self.openapi_nullable
102
+ Set.new([
103
+ ])
104
+ end
105
+
106
+ # Initializes the object
107
+ # @param [Hash] attributes Model attributes in the form of hash
108
+ def initialize(attributes = {})
109
+ if (!attributes.is_a?(Hash))
110
+ fail ArgumentError, "The input argument (attributes) must be a hash in `FinnhubRuby::FilingResponse` initialize method"
111
+ end
112
+
113
+ # check to see if the attribute exists and convert string to symbol for hash key
114
+ attributes = attributes.each_with_object({}) { |(k, v), h|
115
+ if (!self.class.attribute_map.key?(k.to_sym))
116
+ fail ArgumentError, "`#{k}` is not a valid attribute in `FinnhubRuby::FilingResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
117
+ end
118
+ h[k.to_sym] = v
119
+ }
120
+
121
+ if attributes.key?(:'filing_id')
122
+ self.filing_id = attributes[:'filing_id']
123
+ end
124
+
125
+ if attributes.key?(:'title')
126
+ self.title = attributes[:'title']
127
+ end
128
+
129
+ if attributes.key?(:'filer_id')
130
+ self.filer_id = attributes[:'filer_id']
131
+ end
132
+
133
+ if attributes.key?(:'symbol')
134
+ self.symbol = attributes[:'symbol']
135
+ end
136
+
137
+ if attributes.key?(:'name')
138
+ self.name = attributes[:'name']
139
+ end
140
+
141
+ if attributes.key?(:'acceptance_date')
142
+ self.acceptance_date = attributes[:'acceptance_date']
143
+ end
144
+
145
+ if attributes.key?(:'filed_date')
146
+ self.filed_date = attributes[:'filed_date']
147
+ end
148
+
149
+ if attributes.key?(:'report_date')
150
+ self.report_date = attributes[:'report_date']
151
+ end
152
+
153
+ if attributes.key?(:'form')
154
+ self.form = attributes[:'form']
155
+ end
156
+
157
+ if attributes.key?(:'amend')
158
+ self.amend = attributes[:'amend']
159
+ end
160
+
161
+ if attributes.key?(:'source')
162
+ self.source = attributes[:'source']
163
+ end
164
+
165
+ if attributes.key?(:'page_count')
166
+ self.page_count = attributes[:'page_count']
167
+ end
168
+
169
+ if attributes.key?(:'document_count')
170
+ self.document_count = attributes[:'document_count']
171
+ end
172
+ end
173
+
174
+ # Show invalid properties with the reasons. Usually used together with valid?
175
+ # @return Array for valid properties with the reasons
176
+ def list_invalid_properties
177
+ invalid_properties = Array.new
178
+ invalid_properties
179
+ end
180
+
181
+ # Check to see if the all the properties in the model are valid
182
+ # @return true if the model is valid
183
+ def valid?
184
+ true
185
+ end
186
+
187
+ # Checks equality by comparing each attribute.
188
+ # @param [Object] Object to be compared
189
+ def ==(o)
190
+ return true if self.equal?(o)
191
+ self.class == o.class &&
192
+ filing_id == o.filing_id &&
193
+ title == o.title &&
194
+ filer_id == o.filer_id &&
195
+ symbol == o.symbol &&
196
+ name == o.name &&
197
+ acceptance_date == o.acceptance_date &&
198
+ filed_date == o.filed_date &&
199
+ report_date == o.report_date &&
200
+ form == o.form &&
201
+ amend == o.amend &&
202
+ source == o.source &&
203
+ page_count == o.page_count &&
204
+ document_count == o.document_count
205
+ end
206
+
207
+ # @see the `==` method
208
+ # @param [Object] Object to be compared
209
+ def eql?(o)
210
+ self == o
211
+ end
212
+
213
+ # Calculates hash code according to all attributes.
214
+ # @return [Integer] Hash code
215
+ def hash
216
+ [filing_id, title, filer_id, symbol, name, acceptance_date, filed_date, report_date, form, amend, source, page_count, document_count].hash
217
+ end
218
+
219
+ # Builds the object from hash
220
+ # @param [Hash] attributes Model attributes in the form of hash
221
+ # @return [Object] Returns the model itself
222
+ def self.build_from_hash(attributes)
223
+ new.build_from_hash(attributes)
224
+ end
225
+
226
+ # Builds the object from hash
227
+ # @param [Hash] attributes Model attributes in the form of hash
228
+ # @return [Object] Returns the model itself
229
+ def build_from_hash(attributes)
230
+ return nil unless attributes.is_a?(Hash)
231
+ self.class.openapi_types.each_pair do |key, type|
232
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
233
+ self.send("#{key}=", nil)
234
+ elsif type =~ /\AArray<(.*)>/i
235
+ # check to ensure the input is an array given that the attribute
236
+ # is documented as an array but the input is not
237
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
238
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
239
+ end
240
+ elsif !attributes[self.class.attribute_map[key]].nil?
241
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
242
+ end
243
+ end
244
+
245
+ self
246
+ end
247
+
248
+ # Deserializes the data based on type
249
+ # @param string type Data type
250
+ # @param string value Value to be deserialized
251
+ # @return [Object] Deserialized data
252
+ def _deserialize(type, value)
253
+ case type.to_sym
254
+ when :Time
255
+ Time.parse(value)
256
+ when :Date
257
+ Date.parse(value)
258
+ when :String
259
+ value.to_s
260
+ when :Integer
261
+ value.to_i
262
+ when :Float
263
+ value.to_f
264
+ when :Boolean
265
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
266
+ true
267
+ else
268
+ false
269
+ end
270
+ when :Object
271
+ # generic object (usually a Hash), return directly
272
+ value
273
+ when /\AArray<(?<inner_type>.+)>\z/
274
+ inner_type = Regexp.last_match[:inner_type]
275
+ value.map { |v| _deserialize(inner_type, v) }
276
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
277
+ k_type = Regexp.last_match[:k_type]
278
+ v_type = Regexp.last_match[:v_type]
279
+ {}.tap do |hash|
280
+ value.each do |k, v|
281
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
282
+ end
283
+ end
284
+ else # model
285
+ # models (e.g. Pet) or oneOf
286
+ klass = FinnhubRuby.const_get(type)
287
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
288
+ end
289
+ end
290
+
291
+ # Returns the string representation of the object
292
+ # @return [String] String presentation of the object
293
+ def to_s
294
+ to_hash.to_s
295
+ end
296
+
297
+ # to_body is an alias to to_hash (backward compatibility)
298
+ # @return [Hash] Returns the object in the form of hash
299
+ def to_body
300
+ to_hash
301
+ end
302
+
303
+ # Returns the object in the form of hash
304
+ # @return [Hash] Returns the object in the form of hash
305
+ def to_hash
306
+ hash = {}
307
+ self.class.attribute_map.each_pair do |attr, param|
308
+ value = self.send(attr)
309
+ if value.nil?
310
+ is_nullable = self.class.openapi_nullable.include?(attr)
311
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
312
+ end
313
+
314
+ hash[param] = _to_hash(value)
315
+ end
316
+ hash
317
+ end
318
+
319
+ # Outputs non-array value in the form of hash
320
+ # For object, use to_hash. Otherwise, just return the value
321
+ # @param [Object] value Any valid value
322
+ # @return [Hash] Returns the value in the form of hash
323
+ def _to_hash(value)
324
+ if value.is_a?(Array)
325
+ value.compact.map { |v| _to_hash(v) }
326
+ elsif value.is_a?(Hash)
327
+ {}.tap do |hash|
328
+ value.each { |k, v| hash[k] = _to_hash(v) }
329
+ end
330
+ elsif value.respond_to? :to_hash
331
+ value.to_hash
332
+ else
333
+ value
334
+ end
335
+ end
336
+
337
+ end
338
+
339
+ end
@@ -0,0 +1,351 @@
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 InFilingResponse
18
+ # Filing Id in Alpharesearch platform
19
+ attr_accessor :filing_id
20
+
21
+ # Filing title
22
+ attr_accessor :title
23
+
24
+ # Id of the entity submitted the filing
25
+ attr_accessor :filer_id
26
+
27
+ # List of symbol associate with this filing
28
+ attr_accessor :symbol
29
+
30
+ # Filer name
31
+ attr_accessor :name
32
+
33
+ # Date the filing is submitted.
34
+ attr_accessor :acceptance_date
35
+
36
+ # Date the filing is make available to the public
37
+ attr_accessor :filed_date
38
+
39
+ # Date as which the filing is reported
40
+ attr_accessor :report_date
41
+
42
+ # Filing Form
43
+ attr_accessor :form
44
+
45
+ # Amendment
46
+ attr_accessor :amend
47
+
48
+ # Filing Source
49
+ attr_accessor :source
50
+
51
+ # Estimate number of page when printing
52
+ attr_accessor :page_count
53
+
54
+ # Number of document in this filing
55
+ attr_accessor :document_count
56
+
57
+ # Document for this filing.
58
+ attr_accessor :documents
59
+
60
+ # Attribute mapping from ruby-style variable name to JSON key.
61
+ def self.attribute_map
62
+ {
63
+ :'filing_id' => :'filingId',
64
+ :'title' => :'title',
65
+ :'filer_id' => :'filerId',
66
+ :'symbol' => :'symbol',
67
+ :'name' => :'name',
68
+ :'acceptance_date' => :'acceptanceDate',
69
+ :'filed_date' => :'filedDate',
70
+ :'report_date' => :'reportDate',
71
+ :'form' => :'form',
72
+ :'amend' => :'amend',
73
+ :'source' => :'source',
74
+ :'page_count' => :'pageCount',
75
+ :'document_count' => :'documentCount',
76
+ :'documents' => :'documents'
77
+ }
78
+ end
79
+
80
+ # Returns all the JSON keys this model knows about
81
+ def self.acceptable_attributes
82
+ attribute_map.values
83
+ end
84
+
85
+ # Attribute type mapping.
86
+ def self.openapi_types
87
+ {
88
+ :'filing_id' => :'String',
89
+ :'title' => :'String',
90
+ :'filer_id' => :'String',
91
+ :'symbol' => :'Object',
92
+ :'name' => :'String',
93
+ :'acceptance_date' => :'String',
94
+ :'filed_date' => :'String',
95
+ :'report_date' => :'String',
96
+ :'form' => :'String',
97
+ :'amend' => :'Boolean',
98
+ :'source' => :'String',
99
+ :'page_count' => :'Integer',
100
+ :'document_count' => :'Integer',
101
+ :'documents' => :'Array<DocumentResponse>'
102
+ }
103
+ end
104
+
105
+ # List of attributes with nullable: true
106
+ def self.openapi_nullable
107
+ Set.new([
108
+ ])
109
+ end
110
+
111
+ # Initializes the object
112
+ # @param [Hash] attributes Model attributes in the form of hash
113
+ def initialize(attributes = {})
114
+ if (!attributes.is_a?(Hash))
115
+ fail ArgumentError, "The input argument (attributes) must be a hash in `FinnhubRuby::InFilingResponse` initialize method"
116
+ end
117
+
118
+ # check to see if the attribute exists and convert string to symbol for hash key
119
+ attributes = attributes.each_with_object({}) { |(k, v), h|
120
+ if (!self.class.attribute_map.key?(k.to_sym))
121
+ fail ArgumentError, "`#{k}` is not a valid attribute in `FinnhubRuby::InFilingResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
122
+ end
123
+ h[k.to_sym] = v
124
+ }
125
+
126
+ if attributes.key?(:'filing_id')
127
+ self.filing_id = attributes[:'filing_id']
128
+ end
129
+
130
+ if attributes.key?(:'title')
131
+ self.title = attributes[:'title']
132
+ end
133
+
134
+ if attributes.key?(:'filer_id')
135
+ self.filer_id = attributes[:'filer_id']
136
+ end
137
+
138
+ if attributes.key?(:'symbol')
139
+ self.symbol = attributes[:'symbol']
140
+ end
141
+
142
+ if attributes.key?(:'name')
143
+ self.name = attributes[:'name']
144
+ end
145
+
146
+ if attributes.key?(:'acceptance_date')
147
+ self.acceptance_date = attributes[:'acceptance_date']
148
+ end
149
+
150
+ if attributes.key?(:'filed_date')
151
+ self.filed_date = attributes[:'filed_date']
152
+ end
153
+
154
+ if attributes.key?(:'report_date')
155
+ self.report_date = attributes[:'report_date']
156
+ end
157
+
158
+ if attributes.key?(:'form')
159
+ self.form = attributes[:'form']
160
+ end
161
+
162
+ if attributes.key?(:'amend')
163
+ self.amend = attributes[:'amend']
164
+ end
165
+
166
+ if attributes.key?(:'source')
167
+ self.source = attributes[:'source']
168
+ end
169
+
170
+ if attributes.key?(:'page_count')
171
+ self.page_count = attributes[:'page_count']
172
+ end
173
+
174
+ if attributes.key?(:'document_count')
175
+ self.document_count = attributes[:'document_count']
176
+ end
177
+
178
+ if attributes.key?(:'documents')
179
+ if (value = attributes[:'documents']).is_a?(Array)
180
+ self.documents = value
181
+ end
182
+ end
183
+ end
184
+
185
+ # Show invalid properties with the reasons. Usually used together with valid?
186
+ # @return Array for valid properties with the reasons
187
+ def list_invalid_properties
188
+ invalid_properties = Array.new
189
+ invalid_properties
190
+ end
191
+
192
+ # Check to see if the all the properties in the model are valid
193
+ # @return true if the model is valid
194
+ def valid?
195
+ true
196
+ end
197
+
198
+ # Checks equality by comparing each attribute.
199
+ # @param [Object] Object to be compared
200
+ def ==(o)
201
+ return true if self.equal?(o)
202
+ self.class == o.class &&
203
+ filing_id == o.filing_id &&
204
+ title == o.title &&
205
+ filer_id == o.filer_id &&
206
+ symbol == o.symbol &&
207
+ name == o.name &&
208
+ acceptance_date == o.acceptance_date &&
209
+ filed_date == o.filed_date &&
210
+ report_date == o.report_date &&
211
+ form == o.form &&
212
+ amend == o.amend &&
213
+ source == o.source &&
214
+ page_count == o.page_count &&
215
+ document_count == o.document_count &&
216
+ documents == o.documents
217
+ end
218
+
219
+ # @see the `==` method
220
+ # @param [Object] Object to be compared
221
+ def eql?(o)
222
+ self == o
223
+ end
224
+
225
+ # Calculates hash code according to all attributes.
226
+ # @return [Integer] Hash code
227
+ def hash
228
+ [filing_id, title, filer_id, symbol, name, acceptance_date, filed_date, report_date, form, amend, source, page_count, document_count, documents].hash
229
+ end
230
+
231
+ # Builds the object from hash
232
+ # @param [Hash] attributes Model attributes in the form of hash
233
+ # @return [Object] Returns the model itself
234
+ def self.build_from_hash(attributes)
235
+ new.build_from_hash(attributes)
236
+ end
237
+
238
+ # Builds the object from hash
239
+ # @param [Hash] attributes Model attributes in the form of hash
240
+ # @return [Object] Returns the model itself
241
+ def build_from_hash(attributes)
242
+ return nil unless attributes.is_a?(Hash)
243
+ self.class.openapi_types.each_pair do |key, type|
244
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
245
+ self.send("#{key}=", nil)
246
+ elsif type =~ /\AArray<(.*)>/i
247
+ # check to ensure the input is an array given that the attribute
248
+ # is documented as an array but the input is not
249
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
250
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
251
+ end
252
+ elsif !attributes[self.class.attribute_map[key]].nil?
253
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
254
+ end
255
+ end
256
+
257
+ self
258
+ end
259
+
260
+ # Deserializes the data based on type
261
+ # @param string type Data type
262
+ # @param string value Value to be deserialized
263
+ # @return [Object] Deserialized data
264
+ def _deserialize(type, value)
265
+ case type.to_sym
266
+ when :Time
267
+ Time.parse(value)
268
+ when :Date
269
+ Date.parse(value)
270
+ when :String
271
+ value.to_s
272
+ when :Integer
273
+ value.to_i
274
+ when :Float
275
+ value.to_f
276
+ when :Boolean
277
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
278
+ true
279
+ else
280
+ false
281
+ end
282
+ when :Object
283
+ # generic object (usually a Hash), return directly
284
+ value
285
+ when /\AArray<(?<inner_type>.+)>\z/
286
+ inner_type = Regexp.last_match[:inner_type]
287
+ value.map { |v| _deserialize(inner_type, v) }
288
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
289
+ k_type = Regexp.last_match[:k_type]
290
+ v_type = Regexp.last_match[:v_type]
291
+ {}.tap do |hash|
292
+ value.each do |k, v|
293
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
294
+ end
295
+ end
296
+ else # model
297
+ # models (e.g. Pet) or oneOf
298
+ klass = FinnhubRuby.const_get(type)
299
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
300
+ end
301
+ end
302
+
303
+ # Returns the string representation of the object
304
+ # @return [String] String presentation of the object
305
+ def to_s
306
+ to_hash.to_s
307
+ end
308
+
309
+ # to_body is an alias to to_hash (backward compatibility)
310
+ # @return [Hash] Returns the object in the form of hash
311
+ def to_body
312
+ to_hash
313
+ end
314
+
315
+ # Returns the object in the form of hash
316
+ # @return [Hash] Returns the object in the form of hash
317
+ def to_hash
318
+ hash = {}
319
+ self.class.attribute_map.each_pair do |attr, param|
320
+ value = self.send(attr)
321
+ if value.nil?
322
+ is_nullable = self.class.openapi_nullable.include?(attr)
323
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
324
+ end
325
+
326
+ hash[param] = _to_hash(value)
327
+ end
328
+ hash
329
+ end
330
+
331
+ # Outputs non-array value in the form of hash
332
+ # For object, use to_hash. Otherwise, just return the value
333
+ # @param [Object] value Any valid value
334
+ # @return [Hash] Returns the value in the form of hash
335
+ def _to_hash(value)
336
+ if value.is_a?(Array)
337
+ value.compact.map { |v| _to_hash(v) }
338
+ elsif value.is_a?(Hash)
339
+ {}.tap do |hash|
340
+ value.each { |k, v| hash[k] = _to_hash(v) }
341
+ end
342
+ elsif value.respond_to? :to_hash
343
+ value.to_hash
344
+ else
345
+ value
346
+ end
347
+ end
348
+
349
+ end
350
+
351
+ end