finnhub_ruby 1.1.14 → 1.1.15

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.
@@ -0,0 +1,359 @@
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 LobbyingData
18
+ # Symbol.
19
+ attr_accessor :symbol
20
+
21
+ # Company's name.
22
+ attr_accessor :name
23
+
24
+ # Description.
25
+ attr_accessor :description
26
+
27
+ # Country.
28
+ attr_accessor :country
29
+
30
+ # Year.
31
+ attr_accessor :year
32
+
33
+ # Period.
34
+ attr_accessor :period
35
+
36
+ # Income reported by lobbying firms.
37
+ attr_accessor :income
38
+
39
+ # Expenses reported by the company.
40
+ attr_accessor :expenses
41
+
42
+ # Document's URL.
43
+ attr_accessor :document_url
44
+
45
+ # Posted name.
46
+ attr_accessor :posted_name
47
+
48
+ # Date.
49
+ attr_accessor :date
50
+
51
+ # Client ID.
52
+ attr_accessor :client_id
53
+
54
+ # Registrant ID.
55
+ attr_accessor :registrant_id
56
+
57
+ # Senate ID.
58
+ attr_accessor :senate_id
59
+
60
+ # House registrant ID.
61
+ attr_accessor :houseregistrant_id
62
+
63
+ # Attribute mapping from ruby-style variable name to JSON key.
64
+ def self.attribute_map
65
+ {
66
+ :'symbol' => :'symbol',
67
+ :'name' => :'name',
68
+ :'description' => :'description',
69
+ :'country' => :'country',
70
+ :'year' => :'year',
71
+ :'period' => :'period',
72
+ :'income' => :'income',
73
+ :'expenses' => :'expenses',
74
+ :'document_url' => :'documentUrl',
75
+ :'posted_name' => :'postedName',
76
+ :'date' => :'date',
77
+ :'client_id' => :'clientId',
78
+ :'registrant_id' => :'registrantId',
79
+ :'senate_id' => :'senateId',
80
+ :'houseregistrant_id' => :'houseregistrantId'
81
+ }
82
+ end
83
+
84
+ # Returns all the JSON keys this model knows about
85
+ def self.acceptable_attributes
86
+ attribute_map.values
87
+ end
88
+
89
+ # Attribute type mapping.
90
+ def self.openapi_types
91
+ {
92
+ :'symbol' => :'String',
93
+ :'name' => :'String',
94
+ :'description' => :'String',
95
+ :'country' => :'String',
96
+ :'year' => :'Integer',
97
+ :'period' => :'String',
98
+ :'income' => :'Float',
99
+ :'expenses' => :'Float',
100
+ :'document_url' => :'String',
101
+ :'posted_name' => :'String',
102
+ :'date' => :'String',
103
+ :'client_id' => :'String',
104
+ :'registrant_id' => :'String',
105
+ :'senate_id' => :'String',
106
+ :'houseregistrant_id' => :'String'
107
+ }
108
+ end
109
+
110
+ # List of attributes with nullable: true
111
+ def self.openapi_nullable
112
+ Set.new([
113
+ ])
114
+ end
115
+
116
+ # Initializes the object
117
+ # @param [Hash] attributes Model attributes in the form of hash
118
+ def initialize(attributes = {})
119
+ if (!attributes.is_a?(Hash))
120
+ fail ArgumentError, "The input argument (attributes) must be a hash in `FinnhubRuby::LobbyingData` initialize method"
121
+ end
122
+
123
+ # check to see if the attribute exists and convert string to symbol for hash key
124
+ attributes = attributes.each_with_object({}) { |(k, v), h|
125
+ if (!self.class.attribute_map.key?(k.to_sym))
126
+ fail ArgumentError, "`#{k}` is not a valid attribute in `FinnhubRuby::LobbyingData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
127
+ end
128
+ h[k.to_sym] = v
129
+ }
130
+
131
+ if attributes.key?(:'symbol')
132
+ self.symbol = attributes[:'symbol']
133
+ end
134
+
135
+ if attributes.key?(:'name')
136
+ self.name = attributes[:'name']
137
+ end
138
+
139
+ if attributes.key?(:'description')
140
+ self.description = attributes[:'description']
141
+ end
142
+
143
+ if attributes.key?(:'country')
144
+ self.country = attributes[:'country']
145
+ end
146
+
147
+ if attributes.key?(:'year')
148
+ self.year = attributes[:'year']
149
+ end
150
+
151
+ if attributes.key?(:'period')
152
+ self.period = attributes[:'period']
153
+ end
154
+
155
+ if attributes.key?(:'income')
156
+ self.income = attributes[:'income']
157
+ end
158
+
159
+ if attributes.key?(:'expenses')
160
+ self.expenses = attributes[:'expenses']
161
+ end
162
+
163
+ if attributes.key?(:'document_url')
164
+ self.document_url = attributes[:'document_url']
165
+ end
166
+
167
+ if attributes.key?(:'posted_name')
168
+ self.posted_name = attributes[:'posted_name']
169
+ end
170
+
171
+ if attributes.key?(:'date')
172
+ self.date = attributes[:'date']
173
+ end
174
+
175
+ if attributes.key?(:'client_id')
176
+ self.client_id = attributes[:'client_id']
177
+ end
178
+
179
+ if attributes.key?(:'registrant_id')
180
+ self.registrant_id = attributes[:'registrant_id']
181
+ end
182
+
183
+ if attributes.key?(:'senate_id')
184
+ self.senate_id = attributes[:'senate_id']
185
+ end
186
+
187
+ if attributes.key?(:'houseregistrant_id')
188
+ self.houseregistrant_id = attributes[:'houseregistrant_id']
189
+ end
190
+ end
191
+
192
+ # Show invalid properties with the reasons. Usually used together with valid?
193
+ # @return Array for valid properties with the reasons
194
+ def list_invalid_properties
195
+ invalid_properties = Array.new
196
+ invalid_properties
197
+ end
198
+
199
+ # Check to see if the all the properties in the model are valid
200
+ # @return true if the model is valid
201
+ def valid?
202
+ true
203
+ end
204
+
205
+ # Checks equality by comparing each attribute.
206
+ # @param [Object] Object to be compared
207
+ def ==(o)
208
+ return true if self.equal?(o)
209
+ self.class == o.class &&
210
+ symbol == o.symbol &&
211
+ name == o.name &&
212
+ description == o.description &&
213
+ country == o.country &&
214
+ year == o.year &&
215
+ period == o.period &&
216
+ income == o.income &&
217
+ expenses == o.expenses &&
218
+ document_url == o.document_url &&
219
+ posted_name == o.posted_name &&
220
+ date == o.date &&
221
+ client_id == o.client_id &&
222
+ registrant_id == o.registrant_id &&
223
+ senate_id == o.senate_id &&
224
+ houseregistrant_id == o.houseregistrant_id
225
+ end
226
+
227
+ # @see the `==` method
228
+ # @param [Object] Object to be compared
229
+ def eql?(o)
230
+ self == o
231
+ end
232
+
233
+ # Calculates hash code according to all attributes.
234
+ # @return [Integer] Hash code
235
+ def hash
236
+ [symbol, name, description, country, year, period, income, expenses, document_url, posted_name, date, client_id, registrant_id, senate_id, houseregistrant_id].hash
237
+ end
238
+
239
+ # Builds the object from hash
240
+ # @param [Hash] attributes Model attributes in the form of hash
241
+ # @return [Object] Returns the model itself
242
+ def self.build_from_hash(attributes)
243
+ new.build_from_hash(attributes)
244
+ end
245
+
246
+ # Builds the object from hash
247
+ # @param [Hash] attributes Model attributes in the form of hash
248
+ # @return [Object] Returns the model itself
249
+ def build_from_hash(attributes)
250
+ return nil unless attributes.is_a?(Hash)
251
+ self.class.openapi_types.each_pair do |key, type|
252
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
253
+ self.send("#{key}=", nil)
254
+ elsif type =~ /\AArray<(.*)>/i
255
+ # check to ensure the input is an array given that the attribute
256
+ # is documented as an array but the input is not
257
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
258
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
259
+ end
260
+ elsif !attributes[self.class.attribute_map[key]].nil?
261
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
262
+ end
263
+ end
264
+
265
+ self
266
+ end
267
+
268
+ # Deserializes the data based on type
269
+ # @param string type Data type
270
+ # @param string value Value to be deserialized
271
+ # @return [Object] Deserialized data
272
+ def _deserialize(type, value)
273
+ case type.to_sym
274
+ when :Time
275
+ Time.parse(value)
276
+ when :Date
277
+ Date.parse(value)
278
+ when :String
279
+ value.to_s
280
+ when :Integer
281
+ value.to_i
282
+ when :Float
283
+ value.to_f
284
+ when :Boolean
285
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
286
+ true
287
+ else
288
+ false
289
+ end
290
+ when :Object
291
+ # generic object (usually a Hash), return directly
292
+ value
293
+ when /\AArray<(?<inner_type>.+)>\z/
294
+ inner_type = Regexp.last_match[:inner_type]
295
+ value.map { |v| _deserialize(inner_type, v) }
296
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
297
+ k_type = Regexp.last_match[:k_type]
298
+ v_type = Regexp.last_match[:v_type]
299
+ {}.tap do |hash|
300
+ value.each do |k, v|
301
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
302
+ end
303
+ end
304
+ else # model
305
+ # models (e.g. Pet) or oneOf
306
+ klass = FinnhubRuby.const_get(type)
307
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
308
+ end
309
+ end
310
+
311
+ # Returns the string representation of the object
312
+ # @return [String] String presentation of the object
313
+ def to_s
314
+ to_hash.to_s
315
+ end
316
+
317
+ # to_body is an alias to to_hash (backward compatibility)
318
+ # @return [Hash] Returns the object in the form of hash
319
+ def to_body
320
+ to_hash
321
+ end
322
+
323
+ # Returns the object in the form of hash
324
+ # @return [Hash] Returns the object in the form of hash
325
+ def to_hash
326
+ hash = {}
327
+ self.class.attribute_map.each_pair do |attr, param|
328
+ value = self.send(attr)
329
+ if value.nil?
330
+ is_nullable = self.class.openapi_nullable.include?(attr)
331
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
332
+ end
333
+
334
+ hash[param] = _to_hash(value)
335
+ end
336
+ hash
337
+ end
338
+
339
+ # Outputs non-array value in the form of hash
340
+ # For object, use to_hash. Otherwise, just return the value
341
+ # @param [Object] value Any valid value
342
+ # @return [Hash] Returns the value in the form of hash
343
+ def _to_hash(value)
344
+ if value.is_a?(Array)
345
+ value.compact.map { |v| _to_hash(v) }
346
+ elsif value.is_a?(Hash)
347
+ {}.tap do |hash|
348
+ value.each { |k, v| hash[k] = _to_hash(v) }
349
+ end
350
+ elsif value.respond_to? :to_hash
351
+ value.to_hash
352
+ else
353
+ value
354
+ end
355
+ end
356
+
357
+ end
358
+
359
+ end
@@ -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 LobbyingResult
18
+ # Symbol.
19
+ attr_accessor :symbol
20
+
21
+ # Array of lobbying activities.
22
+ attr_accessor :data
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'symbol' => :'symbol',
28
+ :'data' => :'data'
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
+ :'symbol' => :'String',
41
+ :'data' => :'Array<LobbyingData>'
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::LobbyingResult` 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::LobbyingResult`. 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?(:'symbol')
67
+ self.symbol = attributes[:'symbol']
68
+ end
69
+
70
+ if attributes.key?(:'data')
71
+ if (value = attributes[:'data']).is_a?(Array)
72
+ self.data = value
73
+ end
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
+ symbol == o.symbol &&
96
+ data == o.data
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
+ [symbol, data].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
@@ -11,5 +11,5 @@ OpenAPI Generator version: 5.2.1
11
11
  =end
12
12
 
13
13
  module FinnhubRuby
14
- VERSION = '1.1.14'
14
+ VERSION = '1.1.15'
15
15
  end
data/lib/finnhub_ruby.rb CHANGED
@@ -19,6 +19,8 @@ require 'finnhub_ruby/configuration'
19
19
  # Models
20
20
  require 'finnhub_ruby/models/aggregate_indicators'
21
21
  require 'finnhub_ruby/models/basic_financials'
22
+ require 'finnhub_ruby/models/bond_candles'
23
+ require 'finnhub_ruby/models/bond_profile'
22
24
  require 'finnhub_ruby/models/breakdown_item'
23
25
  require 'finnhub_ruby/models/company'
24
26
  require 'finnhub_ruby/models/company_esg'
@@ -87,6 +89,8 @@ require 'finnhub_ruby/models/investment_theme_portfolio'
87
89
  require 'finnhub_ruby/models/investment_themes'
88
90
  require 'finnhub_ruby/models/key_customers_suppliers'
89
91
  require 'finnhub_ruby/models/last_bid_ask'
92
+ require 'finnhub_ruby/models/lobbying_data'
93
+ require 'finnhub_ruby/models/lobbying_result'
90
94
  require 'finnhub_ruby/models/market_news'
91
95
  require 'finnhub_ruby/models/mutual_fund_country_exposure'
92
96
  require 'finnhub_ruby/models/mutual_fund_country_exposure_data'
@@ -0,0 +1,46 @@
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 'spec_helper'
14
+ require 'json'
15
+ require 'date'
16
+
17
+ # Unit tests for FinnhubRuby::BondCandles
18
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
+ # Please update as you see appropriate
20
+ describe FinnhubRuby::BondCandles do
21
+ let(:instance) { FinnhubRuby::BondCandles.new }
22
+
23
+ describe 'test an instance of BondCandles' do
24
+ it 'should create an instance of BondCandles' do
25
+ expect(instance).to be_instance_of(FinnhubRuby::BondCandles)
26
+ end
27
+ end
28
+ describe 'test attribute "c"' do
29
+ it 'should work' do
30
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
31
+ end
32
+ end
33
+
34
+ describe 'test attribute "t"' do
35
+ it 'should work' do
36
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
37
+ end
38
+ end
39
+
40
+ describe 'test attribute "s"' do
41
+ it 'should work' do
42
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
43
+ end
44
+ end
45
+
46
+ end