mx-platform-ruby 0.42.0 → 0.44.0
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/MicrodepositRequest.md +30 -0
- data/docs/MicrodepositRequestBody.md +18 -0
- data/docs/MicrodepositResponse.md +44 -0
- data/docs/MicrodepositResponseBody.md +18 -0
- data/docs/MicrodepositVerifyRequest.md +20 -0
- data/docs/MicrodepositVerifyRequestBody.md +18 -0
- data/docs/MicrodepositsApi.md +371 -0
- data/docs/MicrodepositsResponseBody.md +20 -0
- data/docs/TransactionCreateRequest.md +40 -0
- data/docs/TransactionCreateRequestBody.md +18 -0
- data/docs/TransactionCreateResponseBody.md +104 -0
- data/docs/TransactionsApi.md +82 -0
- data/lib/mx-platform-ruby/api/microdeposits_api.rb +365 -0
- data/lib/mx-platform-ruby/api/transactions_api.rb +102 -0
- data/lib/mx-platform-ruby/models/microdeposit_request.rb +289 -0
- data/lib/mx-platform-ruby/models/microdeposit_request_body.rb +214 -0
- data/lib/mx-platform-ruby/models/microdeposit_response.rb +331 -0
- data/lib/mx-platform-ruby/models/microdeposit_response_body.rb +214 -0
- data/lib/mx-platform-ruby/models/microdeposit_verify_request.rb +223 -0
- data/lib/mx-platform-ruby/models/microdeposit_verify_request_body.rb +214 -0
- data/lib/mx-platform-ruby/models/microdeposits_response_body.rb +225 -0
- data/lib/mx-platform-ruby/models/transaction_create_request.rb +344 -0
- data/lib/mx-platform-ruby/models/transaction_create_request_body.rb +214 -0
- data/lib/mx-platform-ruby/models/transaction_create_response_body.rb +642 -0
- data/lib/mx-platform-ruby/version.rb +1 -1
- data/lib/mx-platform-ruby.rb +12 -0
- data/openapi/config.yml +1 -1
- data/spec/api/microdeposits_api_spec.rb +99 -0
- data/spec/api/transactions_api_spec.rb +49 -0
- data/spec/models/microdeposit_request_body_spec.rb +34 -0
- data/spec/models/microdeposit_request_spec.rb +70 -0
- data/spec/models/microdeposit_response_body_spec.rb +34 -0
- data/spec/models/microdeposit_response_spec.rb +112 -0
- data/spec/models/microdeposit_verify_request_body_spec.rb +34 -0
- data/spec/models/microdeposit_verify_request_spec.rb +40 -0
- data/spec/models/microdeposits_response_body_spec.rb +40 -0
- data/spec/models/transaction_create_request_body_spec.rb +34 -0
- data/spec/models/transaction_create_request_spec.rb +100 -0
- data/spec/models/transaction_create_response_body_spec.rb +292 -0
- metadata +195 -147
@@ -0,0 +1,331 @@
|
|
1
|
+
=begin
|
2
|
+
#MX Platform API
|
3
|
+
|
4
|
+
#The MX Platform API is a powerful, fully-featured API designed to make aggregating and enhancing financial data easy and reliable. It can seamlessly connect your app or website to tens of thousands of financial institutions.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 0.1.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 7.0.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module MxPlatformRuby
|
17
|
+
class MicrodepositResponse
|
18
|
+
attr_accessor :account_name
|
19
|
+
|
20
|
+
attr_accessor :account_number
|
21
|
+
|
22
|
+
attr_accessor :account_type
|
23
|
+
|
24
|
+
attr_accessor :email
|
25
|
+
|
26
|
+
attr_accessor :first_name
|
27
|
+
|
28
|
+
attr_accessor :last_name
|
29
|
+
|
30
|
+
attr_accessor :routing_number
|
31
|
+
|
32
|
+
attr_accessor :error_message
|
33
|
+
|
34
|
+
attr_accessor :guid
|
35
|
+
|
36
|
+
attr_accessor :institution_code
|
37
|
+
|
38
|
+
attr_accessor :institution_name
|
39
|
+
|
40
|
+
attr_accessor :status
|
41
|
+
|
42
|
+
attr_accessor :updated_at
|
43
|
+
|
44
|
+
attr_accessor :verified_at
|
45
|
+
|
46
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
47
|
+
def self.attribute_map
|
48
|
+
{
|
49
|
+
:'account_name' => :'account_name',
|
50
|
+
:'account_number' => :'account_number',
|
51
|
+
:'account_type' => :'account_type',
|
52
|
+
:'email' => :'email',
|
53
|
+
:'first_name' => :'first_name',
|
54
|
+
:'last_name' => :'last_name',
|
55
|
+
:'routing_number' => :'routing_number',
|
56
|
+
:'error_message' => :'error_message',
|
57
|
+
:'guid' => :'guid',
|
58
|
+
:'institution_code' => :'institution_code',
|
59
|
+
:'institution_name' => :'institution_name',
|
60
|
+
:'status' => :'status',
|
61
|
+
:'updated_at' => :'updated_at',
|
62
|
+
:'verified_at' => :'verified_at'
|
63
|
+
}
|
64
|
+
end
|
65
|
+
|
66
|
+
# Returns all the JSON keys this model knows about
|
67
|
+
def self.acceptable_attributes
|
68
|
+
attribute_map.values
|
69
|
+
end
|
70
|
+
|
71
|
+
# Attribute type mapping.
|
72
|
+
def self.openapi_types
|
73
|
+
{
|
74
|
+
:'account_name' => :'String',
|
75
|
+
:'account_number' => :'String',
|
76
|
+
:'account_type' => :'String',
|
77
|
+
:'email' => :'String',
|
78
|
+
:'first_name' => :'String',
|
79
|
+
:'last_name' => :'String',
|
80
|
+
:'routing_number' => :'String',
|
81
|
+
:'error_message' => :'String',
|
82
|
+
:'guid' => :'String',
|
83
|
+
:'institution_code' => :'String',
|
84
|
+
:'institution_name' => :'String',
|
85
|
+
:'status' => :'String',
|
86
|
+
:'updated_at' => :'String',
|
87
|
+
:'verified_at' => :'String'
|
88
|
+
}
|
89
|
+
end
|
90
|
+
|
91
|
+
# List of attributes with nullable: true
|
92
|
+
def self.openapi_nullable
|
93
|
+
Set.new([
|
94
|
+
])
|
95
|
+
end
|
96
|
+
|
97
|
+
# Initializes the object
|
98
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
99
|
+
def initialize(attributes = {})
|
100
|
+
if (!attributes.is_a?(Hash))
|
101
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `MxPlatformRuby::MicrodepositResponse` initialize method"
|
102
|
+
end
|
103
|
+
|
104
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
105
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
106
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
107
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `MxPlatformRuby::MicrodepositResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
108
|
+
end
|
109
|
+
h[k.to_sym] = v
|
110
|
+
}
|
111
|
+
|
112
|
+
if attributes.key?(:'account_name')
|
113
|
+
self.account_name = attributes[:'account_name']
|
114
|
+
end
|
115
|
+
|
116
|
+
if attributes.key?(:'account_number')
|
117
|
+
self.account_number = attributes[:'account_number']
|
118
|
+
end
|
119
|
+
|
120
|
+
if attributes.key?(:'account_type')
|
121
|
+
self.account_type = attributes[:'account_type']
|
122
|
+
end
|
123
|
+
|
124
|
+
if attributes.key?(:'email')
|
125
|
+
self.email = attributes[:'email']
|
126
|
+
end
|
127
|
+
|
128
|
+
if attributes.key?(:'first_name')
|
129
|
+
self.first_name = attributes[:'first_name']
|
130
|
+
end
|
131
|
+
|
132
|
+
if attributes.key?(:'last_name')
|
133
|
+
self.last_name = attributes[:'last_name']
|
134
|
+
end
|
135
|
+
|
136
|
+
if attributes.key?(:'routing_number')
|
137
|
+
self.routing_number = attributes[:'routing_number']
|
138
|
+
end
|
139
|
+
|
140
|
+
if attributes.key?(:'error_message')
|
141
|
+
self.error_message = attributes[:'error_message']
|
142
|
+
end
|
143
|
+
|
144
|
+
if attributes.key?(:'guid')
|
145
|
+
self.guid = attributes[:'guid']
|
146
|
+
end
|
147
|
+
|
148
|
+
if attributes.key?(:'institution_code')
|
149
|
+
self.institution_code = attributes[:'institution_code']
|
150
|
+
end
|
151
|
+
|
152
|
+
if attributes.key?(:'institution_name')
|
153
|
+
self.institution_name = attributes[:'institution_name']
|
154
|
+
end
|
155
|
+
|
156
|
+
if attributes.key?(:'status')
|
157
|
+
self.status = attributes[:'status']
|
158
|
+
end
|
159
|
+
|
160
|
+
if attributes.key?(:'updated_at')
|
161
|
+
self.updated_at = attributes[:'updated_at']
|
162
|
+
end
|
163
|
+
|
164
|
+
if attributes.key?(:'verified_at')
|
165
|
+
self.verified_at = attributes[:'verified_at']
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
170
|
+
# @return Array for valid properties with the reasons
|
171
|
+
def list_invalid_properties
|
172
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
173
|
+
invalid_properties = Array.new
|
174
|
+
invalid_properties
|
175
|
+
end
|
176
|
+
|
177
|
+
# Check to see if the all the properties in the model are valid
|
178
|
+
# @return true if the model is valid
|
179
|
+
def valid?
|
180
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
181
|
+
true
|
182
|
+
end
|
183
|
+
|
184
|
+
# Checks equality by comparing each attribute.
|
185
|
+
# @param [Object] Object to be compared
|
186
|
+
def ==(o)
|
187
|
+
return true if self.equal?(o)
|
188
|
+
self.class == o.class &&
|
189
|
+
account_name == o.account_name &&
|
190
|
+
account_number == o.account_number &&
|
191
|
+
account_type == o.account_type &&
|
192
|
+
email == o.email &&
|
193
|
+
first_name == o.first_name &&
|
194
|
+
last_name == o.last_name &&
|
195
|
+
routing_number == o.routing_number &&
|
196
|
+
error_message == o.error_message &&
|
197
|
+
guid == o.guid &&
|
198
|
+
institution_code == o.institution_code &&
|
199
|
+
institution_name == o.institution_name &&
|
200
|
+
status == o.status &&
|
201
|
+
updated_at == o.updated_at &&
|
202
|
+
verified_at == o.verified_at
|
203
|
+
end
|
204
|
+
|
205
|
+
# @see the `==` method
|
206
|
+
# @param [Object] Object to be compared
|
207
|
+
def eql?(o)
|
208
|
+
self == o
|
209
|
+
end
|
210
|
+
|
211
|
+
# Calculates hash code according to all attributes.
|
212
|
+
# @return [Integer] Hash code
|
213
|
+
def hash
|
214
|
+
[account_name, account_number, account_type, email, first_name, last_name, routing_number, error_message, guid, institution_code, institution_name, status, updated_at, verified_at].hash
|
215
|
+
end
|
216
|
+
|
217
|
+
# Builds the object from hash
|
218
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
219
|
+
# @return [Object] Returns the model itself
|
220
|
+
def self.build_from_hash(attributes)
|
221
|
+
return nil unless attributes.is_a?(Hash)
|
222
|
+
attributes = attributes.transform_keys(&:to_sym)
|
223
|
+
transformed_hash = {}
|
224
|
+
openapi_types.each_pair do |key, type|
|
225
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
226
|
+
transformed_hash["#{key}"] = nil
|
227
|
+
elsif type =~ /\AArray<(.*)>/i
|
228
|
+
# check to ensure the input is an array given that the attribute
|
229
|
+
# is documented as an array but the input is not
|
230
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
231
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
232
|
+
end
|
233
|
+
elsif !attributes[attribute_map[key]].nil?
|
234
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
235
|
+
end
|
236
|
+
end
|
237
|
+
new(transformed_hash)
|
238
|
+
end
|
239
|
+
|
240
|
+
# Deserializes the data based on type
|
241
|
+
# @param string type Data type
|
242
|
+
# @param string value Value to be deserialized
|
243
|
+
# @return [Object] Deserialized data
|
244
|
+
def self._deserialize(type, value)
|
245
|
+
case type.to_sym
|
246
|
+
when :Time
|
247
|
+
Time.parse(value)
|
248
|
+
when :Date
|
249
|
+
Date.parse(value)
|
250
|
+
when :String
|
251
|
+
value.to_s
|
252
|
+
when :Integer
|
253
|
+
value.to_i
|
254
|
+
when :Float
|
255
|
+
value.to_f
|
256
|
+
when :Boolean
|
257
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
258
|
+
true
|
259
|
+
else
|
260
|
+
false
|
261
|
+
end
|
262
|
+
when :Object
|
263
|
+
# generic object (usually a Hash), return directly
|
264
|
+
value
|
265
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
266
|
+
inner_type = Regexp.last_match[:inner_type]
|
267
|
+
value.map { |v| _deserialize(inner_type, v) }
|
268
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
269
|
+
k_type = Regexp.last_match[:k_type]
|
270
|
+
v_type = Regexp.last_match[:v_type]
|
271
|
+
{}.tap do |hash|
|
272
|
+
value.each do |k, v|
|
273
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
274
|
+
end
|
275
|
+
end
|
276
|
+
else # model
|
277
|
+
# models (e.g. Pet) or oneOf
|
278
|
+
klass = MxPlatformRuby.const_get(type)
|
279
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
280
|
+
end
|
281
|
+
end
|
282
|
+
|
283
|
+
# Returns the string representation of the object
|
284
|
+
# @return [String] String presentation of the object
|
285
|
+
def to_s
|
286
|
+
to_hash.to_s
|
287
|
+
end
|
288
|
+
|
289
|
+
# to_body is an alias to to_hash (backward compatibility)
|
290
|
+
# @return [Hash] Returns the object in the form of hash
|
291
|
+
def to_body
|
292
|
+
to_hash
|
293
|
+
end
|
294
|
+
|
295
|
+
# Returns the object in the form of hash
|
296
|
+
# @return [Hash] Returns the object in the form of hash
|
297
|
+
def to_hash
|
298
|
+
hash = {}
|
299
|
+
self.class.attribute_map.each_pair do |attr, param|
|
300
|
+
value = self.send(attr)
|
301
|
+
if value.nil?
|
302
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
303
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
304
|
+
end
|
305
|
+
|
306
|
+
hash[param] = _to_hash(value)
|
307
|
+
end
|
308
|
+
hash
|
309
|
+
end
|
310
|
+
|
311
|
+
# Outputs non-array value in the form of hash
|
312
|
+
# For object, use to_hash. Otherwise, just return the value
|
313
|
+
# @param [Object] value Any valid value
|
314
|
+
# @return [Hash] Returns the value in the form of hash
|
315
|
+
def _to_hash(value)
|
316
|
+
if value.is_a?(Array)
|
317
|
+
value.compact.map { |v| _to_hash(v) }
|
318
|
+
elsif value.is_a?(Hash)
|
319
|
+
{}.tap do |hash|
|
320
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
321
|
+
end
|
322
|
+
elsif value.respond_to? :to_hash
|
323
|
+
value.to_hash
|
324
|
+
else
|
325
|
+
value
|
326
|
+
end
|
327
|
+
end
|
328
|
+
|
329
|
+
end
|
330
|
+
|
331
|
+
end
|
@@ -0,0 +1,214 @@
|
|
1
|
+
=begin
|
2
|
+
#MX Platform API
|
3
|
+
|
4
|
+
#The MX Platform API is a powerful, fully-featured API designed to make aggregating and enhancing financial data easy and reliable. It can seamlessly connect your app or website to tens of thousands of financial institutions.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 0.1.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 7.0.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module MxPlatformRuby
|
17
|
+
class MicrodepositResponseBody
|
18
|
+
attr_accessor :micro_deposit
|
19
|
+
|
20
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
21
|
+
def self.attribute_map
|
22
|
+
{
|
23
|
+
:'micro_deposit' => :'micro_deposit'
|
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
|
+
:'micro_deposit' => :'MicrodepositResponse'
|
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 `MxPlatformRuby::MicrodepositResponseBody` 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 `MxPlatformRuby::MicrodepositResponseBody`. 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?(:'micro_deposit')
|
61
|
+
self.micro_deposit = attributes[:'micro_deposit']
|
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
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
69
|
+
invalid_properties = Array.new
|
70
|
+
invalid_properties
|
71
|
+
end
|
72
|
+
|
73
|
+
# Check to see if the all the properties in the model are valid
|
74
|
+
# @return true if the model is valid
|
75
|
+
def valid?
|
76
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
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
|
+
micro_deposit == o.micro_deposit
|
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
|
+
[micro_deposit].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
|
+
return nil unless attributes.is_a?(Hash)
|
105
|
+
attributes = attributes.transform_keys(&:to_sym)
|
106
|
+
transformed_hash = {}
|
107
|
+
openapi_types.each_pair do |key, type|
|
108
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
109
|
+
transformed_hash["#{key}"] = nil
|
110
|
+
elsif type =~ /\AArray<(.*)>/i
|
111
|
+
# check to ensure the input is an array given that the attribute
|
112
|
+
# is documented as an array but the input is not
|
113
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
114
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
115
|
+
end
|
116
|
+
elsif !attributes[attribute_map[key]].nil?
|
117
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
118
|
+
end
|
119
|
+
end
|
120
|
+
new(transformed_hash)
|
121
|
+
end
|
122
|
+
|
123
|
+
# Deserializes the data based on type
|
124
|
+
# @param string type Data type
|
125
|
+
# @param string value Value to be deserialized
|
126
|
+
# @return [Object] Deserialized data
|
127
|
+
def self._deserialize(type, value)
|
128
|
+
case type.to_sym
|
129
|
+
when :Time
|
130
|
+
Time.parse(value)
|
131
|
+
when :Date
|
132
|
+
Date.parse(value)
|
133
|
+
when :String
|
134
|
+
value.to_s
|
135
|
+
when :Integer
|
136
|
+
value.to_i
|
137
|
+
when :Float
|
138
|
+
value.to_f
|
139
|
+
when :Boolean
|
140
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
141
|
+
true
|
142
|
+
else
|
143
|
+
false
|
144
|
+
end
|
145
|
+
when :Object
|
146
|
+
# generic object (usually a Hash), return directly
|
147
|
+
value
|
148
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
149
|
+
inner_type = Regexp.last_match[:inner_type]
|
150
|
+
value.map { |v| _deserialize(inner_type, v) }
|
151
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
152
|
+
k_type = Regexp.last_match[:k_type]
|
153
|
+
v_type = Regexp.last_match[:v_type]
|
154
|
+
{}.tap do |hash|
|
155
|
+
value.each do |k, v|
|
156
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
157
|
+
end
|
158
|
+
end
|
159
|
+
else # model
|
160
|
+
# models (e.g. Pet) or oneOf
|
161
|
+
klass = MxPlatformRuby.const_get(type)
|
162
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
# Returns the string representation of the object
|
167
|
+
# @return [String] String presentation of the object
|
168
|
+
def to_s
|
169
|
+
to_hash.to_s
|
170
|
+
end
|
171
|
+
|
172
|
+
# to_body is an alias to to_hash (backward compatibility)
|
173
|
+
# @return [Hash] Returns the object in the form of hash
|
174
|
+
def to_body
|
175
|
+
to_hash
|
176
|
+
end
|
177
|
+
|
178
|
+
# Returns the object in the form of hash
|
179
|
+
# @return [Hash] Returns the object in the form of hash
|
180
|
+
def to_hash
|
181
|
+
hash = {}
|
182
|
+
self.class.attribute_map.each_pair do |attr, param|
|
183
|
+
value = self.send(attr)
|
184
|
+
if value.nil?
|
185
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
186
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
187
|
+
end
|
188
|
+
|
189
|
+
hash[param] = _to_hash(value)
|
190
|
+
end
|
191
|
+
hash
|
192
|
+
end
|
193
|
+
|
194
|
+
# Outputs non-array value in the form of hash
|
195
|
+
# For object, use to_hash. Otherwise, just return the value
|
196
|
+
# @param [Object] value Any valid value
|
197
|
+
# @return [Hash] Returns the value in the form of hash
|
198
|
+
def _to_hash(value)
|
199
|
+
if value.is_a?(Array)
|
200
|
+
value.compact.map { |v| _to_hash(v) }
|
201
|
+
elsif value.is_a?(Hash)
|
202
|
+
{}.tap do |hash|
|
203
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
204
|
+
end
|
205
|
+
elsif value.respond_to? :to_hash
|
206
|
+
value.to_hash
|
207
|
+
else
|
208
|
+
value
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
end
|
213
|
+
|
214
|
+
end
|