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.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/docs/BondTickData.md +34 -0
- data/docs/DefaultApi.md +543 -7
- data/docs/ETFProfileData.md +8 -2
- data/docs/InstitutionalOwnership.md +22 -0
- data/docs/InstitutionalOwnershipGroup.md +20 -0
- data/docs/InstitutionalOwnershipInfo.md +36 -0
- data/docs/InstitutionalPortfolio.md +22 -0
- data/docs/InstitutionalPortfolioGroup.md +22 -0
- data/docs/InstitutionalPortfolioInfo.md +38 -0
- data/docs/InstitutionalProfile.md +20 -0
- data/docs/InstitutionalProfileInfo.md +28 -0
- data/docs/IsinChange.md +22 -0
- data/docs/IsinChangeInfo.md +22 -0
- data/docs/PriceMetrics.md +20 -0
- data/docs/SymbolChange.md +22 -0
- data/docs/SymbolChangeInfo.md +22 -0
- data/finnhub_ruby-1.1.17.gem +0 -0
- data/lib/finnhub_ruby/api/default_api.rb +534 -4
- data/lib/finnhub_ruby/models/bond_tick_data.rb +311 -0
- data/lib/finnhub_ruby/models/etf_profile_data.rb +35 -5
- data/lib/finnhub_ruby/models/institutional_ownership.rb +241 -0
- data/lib/finnhub_ruby/models/institutional_ownership_group.rb +231 -0
- data/lib/finnhub_ruby/models/institutional_ownership_info.rb +309 -0
- data/lib/finnhub_ruby/models/institutional_portfolio.rb +241 -0
- data/lib/finnhub_ruby/models/institutional_portfolio_group.rb +241 -0
- data/lib/finnhub_ruby/models/institutional_portfolio_info.rb +319 -0
- data/lib/finnhub_ruby/models/institutional_profile.rb +231 -0
- data/lib/finnhub_ruby/models/institutional_profile_info.rb +269 -0
- data/lib/finnhub_ruby/models/isin_change.rb +241 -0
- data/lib/finnhub_ruby/models/isin_change_info.rb +239 -0
- data/lib/finnhub_ruby/models/price_metrics.rb +228 -0
- data/lib/finnhub_ruby/models/symbol_change.rb +241 -0
- data/lib/finnhub_ruby/models/symbol_change_info.rb +239 -0
- data/lib/finnhub_ruby/version.rb +1 -1
- data/lib/finnhub_ruby.rb +14 -0
- data/spec/models/bond_tick_data_spec.rb +82 -0
- data/spec/models/institutional_ownership_group_spec.rb +40 -0
- data/spec/models/institutional_ownership_info_spec.rb +88 -0
- data/spec/models/institutional_ownership_spec.rb +46 -0
- data/spec/models/institutional_portfolio_group_spec.rb +46 -0
- data/spec/models/institutional_portfolio_info_spec.rb +94 -0
- data/spec/models/institutional_portfolio_spec.rb +46 -0
- data/spec/models/institutional_profile_info_spec.rb +64 -0
- data/spec/models/institutional_profile_spec.rb +40 -0
- data/spec/models/isin_change_info_spec.rb +46 -0
- data/spec/models/isin_change_spec.rb +46 -0
- data/spec/models/price_metrics_spec.rb +40 -0
- data/spec/models/symbol_change_info_spec.rb +46 -0
- data/spec/models/symbol_change_spec.rb +46 -0
- metadata +59 -2
@@ -0,0 +1,311 @@
|
|
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 BondTickData
|
18
|
+
# Number of ticks skipped.
|
19
|
+
attr_accessor :skip
|
20
|
+
|
21
|
+
# Number of ticks returned. If <code>count</code> < <code>limit</code>, all data for that date has been returned.
|
22
|
+
attr_accessor :count
|
23
|
+
|
24
|
+
# Total number of ticks for that date.
|
25
|
+
attr_accessor :total
|
26
|
+
|
27
|
+
# List of volume data.
|
28
|
+
attr_accessor :v
|
29
|
+
|
30
|
+
# List of price data.
|
31
|
+
attr_accessor :p
|
32
|
+
|
33
|
+
# List of timestamp in UNIX ms.
|
34
|
+
attr_accessor :t
|
35
|
+
|
36
|
+
# List of values showing the side (Buy/sell) of each trade. List of supported values: <a target=\"_blank\" href=\"https://docs.google.com/spreadsheets/d/1O3aueXSPOqo7Iuyz4PqDG6yZunHsX8BTefZ2kFk5pz4/edit?usp=sharing\",>here</a>
|
37
|
+
attr_accessor :si
|
38
|
+
|
39
|
+
# List of values showing the counterparty of each trade. List of supported values: <a target=\"_blank\" href=\"https://docs.google.com/spreadsheets/d/1O3aueXSPOqo7Iuyz4PqDG6yZunHsX8BTefZ2kFk5pz4/edit?usp=sharing\",>here</a>
|
40
|
+
attr_accessor :cp
|
41
|
+
|
42
|
+
# List of trade conditions. A comprehensive list of trade conditions code can be found <a target=\"_blank\" href=\"https://docs.google.com/spreadsheets/d/1O3aueXSPOqo7Iuyz4PqDG6yZunHsX8BTefZ2kFk5pz4/edit?usp=sharing\">here</a>
|
43
|
+
attr_accessor :c
|
44
|
+
|
45
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
46
|
+
def self.attribute_map
|
47
|
+
{
|
48
|
+
:'skip' => :'skip',
|
49
|
+
:'count' => :'count',
|
50
|
+
:'total' => :'total',
|
51
|
+
:'v' => :'v',
|
52
|
+
:'p' => :'p',
|
53
|
+
:'t' => :'t',
|
54
|
+
:'si' => :'si',
|
55
|
+
:'cp' => :'cp',
|
56
|
+
:'c' => :'c'
|
57
|
+
}
|
58
|
+
end
|
59
|
+
|
60
|
+
# Returns all the JSON keys this model knows about
|
61
|
+
def self.acceptable_attributes
|
62
|
+
attribute_map.values
|
63
|
+
end
|
64
|
+
|
65
|
+
# Attribute type mapping.
|
66
|
+
def self.openapi_types
|
67
|
+
{
|
68
|
+
:'skip' => :'Integer',
|
69
|
+
:'count' => :'Integer',
|
70
|
+
:'total' => :'Integer',
|
71
|
+
:'v' => :'Array<Float>',
|
72
|
+
:'p' => :'Array<Float>',
|
73
|
+
:'t' => :'Array<Integer>',
|
74
|
+
:'si' => :'Array<String>',
|
75
|
+
:'cp' => :'Array<String>',
|
76
|
+
:'c' => :'Array<Array<String>>'
|
77
|
+
}
|
78
|
+
end
|
79
|
+
|
80
|
+
# List of attributes with nullable: true
|
81
|
+
def self.openapi_nullable
|
82
|
+
Set.new([
|
83
|
+
])
|
84
|
+
end
|
85
|
+
|
86
|
+
# Initializes the object
|
87
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
88
|
+
def initialize(attributes = {})
|
89
|
+
if (!attributes.is_a?(Hash))
|
90
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `FinnhubRuby::BondTickData` initialize method"
|
91
|
+
end
|
92
|
+
|
93
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
94
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
95
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
96
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `FinnhubRuby::BondTickData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
97
|
+
end
|
98
|
+
h[k.to_sym] = v
|
99
|
+
}
|
100
|
+
|
101
|
+
if attributes.key?(:'skip')
|
102
|
+
self.skip = attributes[:'skip']
|
103
|
+
end
|
104
|
+
|
105
|
+
if attributes.key?(:'count')
|
106
|
+
self.count = attributes[:'count']
|
107
|
+
end
|
108
|
+
|
109
|
+
if attributes.key?(:'total')
|
110
|
+
self.total = attributes[:'total']
|
111
|
+
end
|
112
|
+
|
113
|
+
if attributes.key?(:'v')
|
114
|
+
if (value = attributes[:'v']).is_a?(Array)
|
115
|
+
self.v = value
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
if attributes.key?(:'p')
|
120
|
+
if (value = attributes[:'p']).is_a?(Array)
|
121
|
+
self.p = value
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
if attributes.key?(:'t')
|
126
|
+
if (value = attributes[:'t']).is_a?(Array)
|
127
|
+
self.t = value
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
if attributes.key?(:'si')
|
132
|
+
if (value = attributes[:'si']).is_a?(Array)
|
133
|
+
self.si = value
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
if attributes.key?(:'cp')
|
138
|
+
if (value = attributes[:'cp']).is_a?(Array)
|
139
|
+
self.cp = value
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
if attributes.key?(:'c')
|
144
|
+
if (value = attributes[:'c']).is_a?(Array)
|
145
|
+
self.c = value
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
151
|
+
# @return Array for valid properties with the reasons
|
152
|
+
def list_invalid_properties
|
153
|
+
invalid_properties = Array.new
|
154
|
+
invalid_properties
|
155
|
+
end
|
156
|
+
|
157
|
+
# Check to see if the all the properties in the model are valid
|
158
|
+
# @return true if the model is valid
|
159
|
+
def valid?
|
160
|
+
true
|
161
|
+
end
|
162
|
+
|
163
|
+
# Checks equality by comparing each attribute.
|
164
|
+
# @param [Object] Object to be compared
|
165
|
+
def ==(o)
|
166
|
+
return true if self.equal?(o)
|
167
|
+
self.class == o.class &&
|
168
|
+
skip == o.skip &&
|
169
|
+
count == o.count &&
|
170
|
+
total == o.total &&
|
171
|
+
v == o.v &&
|
172
|
+
p == o.p &&
|
173
|
+
t == o.t &&
|
174
|
+
si == o.si &&
|
175
|
+
cp == o.cp &&
|
176
|
+
c == o.c
|
177
|
+
end
|
178
|
+
|
179
|
+
# @see the `==` method
|
180
|
+
# @param [Object] Object to be compared
|
181
|
+
def eql?(o)
|
182
|
+
self == o
|
183
|
+
end
|
184
|
+
|
185
|
+
# Calculates hash code according to all attributes.
|
186
|
+
# @return [Integer] Hash code
|
187
|
+
def hash
|
188
|
+
[skip, count, total, v, p, t, si, cp, c].hash
|
189
|
+
end
|
190
|
+
|
191
|
+
# Builds the object from hash
|
192
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
193
|
+
# @return [Object] Returns the model itself
|
194
|
+
def self.build_from_hash(attributes)
|
195
|
+
new.build_from_hash(attributes)
|
196
|
+
end
|
197
|
+
|
198
|
+
# Builds the object from hash
|
199
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
200
|
+
# @return [Object] Returns the model itself
|
201
|
+
def build_from_hash(attributes)
|
202
|
+
return nil unless attributes.is_a?(Hash)
|
203
|
+
self.class.openapi_types.each_pair do |key, type|
|
204
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
205
|
+
self.send("#{key}=", nil)
|
206
|
+
elsif type =~ /\AArray<(.*)>/i
|
207
|
+
# check to ensure the input is an array given that the attribute
|
208
|
+
# is documented as an array but the input is not
|
209
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
210
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
211
|
+
end
|
212
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
213
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
self
|
218
|
+
end
|
219
|
+
|
220
|
+
# Deserializes the data based on type
|
221
|
+
# @param string type Data type
|
222
|
+
# @param string value Value to be deserialized
|
223
|
+
# @return [Object] Deserialized data
|
224
|
+
def _deserialize(type, value)
|
225
|
+
case type.to_sym
|
226
|
+
when :Time
|
227
|
+
Time.parse(value)
|
228
|
+
when :Date
|
229
|
+
Date.parse(value)
|
230
|
+
when :String
|
231
|
+
value.to_s
|
232
|
+
when :Integer
|
233
|
+
value.to_i
|
234
|
+
when :Float
|
235
|
+
value.to_f
|
236
|
+
when :Boolean
|
237
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
238
|
+
true
|
239
|
+
else
|
240
|
+
false
|
241
|
+
end
|
242
|
+
when :Object
|
243
|
+
# generic object (usually a Hash), return directly
|
244
|
+
value
|
245
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
246
|
+
inner_type = Regexp.last_match[:inner_type]
|
247
|
+
value.map { |v| _deserialize(inner_type, v) }
|
248
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
249
|
+
k_type = Regexp.last_match[:k_type]
|
250
|
+
v_type = Regexp.last_match[:v_type]
|
251
|
+
{}.tap do |hash|
|
252
|
+
value.each do |k, v|
|
253
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
254
|
+
end
|
255
|
+
end
|
256
|
+
else # model
|
257
|
+
# models (e.g. Pet) or oneOf
|
258
|
+
klass = FinnhubRuby.const_get(type)
|
259
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
260
|
+
end
|
261
|
+
end
|
262
|
+
|
263
|
+
# Returns the string representation of the object
|
264
|
+
# @return [String] String presentation of the object
|
265
|
+
def to_s
|
266
|
+
to_hash.to_s
|
267
|
+
end
|
268
|
+
|
269
|
+
# to_body is an alias to to_hash (backward compatibility)
|
270
|
+
# @return [Hash] Returns the object in the form of hash
|
271
|
+
def to_body
|
272
|
+
to_hash
|
273
|
+
end
|
274
|
+
|
275
|
+
# Returns the object in the form of hash
|
276
|
+
# @return [Hash] Returns the object in the form of hash
|
277
|
+
def to_hash
|
278
|
+
hash = {}
|
279
|
+
self.class.attribute_map.each_pair do |attr, param|
|
280
|
+
value = self.send(attr)
|
281
|
+
if value.nil?
|
282
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
283
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
284
|
+
end
|
285
|
+
|
286
|
+
hash[param] = _to_hash(value)
|
287
|
+
end
|
288
|
+
hash
|
289
|
+
end
|
290
|
+
|
291
|
+
# Outputs non-array value in the form of hash
|
292
|
+
# For object, use to_hash. Otherwise, just return the value
|
293
|
+
# @param [Object] value Any valid value
|
294
|
+
# @return [Hash] Returns the value in the form of hash
|
295
|
+
def _to_hash(value)
|
296
|
+
if value.is_a?(Array)
|
297
|
+
value.compact.map { |v| _to_hash(v) }
|
298
|
+
elsif value.is_a?(Hash)
|
299
|
+
{}.tap do |hash|
|
300
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
301
|
+
end
|
302
|
+
elsif value.respond_to? :to_hash
|
303
|
+
value.to_hash
|
304
|
+
else
|
305
|
+
value
|
306
|
+
end
|
307
|
+
end
|
308
|
+
|
309
|
+
end
|
310
|
+
|
311
|
+
end
|
@@ -33,7 +33,7 @@ module FinnhubRuby
|
|
33
33
|
# NAV currency.
|
34
34
|
attr_accessor :nav_currency
|
35
35
|
|
36
|
-
# Expense ratio.
|
36
|
+
# Expense ratio. For non-US funds, this is the <a href=\"https://www.esma.europa.eu/sites/default/files/library/2015/11/09_1028_final_kid_ongoing_charges_methodology_for_publication_u_2_.pdf\" target=\"_blank\">KID ongoing charges<a/>.
|
37
37
|
attr_accessor :expense_ratio
|
38
38
|
|
39
39
|
# Tracking Index.
|
@@ -69,6 +69,15 @@ module FinnhubRuby
|
|
69
69
|
# ETF's description.
|
70
70
|
attr_accessor :description
|
71
71
|
|
72
|
+
# Whether the ETF is inverse
|
73
|
+
attr_accessor :is_inverse
|
74
|
+
|
75
|
+
# Whether the ETF is leveraged
|
76
|
+
attr_accessor :is_leveraged
|
77
|
+
|
78
|
+
# Leverage factor.
|
79
|
+
attr_accessor :leverage_factor
|
80
|
+
|
72
81
|
# Attribute mapping from ruby-style variable name to JSON key.
|
73
82
|
def self.attribute_map
|
74
83
|
{
|
@@ -89,7 +98,10 @@ module FinnhubRuby
|
|
89
98
|
:'price_to_earnings' => :'priceToEarnings',
|
90
99
|
:'price_to_book' => :'priceToBook',
|
91
100
|
:'avg_volume' => :'avgVolume',
|
92
|
-
:'description' => :'description'
|
101
|
+
:'description' => :'description',
|
102
|
+
:'is_inverse' => :'isInverse',
|
103
|
+
:'is_leveraged' => :'isLeveraged',
|
104
|
+
:'leverage_factor' => :'leverageFactor'
|
93
105
|
}
|
94
106
|
end
|
95
107
|
|
@@ -118,7 +130,10 @@ module FinnhubRuby
|
|
118
130
|
:'price_to_earnings' => :'Float',
|
119
131
|
:'price_to_book' => :'Float',
|
120
132
|
:'avg_volume' => :'Float',
|
121
|
-
:'description' => :'String'
|
133
|
+
:'description' => :'String',
|
134
|
+
:'is_inverse' => :'Boolean',
|
135
|
+
:'is_leveraged' => :'Boolean',
|
136
|
+
:'leverage_factor' => :'Float'
|
122
137
|
}
|
123
138
|
end
|
124
139
|
|
@@ -214,6 +229,18 @@ module FinnhubRuby
|
|
214
229
|
if attributes.key?(:'description')
|
215
230
|
self.description = attributes[:'description']
|
216
231
|
end
|
232
|
+
|
233
|
+
if attributes.key?(:'is_inverse')
|
234
|
+
self.is_inverse = attributes[:'is_inverse']
|
235
|
+
end
|
236
|
+
|
237
|
+
if attributes.key?(:'is_leveraged')
|
238
|
+
self.is_leveraged = attributes[:'is_leveraged']
|
239
|
+
end
|
240
|
+
|
241
|
+
if attributes.key?(:'leverage_factor')
|
242
|
+
self.leverage_factor = attributes[:'leverage_factor']
|
243
|
+
end
|
217
244
|
end
|
218
245
|
|
219
246
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -251,7 +278,10 @@ module FinnhubRuby
|
|
251
278
|
price_to_earnings == o.price_to_earnings &&
|
252
279
|
price_to_book == o.price_to_book &&
|
253
280
|
avg_volume == o.avg_volume &&
|
254
|
-
description == o.description
|
281
|
+
description == o.description &&
|
282
|
+
is_inverse == o.is_inverse &&
|
283
|
+
is_leveraged == o.is_leveraged &&
|
284
|
+
leverage_factor == o.leverage_factor
|
255
285
|
end
|
256
286
|
|
257
287
|
# @see the `==` method
|
@@ -263,7 +293,7 @@ module FinnhubRuby
|
|
263
293
|
# Calculates hash code according to all attributes.
|
264
294
|
# @return [Integer] Hash code
|
265
295
|
def hash
|
266
|
-
[name, asset_class, investment_segment, aum, nav, nav_currency, expense_ratio, tracking_index, etf_company, domicile, inception_date, website, isin, cusip, price_to_earnings, price_to_book, avg_volume, description].hash
|
296
|
+
[name, asset_class, investment_segment, aum, nav, nav_currency, expense_ratio, tracking_index, etf_company, domicile, inception_date, website, isin, cusip, price_to_earnings, price_to_book, avg_volume, description, is_inverse, is_leveraged, leverage_factor].hash
|
267
297
|
end
|
268
298
|
|
269
299
|
# Builds the object from hash
|
@@ -0,0 +1,241 @@
|
|
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 InstitutionalOwnership
|
18
|
+
# Symbol.
|
19
|
+
attr_accessor :symbol
|
20
|
+
|
21
|
+
# Cusip.
|
22
|
+
attr_accessor :cusip
|
23
|
+
|
24
|
+
# Array of institutional investors.
|
25
|
+
attr_accessor :data
|
26
|
+
|
27
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
28
|
+
def self.attribute_map
|
29
|
+
{
|
30
|
+
:'symbol' => :'symbol',
|
31
|
+
:'cusip' => :'cusip',
|
32
|
+
:'data' => :'data'
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
# Returns all the JSON keys this model knows about
|
37
|
+
def self.acceptable_attributes
|
38
|
+
attribute_map.values
|
39
|
+
end
|
40
|
+
|
41
|
+
# Attribute type mapping.
|
42
|
+
def self.openapi_types
|
43
|
+
{
|
44
|
+
:'symbol' => :'String',
|
45
|
+
:'cusip' => :'String',
|
46
|
+
:'data' => :'Array<InstitutionalOwnershipGroup>'
|
47
|
+
}
|
48
|
+
end
|
49
|
+
|
50
|
+
# List of attributes with nullable: true
|
51
|
+
def self.openapi_nullable
|
52
|
+
Set.new([
|
53
|
+
])
|
54
|
+
end
|
55
|
+
|
56
|
+
# Initializes the object
|
57
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
58
|
+
def initialize(attributes = {})
|
59
|
+
if (!attributes.is_a?(Hash))
|
60
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `FinnhubRuby::InstitutionalOwnership` initialize method"
|
61
|
+
end
|
62
|
+
|
63
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
64
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
65
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
66
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `FinnhubRuby::InstitutionalOwnership`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
67
|
+
end
|
68
|
+
h[k.to_sym] = v
|
69
|
+
}
|
70
|
+
|
71
|
+
if attributes.key?(:'symbol')
|
72
|
+
self.symbol = attributes[:'symbol']
|
73
|
+
end
|
74
|
+
|
75
|
+
if attributes.key?(:'cusip')
|
76
|
+
self.cusip = attributes[:'cusip']
|
77
|
+
end
|
78
|
+
|
79
|
+
if attributes.key?(:'data')
|
80
|
+
if (value = attributes[:'data']).is_a?(Array)
|
81
|
+
self.data = value
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
87
|
+
# @return Array for valid properties with the reasons
|
88
|
+
def list_invalid_properties
|
89
|
+
invalid_properties = Array.new
|
90
|
+
invalid_properties
|
91
|
+
end
|
92
|
+
|
93
|
+
# Check to see if the all the properties in the model are valid
|
94
|
+
# @return true if the model is valid
|
95
|
+
def valid?
|
96
|
+
true
|
97
|
+
end
|
98
|
+
|
99
|
+
# Checks equality by comparing each attribute.
|
100
|
+
# @param [Object] Object to be compared
|
101
|
+
def ==(o)
|
102
|
+
return true if self.equal?(o)
|
103
|
+
self.class == o.class &&
|
104
|
+
symbol == o.symbol &&
|
105
|
+
cusip == o.cusip &&
|
106
|
+
data == o.data
|
107
|
+
end
|
108
|
+
|
109
|
+
# @see the `==` method
|
110
|
+
# @param [Object] Object to be compared
|
111
|
+
def eql?(o)
|
112
|
+
self == o
|
113
|
+
end
|
114
|
+
|
115
|
+
# Calculates hash code according to all attributes.
|
116
|
+
# @return [Integer] Hash code
|
117
|
+
def hash
|
118
|
+
[symbol, cusip, data].hash
|
119
|
+
end
|
120
|
+
|
121
|
+
# Builds the object from hash
|
122
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
123
|
+
# @return [Object] Returns the model itself
|
124
|
+
def self.build_from_hash(attributes)
|
125
|
+
new.build_from_hash(attributes)
|
126
|
+
end
|
127
|
+
|
128
|
+
# Builds the object from hash
|
129
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
130
|
+
# @return [Object] Returns the model itself
|
131
|
+
def build_from_hash(attributes)
|
132
|
+
return nil unless attributes.is_a?(Hash)
|
133
|
+
self.class.openapi_types.each_pair do |key, type|
|
134
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
135
|
+
self.send("#{key}=", nil)
|
136
|
+
elsif type =~ /\AArray<(.*)>/i
|
137
|
+
# check to ensure the input is an array given that the attribute
|
138
|
+
# is documented as an array but the input is not
|
139
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
140
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
141
|
+
end
|
142
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
143
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
self
|
148
|
+
end
|
149
|
+
|
150
|
+
# Deserializes the data based on type
|
151
|
+
# @param string type Data type
|
152
|
+
# @param string value Value to be deserialized
|
153
|
+
# @return [Object] Deserialized data
|
154
|
+
def _deserialize(type, value)
|
155
|
+
case type.to_sym
|
156
|
+
when :Time
|
157
|
+
Time.parse(value)
|
158
|
+
when :Date
|
159
|
+
Date.parse(value)
|
160
|
+
when :String
|
161
|
+
value.to_s
|
162
|
+
when :Integer
|
163
|
+
value.to_i
|
164
|
+
when :Float
|
165
|
+
value.to_f
|
166
|
+
when :Boolean
|
167
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
168
|
+
true
|
169
|
+
else
|
170
|
+
false
|
171
|
+
end
|
172
|
+
when :Object
|
173
|
+
# generic object (usually a Hash), return directly
|
174
|
+
value
|
175
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
176
|
+
inner_type = Regexp.last_match[:inner_type]
|
177
|
+
value.map { |v| _deserialize(inner_type, v) }
|
178
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
179
|
+
k_type = Regexp.last_match[:k_type]
|
180
|
+
v_type = Regexp.last_match[:v_type]
|
181
|
+
{}.tap do |hash|
|
182
|
+
value.each do |k, v|
|
183
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
184
|
+
end
|
185
|
+
end
|
186
|
+
else # model
|
187
|
+
# models (e.g. Pet) or oneOf
|
188
|
+
klass = FinnhubRuby.const_get(type)
|
189
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
# Returns the string representation of the object
|
194
|
+
# @return [String] String presentation of the object
|
195
|
+
def to_s
|
196
|
+
to_hash.to_s
|
197
|
+
end
|
198
|
+
|
199
|
+
# to_body is an alias to to_hash (backward compatibility)
|
200
|
+
# @return [Hash] Returns the object in the form of hash
|
201
|
+
def to_body
|
202
|
+
to_hash
|
203
|
+
end
|
204
|
+
|
205
|
+
# Returns the object in the form of hash
|
206
|
+
# @return [Hash] Returns the object in the form of hash
|
207
|
+
def to_hash
|
208
|
+
hash = {}
|
209
|
+
self.class.attribute_map.each_pair do |attr, param|
|
210
|
+
value = self.send(attr)
|
211
|
+
if value.nil?
|
212
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
213
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
214
|
+
end
|
215
|
+
|
216
|
+
hash[param] = _to_hash(value)
|
217
|
+
end
|
218
|
+
hash
|
219
|
+
end
|
220
|
+
|
221
|
+
# Outputs non-array value in the form of hash
|
222
|
+
# For object, use to_hash. Otherwise, just return the value
|
223
|
+
# @param [Object] value Any valid value
|
224
|
+
# @return [Hash] Returns the value in the form of hash
|
225
|
+
def _to_hash(value)
|
226
|
+
if value.is_a?(Array)
|
227
|
+
value.compact.map { |v| _to_hash(v) }
|
228
|
+
elsif value.is_a?(Hash)
|
229
|
+
{}.tap do |hash|
|
230
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
231
|
+
end
|
232
|
+
elsif value.respond_to? :to_hash
|
233
|
+
value.to_hash
|
234
|
+
else
|
235
|
+
value
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
239
|
+
end
|
240
|
+
|
241
|
+
end
|