fuse_client 1.0.41 → 1.0.42
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/docs/FinancialConnectionData.md +1 -1
- data/docs/FinancialConnectionsAccountDetails.md +1 -1
- data/docs/FinancialConnectionsAccountDetailsAccountNumber.md +1 -1
- data/docs/FuseApi.md +6 -83
- data/docs/Transaction.md +1 -1
- data/lib/fuse_client/api/fuse_api.rb +10 -67
- data/lib/fuse_client/configuration.rb +32 -11
- data/lib/fuse_client/models/financial_connection_data.rb +1 -5
- data/lib/fuse_client/models/financial_connections_account.rb +1 -0
- data/lib/fuse_client/models/financial_connections_account_balance.rb +2 -0
- data/lib/fuse_client/models/financial_connections_account_cached_balance.rb +2 -0
- data/lib/fuse_client/models/financial_connections_account_details.rb +0 -5
- data/lib/fuse_client/models/financial_connections_account_details_account_number.rb +5 -0
- data/lib/fuse_client/models/financial_connections_account_liability.rb +1 -0
- data/lib/fuse_client/models/fuse_api_aggregator_error.rb +5 -0
- data/lib/fuse_client/models/transaction.rb +1 -1
- data/lib/fuse_client/version.rb +1 -1
- data/lib/fuse_client.rb +0 -20
- data/spec/api/fuse_api_spec.rb +1 -12
- metadata +2 -82
- data/docs/FinQLComparisonFeature.md +0 -26
- data/docs/FinQLFeature.md +0 -61
- data/docs/FinQLFeatureOneOf.md +0 -18
- data/docs/FinQLFeatureOneOf1.md +0 -18
- data/docs/FinQLFeatureOneOf2.md +0 -18
- data/docs/FinQLFeatureOneOf3.md +0 -18
- data/docs/FinQLFeatureOneOf4.md +0 -18
- data/docs/FinQLFeatureOneOf5.md +0 -18
- data/docs/FinQLFeatureOneOf6.md +0 -18
- data/docs/FinQLFeatureOneOf7.md +0 -18
- data/docs/FinQLFeatureRequest.md +0 -15
- data/docs/FinQLFrequencyFeature.md +0 -20
- data/docs/FinQLIndividualMerchantFeature.md +0 -20
- data/docs/FinQLInterestFeature.md +0 -18
- data/docs/FinQLMerchantCategoriesFeatureInner.md +0 -20
- data/docs/FinQLMerchantCategoriesFeatureInnerResultInner.md +0 -20
- data/docs/FinQLPromptRequest.md +0 -22
- data/docs/FinQLPromptResponse.md +0 -20
- data/docs/FinQLTimeBasedFeatureInner.md +0 -20
- data/docs/FinQLTopMerchantsFeatureInner.md +0 -22
- data/lib/fuse_client/models/fin_ql_comparison_feature.rb +0 -255
- data/lib/fuse_client/models/fin_ql_feature.rb +0 -111
- data/lib/fuse_client/models/fin_ql_feature_one_of.rb +0 -219
- data/lib/fuse_client/models/fin_ql_feature_one_of1.rb +0 -219
- data/lib/fuse_client/models/fin_ql_feature_one_of2.rb +0 -221
- data/lib/fuse_client/models/fin_ql_feature_one_of3.rb +0 -219
- data/lib/fuse_client/models/fin_ql_feature_one_of4.rb +0 -219
- data/lib/fuse_client/models/fin_ql_feature_one_of5.rb +0 -221
- data/lib/fuse_client/models/fin_ql_feature_one_of6.rb +0 -219
- data/lib/fuse_client/models/fin_ql_feature_one_of7.rb +0 -221
- data/lib/fuse_client/models/fin_ql_feature_request.rb +0 -46
- data/lib/fuse_client/models/fin_ql_frequency_feature.rb +0 -262
- data/lib/fuse_client/models/fin_ql_individual_merchant_feature.rb +0 -228
- data/lib/fuse_client/models/fin_ql_interest_feature.rb +0 -219
- data/lib/fuse_client/models/fin_ql_merchant_categories_feature_inner.rb +0 -230
- data/lib/fuse_client/models/fin_ql_merchant_categories_feature_inner_result_inner.rb +0 -228
- data/lib/fuse_client/models/fin_ql_prompt_request.rb +0 -276
- data/lib/fuse_client/models/fin_ql_prompt_response.rb +0 -234
- data/lib/fuse_client/models/fin_ql_time_based_feature_inner.rb +0 -228
- data/lib/fuse_client/models/fin_ql_top_merchants_feature_inner.rb +0 -237
- data/spec/models/fin_ql_comparison_feature_spec.rb +0 -58
- data/spec/models/fin_ql_feature_one_of1_spec.rb +0 -34
- data/spec/models/fin_ql_feature_one_of2_spec.rb +0 -34
- data/spec/models/fin_ql_feature_one_of3_spec.rb +0 -34
- data/spec/models/fin_ql_feature_one_of4_spec.rb +0 -34
- data/spec/models/fin_ql_feature_one_of5_spec.rb +0 -34
- data/spec/models/fin_ql_feature_one_of6_spec.rb +0 -34
- data/spec/models/fin_ql_feature_one_of7_spec.rb +0 -34
- data/spec/models/fin_ql_feature_one_of_spec.rb +0 -34
- data/spec/models/fin_ql_feature_request_spec.rb +0 -28
- data/spec/models/fin_ql_feature_spec.rb +0 -31
- data/spec/models/fin_ql_frequency_feature_spec.rb +0 -44
- data/spec/models/fin_ql_individual_merchant_feature_spec.rb +0 -40
- data/spec/models/fin_ql_interest_feature_spec.rb +0 -34
- data/spec/models/fin_ql_merchant_categories_feature_inner_result_inner_spec.rb +0 -40
- data/spec/models/fin_ql_merchant_categories_feature_inner_spec.rb +0 -40
- data/spec/models/fin_ql_prompt_request_spec.rb +0 -46
- data/spec/models/fin_ql_prompt_response_spec.rb +0 -40
- data/spec/models/fin_ql_time_based_feature_inner_spec.rb +0 -40
- data/spec/models/fin_ql_top_merchants_feature_inner_spec.rb +0 -46
@@ -1,221 +0,0 @@
|
|
1
|
-
=begin
|
2
|
-
#Fuse
|
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: 6.6.0
|
10
|
-
|
11
|
-
=end
|
12
|
-
|
13
|
-
require 'date'
|
14
|
-
require 'time'
|
15
|
-
|
16
|
-
module FuseClient
|
17
|
-
class FinQLFeatureOneOf7
|
18
|
-
attr_accessor :merchant_categories
|
19
|
-
|
20
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
21
|
-
def self.attribute_map
|
22
|
-
{
|
23
|
-
:'merchant_categories' => :'merchant_categories'
|
24
|
-
}
|
25
|
-
end
|
26
|
-
|
27
|
-
# Returns all the JSON keys this model knows about
|
28
|
-
def self.acceptable_attributes
|
29
|
-
attribute_map.values
|
30
|
-
end
|
31
|
-
|
32
|
-
# Attribute type mapping.
|
33
|
-
def self.openapi_types
|
34
|
-
{
|
35
|
-
:'merchant_categories' => :'Array<FinQLMerchantCategoriesFeatureInner>'
|
36
|
-
}
|
37
|
-
end
|
38
|
-
|
39
|
-
# List of attributes with nullable: true
|
40
|
-
def self.openapi_nullable
|
41
|
-
Set.new([
|
42
|
-
])
|
43
|
-
end
|
44
|
-
|
45
|
-
# Initializes the object
|
46
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
47
|
-
def initialize(attributes = {})
|
48
|
-
if (!attributes.is_a?(Hash))
|
49
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `FuseClient::FinQLFeatureOneOf7` initialize method"
|
50
|
-
end
|
51
|
-
|
52
|
-
# check to see if the attribute exists and convert string to symbol for hash key
|
53
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
54
|
-
if (!self.class.attribute_map.key?(k.to_sym))
|
55
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `FuseClient::FinQLFeatureOneOf7`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
56
|
-
end
|
57
|
-
h[k.to_sym] = v
|
58
|
-
}
|
59
|
-
|
60
|
-
if attributes.key?(:'merchant_categories')
|
61
|
-
if (value = attributes[:'merchant_categories']).is_a?(Array)
|
62
|
-
self.merchant_categories = value
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
68
|
-
# @return Array for valid properties with the reasons
|
69
|
-
def list_invalid_properties
|
70
|
-
invalid_properties = Array.new
|
71
|
-
invalid_properties
|
72
|
-
end
|
73
|
-
|
74
|
-
# Check to see if the all the properties in the model are valid
|
75
|
-
# @return true if the model is valid
|
76
|
-
def valid?
|
77
|
-
true
|
78
|
-
end
|
79
|
-
|
80
|
-
# Checks equality by comparing each attribute.
|
81
|
-
# @param [Object] Object to be compared
|
82
|
-
def ==(o)
|
83
|
-
return true if self.equal?(o)
|
84
|
-
self.class == o.class &&
|
85
|
-
merchant_categories == o.merchant_categories
|
86
|
-
end
|
87
|
-
|
88
|
-
# @see the `==` method
|
89
|
-
# @param [Object] Object to be compared
|
90
|
-
def eql?(o)
|
91
|
-
self == o
|
92
|
-
end
|
93
|
-
|
94
|
-
# Calculates hash code according to all attributes.
|
95
|
-
# @return [Integer] Hash code
|
96
|
-
def hash
|
97
|
-
[merchant_categories].hash
|
98
|
-
end
|
99
|
-
|
100
|
-
# Builds the object from hash
|
101
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
102
|
-
# @return [Object] Returns the model itself
|
103
|
-
def self.build_from_hash(attributes)
|
104
|
-
new.build_from_hash(attributes)
|
105
|
-
end
|
106
|
-
|
107
|
-
# Builds the object from hash
|
108
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
109
|
-
# @return [Object] Returns the model itself
|
110
|
-
def build_from_hash(attributes)
|
111
|
-
return nil unless attributes.is_a?(Hash)
|
112
|
-
attributes = attributes.transform_keys(&:to_sym)
|
113
|
-
self.class.openapi_types.each_pair do |key, type|
|
114
|
-
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
115
|
-
self.send("#{key}=", nil)
|
116
|
-
elsif type =~ /\AArray<(.*)>/i
|
117
|
-
# check to ensure the input is an array given that the attribute
|
118
|
-
# is documented as an array but the input is not
|
119
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
120
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
121
|
-
end
|
122
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
123
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
|
-
self
|
128
|
-
end
|
129
|
-
|
130
|
-
# Deserializes the data based on type
|
131
|
-
# @param string type Data type
|
132
|
-
# @param string value Value to be deserialized
|
133
|
-
# @return [Object] Deserialized data
|
134
|
-
def _deserialize(type, value)
|
135
|
-
case type.to_sym
|
136
|
-
when :Time
|
137
|
-
Time.parse(value)
|
138
|
-
when :Date
|
139
|
-
Date.parse(value)
|
140
|
-
when :String
|
141
|
-
value.to_s
|
142
|
-
when :Integer
|
143
|
-
value.to_i
|
144
|
-
when :Float
|
145
|
-
value.to_f
|
146
|
-
when :Boolean
|
147
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
148
|
-
true
|
149
|
-
else
|
150
|
-
false
|
151
|
-
end
|
152
|
-
when :Object
|
153
|
-
# generic object (usually a Hash), return directly
|
154
|
-
value
|
155
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
156
|
-
inner_type = Regexp.last_match[:inner_type]
|
157
|
-
value.map { |v| _deserialize(inner_type, v) }
|
158
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
159
|
-
k_type = Regexp.last_match[:k_type]
|
160
|
-
v_type = Regexp.last_match[:v_type]
|
161
|
-
{}.tap do |hash|
|
162
|
-
value.each do |k, v|
|
163
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
164
|
-
end
|
165
|
-
end
|
166
|
-
else # model
|
167
|
-
# models (e.g. Pet) or oneOf
|
168
|
-
klass = FuseClient.const_get(type)
|
169
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
170
|
-
end
|
171
|
-
end
|
172
|
-
|
173
|
-
# Returns the string representation of the object
|
174
|
-
# @return [String] String presentation of the object
|
175
|
-
def to_s
|
176
|
-
to_hash.to_s
|
177
|
-
end
|
178
|
-
|
179
|
-
# to_body is an alias to to_hash (backward compatibility)
|
180
|
-
# @return [Hash] Returns the object in the form of hash
|
181
|
-
def to_body
|
182
|
-
to_hash
|
183
|
-
end
|
184
|
-
|
185
|
-
# Returns the object in the form of hash
|
186
|
-
# @return [Hash] Returns the object in the form of hash
|
187
|
-
def to_hash
|
188
|
-
hash = {}
|
189
|
-
self.class.attribute_map.each_pair do |attr, param|
|
190
|
-
value = self.send(attr)
|
191
|
-
if value.nil?
|
192
|
-
is_nullable = self.class.openapi_nullable.include?(attr)
|
193
|
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
194
|
-
end
|
195
|
-
|
196
|
-
hash[param] = _to_hash(value)
|
197
|
-
end
|
198
|
-
hash
|
199
|
-
end
|
200
|
-
|
201
|
-
# Outputs non-array value in the form of hash
|
202
|
-
# For object, use to_hash. Otherwise, just return the value
|
203
|
-
# @param [Object] value Any valid value
|
204
|
-
# @return [Hash] Returns the value in the form of hash
|
205
|
-
def _to_hash(value)
|
206
|
-
if value.is_a?(Array)
|
207
|
-
value.compact.map { |v| _to_hash(v) }
|
208
|
-
elsif value.is_a?(Hash)
|
209
|
-
{}.tap do |hash|
|
210
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
211
|
-
end
|
212
|
-
elsif value.respond_to? :to_hash
|
213
|
-
value.to_hash
|
214
|
-
else
|
215
|
-
value
|
216
|
-
end
|
217
|
-
end
|
218
|
-
|
219
|
-
end
|
220
|
-
|
221
|
-
end
|
@@ -1,46 +0,0 @@
|
|
1
|
-
=begin
|
2
|
-
#Fuse
|
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: 6.6.0
|
10
|
-
|
11
|
-
=end
|
12
|
-
|
13
|
-
require 'date'
|
14
|
-
require 'time'
|
15
|
-
|
16
|
-
module FuseClient
|
17
|
-
class FinQLFeatureRequest
|
18
|
-
TEXT = "text".freeze
|
19
|
-
INDIVIDUAL_MERCHANT = "individual_merchant".freeze
|
20
|
-
TIME_BASED = "time_based".freeze
|
21
|
-
INTEREST = "interest".freeze
|
22
|
-
FREQUENCY = "frequency".freeze
|
23
|
-
TOP_MERCHANTS = "top_merchants".freeze
|
24
|
-
COMPARISON = "comparison".freeze
|
25
|
-
MERCHANT_CATEGORIES = "merchant_categories".freeze
|
26
|
-
|
27
|
-
def self.all_vars
|
28
|
-
@all_vars ||= [TEXT, INDIVIDUAL_MERCHANT, TIME_BASED, INTEREST, FREQUENCY, TOP_MERCHANTS, COMPARISON, MERCHANT_CATEGORIES].freeze
|
29
|
-
end
|
30
|
-
|
31
|
-
# Builds the enum from string
|
32
|
-
# @param [String] The enum value in the form of the string
|
33
|
-
# @return [String] The enum value
|
34
|
-
def self.build_from_hash(value)
|
35
|
-
new.build_from_hash(value)
|
36
|
-
end
|
37
|
-
|
38
|
-
# Builds the enum from string
|
39
|
-
# @param [String] The enum value in the form of the string
|
40
|
-
# @return [String] The enum value
|
41
|
-
def build_from_hash(value)
|
42
|
-
return value if FinQLFeatureRequest.all_vars.include?(value)
|
43
|
-
raise "Invalid ENUM value #{value} for class #FinQLFeatureRequest"
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
@@ -1,262 +0,0 @@
|
|
1
|
-
=begin
|
2
|
-
#Fuse
|
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: 6.6.0
|
10
|
-
|
11
|
-
=end
|
12
|
-
|
13
|
-
require 'date'
|
14
|
-
require 'time'
|
15
|
-
|
16
|
-
module FuseClient
|
17
|
-
class FinQLFrequencyFeature
|
18
|
-
attr_accessor :time_period
|
19
|
-
|
20
|
-
attr_accessor :frequency
|
21
|
-
|
22
|
-
class EnumAttributeValidator
|
23
|
-
attr_reader :datatype
|
24
|
-
attr_reader :allowable_values
|
25
|
-
|
26
|
-
def initialize(datatype, allowable_values)
|
27
|
-
@allowable_values = allowable_values.map do |value|
|
28
|
-
case datatype.to_s
|
29
|
-
when /Integer/i
|
30
|
-
value.to_i
|
31
|
-
when /Float/i
|
32
|
-
value.to_f
|
33
|
-
else
|
34
|
-
value
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
def valid?(value)
|
40
|
-
!value || allowable_values.include?(value)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
45
|
-
def self.attribute_map
|
46
|
-
{
|
47
|
-
:'time_period' => :'time_period',
|
48
|
-
:'frequency' => :'frequency'
|
49
|
-
}
|
50
|
-
end
|
51
|
-
|
52
|
-
# Returns all the JSON keys this model knows about
|
53
|
-
def self.acceptable_attributes
|
54
|
-
attribute_map.values
|
55
|
-
end
|
56
|
-
|
57
|
-
# Attribute type mapping.
|
58
|
-
def self.openapi_types
|
59
|
-
{
|
60
|
-
:'time_period' => :'String',
|
61
|
-
:'frequency' => :'Float'
|
62
|
-
}
|
63
|
-
end
|
64
|
-
|
65
|
-
# List of attributes with nullable: true
|
66
|
-
def self.openapi_nullable
|
67
|
-
Set.new([
|
68
|
-
])
|
69
|
-
end
|
70
|
-
|
71
|
-
# Initializes the object
|
72
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
73
|
-
def initialize(attributes = {})
|
74
|
-
if (!attributes.is_a?(Hash))
|
75
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `FuseClient::FinQLFrequencyFeature` initialize method"
|
76
|
-
end
|
77
|
-
|
78
|
-
# check to see if the attribute exists and convert string to symbol for hash key
|
79
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
80
|
-
if (!self.class.attribute_map.key?(k.to_sym))
|
81
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `FuseClient::FinQLFrequencyFeature`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
82
|
-
end
|
83
|
-
h[k.to_sym] = v
|
84
|
-
}
|
85
|
-
|
86
|
-
if attributes.key?(:'time_period')
|
87
|
-
self.time_period = attributes[:'time_period']
|
88
|
-
end
|
89
|
-
|
90
|
-
if attributes.key?(:'frequency')
|
91
|
-
self.frequency = attributes[:'frequency']
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
96
|
-
# @return Array for valid properties with the reasons
|
97
|
-
def list_invalid_properties
|
98
|
-
invalid_properties = Array.new
|
99
|
-
invalid_properties
|
100
|
-
end
|
101
|
-
|
102
|
-
# Check to see if the all the properties in the model are valid
|
103
|
-
# @return true if the model is valid
|
104
|
-
def valid?
|
105
|
-
time_period_validator = EnumAttributeValidator.new('String', ["day", "month", "year"])
|
106
|
-
return false unless time_period_validator.valid?(@time_period)
|
107
|
-
true
|
108
|
-
end
|
109
|
-
|
110
|
-
# Custom attribute writer method checking allowed values (enum).
|
111
|
-
# @param [Object] time_period Object to be assigned
|
112
|
-
def time_period=(time_period)
|
113
|
-
validator = EnumAttributeValidator.new('String', ["day", "month", "year"])
|
114
|
-
unless validator.valid?(time_period)
|
115
|
-
fail ArgumentError, "invalid value for \"time_period\", must be one of #{validator.allowable_values}."
|
116
|
-
end
|
117
|
-
@time_period = time_period
|
118
|
-
end
|
119
|
-
|
120
|
-
# Checks equality by comparing each attribute.
|
121
|
-
# @param [Object] Object to be compared
|
122
|
-
def ==(o)
|
123
|
-
return true if self.equal?(o)
|
124
|
-
self.class == o.class &&
|
125
|
-
time_period == o.time_period &&
|
126
|
-
frequency == o.frequency
|
127
|
-
end
|
128
|
-
|
129
|
-
# @see the `==` method
|
130
|
-
# @param [Object] Object to be compared
|
131
|
-
def eql?(o)
|
132
|
-
self == o
|
133
|
-
end
|
134
|
-
|
135
|
-
# Calculates hash code according to all attributes.
|
136
|
-
# @return [Integer] Hash code
|
137
|
-
def hash
|
138
|
-
[time_period, frequency].hash
|
139
|
-
end
|
140
|
-
|
141
|
-
# Builds the object from hash
|
142
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
143
|
-
# @return [Object] Returns the model itself
|
144
|
-
def self.build_from_hash(attributes)
|
145
|
-
new.build_from_hash(attributes)
|
146
|
-
end
|
147
|
-
|
148
|
-
# Builds the object from hash
|
149
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
150
|
-
# @return [Object] Returns the model itself
|
151
|
-
def build_from_hash(attributes)
|
152
|
-
return nil unless attributes.is_a?(Hash)
|
153
|
-
attributes = attributes.transform_keys(&:to_sym)
|
154
|
-
self.class.openapi_types.each_pair do |key, type|
|
155
|
-
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
156
|
-
self.send("#{key}=", nil)
|
157
|
-
elsif type =~ /\AArray<(.*)>/i
|
158
|
-
# check to ensure the input is an array given that the attribute
|
159
|
-
# is documented as an array but the input is not
|
160
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
161
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
162
|
-
end
|
163
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
164
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
165
|
-
end
|
166
|
-
end
|
167
|
-
|
168
|
-
self
|
169
|
-
end
|
170
|
-
|
171
|
-
# Deserializes the data based on type
|
172
|
-
# @param string type Data type
|
173
|
-
# @param string value Value to be deserialized
|
174
|
-
# @return [Object] Deserialized data
|
175
|
-
def _deserialize(type, value)
|
176
|
-
case type.to_sym
|
177
|
-
when :Time
|
178
|
-
Time.parse(value)
|
179
|
-
when :Date
|
180
|
-
Date.parse(value)
|
181
|
-
when :String
|
182
|
-
value.to_s
|
183
|
-
when :Integer
|
184
|
-
value.to_i
|
185
|
-
when :Float
|
186
|
-
value.to_f
|
187
|
-
when :Boolean
|
188
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
189
|
-
true
|
190
|
-
else
|
191
|
-
false
|
192
|
-
end
|
193
|
-
when :Object
|
194
|
-
# generic object (usually a Hash), return directly
|
195
|
-
value
|
196
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
197
|
-
inner_type = Regexp.last_match[:inner_type]
|
198
|
-
value.map { |v| _deserialize(inner_type, v) }
|
199
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
200
|
-
k_type = Regexp.last_match[:k_type]
|
201
|
-
v_type = Regexp.last_match[:v_type]
|
202
|
-
{}.tap do |hash|
|
203
|
-
value.each do |k, v|
|
204
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
205
|
-
end
|
206
|
-
end
|
207
|
-
else # model
|
208
|
-
# models (e.g. Pet) or oneOf
|
209
|
-
klass = FuseClient.const_get(type)
|
210
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
211
|
-
end
|
212
|
-
end
|
213
|
-
|
214
|
-
# Returns the string representation of the object
|
215
|
-
# @return [String] String presentation of the object
|
216
|
-
def to_s
|
217
|
-
to_hash.to_s
|
218
|
-
end
|
219
|
-
|
220
|
-
# to_body is an alias to to_hash (backward compatibility)
|
221
|
-
# @return [Hash] Returns the object in the form of hash
|
222
|
-
def to_body
|
223
|
-
to_hash
|
224
|
-
end
|
225
|
-
|
226
|
-
# Returns the object in the form of hash
|
227
|
-
# @return [Hash] Returns the object in the form of hash
|
228
|
-
def to_hash
|
229
|
-
hash = {}
|
230
|
-
self.class.attribute_map.each_pair do |attr, param|
|
231
|
-
value = self.send(attr)
|
232
|
-
if value.nil?
|
233
|
-
is_nullable = self.class.openapi_nullable.include?(attr)
|
234
|
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
235
|
-
end
|
236
|
-
|
237
|
-
hash[param] = _to_hash(value)
|
238
|
-
end
|
239
|
-
hash
|
240
|
-
end
|
241
|
-
|
242
|
-
# Outputs non-array value in the form of hash
|
243
|
-
# For object, use to_hash. Otherwise, just return the value
|
244
|
-
# @param [Object] value Any valid value
|
245
|
-
# @return [Hash] Returns the value in the form of hash
|
246
|
-
def _to_hash(value)
|
247
|
-
if value.is_a?(Array)
|
248
|
-
value.compact.map { |v| _to_hash(v) }
|
249
|
-
elsif value.is_a?(Hash)
|
250
|
-
{}.tap do |hash|
|
251
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
252
|
-
end
|
253
|
-
elsif value.respond_to? :to_hash
|
254
|
-
value.to_hash
|
255
|
-
else
|
256
|
-
value
|
257
|
-
end
|
258
|
-
end
|
259
|
-
|
260
|
-
end
|
261
|
-
|
262
|
-
end
|