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.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/docs/BondTickData.md +40 -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 +849 -93
- data/docs/Dividends.md +3 -1
- data/docs/DocumentResponse.md +28 -0
- data/docs/ETFHoldingsData.md +3 -1
- data/docs/ETFProfileData.md +8 -2
- 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/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/MutualFundEet.md +20 -0
- data/docs/MutualFundEetPai.md +20 -0
- data/docs/MutualFundHoldingsData.md +3 -1
- data/docs/PriceMetrics.md +22 -0
- data/docs/SearchBody.md +60 -0
- data/docs/SearchFilter.md +20 -0
- data/docs/SearchResponse.md +24 -0
- data/docs/SymbolChange.md +22 -0
- data/docs/SymbolChangeInfo.md +22 -0
- data/finnhub_ruby-1.1.17.gem +0 -0
- data/finnhub_ruby-1.1.18.gem +0 -0
- data/lib/finnhub_ruby/api/default_api.rb +835 -95
- data/lib/finnhub_ruby/models/bond_tick_data.rb +347 -0
- 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/etf_profile_data.rb +35 -5
- 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/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/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 +238 -0
- 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/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 +28 -0
- data/spec/models/bond_tick_data_spec.rb +82 -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/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/mutual_fund_eet_pai_spec.rb +40 -0
- data/spec/models/mutual_fund_eet_spec.rb +40 -0
- data/spec/models/price_metrics_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
- data/spec/models/symbol_change_info_spec.rb +46 -0
- data/spec/models/symbol_change_spec.rb +46 -0
- metadata +117 -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
|
@@ -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,249 @@
|
|
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 ExcerptResponse
|
18
|
+
# Highlighted content
|
19
|
+
attr_accessor :content
|
20
|
+
|
21
|
+
# Location of the content in the rendered document
|
22
|
+
attr_accessor :snippet_id
|
23
|
+
|
24
|
+
# Start offset of highlighted content
|
25
|
+
attr_accessor :start_offset
|
26
|
+
|
27
|
+
# End offset of highlighted content
|
28
|
+
attr_accessor :end_offset
|
29
|
+
|
30
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
31
|
+
def self.attribute_map
|
32
|
+
{
|
33
|
+
:'content' => :'content',
|
34
|
+
:'snippet_id' => :'snippetId',
|
35
|
+
:'start_offset' => :'startOffset',
|
36
|
+
:'end_offset' => :'endOffset'
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
40
|
+
# Returns all the JSON keys this model knows about
|
41
|
+
def self.acceptable_attributes
|
42
|
+
attribute_map.values
|
43
|
+
end
|
44
|
+
|
45
|
+
# Attribute type mapping.
|
46
|
+
def self.openapi_types
|
47
|
+
{
|
48
|
+
:'content' => :'String',
|
49
|
+
:'snippet_id' => :'String',
|
50
|
+
:'start_offset' => :'String',
|
51
|
+
:'end_offset' => :'String'
|
52
|
+
}
|
53
|
+
end
|
54
|
+
|
55
|
+
# List of attributes with nullable: true
|
56
|
+
def self.openapi_nullable
|
57
|
+
Set.new([
|
58
|
+
])
|
59
|
+
end
|
60
|
+
|
61
|
+
# Initializes the object
|
62
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
63
|
+
def initialize(attributes = {})
|
64
|
+
if (!attributes.is_a?(Hash))
|
65
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `FinnhubRuby::ExcerptResponse` initialize method"
|
66
|
+
end
|
67
|
+
|
68
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
69
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
70
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
71
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `FinnhubRuby::ExcerptResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
72
|
+
end
|
73
|
+
h[k.to_sym] = v
|
74
|
+
}
|
75
|
+
|
76
|
+
if attributes.key?(:'content')
|
77
|
+
self.content = attributes[:'content']
|
78
|
+
end
|
79
|
+
|
80
|
+
if attributes.key?(:'snippet_id')
|
81
|
+
self.snippet_id = attributes[:'snippet_id']
|
82
|
+
end
|
83
|
+
|
84
|
+
if attributes.key?(:'start_offset')
|
85
|
+
self.start_offset = attributes[:'start_offset']
|
86
|
+
end
|
87
|
+
|
88
|
+
if attributes.key?(:'end_offset')
|
89
|
+
self.end_offset = attributes[:'end_offset']
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
94
|
+
# @return Array for valid properties with the reasons
|
95
|
+
def list_invalid_properties
|
96
|
+
invalid_properties = Array.new
|
97
|
+
invalid_properties
|
98
|
+
end
|
99
|
+
|
100
|
+
# Check to see if the all the properties in the model are valid
|
101
|
+
# @return true if the model is valid
|
102
|
+
def valid?
|
103
|
+
true
|
104
|
+
end
|
105
|
+
|
106
|
+
# Checks equality by comparing each attribute.
|
107
|
+
# @param [Object] Object to be compared
|
108
|
+
def ==(o)
|
109
|
+
return true if self.equal?(o)
|
110
|
+
self.class == o.class &&
|
111
|
+
content == o.content &&
|
112
|
+
snippet_id == o.snippet_id &&
|
113
|
+
start_offset == o.start_offset &&
|
114
|
+
end_offset == o.end_offset
|
115
|
+
end
|
116
|
+
|
117
|
+
# @see the `==` method
|
118
|
+
# @param [Object] Object to be compared
|
119
|
+
def eql?(o)
|
120
|
+
self == o
|
121
|
+
end
|
122
|
+
|
123
|
+
# Calculates hash code according to all attributes.
|
124
|
+
# @return [Integer] Hash code
|
125
|
+
def hash
|
126
|
+
[content, snippet_id, start_offset, end_offset].hash
|
127
|
+
end
|
128
|
+
|
129
|
+
# Builds the object from hash
|
130
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
131
|
+
# @return [Object] Returns the model itself
|
132
|
+
def self.build_from_hash(attributes)
|
133
|
+
new.build_from_hash(attributes)
|
134
|
+
end
|
135
|
+
|
136
|
+
# Builds the object from hash
|
137
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
138
|
+
# @return [Object] Returns the model itself
|
139
|
+
def build_from_hash(attributes)
|
140
|
+
return nil unless attributes.is_a?(Hash)
|
141
|
+
self.class.openapi_types.each_pair do |key, type|
|
142
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
143
|
+
self.send("#{key}=", nil)
|
144
|
+
elsif type =~ /\AArray<(.*)>/i
|
145
|
+
# check to ensure the input is an array given that the attribute
|
146
|
+
# is documented as an array but the input is not
|
147
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
148
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
149
|
+
end
|
150
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
151
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
self
|
156
|
+
end
|
157
|
+
|
158
|
+
# Deserializes the data based on type
|
159
|
+
# @param string type Data type
|
160
|
+
# @param string value Value to be deserialized
|
161
|
+
# @return [Object] Deserialized data
|
162
|
+
def _deserialize(type, value)
|
163
|
+
case type.to_sym
|
164
|
+
when :Time
|
165
|
+
Time.parse(value)
|
166
|
+
when :Date
|
167
|
+
Date.parse(value)
|
168
|
+
when :String
|
169
|
+
value.to_s
|
170
|
+
when :Integer
|
171
|
+
value.to_i
|
172
|
+
when :Float
|
173
|
+
value.to_f
|
174
|
+
when :Boolean
|
175
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
176
|
+
true
|
177
|
+
else
|
178
|
+
false
|
179
|
+
end
|
180
|
+
when :Object
|
181
|
+
# generic object (usually a Hash), return directly
|
182
|
+
value
|
183
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
184
|
+
inner_type = Regexp.last_match[:inner_type]
|
185
|
+
value.map { |v| _deserialize(inner_type, v) }
|
186
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
187
|
+
k_type = Regexp.last_match[:k_type]
|
188
|
+
v_type = Regexp.last_match[:v_type]
|
189
|
+
{}.tap do |hash|
|
190
|
+
value.each do |k, v|
|
191
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
192
|
+
end
|
193
|
+
end
|
194
|
+
else # model
|
195
|
+
# models (e.g. Pet) or oneOf
|
196
|
+
klass = FinnhubRuby.const_get(type)
|
197
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
# Returns the string representation of the object
|
202
|
+
# @return [String] String presentation of the object
|
203
|
+
def to_s
|
204
|
+
to_hash.to_s
|
205
|
+
end
|
206
|
+
|
207
|
+
# to_body is an alias to to_hash (backward compatibility)
|
208
|
+
# @return [Hash] Returns the object in the form of hash
|
209
|
+
def to_body
|
210
|
+
to_hash
|
211
|
+
end
|
212
|
+
|
213
|
+
# Returns the object in the form of hash
|
214
|
+
# @return [Hash] Returns the object in the form of hash
|
215
|
+
def to_hash
|
216
|
+
hash = {}
|
217
|
+
self.class.attribute_map.each_pair do |attr, param|
|
218
|
+
value = self.send(attr)
|
219
|
+
if value.nil?
|
220
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
221
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
222
|
+
end
|
223
|
+
|
224
|
+
hash[param] = _to_hash(value)
|
225
|
+
end
|
226
|
+
hash
|
227
|
+
end
|
228
|
+
|
229
|
+
# Outputs non-array value in the form of hash
|
230
|
+
# For object, use to_hash. Otherwise, just return the value
|
231
|
+
# @param [Object] value Any valid value
|
232
|
+
# @return [Hash] Returns the value in the form of hash
|
233
|
+
def _to_hash(value)
|
234
|
+
if value.is_a?(Array)
|
235
|
+
value.compact.map { |v| _to_hash(v) }
|
236
|
+
elsif value.is_a?(Hash)
|
237
|
+
{}.tap do |hash|
|
238
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
239
|
+
end
|
240
|
+
elsif value.respond_to? :to_hash
|
241
|
+
value.to_hash
|
242
|
+
else
|
243
|
+
value
|
244
|
+
end
|
245
|
+
end
|
246
|
+
|
247
|
+
end
|
248
|
+
|
249
|
+
end
|