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
@@ -30,6 +30,9 @@ module FinnhubRuby
|
|
30
30
|
# List of price data.
|
31
31
|
attr_accessor :p
|
32
32
|
|
33
|
+
# List of yield data.
|
34
|
+
attr_accessor :y
|
35
|
+
|
33
36
|
# List of timestamp in UNIX ms.
|
34
37
|
attr_accessor :t
|
35
38
|
|
@@ -39,6 +42,12 @@ module FinnhubRuby
|
|
39
42
|
# 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
43
|
attr_accessor :cp
|
41
44
|
|
45
|
+
# List of values showing the reporting party of each trade. List of supported values: <a target=\"_blank\" href=\"https://docs.google.com/spreadsheets/d/1O3aueXSPOqo7Iuyz4PqDG6yZunHsX8BTefZ2kFk5pz4/edit?usp=sharing\",>here</a>
|
46
|
+
attr_accessor :rp
|
47
|
+
|
48
|
+
# ATS flag. Y or empty
|
49
|
+
attr_accessor :ats
|
50
|
+
|
42
51
|
# 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
52
|
attr_accessor :c
|
44
53
|
|
@@ -50,9 +59,12 @@ module FinnhubRuby
|
|
50
59
|
:'total' => :'total',
|
51
60
|
:'v' => :'v',
|
52
61
|
:'p' => :'p',
|
62
|
+
:'y' => :'y',
|
53
63
|
:'t' => :'t',
|
54
64
|
:'si' => :'si',
|
55
65
|
:'cp' => :'cp',
|
66
|
+
:'rp' => :'rp',
|
67
|
+
:'ats' => :'ats',
|
56
68
|
:'c' => :'c'
|
57
69
|
}
|
58
70
|
end
|
@@ -70,9 +82,12 @@ module FinnhubRuby
|
|
70
82
|
:'total' => :'Integer',
|
71
83
|
:'v' => :'Array<Float>',
|
72
84
|
:'p' => :'Array<Float>',
|
85
|
+
:'y' => :'Array<Float>',
|
73
86
|
:'t' => :'Array<Integer>',
|
74
87
|
:'si' => :'Array<String>',
|
75
88
|
:'cp' => :'Array<String>',
|
89
|
+
:'rp' => :'Array<String>',
|
90
|
+
:'ats' => :'Array<String>',
|
76
91
|
:'c' => :'Array<Array<String>>'
|
77
92
|
}
|
78
93
|
end
|
@@ -122,6 +137,12 @@ module FinnhubRuby
|
|
122
137
|
end
|
123
138
|
end
|
124
139
|
|
140
|
+
if attributes.key?(:'y')
|
141
|
+
if (value = attributes[:'y']).is_a?(Array)
|
142
|
+
self.y = value
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
125
146
|
if attributes.key?(:'t')
|
126
147
|
if (value = attributes[:'t']).is_a?(Array)
|
127
148
|
self.t = value
|
@@ -140,6 +161,18 @@ module FinnhubRuby
|
|
140
161
|
end
|
141
162
|
end
|
142
163
|
|
164
|
+
if attributes.key?(:'rp')
|
165
|
+
if (value = attributes[:'rp']).is_a?(Array)
|
166
|
+
self.rp = value
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
if attributes.key?(:'ats')
|
171
|
+
if (value = attributes[:'ats']).is_a?(Array)
|
172
|
+
self.ats = value
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
143
176
|
if attributes.key?(:'c')
|
144
177
|
if (value = attributes[:'c']).is_a?(Array)
|
145
178
|
self.c = value
|
@@ -170,9 +203,12 @@ module FinnhubRuby
|
|
170
203
|
total == o.total &&
|
171
204
|
v == o.v &&
|
172
205
|
p == o.p &&
|
206
|
+
y == o.y &&
|
173
207
|
t == o.t &&
|
174
208
|
si == o.si &&
|
175
209
|
cp == o.cp &&
|
210
|
+
rp == o.rp &&
|
211
|
+
ats == o.ats &&
|
176
212
|
c == o.c
|
177
213
|
end
|
178
214
|
|
@@ -185,7 +221,7 @@ module FinnhubRuby
|
|
185
221
|
# Calculates hash code according to all attributes.
|
186
222
|
# @return [Integer] Hash code
|
187
223
|
def hash
|
188
|
-
[skip, count, total, v, p, t, si, cp, c].hash
|
224
|
+
[skip, count, total, v, p, y, t, si, cp, rp, ats, c].hash
|
189
225
|
end
|
190
226
|
|
191
227
|
# Builds the object from hash
|
@@ -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 BondYieldCurve
|
18
|
+
# Array of data.
|
19
|
+
attr_accessor :data
|
20
|
+
|
21
|
+
# Bond's code
|
22
|
+
attr_accessor :code
|
23
|
+
|
24
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
25
|
+
def self.attribute_map
|
26
|
+
{
|
27
|
+
:'data' => :'data',
|
28
|
+
:'code' => :'code'
|
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
|
+
:'data' => :'Array<BondYieldCurveInfo>',
|
41
|
+
:'code' => :'String'
|
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::BondYieldCurve` 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::BondYieldCurve`. 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?(:'data')
|
67
|
+
if (value = attributes[:'data']).is_a?(Array)
|
68
|
+
self.data = value
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
if attributes.key?(:'code')
|
73
|
+
self.code = attributes[:'code']
|
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
|
+
data == o.data &&
|
96
|
+
code == o.code
|
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
|
+
[data, code].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,229 @@
|
|
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 BondYieldCurveInfo
|
18
|
+
# Date of the reading
|
19
|
+
attr_accessor :d
|
20
|
+
|
21
|
+
# Value
|
22
|
+
attr_accessor :v
|
23
|
+
|
24
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
25
|
+
def self.attribute_map
|
26
|
+
{
|
27
|
+
:'d' => :'d',
|
28
|
+
:'v' => :'v'
|
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
|
+
:'d' => :'String',
|
41
|
+
:'v' => :'Float'
|
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::BondYieldCurveInfo` 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::BondYieldCurveInfo`. 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?(:'d')
|
67
|
+
self.d = attributes[:'d']
|
68
|
+
end
|
69
|
+
|
70
|
+
if attributes.key?(:'v')
|
71
|
+
self.v = attributes[:'v']
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
76
|
+
# @return Array for valid properties with the reasons
|
77
|
+
def list_invalid_properties
|
78
|
+
invalid_properties = Array.new
|
79
|
+
invalid_properties
|
80
|
+
end
|
81
|
+
|
82
|
+
# Check to see if the all the properties in the model are valid
|
83
|
+
# @return true if the model is valid
|
84
|
+
def valid?
|
85
|
+
true
|
86
|
+
end
|
87
|
+
|
88
|
+
# Checks equality by comparing each attribute.
|
89
|
+
# @param [Object] Object to be compared
|
90
|
+
def ==(o)
|
91
|
+
return true if self.equal?(o)
|
92
|
+
self.class == o.class &&
|
93
|
+
d == o.d &&
|
94
|
+
v == o.v
|
95
|
+
end
|
96
|
+
|
97
|
+
# @see the `==` method
|
98
|
+
# @param [Object] Object to be compared
|
99
|
+
def eql?(o)
|
100
|
+
self == o
|
101
|
+
end
|
102
|
+
|
103
|
+
# Calculates hash code according to all attributes.
|
104
|
+
# @return [Integer] Hash code
|
105
|
+
def hash
|
106
|
+
[d, v].hash
|
107
|
+
end
|
108
|
+
|
109
|
+
# Builds the object from hash
|
110
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
111
|
+
# @return [Object] Returns the model itself
|
112
|
+
def self.build_from_hash(attributes)
|
113
|
+
new.build_from_hash(attributes)
|
114
|
+
end
|
115
|
+
|
116
|
+
# Builds the object from hash
|
117
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
118
|
+
# @return [Object] Returns the model itself
|
119
|
+
def build_from_hash(attributes)
|
120
|
+
return nil unless attributes.is_a?(Hash)
|
121
|
+
self.class.openapi_types.each_pair do |key, type|
|
122
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
123
|
+
self.send("#{key}=", nil)
|
124
|
+
elsif type =~ /\AArray<(.*)>/i
|
125
|
+
# check to ensure the input is an array given that the attribute
|
126
|
+
# is documented as an array but the input is not
|
127
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
128
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
129
|
+
end
|
130
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
131
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
self
|
136
|
+
end
|
137
|
+
|
138
|
+
# Deserializes the data based on type
|
139
|
+
# @param string type Data type
|
140
|
+
# @param string value Value to be deserialized
|
141
|
+
# @return [Object] Deserialized data
|
142
|
+
def _deserialize(type, value)
|
143
|
+
case type.to_sym
|
144
|
+
when :Time
|
145
|
+
Time.parse(value)
|
146
|
+
when :Date
|
147
|
+
Date.parse(value)
|
148
|
+
when :String
|
149
|
+
value.to_s
|
150
|
+
when :Integer
|
151
|
+
value.to_i
|
152
|
+
when :Float
|
153
|
+
value.to_f
|
154
|
+
when :Boolean
|
155
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
156
|
+
true
|
157
|
+
else
|
158
|
+
false
|
159
|
+
end
|
160
|
+
when :Object
|
161
|
+
# generic object (usually a Hash), return directly
|
162
|
+
value
|
163
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
164
|
+
inner_type = Regexp.last_match[:inner_type]
|
165
|
+
value.map { |v| _deserialize(inner_type, v) }
|
166
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
167
|
+
k_type = Regexp.last_match[:k_type]
|
168
|
+
v_type = Regexp.last_match[:v_type]
|
169
|
+
{}.tap do |hash|
|
170
|
+
value.each do |k, v|
|
171
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
172
|
+
end
|
173
|
+
end
|
174
|
+
else # model
|
175
|
+
# models (e.g. Pet) or oneOf
|
176
|
+
klass = FinnhubRuby.const_get(type)
|
177
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
# Returns the string representation of the object
|
182
|
+
# @return [String] String presentation of the object
|
183
|
+
def to_s
|
184
|
+
to_hash.to_s
|
185
|
+
end
|
186
|
+
|
187
|
+
# to_body is an alias to to_hash (backward compatibility)
|
188
|
+
# @return [Hash] Returns the object in the form of hash
|
189
|
+
def to_body
|
190
|
+
to_hash
|
191
|
+
end
|
192
|
+
|
193
|
+
# Returns the object in the form of hash
|
194
|
+
# @return [Hash] Returns the object in the form of hash
|
195
|
+
def to_hash
|
196
|
+
hash = {}
|
197
|
+
self.class.attribute_map.each_pair do |attr, param|
|
198
|
+
value = self.send(attr)
|
199
|
+
if value.nil?
|
200
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
201
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
202
|
+
end
|
203
|
+
|
204
|
+
hash[param] = _to_hash(value)
|
205
|
+
end
|
206
|
+
hash
|
207
|
+
end
|
208
|
+
|
209
|
+
# Outputs non-array value in the form of hash
|
210
|
+
# For object, use to_hash. Otherwise, just return the value
|
211
|
+
# @param [Object] value Any valid value
|
212
|
+
# @return [Hash] Returns the value in the form of hash
|
213
|
+
def _to_hash(value)
|
214
|
+
if value.is_a?(Array)
|
215
|
+
value.compact.map { |v| _to_hash(v) }
|
216
|
+
elsif value.is_a?(Hash)
|
217
|
+
{}.tap do |hash|
|
218
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
219
|
+
end
|
220
|
+
elsif value.respond_to? :to_hash
|
221
|
+
value.to_hash
|
222
|
+
else
|
223
|
+
value
|
224
|
+
end
|
225
|
+
end
|
226
|
+
|
227
|
+
end
|
228
|
+
|
229
|
+
end
|
@@ -24,9 +24,15 @@ module FinnhubRuby
|
|
24
24
|
# Country of company's headquarter.
|
25
25
|
attr_accessor :country
|
26
26
|
|
27
|
-
# Currency used in company filings.
|
27
|
+
# Currency used in company filings and financials.
|
28
28
|
attr_accessor :currency
|
29
29
|
|
30
|
+
# Currency used in Estimates data.
|
31
|
+
attr_accessor :estimate_currency
|
32
|
+
|
33
|
+
# Currency used in market capitalization.
|
34
|
+
attr_accessor :market_cap_currency
|
35
|
+
|
30
36
|
# CUSIP number.
|
31
37
|
attr_accessor :cusip
|
32
38
|
|
@@ -106,6 +112,8 @@ module FinnhubRuby
|
|
106
112
|
:'city' => :'city',
|
107
113
|
:'country' => :'country',
|
108
114
|
:'currency' => :'currency',
|
115
|
+
:'estimate_currency' => :'estimateCurrency',
|
116
|
+
:'market_cap_currency' => :'marketCapCurrency',
|
109
117
|
:'cusip' => :'cusip',
|
110
118
|
:'sedol' => :'sedol',
|
111
119
|
:'description' => :'description',
|
@@ -145,6 +153,8 @@ module FinnhubRuby
|
|
145
153
|
:'city' => :'String',
|
146
154
|
:'country' => :'String',
|
147
155
|
:'currency' => :'String',
|
156
|
+
:'estimate_currency' => :'String',
|
157
|
+
:'market_cap_currency' => :'String',
|
148
158
|
:'cusip' => :'String',
|
149
159
|
:'sedol' => :'String',
|
150
160
|
:'description' => :'String',
|
@@ -209,6 +219,14 @@ module FinnhubRuby
|
|
209
219
|
self.currency = attributes[:'currency']
|
210
220
|
end
|
211
221
|
|
222
|
+
if attributes.key?(:'estimate_currency')
|
223
|
+
self.estimate_currency = attributes[:'estimate_currency']
|
224
|
+
end
|
225
|
+
|
226
|
+
if attributes.key?(:'market_cap_currency')
|
227
|
+
self.market_cap_currency = attributes[:'market_cap_currency']
|
228
|
+
end
|
229
|
+
|
212
230
|
if attributes.key?(:'cusip')
|
213
231
|
self.cusip = attributes[:'cusip']
|
214
232
|
end
|
@@ -328,6 +346,8 @@ module FinnhubRuby
|
|
328
346
|
city == o.city &&
|
329
347
|
country == o.country &&
|
330
348
|
currency == o.currency &&
|
349
|
+
estimate_currency == o.estimate_currency &&
|
350
|
+
market_cap_currency == o.market_cap_currency &&
|
331
351
|
cusip == o.cusip &&
|
332
352
|
sedol == o.sedol &&
|
333
353
|
description == o.description &&
|
@@ -363,7 +383,7 @@ module FinnhubRuby
|
|
363
383
|
# Calculates hash code according to all attributes.
|
364
384
|
# @return [Integer] Hash code
|
365
385
|
def hash
|
366
|
-
[address, city, country, currency, cusip, sedol, description, exchange, ggroup, gind, gsector, gsubind, isin, naics_national_industry, naics, naics_sector, naics_subsector, name, phone, state, ticker, weburl, ipo, market_capitalization, share_outstanding, employee_total, logo, finnhub_industry].hash
|
386
|
+
[address, city, country, currency, estimate_currency, market_cap_currency, cusip, sedol, description, exchange, ggroup, gind, gsector, gsubind, isin, naics_national_industry, naics, naics_sector, naics_subsector, name, phone, state, ticker, weburl, ipo, market_capitalization, share_outstanding, employee_total, logo, finnhub_industry].hash
|
367
387
|
end
|
368
388
|
|
369
389
|
# Builds the object from hash
|