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.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +2 -2
  3. data/docs/FinancialConnectionData.md +1 -1
  4. data/docs/FinancialConnectionsAccountDetails.md +1 -1
  5. data/docs/FinancialConnectionsAccountDetailsAccountNumber.md +1 -1
  6. data/docs/FuseApi.md +6 -83
  7. data/docs/Transaction.md +1 -1
  8. data/lib/fuse_client/api/fuse_api.rb +10 -67
  9. data/lib/fuse_client/configuration.rb +32 -11
  10. data/lib/fuse_client/models/financial_connection_data.rb +1 -5
  11. data/lib/fuse_client/models/financial_connections_account.rb +1 -0
  12. data/lib/fuse_client/models/financial_connections_account_balance.rb +2 -0
  13. data/lib/fuse_client/models/financial_connections_account_cached_balance.rb +2 -0
  14. data/lib/fuse_client/models/financial_connections_account_details.rb +0 -5
  15. data/lib/fuse_client/models/financial_connections_account_details_account_number.rb +5 -0
  16. data/lib/fuse_client/models/financial_connections_account_liability.rb +1 -0
  17. data/lib/fuse_client/models/fuse_api_aggregator_error.rb +5 -0
  18. data/lib/fuse_client/models/transaction.rb +1 -1
  19. data/lib/fuse_client/version.rb +1 -1
  20. data/lib/fuse_client.rb +0 -20
  21. data/spec/api/fuse_api_spec.rb +1 -12
  22. metadata +2 -82
  23. data/docs/FinQLComparisonFeature.md +0 -26
  24. data/docs/FinQLFeature.md +0 -61
  25. data/docs/FinQLFeatureOneOf.md +0 -18
  26. data/docs/FinQLFeatureOneOf1.md +0 -18
  27. data/docs/FinQLFeatureOneOf2.md +0 -18
  28. data/docs/FinQLFeatureOneOf3.md +0 -18
  29. data/docs/FinQLFeatureOneOf4.md +0 -18
  30. data/docs/FinQLFeatureOneOf5.md +0 -18
  31. data/docs/FinQLFeatureOneOf6.md +0 -18
  32. data/docs/FinQLFeatureOneOf7.md +0 -18
  33. data/docs/FinQLFeatureRequest.md +0 -15
  34. data/docs/FinQLFrequencyFeature.md +0 -20
  35. data/docs/FinQLIndividualMerchantFeature.md +0 -20
  36. data/docs/FinQLInterestFeature.md +0 -18
  37. data/docs/FinQLMerchantCategoriesFeatureInner.md +0 -20
  38. data/docs/FinQLMerchantCategoriesFeatureInnerResultInner.md +0 -20
  39. data/docs/FinQLPromptRequest.md +0 -22
  40. data/docs/FinQLPromptResponse.md +0 -20
  41. data/docs/FinQLTimeBasedFeatureInner.md +0 -20
  42. data/docs/FinQLTopMerchantsFeatureInner.md +0 -22
  43. data/lib/fuse_client/models/fin_ql_comparison_feature.rb +0 -255
  44. data/lib/fuse_client/models/fin_ql_feature.rb +0 -111
  45. data/lib/fuse_client/models/fin_ql_feature_one_of.rb +0 -219
  46. data/lib/fuse_client/models/fin_ql_feature_one_of1.rb +0 -219
  47. data/lib/fuse_client/models/fin_ql_feature_one_of2.rb +0 -221
  48. data/lib/fuse_client/models/fin_ql_feature_one_of3.rb +0 -219
  49. data/lib/fuse_client/models/fin_ql_feature_one_of4.rb +0 -219
  50. data/lib/fuse_client/models/fin_ql_feature_one_of5.rb +0 -221
  51. data/lib/fuse_client/models/fin_ql_feature_one_of6.rb +0 -219
  52. data/lib/fuse_client/models/fin_ql_feature_one_of7.rb +0 -221
  53. data/lib/fuse_client/models/fin_ql_feature_request.rb +0 -46
  54. data/lib/fuse_client/models/fin_ql_frequency_feature.rb +0 -262
  55. data/lib/fuse_client/models/fin_ql_individual_merchant_feature.rb +0 -228
  56. data/lib/fuse_client/models/fin_ql_interest_feature.rb +0 -219
  57. data/lib/fuse_client/models/fin_ql_merchant_categories_feature_inner.rb +0 -230
  58. data/lib/fuse_client/models/fin_ql_merchant_categories_feature_inner_result_inner.rb +0 -228
  59. data/lib/fuse_client/models/fin_ql_prompt_request.rb +0 -276
  60. data/lib/fuse_client/models/fin_ql_prompt_response.rb +0 -234
  61. data/lib/fuse_client/models/fin_ql_time_based_feature_inner.rb +0 -228
  62. data/lib/fuse_client/models/fin_ql_top_merchants_feature_inner.rb +0 -237
  63. data/spec/models/fin_ql_comparison_feature_spec.rb +0 -58
  64. data/spec/models/fin_ql_feature_one_of1_spec.rb +0 -34
  65. data/spec/models/fin_ql_feature_one_of2_spec.rb +0 -34
  66. data/spec/models/fin_ql_feature_one_of3_spec.rb +0 -34
  67. data/spec/models/fin_ql_feature_one_of4_spec.rb +0 -34
  68. data/spec/models/fin_ql_feature_one_of5_spec.rb +0 -34
  69. data/spec/models/fin_ql_feature_one_of6_spec.rb +0 -34
  70. data/spec/models/fin_ql_feature_one_of7_spec.rb +0 -34
  71. data/spec/models/fin_ql_feature_one_of_spec.rb +0 -34
  72. data/spec/models/fin_ql_feature_request_spec.rb +0 -28
  73. data/spec/models/fin_ql_feature_spec.rb +0 -31
  74. data/spec/models/fin_ql_frequency_feature_spec.rb +0 -44
  75. data/spec/models/fin_ql_individual_merchant_feature_spec.rb +0 -40
  76. data/spec/models/fin_ql_interest_feature_spec.rb +0 -34
  77. data/spec/models/fin_ql_merchant_categories_feature_inner_result_inner_spec.rb +0 -40
  78. data/spec/models/fin_ql_merchant_categories_feature_inner_spec.rb +0 -40
  79. data/spec/models/fin_ql_prompt_request_spec.rb +0 -46
  80. data/spec/models/fin_ql_prompt_response_spec.rb +0 -40
  81. data/spec/models/fin_ql_time_based_feature_inner_spec.rb +0 -40
  82. data/spec/models/fin_ql_top_merchants_feature_inner_spec.rb +0 -46
@@ -1,255 +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 FinQLComparisonFeature
18
- attr_accessor :merchant_a
19
-
20
- attr_accessor :merchant_b
21
-
22
- attr_accessor :comparison_metric
23
-
24
- attr_accessor :value_a
25
-
26
- attr_accessor :value_b
27
-
28
- # Attribute mapping from ruby-style variable name to JSON key.
29
- def self.attribute_map
30
- {
31
- :'merchant_a' => :'merchant_a',
32
- :'merchant_b' => :'merchant_b',
33
- :'comparison_metric' => :'comparison_metric',
34
- :'value_a' => :'value_a',
35
- :'value_b' => :'value_b'
36
- }
37
- end
38
-
39
- # Returns all the JSON keys this model knows about
40
- def self.acceptable_attributes
41
- attribute_map.values
42
- end
43
-
44
- # Attribute type mapping.
45
- def self.openapi_types
46
- {
47
- :'merchant_a' => :'Merchant',
48
- :'merchant_b' => :'Merchant',
49
- :'comparison_metric' => :'String',
50
- :'value_a' => :'String',
51
- :'value_b' => :'String'
52
- }
53
- end
54
-
55
- # List of attributes with nullable: true
56
- def self.openapi_nullable
57
- Set.new([
58
- ])
59
- end
60
-
61
- # Initializes the object
62
- # @param [Hash] attributes Model attributes in the form of hash
63
- def initialize(attributes = {})
64
- if (!attributes.is_a?(Hash))
65
- fail ArgumentError, "The input argument (attributes) must be a hash in `FuseClient::FinQLComparisonFeature` initialize method"
66
- end
67
-
68
- # check to see if the attribute exists and convert string to symbol for hash key
69
- attributes = attributes.each_with_object({}) { |(k, v), h|
70
- if (!self.class.attribute_map.key?(k.to_sym))
71
- fail ArgumentError, "`#{k}` is not a valid attribute in `FuseClient::FinQLComparisonFeature`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
72
- end
73
- h[k.to_sym] = v
74
- }
75
-
76
- if attributes.key?(:'merchant_a')
77
- self.merchant_a = attributes[:'merchant_a']
78
- end
79
-
80
- if attributes.key?(:'merchant_b')
81
- self.merchant_b = attributes[:'merchant_b']
82
- end
83
-
84
- if attributes.key?(:'comparison_metric')
85
- self.comparison_metric = attributes[:'comparison_metric']
86
- end
87
-
88
- if attributes.key?(:'value_a')
89
- self.value_a = attributes[:'value_a']
90
- end
91
-
92
- if attributes.key?(:'value_b')
93
- self.value_b = attributes[:'value_b']
94
- end
95
- end
96
-
97
- # Show invalid properties with the reasons. Usually used together with valid?
98
- # @return Array for valid properties with the reasons
99
- def list_invalid_properties
100
- invalid_properties = Array.new
101
- invalid_properties
102
- end
103
-
104
- # Check to see if the all the properties in the model are valid
105
- # @return true if the model is valid
106
- def valid?
107
- true
108
- end
109
-
110
- # Checks equality by comparing each attribute.
111
- # @param [Object] Object to be compared
112
- def ==(o)
113
- return true if self.equal?(o)
114
- self.class == o.class &&
115
- merchant_a == o.merchant_a &&
116
- merchant_b == o.merchant_b &&
117
- comparison_metric == o.comparison_metric &&
118
- value_a == o.value_a &&
119
- value_b == o.value_b
120
- end
121
-
122
- # @see the `==` method
123
- # @param [Object] Object to be compared
124
- def eql?(o)
125
- self == o
126
- end
127
-
128
- # Calculates hash code according to all attributes.
129
- # @return [Integer] Hash code
130
- def hash
131
- [merchant_a, merchant_b, comparison_metric, value_a, value_b].hash
132
- end
133
-
134
- # Builds the object from hash
135
- # @param [Hash] attributes Model attributes in the form of hash
136
- # @return [Object] Returns the model itself
137
- def self.build_from_hash(attributes)
138
- new.build_from_hash(attributes)
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 build_from_hash(attributes)
145
- return nil unless attributes.is_a?(Hash)
146
- attributes = attributes.transform_keys(&:to_sym)
147
- self.class.openapi_types.each_pair do |key, type|
148
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
149
- self.send("#{key}=", nil)
150
- elsif type =~ /\AArray<(.*)>/i
151
- # check to ensure the input is an array given that the attribute
152
- # is documented as an array but the input is not
153
- if attributes[self.class.attribute_map[key]].is_a?(Array)
154
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
155
- end
156
- elsif !attributes[self.class.attribute_map[key]].nil?
157
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
158
- end
159
- end
160
-
161
- self
162
- end
163
-
164
- # Deserializes the data based on type
165
- # @param string type Data type
166
- # @param string value Value to be deserialized
167
- # @return [Object] Deserialized data
168
- def _deserialize(type, value)
169
- case type.to_sym
170
- when :Time
171
- Time.parse(value)
172
- when :Date
173
- Date.parse(value)
174
- when :String
175
- value.to_s
176
- when :Integer
177
- value.to_i
178
- when :Float
179
- value.to_f
180
- when :Boolean
181
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
182
- true
183
- else
184
- false
185
- end
186
- when :Object
187
- # generic object (usually a Hash), return directly
188
- value
189
- when /\AArray<(?<inner_type>.+)>\z/
190
- inner_type = Regexp.last_match[:inner_type]
191
- value.map { |v| _deserialize(inner_type, v) }
192
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
193
- k_type = Regexp.last_match[:k_type]
194
- v_type = Regexp.last_match[:v_type]
195
- {}.tap do |hash|
196
- value.each do |k, v|
197
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
198
- end
199
- end
200
- else # model
201
- # models (e.g. Pet) or oneOf
202
- klass = FuseClient.const_get(type)
203
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
204
- end
205
- end
206
-
207
- # Returns the string representation of the object
208
- # @return [String] String presentation of the object
209
- def to_s
210
- to_hash.to_s
211
- end
212
-
213
- # to_body is an alias to to_hash (backward compatibility)
214
- # @return [Hash] Returns the object in the form of hash
215
- def to_body
216
- to_hash
217
- end
218
-
219
- # Returns the object in the form of hash
220
- # @return [Hash] Returns the object in the form of hash
221
- def to_hash
222
- hash = {}
223
- self.class.attribute_map.each_pair do |attr, param|
224
- value = self.send(attr)
225
- if value.nil?
226
- is_nullable = self.class.openapi_nullable.include?(attr)
227
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
228
- end
229
-
230
- hash[param] = _to_hash(value)
231
- end
232
- hash
233
- end
234
-
235
- # Outputs non-array value in the form of hash
236
- # For object, use to_hash. Otherwise, just return the value
237
- # @param [Object] value Any valid value
238
- # @return [Hash] Returns the value in the form of hash
239
- def _to_hash(value)
240
- if value.is_a?(Array)
241
- value.compact.map { |v| _to_hash(v) }
242
- elsif value.is_a?(Hash)
243
- {}.tap do |hash|
244
- value.each { |k, v| hash[k] = _to_hash(v) }
245
- end
246
- elsif value.respond_to? :to_hash
247
- value.to_hash
248
- else
249
- value
250
- end
251
- end
252
-
253
- end
254
-
255
- end
@@ -1,111 +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
- module FinQLFeature
18
- class << self
19
- # List of class defined in oneOf (OpenAPI v3)
20
- def openapi_one_of
21
- [
22
- :'FinQLFeatureOneOf',
23
- :'FinQLFeatureOneOf1',
24
- :'FinQLFeatureOneOf2',
25
- :'FinQLFeatureOneOf3',
26
- :'FinQLFeatureOneOf4',
27
- :'FinQLFeatureOneOf5',
28
- :'FinQLFeatureOneOf6',
29
- :'FinQLFeatureOneOf7'
30
- ]
31
- end
32
-
33
- # Builds the object
34
- # @param [Mixed] Data to be matched against the list of oneOf items
35
- # @return [Object] Returns the model or the data itself
36
- def build(data)
37
- # Go through the list of oneOf items and attempt to identify the appropriate one.
38
- # Note:
39
- # - We do not attempt to check whether exactly one item matches.
40
- # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
41
- # due to the way the deserialization is made in the base_object template (it just casts without verifying).
42
- # - TODO: scalar values are de facto behaving as if they were nullable.
43
- # - TODO: logging when debugging is set.
44
- openapi_one_of.each do |klass|
45
- begin
46
- next if klass == :AnyType # "nullable: true"
47
- typed_data = find_and_cast_into_type(klass, data)
48
- return typed_data if typed_data
49
- rescue # rescue all errors so we keep iterating even if the current item lookup raises
50
- end
51
- end
52
-
53
- openapi_one_of.include?(:AnyType) ? data : nil
54
- end
55
-
56
- private
57
-
58
- SchemaMismatchError = Class.new(StandardError)
59
-
60
- # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
61
- def find_and_cast_into_type(klass, data)
62
- return if data.nil?
63
-
64
- case klass.to_s
65
- when 'Boolean'
66
- return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
67
- when 'Float'
68
- return data if data.instance_of?(Float)
69
- when 'Integer'
70
- return data if data.instance_of?(Integer)
71
- when 'Time'
72
- return Time.parse(data)
73
- when 'Date'
74
- return Date.parse(data)
75
- when 'String'
76
- return data if data.instance_of?(String)
77
- when 'Object' # "type: object"
78
- return data if data.instance_of?(Hash)
79
- when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
80
- if data.instance_of?(Array)
81
- sub_type = Regexp.last_match[:sub_type]
82
- return data.map { |item| find_and_cast_into_type(sub_type, item) }
83
- end
84
- when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
85
- if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
86
- sub_type = Regexp.last_match[:sub_type]
87
- return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
88
- end
89
- else # model
90
- const = FuseClient.const_get(klass)
91
- if const
92
- if const.respond_to?(:openapi_one_of) # nested oneOf model
93
- model = const.build(data)
94
- return model if model
95
- else
96
- # raise if data contains keys that are not known to the model
97
- raise unless (data.keys - const.acceptable_attributes).empty?
98
- model = const.build_from_hash(data)
99
- return model if model && model.valid?
100
- end
101
- end
102
- end
103
-
104
- raise # if no match by now, raise
105
- rescue
106
- raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
107
- end
108
- end
109
- end
110
-
111
- end
@@ -1,219 +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 FinQLFeatureOneOf
18
- attr_accessor :text
19
-
20
- # Attribute mapping from ruby-style variable name to JSON key.
21
- def self.attribute_map
22
- {
23
- :'text' => :'text'
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
- :'text' => :'String'
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::FinQLFeatureOneOf` 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::FinQLFeatureOneOf`. 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?(:'text')
61
- self.text = attributes[:'text']
62
- end
63
- end
64
-
65
- # Show invalid properties with the reasons. Usually used together with valid?
66
- # @return Array for valid properties with the reasons
67
- def list_invalid_properties
68
- invalid_properties = Array.new
69
- invalid_properties
70
- end
71
-
72
- # Check to see if the all the properties in the model are valid
73
- # @return true if the model is valid
74
- def valid?
75
- true
76
- end
77
-
78
- # Checks equality by comparing each attribute.
79
- # @param [Object] Object to be compared
80
- def ==(o)
81
- return true if self.equal?(o)
82
- self.class == o.class &&
83
- text == o.text
84
- end
85
-
86
- # @see the `==` method
87
- # @param [Object] Object to be compared
88
- def eql?(o)
89
- self == o
90
- end
91
-
92
- # Calculates hash code according to all attributes.
93
- # @return [Integer] Hash code
94
- def hash
95
- [text].hash
96
- end
97
-
98
- # Builds the object from hash
99
- # @param [Hash] attributes Model attributes in the form of hash
100
- # @return [Object] Returns the model itself
101
- def self.build_from_hash(attributes)
102
- new.build_from_hash(attributes)
103
- end
104
-
105
- # Builds the object from hash
106
- # @param [Hash] attributes Model attributes in the form of hash
107
- # @return [Object] Returns the model itself
108
- def build_from_hash(attributes)
109
- return nil unless attributes.is_a?(Hash)
110
- attributes = attributes.transform_keys(&:to_sym)
111
- self.class.openapi_types.each_pair do |key, type|
112
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
113
- self.send("#{key}=", nil)
114
- elsif type =~ /\AArray<(.*)>/i
115
- # check to ensure the input is an array given that the attribute
116
- # is documented as an array but the input is not
117
- if attributes[self.class.attribute_map[key]].is_a?(Array)
118
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
119
- end
120
- elsif !attributes[self.class.attribute_map[key]].nil?
121
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
122
- end
123
- end
124
-
125
- self
126
- end
127
-
128
- # Deserializes the data based on type
129
- # @param string type Data type
130
- # @param string value Value to be deserialized
131
- # @return [Object] Deserialized data
132
- def _deserialize(type, value)
133
- case type.to_sym
134
- when :Time
135
- Time.parse(value)
136
- when :Date
137
- Date.parse(value)
138
- when :String
139
- value.to_s
140
- when :Integer
141
- value.to_i
142
- when :Float
143
- value.to_f
144
- when :Boolean
145
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
146
- true
147
- else
148
- false
149
- end
150
- when :Object
151
- # generic object (usually a Hash), return directly
152
- value
153
- when /\AArray<(?<inner_type>.+)>\z/
154
- inner_type = Regexp.last_match[:inner_type]
155
- value.map { |v| _deserialize(inner_type, v) }
156
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
157
- k_type = Regexp.last_match[:k_type]
158
- v_type = Regexp.last_match[:v_type]
159
- {}.tap do |hash|
160
- value.each do |k, v|
161
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
162
- end
163
- end
164
- else # model
165
- # models (e.g. Pet) or oneOf
166
- klass = FuseClient.const_get(type)
167
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
168
- end
169
- end
170
-
171
- # Returns the string representation of the object
172
- # @return [String] String presentation of the object
173
- def to_s
174
- to_hash.to_s
175
- end
176
-
177
- # to_body is an alias to to_hash (backward compatibility)
178
- # @return [Hash] Returns the object in the form of hash
179
- def to_body
180
- to_hash
181
- end
182
-
183
- # Returns the object in the form of hash
184
- # @return [Hash] Returns the object in the form of hash
185
- def to_hash
186
- hash = {}
187
- self.class.attribute_map.each_pair do |attr, param|
188
- value = self.send(attr)
189
- if value.nil?
190
- is_nullable = self.class.openapi_nullable.include?(attr)
191
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
192
- end
193
-
194
- hash[param] = _to_hash(value)
195
- end
196
- hash
197
- end
198
-
199
- # Outputs non-array value in the form of hash
200
- # For object, use to_hash. Otherwise, just return the value
201
- # @param [Object] value Any valid value
202
- # @return [Hash] Returns the value in the form of hash
203
- def _to_hash(value)
204
- if value.is_a?(Array)
205
- value.compact.map { |v| _to_hash(v) }
206
- elsif value.is_a?(Hash)
207
- {}.tap do |hash|
208
- value.each { |k, v| hash[k] = _to_hash(v) }
209
- end
210
- elsif value.respond_to? :to_hash
211
- value.to_hash
212
- else
213
- value
214
- end
215
- end
216
-
217
- end
218
-
219
- end