mx-platform-ruby 0.3.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -3
- data/README.md +29 -222
- data/docs/ChallengeResponse.md +2 -2
- data/docs/{ChallengeImageOptions.md → ImageOptionResponse.md} +2 -2
- data/docs/{ChallengeOptions.md → OptionResponse.md} +2 -2
- data/lib/mx-platform-ruby/models/challenge_response.rb +2 -2
- data/lib/mx-platform-ruby/models/{challenge_image_options.rb → image_option_response.rb} +3 -3
- data/lib/mx-platform-ruby/models/{challenge_options.rb → option_response.rb} +3 -3
- data/lib/mx-platform-ruby/version.rb +1 -1
- data/lib/mx-platform-ruby.rb +2 -2
- data/openapi/config.yml +1 -1
- data/openapi/templates/README.mustache +71 -0
- data/spec/models/{challenge_image_options_spec.rb → image_option_response_spec.rb} +6 -6
- data/spec/models/{challenge_options_spec.rb → option_response_spec.rb} +6 -6
- metadata +88 -190
- data/docs/Account.md +0 -96
- data/docs/AccountNumber.md +0 -32
- data/docs/AccountOwner.md +0 -40
- data/docs/Category.md +0 -32
- data/docs/Challenge.md +0 -30
- data/docs/ChallengeResponseImageOptions.md +0 -22
- data/docs/ChallengeResponseOptions.md +0 -20
- data/docs/ConnectWidget.md +0 -20
- data/docs/Credential.md +0 -26
- data/docs/EnhanceTransaction.md +0 -48
- data/docs/Holding.md +0 -52
- data/docs/InlineResponse200.md +0 -18
- data/docs/Institution.md +0 -36
- data/docs/Member.md +0 -40
- data/docs/MemberStatus.md +0 -34
- data/docs/Merchant.md +0 -28
- data/docs/OAuthWindow.md +0 -20
- data/docs/Pagination.md +0 -24
- data/docs/Statement.md +0 -32
- data/docs/Tag.md +0 -22
- data/docs/Tagging.md +0 -26
- data/docs/Transaction.md +0 -88
- data/docs/TransactionRule.md +0 -30
- data/docs/User.md +0 -26
- data/docs/Widget.md +0 -22
- data/lib/mx-platform-ruby/models/account.rb +0 -569
- data/lib/mx-platform-ruby/models/account_number.rb +0 -281
- data/lib/mx-platform-ruby/models/account_owner.rb +0 -317
- data/lib/mx-platform-ruby/models/category.rb +0 -281
- data/lib/mx-platform-ruby/models/challenge.rb +0 -276
- data/lib/mx-platform-ruby/models/challenge_response_image_options.rb +0 -236
- data/lib/mx-platform-ruby/models/challenge_response_options.rb +0 -227
- data/lib/mx-platform-ruby/models/connect_widget.rb +0 -227
- data/lib/mx-platform-ruby/models/credential.rb +0 -254
- data/lib/mx-platform-ruby/models/enhance_transaction.rb +0 -353
- data/lib/mx-platform-ruby/models/holding.rb +0 -371
- data/lib/mx-platform-ruby/models/inline_response200.rb +0 -218
- data/lib/mx-platform-ruby/models/institution.rb +0 -299
- data/lib/mx-platform-ruby/models/member.rb +0 -317
- data/lib/mx-platform-ruby/models/member_status.rb +0 -292
- data/lib/mx-platform-ruby/models/merchant.rb +0 -263
- data/lib/mx-platform-ruby/models/o_auth_window.rb +0 -227
- data/lib/mx-platform-ruby/models/pagination.rb +0 -245
- data/lib/mx-platform-ruby/models/statement.rb +0 -281
- data/lib/mx-platform-ruby/models/tag.rb +0 -236
- data/lib/mx-platform-ruby/models/tagging.rb +0 -254
- data/lib/mx-platform-ruby/models/transaction.rb +0 -533
- data/lib/mx-platform-ruby/models/transaction_rule.rb +0 -272
- data/lib/mx-platform-ruby/models/user.rb +0 -254
- data/lib/mx-platform-ruby/models/widget.rb +0 -236
- data/openapi/mx_platform_ruby.yml +0 -11
- data/pkg/mx-platform-ruby-0.2.0.gem +0 -0
- data/pkg/mx-platform-ruby-0.2.1.gem +0 -0
- data/spec/models/account_number_spec.rb +0 -76
- data/spec/models/account_owner_spec.rb +0 -100
- data/spec/models/account_spec.rb +0 -268
- data/spec/models/category_spec.rb +0 -76
- data/spec/models/challenge_response_image_options_spec.rb +0 -46
- data/spec/models/challenge_response_options_spec.rb +0 -40
- data/spec/models/challenge_spec.rb +0 -70
- data/spec/models/connect_widget_spec.rb +0 -40
- data/spec/models/credential_spec.rb +0 -58
- data/spec/models/enhance_transaction_spec.rb +0 -124
- data/spec/models/holding_spec.rb +0 -136
- data/spec/models/inline_response200_spec.rb +0 -34
- data/spec/models/institution_spec.rb +0 -88
- data/spec/models/member_spec.rb +0 -100
- data/spec/models/member_status_spec.rb +0 -82
- data/spec/models/merchant_spec.rb +0 -64
- data/spec/models/o_auth_window_spec.rb +0 -40
- data/spec/models/pagination_spec.rb +0 -52
- data/spec/models/statement_spec.rb +0 -76
- data/spec/models/tag_spec.rb +0 -46
- data/spec/models/tagging_spec.rb +0 -58
- data/spec/models/transaction_rule_spec.rb +0 -70
- data/spec/models/transaction_spec.rb +0 -244
- data/spec/models/user_spec.rb +0 -58
- data/spec/models/widget_spec.rb +0 -46
@@ -1,533 +0,0 @@
|
|
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.0
|
10
|
-
|
11
|
-
=end
|
12
|
-
|
13
|
-
require 'date'
|
14
|
-
require 'time'
|
15
|
-
|
16
|
-
module MxPlatformRuby
|
17
|
-
class Transaction
|
18
|
-
attr_accessor :account_guid
|
19
|
-
|
20
|
-
attr_accessor :amount
|
21
|
-
|
22
|
-
attr_accessor :category
|
23
|
-
|
24
|
-
attr_accessor :check_number_string
|
25
|
-
|
26
|
-
attr_accessor :created_at
|
27
|
-
|
28
|
-
attr_accessor :currency_code
|
29
|
-
|
30
|
-
attr_accessor :date
|
31
|
-
|
32
|
-
attr_accessor :description
|
33
|
-
|
34
|
-
attr_accessor :guid
|
35
|
-
|
36
|
-
attr_accessor :id
|
37
|
-
|
38
|
-
attr_accessor :is_bill_pay
|
39
|
-
|
40
|
-
attr_accessor :is_direct_deposit
|
41
|
-
|
42
|
-
attr_accessor :is_expense
|
43
|
-
|
44
|
-
attr_accessor :is_fee
|
45
|
-
|
46
|
-
attr_accessor :is_income
|
47
|
-
|
48
|
-
attr_accessor :is_international
|
49
|
-
|
50
|
-
attr_accessor :is_overdraft_fee
|
51
|
-
|
52
|
-
attr_accessor :is_payroll_advance
|
53
|
-
|
54
|
-
attr_accessor :is_recurring
|
55
|
-
|
56
|
-
attr_accessor :is_subscription
|
57
|
-
|
58
|
-
attr_accessor :latitude
|
59
|
-
|
60
|
-
attr_accessor :localized_description
|
61
|
-
|
62
|
-
attr_accessor :localized_memo
|
63
|
-
|
64
|
-
attr_accessor :longitude
|
65
|
-
|
66
|
-
attr_accessor :member_guid
|
67
|
-
|
68
|
-
attr_accessor :memo
|
69
|
-
|
70
|
-
attr_accessor :merchant_category_code
|
71
|
-
|
72
|
-
attr_accessor :merchant_guid
|
73
|
-
|
74
|
-
attr_accessor :original_description
|
75
|
-
|
76
|
-
attr_accessor :posted_at
|
77
|
-
|
78
|
-
attr_accessor :status
|
79
|
-
|
80
|
-
attr_accessor :top_level_category
|
81
|
-
|
82
|
-
attr_accessor :transacted_at
|
83
|
-
|
84
|
-
attr_accessor :type
|
85
|
-
|
86
|
-
attr_accessor :updated_at
|
87
|
-
|
88
|
-
attr_accessor :user_guid
|
89
|
-
|
90
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
91
|
-
def self.attribute_map
|
92
|
-
{
|
93
|
-
:'account_guid' => :'account_guid',
|
94
|
-
:'amount' => :'amount',
|
95
|
-
:'category' => :'category',
|
96
|
-
:'check_number_string' => :'check_number_string',
|
97
|
-
:'created_at' => :'created_at',
|
98
|
-
:'currency_code' => :'currency_code',
|
99
|
-
:'date' => :'date',
|
100
|
-
:'description' => :'description',
|
101
|
-
:'guid' => :'guid',
|
102
|
-
:'id' => :'id',
|
103
|
-
:'is_bill_pay' => :'is_bill_pay',
|
104
|
-
:'is_direct_deposit' => :'is_direct_deposit',
|
105
|
-
:'is_expense' => :'is_expense',
|
106
|
-
:'is_fee' => :'is_fee',
|
107
|
-
:'is_income' => :'is_income',
|
108
|
-
:'is_international' => :'is_international',
|
109
|
-
:'is_overdraft_fee' => :'is_overdraft_fee',
|
110
|
-
:'is_payroll_advance' => :'is_payroll_advance',
|
111
|
-
:'is_recurring' => :'is_recurring',
|
112
|
-
:'is_subscription' => :'is_subscription',
|
113
|
-
:'latitude' => :'latitude',
|
114
|
-
:'localized_description' => :'localized_description',
|
115
|
-
:'localized_memo' => :'localized_memo',
|
116
|
-
:'longitude' => :'longitude',
|
117
|
-
:'member_guid' => :'member_guid',
|
118
|
-
:'memo' => :'memo',
|
119
|
-
:'merchant_category_code' => :'merchant_category_code',
|
120
|
-
:'merchant_guid' => :'merchant_guid',
|
121
|
-
:'original_description' => :'original_description',
|
122
|
-
:'posted_at' => :'posted_at',
|
123
|
-
:'status' => :'status',
|
124
|
-
:'top_level_category' => :'top_level_category',
|
125
|
-
:'transacted_at' => :'transacted_at',
|
126
|
-
:'type' => :'type',
|
127
|
-
:'updated_at' => :'updated_at',
|
128
|
-
:'user_guid' => :'user_guid'
|
129
|
-
}
|
130
|
-
end
|
131
|
-
|
132
|
-
# Returns all the JSON keys this model knows about
|
133
|
-
def self.acceptable_attributes
|
134
|
-
attribute_map.values
|
135
|
-
end
|
136
|
-
|
137
|
-
# Attribute type mapping.
|
138
|
-
def self.openapi_types
|
139
|
-
{
|
140
|
-
:'account_guid' => :'String',
|
141
|
-
:'amount' => :'Float',
|
142
|
-
:'category' => :'String',
|
143
|
-
:'check_number_string' => :'String',
|
144
|
-
:'created_at' => :'String',
|
145
|
-
:'currency_code' => :'String',
|
146
|
-
:'date' => :'String',
|
147
|
-
:'description' => :'String',
|
148
|
-
:'guid' => :'String',
|
149
|
-
:'id' => :'String',
|
150
|
-
:'is_bill_pay' => :'Boolean',
|
151
|
-
:'is_direct_deposit' => :'Boolean',
|
152
|
-
:'is_expense' => :'Boolean',
|
153
|
-
:'is_fee' => :'Boolean',
|
154
|
-
:'is_income' => :'Boolean',
|
155
|
-
:'is_international' => :'Boolean',
|
156
|
-
:'is_overdraft_fee' => :'Boolean',
|
157
|
-
:'is_payroll_advance' => :'Boolean',
|
158
|
-
:'is_recurring' => :'Boolean',
|
159
|
-
:'is_subscription' => :'Boolean',
|
160
|
-
:'latitude' => :'Float',
|
161
|
-
:'localized_description' => :'String',
|
162
|
-
:'localized_memo' => :'String',
|
163
|
-
:'longitude' => :'Float',
|
164
|
-
:'member_guid' => :'String',
|
165
|
-
:'memo' => :'String',
|
166
|
-
:'merchant_category_code' => :'Integer',
|
167
|
-
:'merchant_guid' => :'String',
|
168
|
-
:'original_description' => :'String',
|
169
|
-
:'posted_at' => :'String',
|
170
|
-
:'status' => :'String',
|
171
|
-
:'top_level_category' => :'String',
|
172
|
-
:'transacted_at' => :'String',
|
173
|
-
:'type' => :'String',
|
174
|
-
:'updated_at' => :'String',
|
175
|
-
:'user_guid' => :'String'
|
176
|
-
}
|
177
|
-
end
|
178
|
-
|
179
|
-
# List of attributes with nullable: true
|
180
|
-
def self.openapi_nullable
|
181
|
-
Set.new([
|
182
|
-
])
|
183
|
-
end
|
184
|
-
|
185
|
-
# Initializes the object
|
186
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
187
|
-
def initialize(attributes = {})
|
188
|
-
if (!attributes.is_a?(Hash))
|
189
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `MxPlatformRuby::Transaction` initialize method"
|
190
|
-
end
|
191
|
-
|
192
|
-
# check to see if the attribute exists and convert string to symbol for hash key
|
193
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
194
|
-
if (!self.class.attribute_map.key?(k.to_sym))
|
195
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `MxPlatformRuby::Transaction`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
196
|
-
end
|
197
|
-
h[k.to_sym] = v
|
198
|
-
}
|
199
|
-
|
200
|
-
if attributes.key?(:'account_guid')
|
201
|
-
self.account_guid = attributes[:'account_guid']
|
202
|
-
end
|
203
|
-
|
204
|
-
if attributes.key?(:'amount')
|
205
|
-
self.amount = attributes[:'amount']
|
206
|
-
end
|
207
|
-
|
208
|
-
if attributes.key?(:'category')
|
209
|
-
self.category = attributes[:'category']
|
210
|
-
end
|
211
|
-
|
212
|
-
if attributes.key?(:'check_number_string')
|
213
|
-
self.check_number_string = attributes[:'check_number_string']
|
214
|
-
end
|
215
|
-
|
216
|
-
if attributes.key?(:'created_at')
|
217
|
-
self.created_at = attributes[:'created_at']
|
218
|
-
end
|
219
|
-
|
220
|
-
if attributes.key?(:'currency_code')
|
221
|
-
self.currency_code = attributes[:'currency_code']
|
222
|
-
end
|
223
|
-
|
224
|
-
if attributes.key?(:'date')
|
225
|
-
self.date = attributes[:'date']
|
226
|
-
end
|
227
|
-
|
228
|
-
if attributes.key?(:'description')
|
229
|
-
self.description = attributes[:'description']
|
230
|
-
end
|
231
|
-
|
232
|
-
if attributes.key?(:'guid')
|
233
|
-
self.guid = attributes[:'guid']
|
234
|
-
end
|
235
|
-
|
236
|
-
if attributes.key?(:'id')
|
237
|
-
self.id = attributes[:'id']
|
238
|
-
end
|
239
|
-
|
240
|
-
if attributes.key?(:'is_bill_pay')
|
241
|
-
self.is_bill_pay = attributes[:'is_bill_pay']
|
242
|
-
end
|
243
|
-
|
244
|
-
if attributes.key?(:'is_direct_deposit')
|
245
|
-
self.is_direct_deposit = attributes[:'is_direct_deposit']
|
246
|
-
end
|
247
|
-
|
248
|
-
if attributes.key?(:'is_expense')
|
249
|
-
self.is_expense = attributes[:'is_expense']
|
250
|
-
end
|
251
|
-
|
252
|
-
if attributes.key?(:'is_fee')
|
253
|
-
self.is_fee = attributes[:'is_fee']
|
254
|
-
end
|
255
|
-
|
256
|
-
if attributes.key?(:'is_income')
|
257
|
-
self.is_income = attributes[:'is_income']
|
258
|
-
end
|
259
|
-
|
260
|
-
if attributes.key?(:'is_international')
|
261
|
-
self.is_international = attributes[:'is_international']
|
262
|
-
end
|
263
|
-
|
264
|
-
if attributes.key?(:'is_overdraft_fee')
|
265
|
-
self.is_overdraft_fee = attributes[:'is_overdraft_fee']
|
266
|
-
end
|
267
|
-
|
268
|
-
if attributes.key?(:'is_payroll_advance')
|
269
|
-
self.is_payroll_advance = attributes[:'is_payroll_advance']
|
270
|
-
end
|
271
|
-
|
272
|
-
if attributes.key?(:'is_recurring')
|
273
|
-
self.is_recurring = attributes[:'is_recurring']
|
274
|
-
end
|
275
|
-
|
276
|
-
if attributes.key?(:'is_subscription')
|
277
|
-
self.is_subscription = attributes[:'is_subscription']
|
278
|
-
end
|
279
|
-
|
280
|
-
if attributes.key?(:'latitude')
|
281
|
-
self.latitude = attributes[:'latitude']
|
282
|
-
end
|
283
|
-
|
284
|
-
if attributes.key?(:'localized_description')
|
285
|
-
self.localized_description = attributes[:'localized_description']
|
286
|
-
end
|
287
|
-
|
288
|
-
if attributes.key?(:'localized_memo')
|
289
|
-
self.localized_memo = attributes[:'localized_memo']
|
290
|
-
end
|
291
|
-
|
292
|
-
if attributes.key?(:'longitude')
|
293
|
-
self.longitude = attributes[:'longitude']
|
294
|
-
end
|
295
|
-
|
296
|
-
if attributes.key?(:'member_guid')
|
297
|
-
self.member_guid = attributes[:'member_guid']
|
298
|
-
end
|
299
|
-
|
300
|
-
if attributes.key?(:'memo')
|
301
|
-
self.memo = attributes[:'memo']
|
302
|
-
end
|
303
|
-
|
304
|
-
if attributes.key?(:'merchant_category_code')
|
305
|
-
self.merchant_category_code = attributes[:'merchant_category_code']
|
306
|
-
end
|
307
|
-
|
308
|
-
if attributes.key?(:'merchant_guid')
|
309
|
-
self.merchant_guid = attributes[:'merchant_guid']
|
310
|
-
end
|
311
|
-
|
312
|
-
if attributes.key?(:'original_description')
|
313
|
-
self.original_description = attributes[:'original_description']
|
314
|
-
end
|
315
|
-
|
316
|
-
if attributes.key?(:'posted_at')
|
317
|
-
self.posted_at = attributes[:'posted_at']
|
318
|
-
end
|
319
|
-
|
320
|
-
if attributes.key?(:'status')
|
321
|
-
self.status = attributes[:'status']
|
322
|
-
end
|
323
|
-
|
324
|
-
if attributes.key?(:'top_level_category')
|
325
|
-
self.top_level_category = attributes[:'top_level_category']
|
326
|
-
end
|
327
|
-
|
328
|
-
if attributes.key?(:'transacted_at')
|
329
|
-
self.transacted_at = attributes[:'transacted_at']
|
330
|
-
end
|
331
|
-
|
332
|
-
if attributes.key?(:'type')
|
333
|
-
self.type = attributes[:'type']
|
334
|
-
end
|
335
|
-
|
336
|
-
if attributes.key?(:'updated_at')
|
337
|
-
self.updated_at = attributes[:'updated_at']
|
338
|
-
end
|
339
|
-
|
340
|
-
if attributes.key?(:'user_guid')
|
341
|
-
self.user_guid = attributes[:'user_guid']
|
342
|
-
end
|
343
|
-
end
|
344
|
-
|
345
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
346
|
-
# @return Array for valid properties with the reasons
|
347
|
-
def list_invalid_properties
|
348
|
-
invalid_properties = Array.new
|
349
|
-
invalid_properties
|
350
|
-
end
|
351
|
-
|
352
|
-
# Check to see if the all the properties in the model are valid
|
353
|
-
# @return true if the model is valid
|
354
|
-
def valid?
|
355
|
-
true
|
356
|
-
end
|
357
|
-
|
358
|
-
# Checks equality by comparing each attribute.
|
359
|
-
# @param [Object] Object to be compared
|
360
|
-
def ==(o)
|
361
|
-
return true if self.equal?(o)
|
362
|
-
self.class == o.class &&
|
363
|
-
account_guid == o.account_guid &&
|
364
|
-
amount == o.amount &&
|
365
|
-
category == o.category &&
|
366
|
-
check_number_string == o.check_number_string &&
|
367
|
-
created_at == o.created_at &&
|
368
|
-
currency_code == o.currency_code &&
|
369
|
-
date == o.date &&
|
370
|
-
description == o.description &&
|
371
|
-
guid == o.guid &&
|
372
|
-
id == o.id &&
|
373
|
-
is_bill_pay == o.is_bill_pay &&
|
374
|
-
is_direct_deposit == o.is_direct_deposit &&
|
375
|
-
is_expense == o.is_expense &&
|
376
|
-
is_fee == o.is_fee &&
|
377
|
-
is_income == o.is_income &&
|
378
|
-
is_international == o.is_international &&
|
379
|
-
is_overdraft_fee == o.is_overdraft_fee &&
|
380
|
-
is_payroll_advance == o.is_payroll_advance &&
|
381
|
-
is_recurring == o.is_recurring &&
|
382
|
-
is_subscription == o.is_subscription &&
|
383
|
-
latitude == o.latitude &&
|
384
|
-
localized_description == o.localized_description &&
|
385
|
-
localized_memo == o.localized_memo &&
|
386
|
-
longitude == o.longitude &&
|
387
|
-
member_guid == o.member_guid &&
|
388
|
-
memo == o.memo &&
|
389
|
-
merchant_category_code == o.merchant_category_code &&
|
390
|
-
merchant_guid == o.merchant_guid &&
|
391
|
-
original_description == o.original_description &&
|
392
|
-
posted_at == o.posted_at &&
|
393
|
-
status == o.status &&
|
394
|
-
top_level_category == o.top_level_category &&
|
395
|
-
transacted_at == o.transacted_at &&
|
396
|
-
type == o.type &&
|
397
|
-
updated_at == o.updated_at &&
|
398
|
-
user_guid == o.user_guid
|
399
|
-
end
|
400
|
-
|
401
|
-
# @see the `==` method
|
402
|
-
# @param [Object] Object to be compared
|
403
|
-
def eql?(o)
|
404
|
-
self == o
|
405
|
-
end
|
406
|
-
|
407
|
-
# Calculates hash code according to all attributes.
|
408
|
-
# @return [Integer] Hash code
|
409
|
-
def hash
|
410
|
-
[account_guid, amount, category, check_number_string, created_at, currency_code, date, description, guid, id, is_bill_pay, is_direct_deposit, is_expense, is_fee, is_income, is_international, is_overdraft_fee, is_payroll_advance, is_recurring, is_subscription, latitude, localized_description, localized_memo, longitude, member_guid, memo, merchant_category_code, merchant_guid, original_description, posted_at, status, top_level_category, transacted_at, type, updated_at, user_guid].hash
|
411
|
-
end
|
412
|
-
|
413
|
-
# Builds the object from hash
|
414
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
415
|
-
# @return [Object] Returns the model itself
|
416
|
-
def self.build_from_hash(attributes)
|
417
|
-
new.build_from_hash(attributes)
|
418
|
-
end
|
419
|
-
|
420
|
-
# Builds the object from hash
|
421
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
422
|
-
# @return [Object] Returns the model itself
|
423
|
-
def build_from_hash(attributes)
|
424
|
-
return nil unless attributes.is_a?(Hash)
|
425
|
-
self.class.openapi_types.each_pair do |key, type|
|
426
|
-
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
427
|
-
self.send("#{key}=", nil)
|
428
|
-
elsif type =~ /\AArray<(.*)>/i
|
429
|
-
# check to ensure the input is an array given that the attribute
|
430
|
-
# is documented as an array but the input is not
|
431
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
432
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
433
|
-
end
|
434
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
435
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
436
|
-
end
|
437
|
-
end
|
438
|
-
|
439
|
-
self
|
440
|
-
end
|
441
|
-
|
442
|
-
# Deserializes the data based on type
|
443
|
-
# @param string type Data type
|
444
|
-
# @param string value Value to be deserialized
|
445
|
-
# @return [Object] Deserialized data
|
446
|
-
def _deserialize(type, value)
|
447
|
-
case type.to_sym
|
448
|
-
when :Time
|
449
|
-
Time.parse(value)
|
450
|
-
when :Date
|
451
|
-
Date.parse(value)
|
452
|
-
when :String
|
453
|
-
value.to_s
|
454
|
-
when :Integer
|
455
|
-
value.to_i
|
456
|
-
when :Float
|
457
|
-
value.to_f
|
458
|
-
when :Boolean
|
459
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
460
|
-
true
|
461
|
-
else
|
462
|
-
false
|
463
|
-
end
|
464
|
-
when :Object
|
465
|
-
# generic object (usually a Hash), return directly
|
466
|
-
value
|
467
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
468
|
-
inner_type = Regexp.last_match[:inner_type]
|
469
|
-
value.map { |v| _deserialize(inner_type, v) }
|
470
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
471
|
-
k_type = Regexp.last_match[:k_type]
|
472
|
-
v_type = Regexp.last_match[:v_type]
|
473
|
-
{}.tap do |hash|
|
474
|
-
value.each do |k, v|
|
475
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
476
|
-
end
|
477
|
-
end
|
478
|
-
else # model
|
479
|
-
# models (e.g. Pet) or oneOf
|
480
|
-
klass = MxPlatformRuby.const_get(type)
|
481
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
482
|
-
end
|
483
|
-
end
|
484
|
-
|
485
|
-
# Returns the string representation of the object
|
486
|
-
# @return [String] String presentation of the object
|
487
|
-
def to_s
|
488
|
-
to_hash.to_s
|
489
|
-
end
|
490
|
-
|
491
|
-
# to_body is an alias to to_hash (backward compatibility)
|
492
|
-
# @return [Hash] Returns the object in the form of hash
|
493
|
-
def to_body
|
494
|
-
to_hash
|
495
|
-
end
|
496
|
-
|
497
|
-
# Returns the object in the form of hash
|
498
|
-
# @return [Hash] Returns the object in the form of hash
|
499
|
-
def to_hash
|
500
|
-
hash = {}
|
501
|
-
self.class.attribute_map.each_pair do |attr, param|
|
502
|
-
value = self.send(attr)
|
503
|
-
if value.nil?
|
504
|
-
is_nullable = self.class.openapi_nullable.include?(attr)
|
505
|
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
506
|
-
end
|
507
|
-
|
508
|
-
hash[param] = _to_hash(value)
|
509
|
-
end
|
510
|
-
hash
|
511
|
-
end
|
512
|
-
|
513
|
-
# Outputs non-array value in the form of hash
|
514
|
-
# For object, use to_hash. Otherwise, just return the value
|
515
|
-
# @param [Object] value Any valid value
|
516
|
-
# @return [Hash] Returns the value in the form of hash
|
517
|
-
def _to_hash(value)
|
518
|
-
if value.is_a?(Array)
|
519
|
-
value.compact.map { |v| _to_hash(v) }
|
520
|
-
elsif value.is_a?(Hash)
|
521
|
-
{}.tap do |hash|
|
522
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
523
|
-
end
|
524
|
-
elsif value.respond_to? :to_hash
|
525
|
-
value.to_hash
|
526
|
-
else
|
527
|
-
value
|
528
|
-
end
|
529
|
-
end
|
530
|
-
|
531
|
-
end
|
532
|
-
|
533
|
-
end
|