finnhub_ruby 1.1.11 → 1.1.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -3
- data/docs/DefaultApi.md +240 -8
- data/docs/InsiderSentiments.md +20 -0
- data/docs/InsiderSentimentsData.md +26 -0
- data/docs/StockSymbol.md +7 -1
- data/docs/UsptoPatent.md +34 -0
- data/docs/UsptoPatentResult.md +20 -0
- data/docs/VisaApplication.md +62 -0
- data/docs/VisaApplicationResult.md +20 -0
- data/finnhub_ruby-1.1.11.gem +0 -0
- data/finnhub_ruby-1.1.12.gem +0 -0
- data/finnhub_ruby-1.1.13.gem +0 -0
- data/lib/finnhub_ruby/api/default_api.rb +252 -12
- data/lib/finnhub_ruby/models/insider_sentiments.rb +231 -0
- data/lib/finnhub_ruby/models/insider_sentiments_data.rb +259 -0
- data/lib/finnhub_ruby/models/stock_symbol.rb +34 -4
- data/lib/finnhub_ruby/models/uspto_patent.rb +301 -0
- data/lib/finnhub_ruby/models/uspto_patent_result.rb +231 -0
- data/lib/finnhub_ruby/models/visa_application.rb +439 -0
- data/lib/finnhub_ruby/models/visa_application_result.rb +231 -0
- data/lib/finnhub_ruby/version.rb +1 -1
- data/lib/finnhub_ruby.rb +6 -0
- data/spec/models/insider_sentiments_data_spec.rb +58 -0
- data/spec/models/insider_sentiments_spec.rb +40 -0
- data/spec/models/uspto_patent_result_spec.rb +40 -0
- data/spec/models/uspto_patent_spec.rb +82 -0
- data/spec/models/visa_application_result_spec.rb +40 -0
- data/spec/models/visa_application_spec.rb +166 -0
- metadata +29 -2
@@ -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.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module FinnhubRuby
|
17
|
+
class InsiderSentimentsData
|
18
|
+
# Symbol.
|
19
|
+
attr_accessor :symbol
|
20
|
+
|
21
|
+
# Year.
|
22
|
+
attr_accessor :year
|
23
|
+
|
24
|
+
# Month.
|
25
|
+
attr_accessor :month
|
26
|
+
|
27
|
+
# Net buying/selling from all insiders' transactions.
|
28
|
+
attr_accessor :change
|
29
|
+
|
30
|
+
# Monthly share purchase ratio.
|
31
|
+
attr_accessor :mspr
|
32
|
+
|
33
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
34
|
+
def self.attribute_map
|
35
|
+
{
|
36
|
+
:'symbol' => :'symbol',
|
37
|
+
:'year' => :'year',
|
38
|
+
:'month' => :'month',
|
39
|
+
:'change' => :'change',
|
40
|
+
:'mspr' => :'mspr'
|
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
|
+
:'symbol' => :'String',
|
53
|
+
:'year' => :'Integer',
|
54
|
+
:'month' => :'Integer',
|
55
|
+
:'change' => :'Integer',
|
56
|
+
:'mspr' => :'Float'
|
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::InsiderSentimentsData` 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::InsiderSentimentsData`. 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?(:'symbol')
|
82
|
+
self.symbol = attributes[:'symbol']
|
83
|
+
end
|
84
|
+
|
85
|
+
if attributes.key?(:'year')
|
86
|
+
self.year = attributes[:'year']
|
87
|
+
end
|
88
|
+
|
89
|
+
if attributes.key?(:'month')
|
90
|
+
self.month = attributes[:'month']
|
91
|
+
end
|
92
|
+
|
93
|
+
if attributes.key?(:'change')
|
94
|
+
self.change = attributes[:'change']
|
95
|
+
end
|
96
|
+
|
97
|
+
if attributes.key?(:'mspr')
|
98
|
+
self.mspr = attributes[:'mspr']
|
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
|
+
symbol == o.symbol &&
|
121
|
+
year == o.year &&
|
122
|
+
month == o.month &&
|
123
|
+
change == o.change &&
|
124
|
+
mspr == o.mspr
|
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
|
+
[symbol, year, month, change, mspr].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
|
@@ -33,9 +33,18 @@ module FinnhubRuby
|
|
33
33
|
# FIGI identifier.
|
34
34
|
attr_accessor :figi
|
35
35
|
|
36
|
+
# Global Share Class FIGI.
|
37
|
+
attr_accessor :share_class_figi
|
38
|
+
|
36
39
|
# Price's currency. This might be different from the reporting currency of fundamental data.
|
37
40
|
attr_accessor :currency
|
38
41
|
|
42
|
+
# Alternative ticker for exchanges with multiple tickers for 1 stock such as BSE.
|
43
|
+
attr_accessor :symbol2
|
44
|
+
|
45
|
+
# ISIN. This field is only available for EU stocks and selected Asian markets. Entitlement from Finnhub is required to access this field.
|
46
|
+
attr_accessor :isin
|
47
|
+
|
39
48
|
# Attribute mapping from ruby-style variable name to JSON key.
|
40
49
|
def self.attribute_map
|
41
50
|
{
|
@@ -45,7 +54,10 @@ module FinnhubRuby
|
|
45
54
|
:'type' => :'type',
|
46
55
|
:'mic' => :'mic',
|
47
56
|
:'figi' => :'figi',
|
48
|
-
:'
|
57
|
+
:'share_class_figi' => :'shareClassFIGI',
|
58
|
+
:'currency' => :'currency',
|
59
|
+
:'symbol2' => :'symbol2',
|
60
|
+
:'isin' => :'isin'
|
49
61
|
}
|
50
62
|
end
|
51
63
|
|
@@ -63,7 +75,10 @@ module FinnhubRuby
|
|
63
75
|
:'type' => :'String',
|
64
76
|
:'mic' => :'String',
|
65
77
|
:'figi' => :'String',
|
66
|
-
:'
|
78
|
+
:'share_class_figi' => :'String',
|
79
|
+
:'currency' => :'String',
|
80
|
+
:'symbol2' => :'String',
|
81
|
+
:'isin' => :'String'
|
67
82
|
}
|
68
83
|
end
|
69
84
|
|
@@ -112,9 +127,21 @@ module FinnhubRuby
|
|
112
127
|
self.figi = attributes[:'figi']
|
113
128
|
end
|
114
129
|
|
130
|
+
if attributes.key?(:'share_class_figi')
|
131
|
+
self.share_class_figi = attributes[:'share_class_figi']
|
132
|
+
end
|
133
|
+
|
115
134
|
if attributes.key?(:'currency')
|
116
135
|
self.currency = attributes[:'currency']
|
117
136
|
end
|
137
|
+
|
138
|
+
if attributes.key?(:'symbol2')
|
139
|
+
self.symbol2 = attributes[:'symbol2']
|
140
|
+
end
|
141
|
+
|
142
|
+
if attributes.key?(:'isin')
|
143
|
+
self.isin = attributes[:'isin']
|
144
|
+
end
|
118
145
|
end
|
119
146
|
|
120
147
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -141,7 +168,10 @@ module FinnhubRuby
|
|
141
168
|
type == o.type &&
|
142
169
|
mic == o.mic &&
|
143
170
|
figi == o.figi &&
|
144
|
-
|
171
|
+
share_class_figi == o.share_class_figi &&
|
172
|
+
currency == o.currency &&
|
173
|
+
symbol2 == o.symbol2 &&
|
174
|
+
isin == o.isin
|
145
175
|
end
|
146
176
|
|
147
177
|
# @see the `==` method
|
@@ -153,7 +183,7 @@ module FinnhubRuby
|
|
153
183
|
# Calculates hash code according to all attributes.
|
154
184
|
# @return [Integer] Hash code
|
155
185
|
def hash
|
156
|
-
[description, display_symbol, symbol, type, mic, figi, currency].hash
|
186
|
+
[description, display_symbol, symbol, type, mic, figi, share_class_figi, currency, symbol2, isin].hash
|
157
187
|
end
|
158
188
|
|
159
189
|
# Builds the object from hash
|
@@ -0,0 +1,301 @@
|
|
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 UsptoPatent
|
18
|
+
# Application Number.
|
19
|
+
attr_accessor :application_number
|
20
|
+
|
21
|
+
# Array of companies' name on the patent.
|
22
|
+
attr_accessor :company_filing_name
|
23
|
+
|
24
|
+
# Filing date.
|
25
|
+
attr_accessor :filing_date
|
26
|
+
|
27
|
+
# Description.
|
28
|
+
attr_accessor :description
|
29
|
+
|
30
|
+
# Filing status.
|
31
|
+
attr_accessor :filing_status
|
32
|
+
|
33
|
+
# Patent number.
|
34
|
+
attr_accessor :patent_number
|
35
|
+
|
36
|
+
# Publication date.
|
37
|
+
attr_accessor :publication_date
|
38
|
+
|
39
|
+
# Patent's type.
|
40
|
+
attr_accessor :patent_type
|
41
|
+
|
42
|
+
# URL of the original article.
|
43
|
+
attr_accessor :url
|
44
|
+
|
45
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
46
|
+
def self.attribute_map
|
47
|
+
{
|
48
|
+
:'application_number' => :'applicationNumber',
|
49
|
+
:'company_filing_name' => :'companyFilingName',
|
50
|
+
:'filing_date' => :'filingDate',
|
51
|
+
:'description' => :'description',
|
52
|
+
:'filing_status' => :'filingStatus',
|
53
|
+
:'patent_number' => :'patentNumber',
|
54
|
+
:'publication_date' => :'publicationDate',
|
55
|
+
:'patent_type' => :'patentType',
|
56
|
+
:'url' => :'url'
|
57
|
+
}
|
58
|
+
end
|
59
|
+
|
60
|
+
# Returns all the JSON keys this model knows about
|
61
|
+
def self.acceptable_attributes
|
62
|
+
attribute_map.values
|
63
|
+
end
|
64
|
+
|
65
|
+
# Attribute type mapping.
|
66
|
+
def self.openapi_types
|
67
|
+
{
|
68
|
+
:'application_number' => :'String',
|
69
|
+
:'company_filing_name' => :'Array<String>',
|
70
|
+
:'filing_date' => :'String',
|
71
|
+
:'description' => :'String',
|
72
|
+
:'filing_status' => :'String',
|
73
|
+
:'patent_number' => :'String',
|
74
|
+
:'publication_date' => :'String',
|
75
|
+
:'patent_type' => :'String',
|
76
|
+
:'url' => :'String'
|
77
|
+
}
|
78
|
+
end
|
79
|
+
|
80
|
+
# List of attributes with nullable: true
|
81
|
+
def self.openapi_nullable
|
82
|
+
Set.new([
|
83
|
+
])
|
84
|
+
end
|
85
|
+
|
86
|
+
# Initializes the object
|
87
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
88
|
+
def initialize(attributes = {})
|
89
|
+
if (!attributes.is_a?(Hash))
|
90
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `FinnhubRuby::UsptoPatent` initialize method"
|
91
|
+
end
|
92
|
+
|
93
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
94
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
95
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
96
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `FinnhubRuby::UsptoPatent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
97
|
+
end
|
98
|
+
h[k.to_sym] = v
|
99
|
+
}
|
100
|
+
|
101
|
+
if attributes.key?(:'application_number')
|
102
|
+
self.application_number = attributes[:'application_number']
|
103
|
+
end
|
104
|
+
|
105
|
+
if attributes.key?(:'company_filing_name')
|
106
|
+
if (value = attributes[:'company_filing_name']).is_a?(Array)
|
107
|
+
self.company_filing_name = value
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
if attributes.key?(:'filing_date')
|
112
|
+
self.filing_date = attributes[:'filing_date']
|
113
|
+
end
|
114
|
+
|
115
|
+
if attributes.key?(:'description')
|
116
|
+
self.description = attributes[:'description']
|
117
|
+
end
|
118
|
+
|
119
|
+
if attributes.key?(:'filing_status')
|
120
|
+
self.filing_status = attributes[:'filing_status']
|
121
|
+
end
|
122
|
+
|
123
|
+
if attributes.key?(:'patent_number')
|
124
|
+
self.patent_number = attributes[:'patent_number']
|
125
|
+
end
|
126
|
+
|
127
|
+
if attributes.key?(:'publication_date')
|
128
|
+
self.publication_date = attributes[:'publication_date']
|
129
|
+
end
|
130
|
+
|
131
|
+
if attributes.key?(:'patent_type')
|
132
|
+
self.patent_type = attributes[:'patent_type']
|
133
|
+
end
|
134
|
+
|
135
|
+
if attributes.key?(:'url')
|
136
|
+
self.url = attributes[:'url']
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
141
|
+
# @return Array for valid properties with the reasons
|
142
|
+
def list_invalid_properties
|
143
|
+
invalid_properties = Array.new
|
144
|
+
invalid_properties
|
145
|
+
end
|
146
|
+
|
147
|
+
# Check to see if the all the properties in the model are valid
|
148
|
+
# @return true if the model is valid
|
149
|
+
def valid?
|
150
|
+
true
|
151
|
+
end
|
152
|
+
|
153
|
+
# Checks equality by comparing each attribute.
|
154
|
+
# @param [Object] Object to be compared
|
155
|
+
def ==(o)
|
156
|
+
return true if self.equal?(o)
|
157
|
+
self.class == o.class &&
|
158
|
+
application_number == o.application_number &&
|
159
|
+
company_filing_name == o.company_filing_name &&
|
160
|
+
filing_date == o.filing_date &&
|
161
|
+
description == o.description &&
|
162
|
+
filing_status == o.filing_status &&
|
163
|
+
patent_number == o.patent_number &&
|
164
|
+
publication_date == o.publication_date &&
|
165
|
+
patent_type == o.patent_type &&
|
166
|
+
url == o.url
|
167
|
+
end
|
168
|
+
|
169
|
+
# @see the `==` method
|
170
|
+
# @param [Object] Object to be compared
|
171
|
+
def eql?(o)
|
172
|
+
self == o
|
173
|
+
end
|
174
|
+
|
175
|
+
# Calculates hash code according to all attributes.
|
176
|
+
# @return [Integer] Hash code
|
177
|
+
def hash
|
178
|
+
[application_number, company_filing_name, filing_date, description, filing_status, patent_number, publication_date, patent_type, url].hash
|
179
|
+
end
|
180
|
+
|
181
|
+
# Builds the object from hash
|
182
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
183
|
+
# @return [Object] Returns the model itself
|
184
|
+
def self.build_from_hash(attributes)
|
185
|
+
new.build_from_hash(attributes)
|
186
|
+
end
|
187
|
+
|
188
|
+
# Builds the object from hash
|
189
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
190
|
+
# @return [Object] Returns the model itself
|
191
|
+
def build_from_hash(attributes)
|
192
|
+
return nil unless attributes.is_a?(Hash)
|
193
|
+
self.class.openapi_types.each_pair do |key, type|
|
194
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
195
|
+
self.send("#{key}=", nil)
|
196
|
+
elsif type =~ /\AArray<(.*)>/i
|
197
|
+
# check to ensure the input is an array given that the attribute
|
198
|
+
# is documented as an array but the input is not
|
199
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
200
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
201
|
+
end
|
202
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
203
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
self
|
208
|
+
end
|
209
|
+
|
210
|
+
# Deserializes the data based on type
|
211
|
+
# @param string type Data type
|
212
|
+
# @param string value Value to be deserialized
|
213
|
+
# @return [Object] Deserialized data
|
214
|
+
def _deserialize(type, value)
|
215
|
+
case type.to_sym
|
216
|
+
when :Time
|
217
|
+
Time.parse(value)
|
218
|
+
when :Date
|
219
|
+
Date.parse(value)
|
220
|
+
when :String
|
221
|
+
value.to_s
|
222
|
+
when :Integer
|
223
|
+
value.to_i
|
224
|
+
when :Float
|
225
|
+
value.to_f
|
226
|
+
when :Boolean
|
227
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
228
|
+
true
|
229
|
+
else
|
230
|
+
false
|
231
|
+
end
|
232
|
+
when :Object
|
233
|
+
# generic object (usually a Hash), return directly
|
234
|
+
value
|
235
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
236
|
+
inner_type = Regexp.last_match[:inner_type]
|
237
|
+
value.map { |v| _deserialize(inner_type, v) }
|
238
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
239
|
+
k_type = Regexp.last_match[:k_type]
|
240
|
+
v_type = Regexp.last_match[:v_type]
|
241
|
+
{}.tap do |hash|
|
242
|
+
value.each do |k, v|
|
243
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
244
|
+
end
|
245
|
+
end
|
246
|
+
else # model
|
247
|
+
# models (e.g. Pet) or oneOf
|
248
|
+
klass = FinnhubRuby.const_get(type)
|
249
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
250
|
+
end
|
251
|
+
end
|
252
|
+
|
253
|
+
# Returns the string representation of the object
|
254
|
+
# @return [String] String presentation of the object
|
255
|
+
def to_s
|
256
|
+
to_hash.to_s
|
257
|
+
end
|
258
|
+
|
259
|
+
# to_body is an alias to to_hash (backward compatibility)
|
260
|
+
# @return [Hash] Returns the object in the form of hash
|
261
|
+
def to_body
|
262
|
+
to_hash
|
263
|
+
end
|
264
|
+
|
265
|
+
# Returns the object in the form of hash
|
266
|
+
# @return [Hash] Returns the object in the form of hash
|
267
|
+
def to_hash
|
268
|
+
hash = {}
|
269
|
+
self.class.attribute_map.each_pair do |attr, param|
|
270
|
+
value = self.send(attr)
|
271
|
+
if value.nil?
|
272
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
273
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
274
|
+
end
|
275
|
+
|
276
|
+
hash[param] = _to_hash(value)
|
277
|
+
end
|
278
|
+
hash
|
279
|
+
end
|
280
|
+
|
281
|
+
# Outputs non-array value in the form of hash
|
282
|
+
# For object, use to_hash. Otherwise, just return the value
|
283
|
+
# @param [Object] value Any valid value
|
284
|
+
# @return [Hash] Returns the value in the form of hash
|
285
|
+
def _to_hash(value)
|
286
|
+
if value.is_a?(Array)
|
287
|
+
value.compact.map { |v| _to_hash(v) }
|
288
|
+
elsif value.is_a?(Hash)
|
289
|
+
{}.tap do |hash|
|
290
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
291
|
+
end
|
292
|
+
elsif value.respond_to? :to_hash
|
293
|
+
value.to_hash
|
294
|
+
else
|
295
|
+
value
|
296
|
+
end
|
297
|
+
end
|
298
|
+
|
299
|
+
end
|
300
|
+
|
301
|
+
end
|