finnhub_ruby 1.1.17 → 1.1.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/docs/BondTickData.md +34 -0
  4. data/docs/DefaultApi.md +543 -7
  5. data/docs/ETFProfileData.md +8 -2
  6. data/docs/InstitutionalOwnership.md +22 -0
  7. data/docs/InstitutionalOwnershipGroup.md +20 -0
  8. data/docs/InstitutionalOwnershipInfo.md +36 -0
  9. data/docs/InstitutionalPortfolio.md +22 -0
  10. data/docs/InstitutionalPortfolioGroup.md +22 -0
  11. data/docs/InstitutionalPortfolioInfo.md +38 -0
  12. data/docs/InstitutionalProfile.md +20 -0
  13. data/docs/InstitutionalProfileInfo.md +28 -0
  14. data/docs/IsinChange.md +22 -0
  15. data/docs/IsinChangeInfo.md +22 -0
  16. data/docs/PriceMetrics.md +20 -0
  17. data/docs/SymbolChange.md +22 -0
  18. data/docs/SymbolChangeInfo.md +22 -0
  19. data/finnhub_ruby-1.1.17.gem +0 -0
  20. data/lib/finnhub_ruby/api/default_api.rb +534 -4
  21. data/lib/finnhub_ruby/models/bond_tick_data.rb +311 -0
  22. data/lib/finnhub_ruby/models/etf_profile_data.rb +35 -5
  23. data/lib/finnhub_ruby/models/institutional_ownership.rb +241 -0
  24. data/lib/finnhub_ruby/models/institutional_ownership_group.rb +231 -0
  25. data/lib/finnhub_ruby/models/institutional_ownership_info.rb +309 -0
  26. data/lib/finnhub_ruby/models/institutional_portfolio.rb +241 -0
  27. data/lib/finnhub_ruby/models/institutional_portfolio_group.rb +241 -0
  28. data/lib/finnhub_ruby/models/institutional_portfolio_info.rb +319 -0
  29. data/lib/finnhub_ruby/models/institutional_profile.rb +231 -0
  30. data/lib/finnhub_ruby/models/institutional_profile_info.rb +269 -0
  31. data/lib/finnhub_ruby/models/isin_change.rb +241 -0
  32. data/lib/finnhub_ruby/models/isin_change_info.rb +239 -0
  33. data/lib/finnhub_ruby/models/price_metrics.rb +228 -0
  34. data/lib/finnhub_ruby/models/symbol_change.rb +241 -0
  35. data/lib/finnhub_ruby/models/symbol_change_info.rb +239 -0
  36. data/lib/finnhub_ruby/version.rb +1 -1
  37. data/lib/finnhub_ruby.rb +14 -0
  38. data/spec/models/bond_tick_data_spec.rb +82 -0
  39. data/spec/models/institutional_ownership_group_spec.rb +40 -0
  40. data/spec/models/institutional_ownership_info_spec.rb +88 -0
  41. data/spec/models/institutional_ownership_spec.rb +46 -0
  42. data/spec/models/institutional_portfolio_group_spec.rb +46 -0
  43. data/spec/models/institutional_portfolio_info_spec.rb +94 -0
  44. data/spec/models/institutional_portfolio_spec.rb +46 -0
  45. data/spec/models/institutional_profile_info_spec.rb +64 -0
  46. data/spec/models/institutional_profile_spec.rb +40 -0
  47. data/spec/models/isin_change_info_spec.rb +46 -0
  48. data/spec/models/isin_change_spec.rb +46 -0
  49. data/spec/models/price_metrics_spec.rb +40 -0
  50. data/spec/models/symbol_change_info_spec.rb +46 -0
  51. data/spec/models/symbol_change_spec.rb +46 -0
  52. metadata +59 -2
@@ -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.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module FinnhubRuby
17
+ class InstitutionalOwnershipGroup
18
+ # Report date.
19
+ attr_accessor :report_date
20
+
21
+ # Array of institutional investors.
22
+ attr_accessor :ownership
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'report_date' => :'reportDate',
28
+ :'ownership' => :'ownership'
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
+ :'report_date' => :'String',
41
+ :'ownership' => :'Array<InstitutionalOwnershipInfo>'
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::InstitutionalOwnershipGroup` 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::InstitutionalOwnershipGroup`. 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?(:'report_date')
67
+ self.report_date = attributes[:'report_date']
68
+ end
69
+
70
+ if attributes.key?(:'ownership')
71
+ if (value = attributes[:'ownership']).is_a?(Array)
72
+ self.ownership = 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
+ report_date == o.report_date &&
96
+ ownership == o.ownership
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
+ [report_date, ownership].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,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 InstitutionalOwnershipInfo
18
+ # Investor's company CIK.
19
+ attr_accessor :cik
20
+
21
+ # Firm's name.
22
+ attr_accessor :name
23
+
24
+ # <code>put</code> or <code>call</code> for options.
25
+ attr_accessor :put_call
26
+
27
+ # Number of shares change.
28
+ attr_accessor :change
29
+
30
+ # Number of shares with no voting rights.
31
+ attr_accessor :no_voting
32
+
33
+ # Percentage of portfolio.
34
+ attr_accessor :percentage
35
+
36
+ # News score.
37
+ attr_accessor :share
38
+
39
+ # Number of shares with shared voting rights.
40
+ attr_accessor :shared_voting
41
+
42
+ # Number of shares with sole voting rights.
43
+ attr_accessor :sole_voting
44
+
45
+ # Position value.
46
+ attr_accessor :value
47
+
48
+ # Attribute mapping from ruby-style variable name to JSON key.
49
+ def self.attribute_map
50
+ {
51
+ :'cik' => :'cik',
52
+ :'name' => :'name',
53
+ :'put_call' => :'putCall',
54
+ :'change' => :'change',
55
+ :'no_voting' => :'noVoting',
56
+ :'percentage' => :'percentage',
57
+ :'share' => :'share',
58
+ :'shared_voting' => :'sharedVoting',
59
+ :'sole_voting' => :'soleVoting',
60
+ :'value' => :'value'
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
+ :'cik' => :'String',
73
+ :'name' => :'String',
74
+ :'put_call' => :'String',
75
+ :'change' => :'Float',
76
+ :'no_voting' => :'Float',
77
+ :'percentage' => :'Float',
78
+ :'share' => :'Float',
79
+ :'shared_voting' => :'Float',
80
+ :'sole_voting' => :'Float',
81
+ :'value' => :'Float'
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::InstitutionalOwnershipInfo` 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::InstitutionalOwnershipInfo`. 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?(:'cik')
107
+ self.cik = attributes[:'cik']
108
+ end
109
+
110
+ if attributes.key?(:'name')
111
+ self.name = attributes[:'name']
112
+ end
113
+
114
+ if attributes.key?(:'put_call')
115
+ self.put_call = attributes[:'put_call']
116
+ end
117
+
118
+ if attributes.key?(:'change')
119
+ self.change = attributes[:'change']
120
+ end
121
+
122
+ if attributes.key?(:'no_voting')
123
+ self.no_voting = attributes[:'no_voting']
124
+ end
125
+
126
+ if attributes.key?(:'percentage')
127
+ self.percentage = attributes[:'percentage']
128
+ end
129
+
130
+ if attributes.key?(:'share')
131
+ self.share = attributes[:'share']
132
+ end
133
+
134
+ if attributes.key?(:'shared_voting')
135
+ self.shared_voting = attributes[:'shared_voting']
136
+ end
137
+
138
+ if attributes.key?(:'sole_voting')
139
+ self.sole_voting = attributes[:'sole_voting']
140
+ end
141
+
142
+ if attributes.key?(:'value')
143
+ self.value = attributes[:'value']
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
+ cik == o.cik &&
166
+ name == o.name &&
167
+ put_call == o.put_call &&
168
+ change == o.change &&
169
+ no_voting == o.no_voting &&
170
+ percentage == o.percentage &&
171
+ share == o.share &&
172
+ shared_voting == o.shared_voting &&
173
+ sole_voting == o.sole_voting &&
174
+ value == o.value
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
+ [cik, name, put_call, change, no_voting, percentage, share, shared_voting, sole_voting, value].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