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