mx-platform-ruby 0.4.2 → 0.5.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 +5 -5
- data/README.md +1 -1
- data/docs/AccountResponse.md +15 -1
- data/docs/ManagedAccountCreateRequest.md +78 -0
- data/docs/ManagedAccountCreateRequestBody.md +18 -0
- data/docs/ManagedAccountUpdateRequest.md +78 -0
- data/docs/ManagedAccountUpdateRequestBody.md +18 -0
- data/docs/ManagedMemberCreateRequest.md +24 -0
- data/docs/ManagedMemberCreateRequestBody.md +18 -0
- data/docs/ManagedMemberUpdateRequest.md +22 -0
- data/docs/ManagedMemberUpdateRequestBody.md +18 -0
- data/docs/ManagedTransactionCreateRequest.md +56 -0
- data/docs/ManagedTransactionCreateRequestBody.md +18 -0
- data/docs/ManagedTransactionUpdateRequest.md +56 -0
- data/docs/ManagedTransactionUpdateRequestBody.md +18 -0
- data/docs/MemberResponse.md +5 -1
- data/docs/MerchantLocationResponse.md +40 -0
- data/docs/MerchantLocationResponseBody.md +18 -0
- data/docs/MxPlatformApi.md +1397 -119
- data/docs/TransactionResponse.md +11 -1
- data/lib/mx-platform-ruby/api/mx_platform_api.rb +1379 -125
- data/lib/mx-platform-ruby/models/account_response.rb +67 -4
- data/lib/mx-platform-ruby/models/managed_account_create_request.rb +503 -0
- data/lib/mx-platform-ruby/models/managed_account_create_request_body.rb +218 -0
- data/lib/mx-platform-ruby/models/managed_account_update_request.rb +488 -0
- data/lib/mx-platform-ruby/models/managed_account_update_request_body.rb +218 -0
- data/lib/mx-platform-ruby/models/managed_member_create_request.rb +250 -0
- data/lib/mx-platform-ruby/models/managed_member_create_request_body.rb +218 -0
- data/lib/mx-platform-ruby/models/managed_member_update_request.rb +236 -0
- data/lib/mx-platform-ruby/models/managed_member_update_request_body.rb +218 -0
- data/lib/mx-platform-ruby/models/managed_transaction_create_request.rb +414 -0
- data/lib/mx-platform-ruby/models/managed_transaction_create_request_body.rb +218 -0
- data/lib/mx-platform-ruby/models/managed_transaction_update_request.rb +389 -0
- data/lib/mx-platform-ruby/models/managed_transaction_update_request_body.rb +218 -0
- data/lib/mx-platform-ruby/models/member_response.rb +22 -4
- data/lib/mx-platform-ruby/models/merchant_location_response.rb +317 -0
- data/lib/mx-platform-ruby/models/merchant_location_response_body.rb +218 -0
- data/lib/mx-platform-ruby/models/transaction_response.rb +49 -4
- data/lib/mx-platform-ruby/version.rb +1 -1
- data/lib/mx-platform-ruby.rb +14 -0
- data/openapi/config.yml +1 -1
- data/spec/api/mx_platform_api_spec.rb +237 -0
- data/spec/models/account_response_spec.rb +42 -0
- data/spec/models/managed_account_create_request_body_spec.rb +34 -0
- data/spec/models/managed_account_create_request_spec.rb +214 -0
- data/spec/models/managed_account_update_request_body_spec.rb +34 -0
- data/spec/models/managed_account_update_request_spec.rb +214 -0
- data/spec/models/managed_member_create_request_body_spec.rb +34 -0
- data/spec/models/managed_member_create_request_spec.rb +52 -0
- data/spec/models/managed_member_update_request_body_spec.rb +34 -0
- data/spec/models/managed_member_update_request_spec.rb +46 -0
- data/spec/models/managed_transaction_create_request_body_spec.rb +34 -0
- data/spec/models/managed_transaction_create_request_spec.rb +148 -0
- data/spec/models/managed_transaction_update_request_body_spec.rb +34 -0
- data/spec/models/managed_transaction_update_request_spec.rb +148 -0
- data/spec/models/member_response_spec.rb +12 -0
- data/spec/models/merchant_location_response_body_spec.rb +34 -0
- data/spec/models/merchant_location_response_spec.rb +100 -0
- data/spec/models/transaction_response_spec.rb +30 -0
- metadata +136 -80
@@ -0,0 +1,414 @@
|
|
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: 5.2.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module MxPlatformRuby
|
17
|
+
class ManagedTransactionCreateRequest
|
18
|
+
attr_accessor :amount
|
19
|
+
|
20
|
+
attr_accessor :category
|
21
|
+
|
22
|
+
attr_accessor :check_number_string
|
23
|
+
|
24
|
+
attr_accessor :currency_code
|
25
|
+
|
26
|
+
attr_accessor :description
|
27
|
+
|
28
|
+
attr_accessor :id
|
29
|
+
|
30
|
+
attr_accessor :is_international
|
31
|
+
|
32
|
+
attr_accessor :latitude
|
33
|
+
|
34
|
+
attr_accessor :localized_description
|
35
|
+
|
36
|
+
attr_accessor :localized_memo
|
37
|
+
|
38
|
+
attr_accessor :longitude
|
39
|
+
|
40
|
+
attr_accessor :memo
|
41
|
+
|
42
|
+
attr_accessor :merchant_category_code
|
43
|
+
|
44
|
+
attr_accessor :merchant_guid
|
45
|
+
|
46
|
+
attr_accessor :merchant_location_guid
|
47
|
+
|
48
|
+
attr_accessor :metadata
|
49
|
+
|
50
|
+
attr_accessor :posted_at
|
51
|
+
|
52
|
+
attr_accessor :status
|
53
|
+
|
54
|
+
attr_accessor :transacted_at
|
55
|
+
|
56
|
+
attr_accessor :type
|
57
|
+
|
58
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
59
|
+
def self.attribute_map
|
60
|
+
{
|
61
|
+
:'amount' => :'amount',
|
62
|
+
:'category' => :'category',
|
63
|
+
:'check_number_string' => :'check_number_string',
|
64
|
+
:'currency_code' => :'currency_code',
|
65
|
+
:'description' => :'description',
|
66
|
+
:'id' => :'id',
|
67
|
+
:'is_international' => :'is_international',
|
68
|
+
:'latitude' => :'latitude',
|
69
|
+
:'localized_description' => :'localized_description',
|
70
|
+
:'localized_memo' => :'localized_memo',
|
71
|
+
:'longitude' => :'longitude',
|
72
|
+
:'memo' => :'memo',
|
73
|
+
:'merchant_category_code' => :'merchant_category_code',
|
74
|
+
:'merchant_guid' => :'merchant_guid',
|
75
|
+
:'merchant_location_guid' => :'merchant_location_guid',
|
76
|
+
:'metadata' => :'metadata',
|
77
|
+
:'posted_at' => :'posted_at',
|
78
|
+
:'status' => :'status',
|
79
|
+
:'transacted_at' => :'transacted_at',
|
80
|
+
:'type' => :'type'
|
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
|
+
:'amount' => :'String',
|
93
|
+
:'category' => :'String',
|
94
|
+
:'check_number_string' => :'String',
|
95
|
+
:'currency_code' => :'String',
|
96
|
+
:'description' => :'String',
|
97
|
+
:'id' => :'String',
|
98
|
+
:'is_international' => :'Boolean',
|
99
|
+
:'latitude' => :'Float',
|
100
|
+
:'localized_description' => :'String',
|
101
|
+
:'localized_memo' => :'String',
|
102
|
+
:'longitude' => :'Float',
|
103
|
+
:'memo' => :'String',
|
104
|
+
:'merchant_category_code' => :'Integer',
|
105
|
+
:'merchant_guid' => :'String',
|
106
|
+
:'merchant_location_guid' => :'String',
|
107
|
+
:'metadata' => :'String',
|
108
|
+
:'posted_at' => :'String',
|
109
|
+
:'status' => :'String',
|
110
|
+
:'transacted_at' => :'String',
|
111
|
+
:'type' => :'String'
|
112
|
+
}
|
113
|
+
end
|
114
|
+
|
115
|
+
# List of attributes with nullable: true
|
116
|
+
def self.openapi_nullable
|
117
|
+
Set.new([
|
118
|
+
])
|
119
|
+
end
|
120
|
+
|
121
|
+
# Initializes the object
|
122
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
123
|
+
def initialize(attributes = {})
|
124
|
+
if (!attributes.is_a?(Hash))
|
125
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `MxPlatformRuby::ManagedTransactionCreateRequest` initialize method"
|
126
|
+
end
|
127
|
+
|
128
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
129
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
130
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
131
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `MxPlatformRuby::ManagedTransactionCreateRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
132
|
+
end
|
133
|
+
h[k.to_sym] = v
|
134
|
+
}
|
135
|
+
|
136
|
+
if attributes.key?(:'amount')
|
137
|
+
self.amount = attributes[:'amount']
|
138
|
+
end
|
139
|
+
|
140
|
+
if attributes.key?(:'category')
|
141
|
+
self.category = attributes[:'category']
|
142
|
+
end
|
143
|
+
|
144
|
+
if attributes.key?(:'check_number_string')
|
145
|
+
self.check_number_string = attributes[:'check_number_string']
|
146
|
+
end
|
147
|
+
|
148
|
+
if attributes.key?(:'currency_code')
|
149
|
+
self.currency_code = attributes[:'currency_code']
|
150
|
+
end
|
151
|
+
|
152
|
+
if attributes.key?(:'description')
|
153
|
+
self.description = attributes[:'description']
|
154
|
+
end
|
155
|
+
|
156
|
+
if attributes.key?(:'id')
|
157
|
+
self.id = attributes[:'id']
|
158
|
+
end
|
159
|
+
|
160
|
+
if attributes.key?(:'is_international')
|
161
|
+
self.is_international = attributes[:'is_international']
|
162
|
+
end
|
163
|
+
|
164
|
+
if attributes.key?(:'latitude')
|
165
|
+
self.latitude = attributes[:'latitude']
|
166
|
+
end
|
167
|
+
|
168
|
+
if attributes.key?(:'localized_description')
|
169
|
+
self.localized_description = attributes[:'localized_description']
|
170
|
+
end
|
171
|
+
|
172
|
+
if attributes.key?(:'localized_memo')
|
173
|
+
self.localized_memo = attributes[:'localized_memo']
|
174
|
+
end
|
175
|
+
|
176
|
+
if attributes.key?(:'longitude')
|
177
|
+
self.longitude = attributes[:'longitude']
|
178
|
+
end
|
179
|
+
|
180
|
+
if attributes.key?(:'memo')
|
181
|
+
self.memo = attributes[:'memo']
|
182
|
+
end
|
183
|
+
|
184
|
+
if attributes.key?(:'merchant_category_code')
|
185
|
+
self.merchant_category_code = attributes[:'merchant_category_code']
|
186
|
+
end
|
187
|
+
|
188
|
+
if attributes.key?(:'merchant_guid')
|
189
|
+
self.merchant_guid = attributes[:'merchant_guid']
|
190
|
+
end
|
191
|
+
|
192
|
+
if attributes.key?(:'merchant_location_guid')
|
193
|
+
self.merchant_location_guid = attributes[:'merchant_location_guid']
|
194
|
+
end
|
195
|
+
|
196
|
+
if attributes.key?(:'metadata')
|
197
|
+
self.metadata = attributes[:'metadata']
|
198
|
+
end
|
199
|
+
|
200
|
+
if attributes.key?(:'posted_at')
|
201
|
+
self.posted_at = attributes[:'posted_at']
|
202
|
+
end
|
203
|
+
|
204
|
+
if attributes.key?(:'status')
|
205
|
+
self.status = attributes[:'status']
|
206
|
+
end
|
207
|
+
|
208
|
+
if attributes.key?(:'transacted_at')
|
209
|
+
self.transacted_at = attributes[:'transacted_at']
|
210
|
+
end
|
211
|
+
|
212
|
+
if attributes.key?(:'type')
|
213
|
+
self.type = attributes[:'type']
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
218
|
+
# @return Array for valid properties with the reasons
|
219
|
+
def list_invalid_properties
|
220
|
+
invalid_properties = Array.new
|
221
|
+
if @amount.nil?
|
222
|
+
invalid_properties.push('invalid value for "amount", amount cannot be nil.')
|
223
|
+
end
|
224
|
+
|
225
|
+
if @description.nil?
|
226
|
+
invalid_properties.push('invalid value for "description", description cannot be nil.')
|
227
|
+
end
|
228
|
+
|
229
|
+
if @status.nil?
|
230
|
+
invalid_properties.push('invalid value for "status", status cannot be nil.')
|
231
|
+
end
|
232
|
+
|
233
|
+
if @transacted_at.nil?
|
234
|
+
invalid_properties.push('invalid value for "transacted_at", transacted_at cannot be nil.')
|
235
|
+
end
|
236
|
+
|
237
|
+
if @type.nil?
|
238
|
+
invalid_properties.push('invalid value for "type", type cannot be nil.')
|
239
|
+
end
|
240
|
+
|
241
|
+
invalid_properties
|
242
|
+
end
|
243
|
+
|
244
|
+
# Check to see if the all the properties in the model are valid
|
245
|
+
# @return true if the model is valid
|
246
|
+
def valid?
|
247
|
+
return false if @amount.nil?
|
248
|
+
return false if @description.nil?
|
249
|
+
return false if @status.nil?
|
250
|
+
return false if @transacted_at.nil?
|
251
|
+
return false if @type.nil?
|
252
|
+
true
|
253
|
+
end
|
254
|
+
|
255
|
+
# Checks equality by comparing each attribute.
|
256
|
+
# @param [Object] Object to be compared
|
257
|
+
def ==(o)
|
258
|
+
return true if self.equal?(o)
|
259
|
+
self.class == o.class &&
|
260
|
+
amount == o.amount &&
|
261
|
+
category == o.category &&
|
262
|
+
check_number_string == o.check_number_string &&
|
263
|
+
currency_code == o.currency_code &&
|
264
|
+
description == o.description &&
|
265
|
+
id == o.id &&
|
266
|
+
is_international == o.is_international &&
|
267
|
+
latitude == o.latitude &&
|
268
|
+
localized_description == o.localized_description &&
|
269
|
+
localized_memo == o.localized_memo &&
|
270
|
+
longitude == o.longitude &&
|
271
|
+
memo == o.memo &&
|
272
|
+
merchant_category_code == o.merchant_category_code &&
|
273
|
+
merchant_guid == o.merchant_guid &&
|
274
|
+
merchant_location_guid == o.merchant_location_guid &&
|
275
|
+
metadata == o.metadata &&
|
276
|
+
posted_at == o.posted_at &&
|
277
|
+
status == o.status &&
|
278
|
+
transacted_at == o.transacted_at &&
|
279
|
+
type == o.type
|
280
|
+
end
|
281
|
+
|
282
|
+
# @see the `==` method
|
283
|
+
# @param [Object] Object to be compared
|
284
|
+
def eql?(o)
|
285
|
+
self == o
|
286
|
+
end
|
287
|
+
|
288
|
+
# Calculates hash code according to all attributes.
|
289
|
+
# @return [Integer] Hash code
|
290
|
+
def hash
|
291
|
+
[amount, category, check_number_string, currency_code, description, id, is_international, latitude, localized_description, localized_memo, longitude, memo, merchant_category_code, merchant_guid, merchant_location_guid, metadata, posted_at, status, transacted_at, type].hash
|
292
|
+
end
|
293
|
+
|
294
|
+
# Builds the object from hash
|
295
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
296
|
+
# @return [Object] Returns the model itself
|
297
|
+
def self.build_from_hash(attributes)
|
298
|
+
new.build_from_hash(attributes)
|
299
|
+
end
|
300
|
+
|
301
|
+
# Builds the object from hash
|
302
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
303
|
+
# @return [Object] Returns the model itself
|
304
|
+
def build_from_hash(attributes)
|
305
|
+
return nil unless attributes.is_a?(Hash)
|
306
|
+
self.class.openapi_types.each_pair do |key, type|
|
307
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
308
|
+
self.send("#{key}=", nil)
|
309
|
+
elsif type =~ /\AArray<(.*)>/i
|
310
|
+
# check to ensure the input is an array given that the attribute
|
311
|
+
# is documented as an array but the input is not
|
312
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
313
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
314
|
+
end
|
315
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
316
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
317
|
+
end
|
318
|
+
end
|
319
|
+
|
320
|
+
self
|
321
|
+
end
|
322
|
+
|
323
|
+
# Deserializes the data based on type
|
324
|
+
# @param string type Data type
|
325
|
+
# @param string value Value to be deserialized
|
326
|
+
# @return [Object] Deserialized data
|
327
|
+
def _deserialize(type, value)
|
328
|
+
case type.to_sym
|
329
|
+
when :Time
|
330
|
+
Time.parse(value)
|
331
|
+
when :Date
|
332
|
+
Date.parse(value)
|
333
|
+
when :String
|
334
|
+
value.to_s
|
335
|
+
when :Integer
|
336
|
+
value.to_i
|
337
|
+
when :Float
|
338
|
+
value.to_f
|
339
|
+
when :Boolean
|
340
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
341
|
+
true
|
342
|
+
else
|
343
|
+
false
|
344
|
+
end
|
345
|
+
when :Object
|
346
|
+
# generic object (usually a Hash), return directly
|
347
|
+
value
|
348
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
349
|
+
inner_type = Regexp.last_match[:inner_type]
|
350
|
+
value.map { |v| _deserialize(inner_type, v) }
|
351
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
352
|
+
k_type = Regexp.last_match[:k_type]
|
353
|
+
v_type = Regexp.last_match[:v_type]
|
354
|
+
{}.tap do |hash|
|
355
|
+
value.each do |k, v|
|
356
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
357
|
+
end
|
358
|
+
end
|
359
|
+
else # model
|
360
|
+
# models (e.g. Pet) or oneOf
|
361
|
+
klass = MxPlatformRuby.const_get(type)
|
362
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
363
|
+
end
|
364
|
+
end
|
365
|
+
|
366
|
+
# Returns the string representation of the object
|
367
|
+
# @return [String] String presentation of the object
|
368
|
+
def to_s
|
369
|
+
to_hash.to_s
|
370
|
+
end
|
371
|
+
|
372
|
+
# to_body is an alias to to_hash (backward compatibility)
|
373
|
+
# @return [Hash] Returns the object in the form of hash
|
374
|
+
def to_body
|
375
|
+
to_hash
|
376
|
+
end
|
377
|
+
|
378
|
+
# Returns the object in the form of hash
|
379
|
+
# @return [Hash] Returns the object in the form of hash
|
380
|
+
def to_hash
|
381
|
+
hash = {}
|
382
|
+
self.class.attribute_map.each_pair do |attr, param|
|
383
|
+
value = self.send(attr)
|
384
|
+
if value.nil?
|
385
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
386
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
387
|
+
end
|
388
|
+
|
389
|
+
hash[param] = _to_hash(value)
|
390
|
+
end
|
391
|
+
hash
|
392
|
+
end
|
393
|
+
|
394
|
+
# Outputs non-array value in the form of hash
|
395
|
+
# For object, use to_hash. Otherwise, just return the value
|
396
|
+
# @param [Object] value Any valid value
|
397
|
+
# @return [Hash] Returns the value in the form of hash
|
398
|
+
def _to_hash(value)
|
399
|
+
if value.is_a?(Array)
|
400
|
+
value.compact.map { |v| _to_hash(v) }
|
401
|
+
elsif value.is_a?(Hash)
|
402
|
+
{}.tap do |hash|
|
403
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
404
|
+
end
|
405
|
+
elsif value.respond_to? :to_hash
|
406
|
+
value.to_hash
|
407
|
+
else
|
408
|
+
value
|
409
|
+
end
|
410
|
+
end
|
411
|
+
|
412
|
+
end
|
413
|
+
|
414
|
+
end
|
@@ -0,0 +1,218 @@
|
|
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: 5.2.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module MxPlatformRuby
|
17
|
+
class ManagedTransactionCreateRequestBody
|
18
|
+
attr_accessor :transaction
|
19
|
+
|
20
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
21
|
+
def self.attribute_map
|
22
|
+
{
|
23
|
+
:'transaction' => :'transaction'
|
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
|
+
:'transaction' => :'ManagedTransactionCreateRequest'
|
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::ManagedTransactionCreateRequestBody` 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::ManagedTransactionCreateRequestBody`. 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?(:'transaction')
|
61
|
+
self.transaction = attributes[:'transaction']
|
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
|
+
transaction == o.transaction
|
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
|
+
[transaction].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
|
+
self.class.openapi_types.each_pair do |key, type|
|
111
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
112
|
+
self.send("#{key}=", nil)
|
113
|
+
elsif type =~ /\AArray<(.*)>/i
|
114
|
+
# check to ensure the input is an array given that the attribute
|
115
|
+
# is documented as an array but the input is not
|
116
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
117
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
118
|
+
end
|
119
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
120
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
self
|
125
|
+
end
|
126
|
+
|
127
|
+
# Deserializes the data based on type
|
128
|
+
# @param string type Data type
|
129
|
+
# @param string value Value to be deserialized
|
130
|
+
# @return [Object] Deserialized data
|
131
|
+
def _deserialize(type, value)
|
132
|
+
case type.to_sym
|
133
|
+
when :Time
|
134
|
+
Time.parse(value)
|
135
|
+
when :Date
|
136
|
+
Date.parse(value)
|
137
|
+
when :String
|
138
|
+
value.to_s
|
139
|
+
when :Integer
|
140
|
+
value.to_i
|
141
|
+
when :Float
|
142
|
+
value.to_f
|
143
|
+
when :Boolean
|
144
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
145
|
+
true
|
146
|
+
else
|
147
|
+
false
|
148
|
+
end
|
149
|
+
when :Object
|
150
|
+
# generic object (usually a Hash), return directly
|
151
|
+
value
|
152
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
153
|
+
inner_type = Regexp.last_match[:inner_type]
|
154
|
+
value.map { |v| _deserialize(inner_type, v) }
|
155
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
156
|
+
k_type = Regexp.last_match[:k_type]
|
157
|
+
v_type = Regexp.last_match[:v_type]
|
158
|
+
{}.tap do |hash|
|
159
|
+
value.each do |k, v|
|
160
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
161
|
+
end
|
162
|
+
end
|
163
|
+
else # model
|
164
|
+
# models (e.g. Pet) or oneOf
|
165
|
+
klass = MxPlatformRuby.const_get(type)
|
166
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
# Returns the string representation of the object
|
171
|
+
# @return [String] String presentation of the object
|
172
|
+
def to_s
|
173
|
+
to_hash.to_s
|
174
|
+
end
|
175
|
+
|
176
|
+
# to_body is an alias to to_hash (backward compatibility)
|
177
|
+
# @return [Hash] Returns the object in the form of hash
|
178
|
+
def to_body
|
179
|
+
to_hash
|
180
|
+
end
|
181
|
+
|
182
|
+
# Returns the object in the form of hash
|
183
|
+
# @return [Hash] Returns the object in the form of hash
|
184
|
+
def to_hash
|
185
|
+
hash = {}
|
186
|
+
self.class.attribute_map.each_pair do |attr, param|
|
187
|
+
value = self.send(attr)
|
188
|
+
if value.nil?
|
189
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
190
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
191
|
+
end
|
192
|
+
|
193
|
+
hash[param] = _to_hash(value)
|
194
|
+
end
|
195
|
+
hash
|
196
|
+
end
|
197
|
+
|
198
|
+
# Outputs non-array value in the form of hash
|
199
|
+
# For object, use to_hash. Otherwise, just return the value
|
200
|
+
# @param [Object] value Any valid value
|
201
|
+
# @return [Hash] Returns the value in the form of hash
|
202
|
+
def _to_hash(value)
|
203
|
+
if value.is_a?(Array)
|
204
|
+
value.compact.map { |v| _to_hash(v) }
|
205
|
+
elsif value.is_a?(Hash)
|
206
|
+
{}.tap do |hash|
|
207
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
208
|
+
end
|
209
|
+
elsif value.respond_to? :to_hash
|
210
|
+
value.to_hash
|
211
|
+
else
|
212
|
+
value
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
end
|
217
|
+
|
218
|
+
end
|