finnhub_ruby 1.1.18 → 1.1.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/docs/BondTickData.md +6 -0
- data/docs/BondYieldCurve.md +20 -0
- data/docs/BondYieldCurveInfo.md +20 -0
- data/docs/CompanyProfile.md +5 -1
- data/docs/CongressionalTrading.md +20 -0
- data/docs/CongressionalTransaction.md +36 -0
- data/docs/DefaultApi.md +312 -92
- data/docs/Dividends.md +3 -1
- data/docs/DocumentResponse.md +28 -0
- data/docs/ETFHoldingsData.md +3 -1
- data/docs/EarningResult.md +5 -1
- data/docs/ExcerptResponse.md +24 -0
- data/docs/FilingResponse.md +42 -0
- data/docs/InFilingResponse.md +44 -0
- data/docs/InFilingSearchBody.md +20 -0
- data/docs/MutualFundEet.md +20 -0
- data/docs/MutualFundEetPai.md +20 -0
- data/docs/MutualFundHoldingsData.md +3 -1
- data/docs/PriceMetrics.md +2 -0
- data/docs/SearchBody.md +60 -0
- data/docs/SearchFilter.md +20 -0
- data/docs/SearchResponse.md +24 -0
- data/finnhub_ruby-1.1.18.gem +0 -0
- data/lib/finnhub_ruby/api/default_api.rb +296 -86
- data/lib/finnhub_ruby/models/bond_tick_data.rb +37 -1
- data/lib/finnhub_ruby/models/bond_yield_curve.rb +231 -0
- data/lib/finnhub_ruby/models/bond_yield_curve_info.rb +229 -0
- data/lib/finnhub_ruby/models/company_profile.rb +22 -2
- data/lib/finnhub_ruby/models/congressional_trading.rb +231 -0
- data/lib/finnhub_ruby/models/congressional_transaction.rb +309 -0
- data/lib/finnhub_ruby/models/dividends.rb +14 -4
- data/lib/finnhub_ruby/models/document_response.rb +271 -0
- data/lib/finnhub_ruby/models/earning_result.rb +24 -4
- data/lib/finnhub_ruby/models/etf_holdings_data.rb +14 -4
- data/lib/finnhub_ruby/models/excerpt_response.rb +249 -0
- data/lib/finnhub_ruby/models/filing_response.rb +339 -0
- data/lib/finnhub_ruby/models/in_filing_response.rb +351 -0
- data/lib/finnhub_ruby/models/in_filing_search_body.rb +239 -0
- data/lib/finnhub_ruby/models/mutual_fund_eet.rb +228 -0
- data/lib/finnhub_ruby/models/mutual_fund_eet_pai.rb +228 -0
- data/lib/finnhub_ruby/models/mutual_fund_holdings_data.rb +14 -4
- data/lib/finnhub_ruby/models/price_metrics.rb +11 -1
- data/lib/finnhub_ruby/models/search_body.rb +434 -0
- data/lib/finnhub_ruby/models/search_filter.rb +229 -0
- data/lib/finnhub_ruby/models/search_response.rb +251 -0
- data/lib/finnhub_ruby/version.rb +1 -1
- data/lib/finnhub_ruby.rb +14 -0
- data/spec/models/bond_yield_curve_info_spec.rb +40 -0
- data/spec/models/bond_yield_curve_spec.rb +40 -0
- data/spec/models/congressional_trading_spec.rb +40 -0
- data/spec/models/congressional_transaction_spec.rb +88 -0
- data/spec/models/document_response_spec.rb +64 -0
- data/spec/models/excerpt_response_spec.rb +52 -0
- data/spec/models/filing_response_spec.rb +106 -0
- data/spec/models/in_filing_response_spec.rb +112 -0
- data/spec/models/in_filing_search_body_spec.rb +40 -0
- data/spec/models/mutual_fund_eet_pai_spec.rb +40 -0
- data/spec/models/mutual_fund_eet_spec.rb +40 -0
- data/spec/models/search_body_spec.rb +160 -0
- data/spec/models/search_filter_spec.rb +40 -0
- data/spec/models/search_response_spec.rb +52 -0
- metadata +60 -3
@@ -36,6 +36,9 @@ module FinnhubRuby
|
|
36
36
|
# Market value
|
37
37
|
attr_accessor :value
|
38
38
|
|
39
|
+
# Asset type. Can be 1 of the following values: <code>Equity</code>, <code>ETP</code>, <code>Fund</code>, <code>Bond</code>, <code>Other</code> or empty.
|
40
|
+
attr_accessor :asset_type
|
41
|
+
|
39
42
|
# Attribute mapping from ruby-style variable name to JSON key.
|
40
43
|
def self.attribute_map
|
41
44
|
{
|
@@ -45,7 +48,8 @@ module FinnhubRuby
|
|
45
48
|
:'cusip' => :'cusip',
|
46
49
|
:'share' => :'share',
|
47
50
|
:'percent' => :'percent',
|
48
|
-
:'value' => :'value'
|
51
|
+
:'value' => :'value',
|
52
|
+
:'asset_type' => :'assetType'
|
49
53
|
}
|
50
54
|
end
|
51
55
|
|
@@ -63,7 +67,8 @@ module FinnhubRuby
|
|
63
67
|
:'cusip' => :'String',
|
64
68
|
:'share' => :'Float',
|
65
69
|
:'percent' => :'Float',
|
66
|
-
:'value' => :'Float'
|
70
|
+
:'value' => :'Float',
|
71
|
+
:'asset_type' => :'String'
|
67
72
|
}
|
68
73
|
end
|
69
74
|
|
@@ -115,6 +120,10 @@ module FinnhubRuby
|
|
115
120
|
if attributes.key?(:'value')
|
116
121
|
self.value = attributes[:'value']
|
117
122
|
end
|
123
|
+
|
124
|
+
if attributes.key?(:'asset_type')
|
125
|
+
self.asset_type = attributes[:'asset_type']
|
126
|
+
end
|
118
127
|
end
|
119
128
|
|
120
129
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -141,7 +150,8 @@ module FinnhubRuby
|
|
141
150
|
cusip == o.cusip &&
|
142
151
|
share == o.share &&
|
143
152
|
percent == o.percent &&
|
144
|
-
value == o.value
|
153
|
+
value == o.value &&
|
154
|
+
asset_type == o.asset_type
|
145
155
|
end
|
146
156
|
|
147
157
|
# @see the `==` method
|
@@ -153,7 +163,7 @@ module FinnhubRuby
|
|
153
163
|
# Calculates hash code according to all attributes.
|
154
164
|
# @return [Integer] Hash code
|
155
165
|
def hash
|
156
|
-
[symbol, name, isin, cusip, share, percent, value].hash
|
166
|
+
[symbol, name, isin, cusip, share, percent, value, asset_type].hash
|
157
167
|
end
|
158
168
|
|
159
169
|
# Builds the object from hash
|
@@ -18,12 +18,16 @@ module FinnhubRuby
|
|
18
18
|
# Symbol of the company.
|
19
19
|
attr_accessor :symbol
|
20
20
|
|
21
|
+
# Data date.
|
22
|
+
attr_accessor :at_date
|
23
|
+
|
21
24
|
attr_accessor :data
|
22
25
|
|
23
26
|
# Attribute mapping from ruby-style variable name to JSON key.
|
24
27
|
def self.attribute_map
|
25
28
|
{
|
26
29
|
:'symbol' => :'symbol',
|
30
|
+
:'at_date' => :'atDate',
|
27
31
|
:'data' => :'data'
|
28
32
|
}
|
29
33
|
end
|
@@ -37,6 +41,7 @@ module FinnhubRuby
|
|
37
41
|
def self.openapi_types
|
38
42
|
{
|
39
43
|
:'symbol' => :'String',
|
44
|
+
:'at_date' => :'String',
|
40
45
|
:'data' => :'Object'
|
41
46
|
}
|
42
47
|
end
|
@@ -66,6 +71,10 @@ module FinnhubRuby
|
|
66
71
|
self.symbol = attributes[:'symbol']
|
67
72
|
end
|
68
73
|
|
74
|
+
if attributes.key?(:'at_date')
|
75
|
+
self.at_date = attributes[:'at_date']
|
76
|
+
end
|
77
|
+
|
69
78
|
if attributes.key?(:'data')
|
70
79
|
self.data = attributes[:'data']
|
71
80
|
end
|
@@ -90,6 +99,7 @@ module FinnhubRuby
|
|
90
99
|
return true if self.equal?(o)
|
91
100
|
self.class == o.class &&
|
92
101
|
symbol == o.symbol &&
|
102
|
+
at_date == o.at_date &&
|
93
103
|
data == o.data
|
94
104
|
end
|
95
105
|
|
@@ -102,7 +112,7 @@ module FinnhubRuby
|
|
102
112
|
# Calculates hash code according to all attributes.
|
103
113
|
# @return [Integer] Hash code
|
104
114
|
def hash
|
105
|
-
[symbol, data].hash
|
115
|
+
[symbol, at_date, data].hash
|
106
116
|
end
|
107
117
|
|
108
118
|
# Builds the object from hash
|
@@ -0,0 +1,434 @@
|
|
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 SearchBody
|
18
|
+
# Search query
|
19
|
+
attr_accessor :query
|
20
|
+
|
21
|
+
# List of isin to search, comma separated (Max: 50).
|
22
|
+
attr_accessor :isins
|
23
|
+
|
24
|
+
# List of cusip to search, comma separated (Max: 50).
|
25
|
+
attr_accessor :cusips
|
26
|
+
|
27
|
+
# List of SEC Center Index Key to search, comma separated (Max: 50).
|
28
|
+
attr_accessor :ciks
|
29
|
+
|
30
|
+
# List of SEDAR issuer number to search, comma separated (Max: 50).
|
31
|
+
attr_accessor :sedar_ids
|
32
|
+
|
33
|
+
# List of Companies House number to search, comma separated (Max: 50).
|
34
|
+
attr_accessor :ch_ids
|
35
|
+
|
36
|
+
# List of symbols to search, comma separated (Max: 50).
|
37
|
+
attr_accessor :symbols
|
38
|
+
|
39
|
+
# List of sedols to search, comma separated (Max: 50).
|
40
|
+
attr_accessor :sedols
|
41
|
+
|
42
|
+
# List of sources to search, comma separated (Max: 50). Look at <code>/filter</code> endpoint to see all available values.
|
43
|
+
attr_accessor :sources
|
44
|
+
|
45
|
+
# List of forms to search, comma separated (Max: 50). Look at <code>/filter</code> endpoint to see all available values.
|
46
|
+
attr_accessor :forms
|
47
|
+
|
48
|
+
# List of gics to search, comma separated (Max: 50). Look at <code>/filter</code> endpoint to see all available values.
|
49
|
+
attr_accessor :gics
|
50
|
+
|
51
|
+
# List of sources to search, comma separated (Max: 50). Look at <code>/filter</code> endpoint to see all available values.
|
52
|
+
attr_accessor :naics
|
53
|
+
|
54
|
+
# List of exhibits to search, comma separated (Max: 50). Look at <code>/filter</code> endpoint to see all available values.
|
55
|
+
attr_accessor :exhibits
|
56
|
+
|
57
|
+
# List of exchanges to search, comma separated (Max: 50). Look at <code>/filter</code> endpoint to see all available values.
|
58
|
+
attr_accessor :exchanges
|
59
|
+
|
60
|
+
# List of sources to search, comma separated (Max: 50). Look at <code>/filter</code> endpoint to see all available values.
|
61
|
+
attr_accessor :countries
|
62
|
+
|
63
|
+
# List of SEC's exchanges act to search, comma separated. Look at <code>/filter</code> endpoint to see all available values.
|
64
|
+
attr_accessor :acts
|
65
|
+
|
66
|
+
# List of market capitalization to search, comma separated. Look at <code>/filter</code> endpoint to see all available values.
|
67
|
+
attr_accessor :caps
|
68
|
+
|
69
|
+
# Search from date in format: YYYY-MM-DD, default from the last 2 years
|
70
|
+
attr_accessor :from_date
|
71
|
+
|
72
|
+
# Search to date in format: YYYY-MM-DD, default to today
|
73
|
+
attr_accessor :to_date
|
74
|
+
|
75
|
+
# Use for pagination, default to page 1
|
76
|
+
attr_accessor :page
|
77
|
+
|
78
|
+
# Sort result by, default: sortMostRecent. Look at <code>/filter</code> endpoint to see all available values.
|
79
|
+
attr_accessor :sort
|
80
|
+
|
81
|
+
# Enable highlight in returned filings. If enabled, only return 10 results each time
|
82
|
+
attr_accessor :highlighted
|
83
|
+
|
84
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
85
|
+
def self.attribute_map
|
86
|
+
{
|
87
|
+
:'query' => :'query',
|
88
|
+
:'isins' => :'isins',
|
89
|
+
:'cusips' => :'cusips',
|
90
|
+
:'ciks' => :'ciks',
|
91
|
+
:'sedar_ids' => :'sedarIds',
|
92
|
+
:'ch_ids' => :'chIds',
|
93
|
+
:'symbols' => :'symbols',
|
94
|
+
:'sedols' => :'sedols',
|
95
|
+
:'sources' => :'sources',
|
96
|
+
:'forms' => :'forms',
|
97
|
+
:'gics' => :'gics',
|
98
|
+
:'naics' => :'naics',
|
99
|
+
:'exhibits' => :'exhibits',
|
100
|
+
:'exchanges' => :'exchanges',
|
101
|
+
:'countries' => :'countries',
|
102
|
+
:'acts' => :'acts',
|
103
|
+
:'caps' => :'caps',
|
104
|
+
:'from_date' => :'fromDate',
|
105
|
+
:'to_date' => :'toDate',
|
106
|
+
:'page' => :'page',
|
107
|
+
:'sort' => :'sort',
|
108
|
+
:'highlighted' => :'highlighted'
|
109
|
+
}
|
110
|
+
end
|
111
|
+
|
112
|
+
# Returns all the JSON keys this model knows about
|
113
|
+
def self.acceptable_attributes
|
114
|
+
attribute_map.values
|
115
|
+
end
|
116
|
+
|
117
|
+
# Attribute type mapping.
|
118
|
+
def self.openapi_types
|
119
|
+
{
|
120
|
+
:'query' => :'String',
|
121
|
+
:'isins' => :'String',
|
122
|
+
:'cusips' => :'String',
|
123
|
+
:'ciks' => :'String',
|
124
|
+
:'sedar_ids' => :'String',
|
125
|
+
:'ch_ids' => :'String',
|
126
|
+
:'symbols' => :'String',
|
127
|
+
:'sedols' => :'String',
|
128
|
+
:'sources' => :'String',
|
129
|
+
:'forms' => :'String',
|
130
|
+
:'gics' => :'String',
|
131
|
+
:'naics' => :'String',
|
132
|
+
:'exhibits' => :'String',
|
133
|
+
:'exchanges' => :'String',
|
134
|
+
:'countries' => :'String',
|
135
|
+
:'acts' => :'String',
|
136
|
+
:'caps' => :'String',
|
137
|
+
:'from_date' => :'String',
|
138
|
+
:'to_date' => :'String',
|
139
|
+
:'page' => :'String',
|
140
|
+
:'sort' => :'String',
|
141
|
+
:'highlighted' => :'Boolean'
|
142
|
+
}
|
143
|
+
end
|
144
|
+
|
145
|
+
# List of attributes with nullable: true
|
146
|
+
def self.openapi_nullable
|
147
|
+
Set.new([
|
148
|
+
])
|
149
|
+
end
|
150
|
+
|
151
|
+
# Initializes the object
|
152
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
153
|
+
def initialize(attributes = {})
|
154
|
+
if (!attributes.is_a?(Hash))
|
155
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `FinnhubRuby::SearchBody` initialize method"
|
156
|
+
end
|
157
|
+
|
158
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
159
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
160
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
161
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `FinnhubRuby::SearchBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
162
|
+
end
|
163
|
+
h[k.to_sym] = v
|
164
|
+
}
|
165
|
+
|
166
|
+
if attributes.key?(:'query')
|
167
|
+
self.query = attributes[:'query']
|
168
|
+
end
|
169
|
+
|
170
|
+
if attributes.key?(:'isins')
|
171
|
+
self.isins = attributes[:'isins']
|
172
|
+
end
|
173
|
+
|
174
|
+
if attributes.key?(:'cusips')
|
175
|
+
self.cusips = attributes[:'cusips']
|
176
|
+
end
|
177
|
+
|
178
|
+
if attributes.key?(:'ciks')
|
179
|
+
self.ciks = attributes[:'ciks']
|
180
|
+
end
|
181
|
+
|
182
|
+
if attributes.key?(:'sedar_ids')
|
183
|
+
self.sedar_ids = attributes[:'sedar_ids']
|
184
|
+
end
|
185
|
+
|
186
|
+
if attributes.key?(:'ch_ids')
|
187
|
+
self.ch_ids = attributes[:'ch_ids']
|
188
|
+
end
|
189
|
+
|
190
|
+
if attributes.key?(:'symbols')
|
191
|
+
self.symbols = attributes[:'symbols']
|
192
|
+
end
|
193
|
+
|
194
|
+
if attributes.key?(:'sedols')
|
195
|
+
self.sedols = attributes[:'sedols']
|
196
|
+
end
|
197
|
+
|
198
|
+
if attributes.key?(:'sources')
|
199
|
+
self.sources = attributes[:'sources']
|
200
|
+
end
|
201
|
+
|
202
|
+
if attributes.key?(:'forms')
|
203
|
+
self.forms = attributes[:'forms']
|
204
|
+
end
|
205
|
+
|
206
|
+
if attributes.key?(:'gics')
|
207
|
+
self.gics = attributes[:'gics']
|
208
|
+
end
|
209
|
+
|
210
|
+
if attributes.key?(:'naics')
|
211
|
+
self.naics = attributes[:'naics']
|
212
|
+
end
|
213
|
+
|
214
|
+
if attributes.key?(:'exhibits')
|
215
|
+
self.exhibits = attributes[:'exhibits']
|
216
|
+
end
|
217
|
+
|
218
|
+
if attributes.key?(:'exchanges')
|
219
|
+
self.exchanges = attributes[:'exchanges']
|
220
|
+
end
|
221
|
+
|
222
|
+
if attributes.key?(:'countries')
|
223
|
+
self.countries = attributes[:'countries']
|
224
|
+
end
|
225
|
+
|
226
|
+
if attributes.key?(:'acts')
|
227
|
+
self.acts = attributes[:'acts']
|
228
|
+
end
|
229
|
+
|
230
|
+
if attributes.key?(:'caps')
|
231
|
+
self.caps = attributes[:'caps']
|
232
|
+
end
|
233
|
+
|
234
|
+
if attributes.key?(:'from_date')
|
235
|
+
self.from_date = attributes[:'from_date']
|
236
|
+
end
|
237
|
+
|
238
|
+
if attributes.key?(:'to_date')
|
239
|
+
self.to_date = attributes[:'to_date']
|
240
|
+
end
|
241
|
+
|
242
|
+
if attributes.key?(:'page')
|
243
|
+
self.page = attributes[:'page']
|
244
|
+
end
|
245
|
+
|
246
|
+
if attributes.key?(:'sort')
|
247
|
+
self.sort = attributes[:'sort']
|
248
|
+
end
|
249
|
+
|
250
|
+
if attributes.key?(:'highlighted')
|
251
|
+
self.highlighted = attributes[:'highlighted']
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
255
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
256
|
+
# @return Array for valid properties with the reasons
|
257
|
+
def list_invalid_properties
|
258
|
+
invalid_properties = Array.new
|
259
|
+
if @query.nil?
|
260
|
+
invalid_properties.push('invalid value for "query", query cannot be nil.')
|
261
|
+
end
|
262
|
+
|
263
|
+
invalid_properties
|
264
|
+
end
|
265
|
+
|
266
|
+
# Check to see if the all the properties in the model are valid
|
267
|
+
# @return true if the model is valid
|
268
|
+
def valid?
|
269
|
+
return false if @query.nil?
|
270
|
+
true
|
271
|
+
end
|
272
|
+
|
273
|
+
# Checks equality by comparing each attribute.
|
274
|
+
# @param [Object] Object to be compared
|
275
|
+
def ==(o)
|
276
|
+
return true if self.equal?(o)
|
277
|
+
self.class == o.class &&
|
278
|
+
query == o.query &&
|
279
|
+
isins == o.isins &&
|
280
|
+
cusips == o.cusips &&
|
281
|
+
ciks == o.ciks &&
|
282
|
+
sedar_ids == o.sedar_ids &&
|
283
|
+
ch_ids == o.ch_ids &&
|
284
|
+
symbols == o.symbols &&
|
285
|
+
sedols == o.sedols &&
|
286
|
+
sources == o.sources &&
|
287
|
+
forms == o.forms &&
|
288
|
+
gics == o.gics &&
|
289
|
+
naics == o.naics &&
|
290
|
+
exhibits == o.exhibits &&
|
291
|
+
exchanges == o.exchanges &&
|
292
|
+
countries == o.countries &&
|
293
|
+
acts == o.acts &&
|
294
|
+
caps == o.caps &&
|
295
|
+
from_date == o.from_date &&
|
296
|
+
to_date == o.to_date &&
|
297
|
+
page == o.page &&
|
298
|
+
sort == o.sort &&
|
299
|
+
highlighted == o.highlighted
|
300
|
+
end
|
301
|
+
|
302
|
+
# @see the `==` method
|
303
|
+
# @param [Object] Object to be compared
|
304
|
+
def eql?(o)
|
305
|
+
self == o
|
306
|
+
end
|
307
|
+
|
308
|
+
# Calculates hash code according to all attributes.
|
309
|
+
# @return [Integer] Hash code
|
310
|
+
def hash
|
311
|
+
[query, isins, cusips, ciks, sedar_ids, ch_ids, symbols, sedols, sources, forms, gics, naics, exhibits, exchanges, countries, acts, caps, from_date, to_date, page, sort, highlighted].hash
|
312
|
+
end
|
313
|
+
|
314
|
+
# Builds the object from hash
|
315
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
316
|
+
# @return [Object] Returns the model itself
|
317
|
+
def self.build_from_hash(attributes)
|
318
|
+
new.build_from_hash(attributes)
|
319
|
+
end
|
320
|
+
|
321
|
+
# Builds the object from hash
|
322
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
323
|
+
# @return [Object] Returns the model itself
|
324
|
+
def build_from_hash(attributes)
|
325
|
+
return nil unless attributes.is_a?(Hash)
|
326
|
+
self.class.openapi_types.each_pair do |key, type|
|
327
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
328
|
+
self.send("#{key}=", nil)
|
329
|
+
elsif type =~ /\AArray<(.*)>/i
|
330
|
+
# check to ensure the input is an array given that the attribute
|
331
|
+
# is documented as an array but the input is not
|
332
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
333
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
334
|
+
end
|
335
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
336
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
337
|
+
end
|
338
|
+
end
|
339
|
+
|
340
|
+
self
|
341
|
+
end
|
342
|
+
|
343
|
+
# Deserializes the data based on type
|
344
|
+
# @param string type Data type
|
345
|
+
# @param string value Value to be deserialized
|
346
|
+
# @return [Object] Deserialized data
|
347
|
+
def _deserialize(type, value)
|
348
|
+
case type.to_sym
|
349
|
+
when :Time
|
350
|
+
Time.parse(value)
|
351
|
+
when :Date
|
352
|
+
Date.parse(value)
|
353
|
+
when :String
|
354
|
+
value.to_s
|
355
|
+
when :Integer
|
356
|
+
value.to_i
|
357
|
+
when :Float
|
358
|
+
value.to_f
|
359
|
+
when :Boolean
|
360
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
361
|
+
true
|
362
|
+
else
|
363
|
+
false
|
364
|
+
end
|
365
|
+
when :Object
|
366
|
+
# generic object (usually a Hash), return directly
|
367
|
+
value
|
368
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
369
|
+
inner_type = Regexp.last_match[:inner_type]
|
370
|
+
value.map { |v| _deserialize(inner_type, v) }
|
371
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
372
|
+
k_type = Regexp.last_match[:k_type]
|
373
|
+
v_type = Regexp.last_match[:v_type]
|
374
|
+
{}.tap do |hash|
|
375
|
+
value.each do |k, v|
|
376
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
377
|
+
end
|
378
|
+
end
|
379
|
+
else # model
|
380
|
+
# models (e.g. Pet) or oneOf
|
381
|
+
klass = FinnhubRuby.const_get(type)
|
382
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
383
|
+
end
|
384
|
+
end
|
385
|
+
|
386
|
+
# Returns the string representation of the object
|
387
|
+
# @return [String] String presentation of the object
|
388
|
+
def to_s
|
389
|
+
to_hash.to_s
|
390
|
+
end
|
391
|
+
|
392
|
+
# to_body is an alias to to_hash (backward compatibility)
|
393
|
+
# @return [Hash] Returns the object in the form of hash
|
394
|
+
def to_body
|
395
|
+
to_hash
|
396
|
+
end
|
397
|
+
|
398
|
+
# Returns the object in the form of hash
|
399
|
+
# @return [Hash] Returns the object in the form of hash
|
400
|
+
def to_hash
|
401
|
+
hash = {}
|
402
|
+
self.class.attribute_map.each_pair do |attr, param|
|
403
|
+
value = self.send(attr)
|
404
|
+
if value.nil?
|
405
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
406
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
407
|
+
end
|
408
|
+
|
409
|
+
hash[param] = _to_hash(value)
|
410
|
+
end
|
411
|
+
hash
|
412
|
+
end
|
413
|
+
|
414
|
+
# Outputs non-array value in the form of hash
|
415
|
+
# For object, use to_hash. Otherwise, just return the value
|
416
|
+
# @param [Object] value Any valid value
|
417
|
+
# @return [Hash] Returns the value in the form of hash
|
418
|
+
def _to_hash(value)
|
419
|
+
if value.is_a?(Array)
|
420
|
+
value.compact.map { |v| _to_hash(v) }
|
421
|
+
elsif value.is_a?(Hash)
|
422
|
+
{}.tap do |hash|
|
423
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
424
|
+
end
|
425
|
+
elsif value.respond_to? :to_hash
|
426
|
+
value.to_hash
|
427
|
+
else
|
428
|
+
value
|
429
|
+
end
|
430
|
+
end
|
431
|
+
|
432
|
+
end
|
433
|
+
|
434
|
+
end
|