finnhub_ruby 1.1.6 → 1.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -67,8 +67,8 @@ module FinnhubRuby
67
67
  :'name' => :'String',
68
68
  :'status' => :'String',
69
69
  :'price' => :'String',
70
- :'number_of_shares' => :'Integer',
71
- :'total_shares_value' => :'Integer'
70
+ :'number_of_shares' => :'Float',
71
+ :'total_shares_value' => :'Float'
72
72
  }
73
73
  end
74
74
 
@@ -41,7 +41,7 @@ module FinnhubRuby
41
41
  # Attribute type mapping.
42
42
  def self.openapi_types
43
43
  {
44
- :'data' => :'Array<Estimate>',
44
+ :'data' => :'Array<RevenueEstimatesInfo>',
45
45
  :'freq' => :'String',
46
46
  :'symbol' => :'String'
47
47
  }
@@ -0,0 +1,259 @@
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.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module FinnhubRuby
17
+ class RevenueEstimatesInfo
18
+ # Average revenue estimates including Finnhub's proprietary estimates.
19
+ attr_accessor :revenue_avg
20
+
21
+ # Highest estimate.
22
+ attr_accessor :revenue_high
23
+
24
+ # Lowest estimate.
25
+ attr_accessor :revenue_low
26
+
27
+ # Number of Analysts.
28
+ attr_accessor :number_analysts
29
+
30
+ # Period.
31
+ attr_accessor :period
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'revenue_avg' => :'revenueAvg',
37
+ :'revenue_high' => :'revenueHigh',
38
+ :'revenue_low' => :'revenueLow',
39
+ :'number_analysts' => :'numberAnalysts',
40
+ :'period' => :'period'
41
+ }
42
+ end
43
+
44
+ # Returns all the JSON keys this model knows about
45
+ def self.acceptable_attributes
46
+ attribute_map.values
47
+ end
48
+
49
+ # Attribute type mapping.
50
+ def self.openapi_types
51
+ {
52
+ :'revenue_avg' => :'Float',
53
+ :'revenue_high' => :'Float',
54
+ :'revenue_low' => :'Float',
55
+ :'number_analysts' => :'Integer',
56
+ :'period' => :'Date'
57
+ }
58
+ end
59
+
60
+ # List of attributes with nullable: true
61
+ def self.openapi_nullable
62
+ Set.new([
63
+ ])
64
+ end
65
+
66
+ # Initializes the object
67
+ # @param [Hash] attributes Model attributes in the form of hash
68
+ def initialize(attributes = {})
69
+ if (!attributes.is_a?(Hash))
70
+ fail ArgumentError, "The input argument (attributes) must be a hash in `FinnhubRuby::RevenueEstimatesInfo` initialize method"
71
+ end
72
+
73
+ # check to see if the attribute exists and convert string to symbol for hash key
74
+ attributes = attributes.each_with_object({}) { |(k, v), h|
75
+ if (!self.class.attribute_map.key?(k.to_sym))
76
+ fail ArgumentError, "`#{k}` is not a valid attribute in `FinnhubRuby::RevenueEstimatesInfo`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
77
+ end
78
+ h[k.to_sym] = v
79
+ }
80
+
81
+ if attributes.key?(:'revenue_avg')
82
+ self.revenue_avg = attributes[:'revenue_avg']
83
+ end
84
+
85
+ if attributes.key?(:'revenue_high')
86
+ self.revenue_high = attributes[:'revenue_high']
87
+ end
88
+
89
+ if attributes.key?(:'revenue_low')
90
+ self.revenue_low = attributes[:'revenue_low']
91
+ end
92
+
93
+ if attributes.key?(:'number_analysts')
94
+ self.number_analysts = attributes[:'number_analysts']
95
+ end
96
+
97
+ if attributes.key?(:'period')
98
+ self.period = attributes[:'period']
99
+ end
100
+ end
101
+
102
+ # Show invalid properties with the reasons. Usually used together with valid?
103
+ # @return Array for valid properties with the reasons
104
+ def list_invalid_properties
105
+ invalid_properties = Array.new
106
+ invalid_properties
107
+ end
108
+
109
+ # Check to see if the all the properties in the model are valid
110
+ # @return true if the model is valid
111
+ def valid?
112
+ true
113
+ end
114
+
115
+ # Checks equality by comparing each attribute.
116
+ # @param [Object] Object to be compared
117
+ def ==(o)
118
+ return true if self.equal?(o)
119
+ self.class == o.class &&
120
+ revenue_avg == o.revenue_avg &&
121
+ revenue_high == o.revenue_high &&
122
+ revenue_low == o.revenue_low &&
123
+ number_analysts == o.number_analysts &&
124
+ period == o.period
125
+ end
126
+
127
+ # @see the `==` method
128
+ # @param [Object] Object to be compared
129
+ def eql?(o)
130
+ self == o
131
+ end
132
+
133
+ # Calculates hash code according to all attributes.
134
+ # @return [Integer] Hash code
135
+ def hash
136
+ [revenue_avg, revenue_high, revenue_low, number_analysts, period].hash
137
+ end
138
+
139
+ # Builds the object from hash
140
+ # @param [Hash] attributes Model attributes in the form of hash
141
+ # @return [Object] Returns the model itself
142
+ def self.build_from_hash(attributes)
143
+ new.build_from_hash(attributes)
144
+ end
145
+
146
+ # Builds the object from hash
147
+ # @param [Hash] attributes Model attributes in the form of hash
148
+ # @return [Object] Returns the model itself
149
+ def build_from_hash(attributes)
150
+ return nil unless attributes.is_a?(Hash)
151
+ self.class.openapi_types.each_pair do |key, type|
152
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
153
+ self.send("#{key}=", nil)
154
+ elsif type =~ /\AArray<(.*)>/i
155
+ # check to ensure the input is an array given that the attribute
156
+ # is documented as an array but the input is not
157
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
158
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
159
+ end
160
+ elsif !attributes[self.class.attribute_map[key]].nil?
161
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
162
+ end
163
+ end
164
+
165
+ self
166
+ end
167
+
168
+ # Deserializes the data based on type
169
+ # @param string type Data type
170
+ # @param string value Value to be deserialized
171
+ # @return [Object] Deserialized data
172
+ def _deserialize(type, value)
173
+ case type.to_sym
174
+ when :Time
175
+ Time.parse(value)
176
+ when :Date
177
+ Date.parse(value)
178
+ when :String
179
+ value.to_s
180
+ when :Integer
181
+ value.to_i
182
+ when :Float
183
+ value.to_f
184
+ when :Boolean
185
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
186
+ true
187
+ else
188
+ false
189
+ end
190
+ when :Object
191
+ # generic object (usually a Hash), return directly
192
+ value
193
+ when /\AArray<(?<inner_type>.+)>\z/
194
+ inner_type = Regexp.last_match[:inner_type]
195
+ value.map { |v| _deserialize(inner_type, v) }
196
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
197
+ k_type = Regexp.last_match[:k_type]
198
+ v_type = Regexp.last_match[:v_type]
199
+ {}.tap do |hash|
200
+ value.each do |k, v|
201
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
202
+ end
203
+ end
204
+ else # model
205
+ # models (e.g. Pet) or oneOf
206
+ klass = FinnhubRuby.const_get(type)
207
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
208
+ end
209
+ end
210
+
211
+ # Returns the string representation of the object
212
+ # @return [String] String presentation of the object
213
+ def to_s
214
+ to_hash.to_s
215
+ end
216
+
217
+ # to_body is an alias to to_hash (backward compatibility)
218
+ # @return [Hash] Returns the object in the form of hash
219
+ def to_body
220
+ to_hash
221
+ end
222
+
223
+ # Returns the object in the form of hash
224
+ # @return [Hash] Returns the object in the form of hash
225
+ def to_hash
226
+ hash = {}
227
+ self.class.attribute_map.each_pair do |attr, param|
228
+ value = self.send(attr)
229
+ if value.nil?
230
+ is_nullable = self.class.openapi_nullable.include?(attr)
231
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
232
+ end
233
+
234
+ hash[param] = _to_hash(value)
235
+ end
236
+ hash
237
+ end
238
+
239
+ # Outputs non-array value in the form of hash
240
+ # For object, use to_hash. Otherwise, just return the value
241
+ # @param [Object] value Any valid value
242
+ # @return [Hash] Returns the value in the form of hash
243
+ def _to_hash(value)
244
+ if value.is_a?(Array)
245
+ value.compact.map { |v| _to_hash(v) }
246
+ elsif value.is_a?(Hash)
247
+ {}.tap do |hash|
248
+ value.each { |k, v| hash[k] = _to_hash(v) }
249
+ end
250
+ elsif value.respond_to? :to_hash
251
+ value.to_hash
252
+ else
253
+ value
254
+ end
255
+ end
256
+
257
+ end
258
+
259
+ end
@@ -37,8 +37,8 @@ module FinnhubRuby
37
37
  # Attribute type mapping.
38
38
  def self.openapi_types
39
39
  {
40
- :'bearish_percent' => :'Integer',
41
- :'bullish_percent' => :'Integer'
40
+ :'bearish_percent' => :'Float',
41
+ :'bullish_percent' => :'Float'
42
42
  }
43
43
  end
44
44
 
@@ -43,7 +43,7 @@ module FinnhubRuby
43
43
  {
44
44
  :'symbol' => :'String',
45
45
  :'cik' => :'String',
46
- :'similarity' => :'Array<Filing>'
46
+ :'similarity' => :'Array<SimilarityIndexInfo>'
47
47
  }
48
48
  end
49
49
 
@@ -0,0 +1,329 @@
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.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module FinnhubRuby
17
+ class SimilarityIndexInfo
18
+ # CIK.
19
+ attr_accessor :cik
20
+
21
+ # Cosine similarity of Item 1 (Business). This number is only available for Annual reports.
22
+ attr_accessor :item1
23
+
24
+ # Cosine similarity of Item 1A (Risk Factors). This number is available for both Annual and Quarterly reports.
25
+ attr_accessor :item1a
26
+
27
+ # Cosine similarity of Item 2 (Management’s Discussion and Analysis of Financial Condition and Results of Operations). This number is only available for Quarterly reports.
28
+ attr_accessor :item2
29
+
30
+ # Cosine similarity of Item 7 (Management’s Discussion and Analysis of Financial Condition and Results of Operations). This number is only available for Annual reports.
31
+ attr_accessor :item7
32
+
33
+ # Cosine similarity of Item 7A (Quantitative and Qualitative Disclosures About Market Risk). This number is only available for Annual reports.
34
+ attr_accessor :item7a
35
+
36
+ # Access number.
37
+ attr_accessor :access_number
38
+
39
+ # Form type.
40
+ attr_accessor :form
41
+
42
+ # Filed date <code>%Y-%m-%d %H:%M:%S</code>.
43
+ attr_accessor :filed_date
44
+
45
+ # Accepted date <code>%Y-%m-%d %H:%M:%S</code>.
46
+ attr_accessor :accepted_date
47
+
48
+ # Report's URL.
49
+ attr_accessor :report_url
50
+
51
+ # Filing's URL.
52
+ attr_accessor :filing_url
53
+
54
+ # Attribute mapping from ruby-style variable name to JSON key.
55
+ def self.attribute_map
56
+ {
57
+ :'cik' => :'cik',
58
+ :'item1' => :'item1',
59
+ :'item1a' => :'item1a',
60
+ :'item2' => :'item2',
61
+ :'item7' => :'item7',
62
+ :'item7a' => :'item7a',
63
+ :'access_number' => :'accessNumber',
64
+ :'form' => :'form',
65
+ :'filed_date' => :'filedDate',
66
+ :'accepted_date' => :'acceptedDate',
67
+ :'report_url' => :'reportUrl',
68
+ :'filing_url' => :'filingUrl'
69
+ }
70
+ end
71
+
72
+ # Returns all the JSON keys this model knows about
73
+ def self.acceptable_attributes
74
+ attribute_map.values
75
+ end
76
+
77
+ # Attribute type mapping.
78
+ def self.openapi_types
79
+ {
80
+ :'cik' => :'String',
81
+ :'item1' => :'Float',
82
+ :'item1a' => :'Float',
83
+ :'item2' => :'Float',
84
+ :'item7' => :'Float',
85
+ :'item7a' => :'Float',
86
+ :'access_number' => :'String',
87
+ :'form' => :'String',
88
+ :'filed_date' => :'String',
89
+ :'accepted_date' => :'String',
90
+ :'report_url' => :'String',
91
+ :'filing_url' => :'String'
92
+ }
93
+ end
94
+
95
+ # List of attributes with nullable: true
96
+ def self.openapi_nullable
97
+ Set.new([
98
+ ])
99
+ end
100
+
101
+ # Initializes the object
102
+ # @param [Hash] attributes Model attributes in the form of hash
103
+ def initialize(attributes = {})
104
+ if (!attributes.is_a?(Hash))
105
+ fail ArgumentError, "The input argument (attributes) must be a hash in `FinnhubRuby::SimilarityIndexInfo` initialize method"
106
+ end
107
+
108
+ # check to see if the attribute exists and convert string to symbol for hash key
109
+ attributes = attributes.each_with_object({}) { |(k, v), h|
110
+ if (!self.class.attribute_map.key?(k.to_sym))
111
+ fail ArgumentError, "`#{k}` is not a valid attribute in `FinnhubRuby::SimilarityIndexInfo`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
112
+ end
113
+ h[k.to_sym] = v
114
+ }
115
+
116
+ if attributes.key?(:'cik')
117
+ self.cik = attributes[:'cik']
118
+ end
119
+
120
+ if attributes.key?(:'item1')
121
+ self.item1 = attributes[:'item1']
122
+ end
123
+
124
+ if attributes.key?(:'item1a')
125
+ self.item1a = attributes[:'item1a']
126
+ end
127
+
128
+ if attributes.key?(:'item2')
129
+ self.item2 = attributes[:'item2']
130
+ end
131
+
132
+ if attributes.key?(:'item7')
133
+ self.item7 = attributes[:'item7']
134
+ end
135
+
136
+ if attributes.key?(:'item7a')
137
+ self.item7a = attributes[:'item7a']
138
+ end
139
+
140
+ if attributes.key?(:'access_number')
141
+ self.access_number = attributes[:'access_number']
142
+ end
143
+
144
+ if attributes.key?(:'form')
145
+ self.form = attributes[:'form']
146
+ end
147
+
148
+ if attributes.key?(:'filed_date')
149
+ self.filed_date = attributes[:'filed_date']
150
+ end
151
+
152
+ if attributes.key?(:'accepted_date')
153
+ self.accepted_date = attributes[:'accepted_date']
154
+ end
155
+
156
+ if attributes.key?(:'report_url')
157
+ self.report_url = attributes[:'report_url']
158
+ end
159
+
160
+ if attributes.key?(:'filing_url')
161
+ self.filing_url = attributes[:'filing_url']
162
+ end
163
+ end
164
+
165
+ # Show invalid properties with the reasons. Usually used together with valid?
166
+ # @return Array for valid properties with the reasons
167
+ def list_invalid_properties
168
+ invalid_properties = Array.new
169
+ invalid_properties
170
+ end
171
+
172
+ # Check to see if the all the properties in the model are valid
173
+ # @return true if the model is valid
174
+ def valid?
175
+ true
176
+ end
177
+
178
+ # Checks equality by comparing each attribute.
179
+ # @param [Object] Object to be compared
180
+ def ==(o)
181
+ return true if self.equal?(o)
182
+ self.class == o.class &&
183
+ cik == o.cik &&
184
+ item1 == o.item1 &&
185
+ item1a == o.item1a &&
186
+ item2 == o.item2 &&
187
+ item7 == o.item7 &&
188
+ item7a == o.item7a &&
189
+ access_number == o.access_number &&
190
+ form == o.form &&
191
+ filed_date == o.filed_date &&
192
+ accepted_date == o.accepted_date &&
193
+ report_url == o.report_url &&
194
+ filing_url == o.filing_url
195
+ end
196
+
197
+ # @see the `==` method
198
+ # @param [Object] Object to be compared
199
+ def eql?(o)
200
+ self == o
201
+ end
202
+
203
+ # Calculates hash code according to all attributes.
204
+ # @return [Integer] Hash code
205
+ def hash
206
+ [cik, item1, item1a, item2, item7, item7a, access_number, form, filed_date, accepted_date, report_url, filing_url].hash
207
+ end
208
+
209
+ # Builds the object from hash
210
+ # @param [Hash] attributes Model attributes in the form of hash
211
+ # @return [Object] Returns the model itself
212
+ def self.build_from_hash(attributes)
213
+ new.build_from_hash(attributes)
214
+ end
215
+
216
+ # Builds the object from hash
217
+ # @param [Hash] attributes Model attributes in the form of hash
218
+ # @return [Object] Returns the model itself
219
+ def build_from_hash(attributes)
220
+ return nil unless attributes.is_a?(Hash)
221
+ self.class.openapi_types.each_pair do |key, type|
222
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
223
+ self.send("#{key}=", nil)
224
+ elsif type =~ /\AArray<(.*)>/i
225
+ # check to ensure the input is an array given that the attribute
226
+ # is documented as an array but the input is not
227
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
228
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
229
+ end
230
+ elsif !attributes[self.class.attribute_map[key]].nil?
231
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
232
+ end
233
+ end
234
+
235
+ self
236
+ end
237
+
238
+ # Deserializes the data based on type
239
+ # @param string type Data type
240
+ # @param string value Value to be deserialized
241
+ # @return [Object] Deserialized data
242
+ def _deserialize(type, value)
243
+ case type.to_sym
244
+ when :Time
245
+ Time.parse(value)
246
+ when :Date
247
+ Date.parse(value)
248
+ when :String
249
+ value.to_s
250
+ when :Integer
251
+ value.to_i
252
+ when :Float
253
+ value.to_f
254
+ when :Boolean
255
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
256
+ true
257
+ else
258
+ false
259
+ end
260
+ when :Object
261
+ # generic object (usually a Hash), return directly
262
+ value
263
+ when /\AArray<(?<inner_type>.+)>\z/
264
+ inner_type = Regexp.last_match[:inner_type]
265
+ value.map { |v| _deserialize(inner_type, v) }
266
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
267
+ k_type = Regexp.last_match[:k_type]
268
+ v_type = Regexp.last_match[:v_type]
269
+ {}.tap do |hash|
270
+ value.each do |k, v|
271
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
272
+ end
273
+ end
274
+ else # model
275
+ # models (e.g. Pet) or oneOf
276
+ klass = FinnhubRuby.const_get(type)
277
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
278
+ end
279
+ end
280
+
281
+ # Returns the string representation of the object
282
+ # @return [String] String presentation of the object
283
+ def to_s
284
+ to_hash.to_s
285
+ end
286
+
287
+ # to_body is an alias to to_hash (backward compatibility)
288
+ # @return [Hash] Returns the object in the form of hash
289
+ def to_body
290
+ to_hash
291
+ end
292
+
293
+ # Returns the object in the form of hash
294
+ # @return [Hash] Returns the object in the form of hash
295
+ def to_hash
296
+ hash = {}
297
+ self.class.attribute_map.each_pair do |attr, param|
298
+ value = self.send(attr)
299
+ if value.nil?
300
+ is_nullable = self.class.openapi_nullable.include?(attr)
301
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
302
+ end
303
+
304
+ hash[param] = _to_hash(value)
305
+ end
306
+ hash
307
+ end
308
+
309
+ # Outputs non-array value in the form of hash
310
+ # For object, use to_hash. Otherwise, just return the value
311
+ # @param [Object] value Any valid value
312
+ # @return [Hash] Returns the value in the form of hash
313
+ def _to_hash(value)
314
+ if value.is_a?(Array)
315
+ value.compact.map { |v| _to_hash(v) }
316
+ elsif value.is_a?(Hash)
317
+ {}.tap do |hash|
318
+ value.each { |k, v| hash[k] = _to_hash(v) }
319
+ end
320
+ elsif value.respond_to? :to_hash
321
+ value.to_hash
322
+ else
323
+ value
324
+ end
325
+ end
326
+
327
+ end
328
+
329
+ end