mx-platform-ruby 0.28.0 → 0.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -3
- data/docs/AccountResponse.md +2 -2
- data/docs/InsightResponse.md +56 -0
- data/docs/InsightResponseBody.md +18 -0
- data/docs/InsightUpdateRequest.md +20 -0
- data/docs/InsightsApi.md +706 -0
- data/docs/InsightsResponseBody.md +20 -0
- data/docs/MxPlatformApi.md +1 -1
- data/docs/ScheduledPaymentResponse.md +42 -0
- data/docs/ScheduledPaymentsResponseBody.md +20 -0
- data/docs/WidgetRequest.md +1 -1
- data/lib/mx-platform-ruby/api/insights_api.rb +690 -0
- data/lib/mx-platform-ruby/api/mx_platform_api.rb +2 -2
- data/lib/mx-platform-ruby/models/account_response.rb +11 -11
- data/lib/mx-platform-ruby/models/insight_response.rb +404 -0
- data/lib/mx-platform-ruby/models/insight_response_body.rb +216 -0
- data/lib/mx-platform-ruby/models/insight_update_request.rb +223 -0
- data/lib/mx-platform-ruby/models/insights_response_body.rb +225 -0
- data/lib/mx-platform-ruby/models/scheduled_payment_response.rb +322 -0
- data/lib/mx-platform-ruby/models/scheduled_payments_response_body.rb +225 -0
- data/lib/mx-platform-ruby/version.rb +1 -1
- data/lib/mx-platform-ruby.rb +7 -0
- data/openapi/config.yml +1 -1
- data/spec/api/insights_api_spec.rb +166 -0
- data/spec/api/mx_platform_api_spec.rb +1 -1
- data/spec/models/account_response_spec.rb +3 -3
- data/spec/models/insight_response_body_spec.rb +34 -0
- data/spec/models/insight_response_spec.rb +148 -0
- data/spec/models/insight_update_request_spec.rb +40 -0
- data/spec/models/insights_response_body_spec.rb +40 -0
- data/spec/models/scheduled_payment_response_spec.rb +106 -0
- data/spec/models/scheduled_payments_response_body_spec.rb +40 -0
- metadata +30 -2
@@ -472,7 +472,7 @@ module MxPlatformRuby
|
|
472
472
|
end
|
473
473
|
|
474
474
|
# Create manual account
|
475
|
-
# This endpoint can only be used to create manual accounts. Creating a manual account will automatically create it under the Manual Institution member. Since a manual account has no credentials tied to the member, the account will never aggregate or include data from a data feed
|
475
|
+
# This endpoint can only be used to create manual accounts. Creating a manual account will automatically create it under the Manual Institution member. Since a manual account has no credentials tied to the member, the account will never aggregate or include data from a data feed.
|
476
476
|
# @param user_guid [String] The unique id for a `user`.
|
477
477
|
# @param account_create_request_body [AccountCreateRequestBody] Manual account object to be created.
|
478
478
|
# @param [Hash] opts the optional parameters
|
@@ -483,7 +483,7 @@ module MxPlatformRuby
|
|
483
483
|
end
|
484
484
|
|
485
485
|
# Create manual account
|
486
|
-
# This endpoint can only be used to create manual accounts. Creating a manual account will automatically create it under the Manual Institution member. Since a manual account has no credentials tied to the member, the account will never aggregate or include data from a data feed
|
486
|
+
# This endpoint can only be used to create manual accounts. Creating a manual account will automatically create it under the Manual Institution member. Since a manual account has no credentials tied to the member, the account will never aggregate or include data from a data feed.
|
487
487
|
# @param user_guid [String] The unique id for a `user`.
|
488
488
|
# @param account_create_request_body [AccountCreateRequestBody] Manual account object to be created.
|
489
489
|
# @param [Hash] opts the optional parameters
|
@@ -57,12 +57,12 @@ module MxPlatformRuby
|
|
57
57
|
|
58
58
|
attr_accessor :imported_at
|
59
59
|
|
60
|
-
attr_accessor :interest_rate
|
61
|
-
|
62
60
|
attr_accessor :institution_code
|
63
61
|
|
64
62
|
attr_accessor :insured_name
|
65
63
|
|
64
|
+
attr_accessor :interest_rate
|
65
|
+
|
66
66
|
attr_accessor :is_closed
|
67
67
|
|
68
68
|
attr_accessor :is_hidden
|
@@ -151,9 +151,9 @@ module MxPlatformRuby
|
|
151
151
|
:'holdings_value' => :'holdings_value',
|
152
152
|
:'id' => :'id',
|
153
153
|
:'imported_at' => :'imported_at',
|
154
|
-
:'interest_rate' => :'interest_rate',
|
155
154
|
:'institution_code' => :'institution_code',
|
156
155
|
:'insured_name' => :'insured_name',
|
156
|
+
:'interest_rate' => :'interest_rate',
|
157
157
|
:'is_closed' => :'is_closed',
|
158
158
|
:'is_hidden' => :'is_hidden',
|
159
159
|
:'is_manual' => :'is_manual',
|
@@ -218,9 +218,9 @@ module MxPlatformRuby
|
|
218
218
|
:'holdings_value' => :'Float',
|
219
219
|
:'id' => :'String',
|
220
220
|
:'imported_at' => :'String',
|
221
|
-
:'interest_rate' => :'Float',
|
222
221
|
:'institution_code' => :'String',
|
223
222
|
:'insured_name' => :'String',
|
223
|
+
:'interest_rate' => :'Float',
|
224
224
|
:'is_closed' => :'Boolean',
|
225
225
|
:'is_hidden' => :'Boolean',
|
226
226
|
:'is_manual' => :'Boolean',
|
@@ -279,9 +279,9 @@ module MxPlatformRuby
|
|
279
279
|
:'holdings_value',
|
280
280
|
:'id',
|
281
281
|
:'imported_at',
|
282
|
-
:'interest_rate',
|
283
282
|
:'institution_code',
|
284
283
|
:'insured_name',
|
284
|
+
:'interest_rate',
|
285
285
|
:'is_closed',
|
286
286
|
:'is_hidden',
|
287
287
|
:'is_manual',
|
@@ -416,10 +416,6 @@ module MxPlatformRuby
|
|
416
416
|
self.imported_at = attributes[:'imported_at']
|
417
417
|
end
|
418
418
|
|
419
|
-
if attributes.key?(:'interest_rate')
|
420
|
-
self.interest_rate = attributes[:'interest_rate']
|
421
|
-
end
|
422
|
-
|
423
419
|
if attributes.key?(:'institution_code')
|
424
420
|
self.institution_code = attributes[:'institution_code']
|
425
421
|
end
|
@@ -428,6 +424,10 @@ module MxPlatformRuby
|
|
428
424
|
self.insured_name = attributes[:'insured_name']
|
429
425
|
end
|
430
426
|
|
427
|
+
if attributes.key?(:'interest_rate')
|
428
|
+
self.interest_rate = attributes[:'interest_rate']
|
429
|
+
end
|
430
|
+
|
431
431
|
if attributes.key?(:'is_closed')
|
432
432
|
self.is_closed = attributes[:'is_closed']
|
433
433
|
end
|
@@ -598,9 +598,9 @@ module MxPlatformRuby
|
|
598
598
|
holdings_value == o.holdings_value &&
|
599
599
|
id == o.id &&
|
600
600
|
imported_at == o.imported_at &&
|
601
|
-
interest_rate == o.interest_rate &&
|
602
601
|
institution_code == o.institution_code &&
|
603
602
|
insured_name == o.insured_name &&
|
603
|
+
interest_rate == o.interest_rate &&
|
604
604
|
is_closed == o.is_closed &&
|
605
605
|
is_hidden == o.is_hidden &&
|
606
606
|
is_manual == o.is_manual &&
|
@@ -644,7 +644,7 @@ module MxPlatformRuby
|
|
644
644
|
# Calculates hash code according to all attributes.
|
645
645
|
# @return [Integer] Hash code
|
646
646
|
def hash
|
647
|
-
[account_number, account_ownership, annuity_policy_to_date, annuity_provider, annuity_term_year, apr, apy, available_balance, available_credit, balance, cash_balance, cash_surrender_value, created_at, credit_limit, currency_code, day_payment_is_due, death_benefit, guid, holdings_value, id, imported_at,
|
647
|
+
[account_number, account_ownership, annuity_policy_to_date, annuity_provider, annuity_term_year, apr, apy, available_balance, available_credit, balance, cash_balance, cash_surrender_value, created_at, credit_limit, currency_code, day_payment_is_due, death_benefit, guid, holdings_value, id, imported_at, institution_code, insured_name, interest_rate, is_closed, is_hidden, is_manual, last_payment, last_payment_at, loan_amount, margin_balance, matures_on, member_guid, member_id, member_is_managed_by_user, metadata, minimum_balance, minimum_payment, name, nickname, original_balance, pay_out_amount, payment_due_at, payoff_balance, premium_amount, property_type, routing_number, started_on, subtype, today_ugl_amount, today_ugl_percentage, total_account_value, type, updated_at, user_guid, user_id].hash
|
648
648
|
end
|
649
649
|
|
650
650
|
# Builds the object from hash
|
@@ -0,0 +1,404 @@
|
|
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 InsightResponse
|
18
|
+
attr_accessor :active_at
|
19
|
+
|
20
|
+
attr_accessor :client_guid
|
21
|
+
|
22
|
+
attr_accessor :created_at
|
23
|
+
|
24
|
+
attr_accessor :cta_clicked_at
|
25
|
+
|
26
|
+
attr_accessor :description
|
27
|
+
|
28
|
+
attr_accessor :guid
|
29
|
+
|
30
|
+
attr_accessor :has_associated_accounts
|
31
|
+
|
32
|
+
attr_accessor :has_associated_merchants
|
33
|
+
|
34
|
+
attr_accessor :has_associated_scheduled_payments
|
35
|
+
|
36
|
+
attr_accessor :has_associated_transactions
|
37
|
+
|
38
|
+
attr_accessor :has_been_displayed
|
39
|
+
|
40
|
+
attr_accessor :is_dismissed
|
41
|
+
|
42
|
+
attr_accessor :micro_call_to_action
|
43
|
+
|
44
|
+
attr_accessor :micro_description
|
45
|
+
|
46
|
+
attr_accessor :micro_title
|
47
|
+
|
48
|
+
attr_accessor :template
|
49
|
+
|
50
|
+
attr_accessor :title
|
51
|
+
|
52
|
+
attr_accessor :updated_at
|
53
|
+
|
54
|
+
attr_accessor :user_guid
|
55
|
+
|
56
|
+
attr_accessor :user_id
|
57
|
+
|
58
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
59
|
+
def self.attribute_map
|
60
|
+
{
|
61
|
+
:'active_at' => :'active_at',
|
62
|
+
:'client_guid' => :'client_guid',
|
63
|
+
:'created_at' => :'created_at',
|
64
|
+
:'cta_clicked_at' => :'cta_clicked_at',
|
65
|
+
:'description' => :'description',
|
66
|
+
:'guid' => :'guid',
|
67
|
+
:'has_associated_accounts' => :'has_associated_accounts',
|
68
|
+
:'has_associated_merchants' => :'has_associated_merchants',
|
69
|
+
:'has_associated_scheduled_payments' => :'has_associated_scheduled_payments',
|
70
|
+
:'has_associated_transactions' => :'has_associated_transactions',
|
71
|
+
:'has_been_displayed' => :'has_been_displayed',
|
72
|
+
:'is_dismissed' => :'is_dismissed',
|
73
|
+
:'micro_call_to_action' => :'micro_call_to_action',
|
74
|
+
:'micro_description' => :'micro_description',
|
75
|
+
:'micro_title' => :'micro_title',
|
76
|
+
:'template' => :'template',
|
77
|
+
:'title' => :'title',
|
78
|
+
:'updated_at' => :'updated_at',
|
79
|
+
:'user_guid' => :'user_guid',
|
80
|
+
:'user_id' => :'user_id'
|
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
|
+
:'active_at' => :'String',
|
93
|
+
:'client_guid' => :'String',
|
94
|
+
:'created_at' => :'String',
|
95
|
+
:'cta_clicked_at' => :'String',
|
96
|
+
:'description' => :'String',
|
97
|
+
:'guid' => :'String',
|
98
|
+
:'has_associated_accounts' => :'Boolean',
|
99
|
+
:'has_associated_merchants' => :'Boolean',
|
100
|
+
:'has_associated_scheduled_payments' => :'Boolean',
|
101
|
+
:'has_associated_transactions' => :'Boolean',
|
102
|
+
:'has_been_displayed' => :'Boolean',
|
103
|
+
:'is_dismissed' => :'Boolean',
|
104
|
+
:'micro_call_to_action' => :'String',
|
105
|
+
:'micro_description' => :'String',
|
106
|
+
:'micro_title' => :'String',
|
107
|
+
:'template' => :'String',
|
108
|
+
:'title' => :'String',
|
109
|
+
:'updated_at' => :'String',
|
110
|
+
:'user_guid' => :'String',
|
111
|
+
:'user_id' => :'Object'
|
112
|
+
}
|
113
|
+
end
|
114
|
+
|
115
|
+
# List of attributes with nullable: true
|
116
|
+
def self.openapi_nullable
|
117
|
+
Set.new([
|
118
|
+
:'active_at',
|
119
|
+
:'client_guid',
|
120
|
+
:'created_at',
|
121
|
+
:'cta_clicked_at',
|
122
|
+
:'description',
|
123
|
+
:'guid',
|
124
|
+
:'has_associated_accounts',
|
125
|
+
:'has_associated_merchants',
|
126
|
+
:'has_associated_scheduled_payments',
|
127
|
+
:'has_associated_transactions',
|
128
|
+
:'has_been_displayed',
|
129
|
+
:'is_dismissed',
|
130
|
+
:'micro_call_to_action',
|
131
|
+
:'micro_description',
|
132
|
+
:'micro_title',
|
133
|
+
:'template',
|
134
|
+
:'title',
|
135
|
+
:'updated_at',
|
136
|
+
:'user_id'
|
137
|
+
])
|
138
|
+
end
|
139
|
+
|
140
|
+
# Initializes the object
|
141
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
142
|
+
def initialize(attributes = {})
|
143
|
+
if (!attributes.is_a?(Hash))
|
144
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `MxPlatformRuby::InsightResponse` initialize method"
|
145
|
+
end
|
146
|
+
|
147
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
148
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
149
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
150
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `MxPlatformRuby::InsightResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
151
|
+
end
|
152
|
+
h[k.to_sym] = v
|
153
|
+
}
|
154
|
+
|
155
|
+
if attributes.key?(:'active_at')
|
156
|
+
self.active_at = attributes[:'active_at']
|
157
|
+
end
|
158
|
+
|
159
|
+
if attributes.key?(:'client_guid')
|
160
|
+
self.client_guid = attributes[:'client_guid']
|
161
|
+
end
|
162
|
+
|
163
|
+
if attributes.key?(:'created_at')
|
164
|
+
self.created_at = attributes[:'created_at']
|
165
|
+
end
|
166
|
+
|
167
|
+
if attributes.key?(:'cta_clicked_at')
|
168
|
+
self.cta_clicked_at = attributes[:'cta_clicked_at']
|
169
|
+
end
|
170
|
+
|
171
|
+
if attributes.key?(:'description')
|
172
|
+
self.description = attributes[:'description']
|
173
|
+
end
|
174
|
+
|
175
|
+
if attributes.key?(:'guid')
|
176
|
+
self.guid = attributes[:'guid']
|
177
|
+
end
|
178
|
+
|
179
|
+
if attributes.key?(:'has_associated_accounts')
|
180
|
+
self.has_associated_accounts = attributes[:'has_associated_accounts']
|
181
|
+
end
|
182
|
+
|
183
|
+
if attributes.key?(:'has_associated_merchants')
|
184
|
+
self.has_associated_merchants = attributes[:'has_associated_merchants']
|
185
|
+
end
|
186
|
+
|
187
|
+
if attributes.key?(:'has_associated_scheduled_payments')
|
188
|
+
self.has_associated_scheduled_payments = attributes[:'has_associated_scheduled_payments']
|
189
|
+
end
|
190
|
+
|
191
|
+
if attributes.key?(:'has_associated_transactions')
|
192
|
+
self.has_associated_transactions = attributes[:'has_associated_transactions']
|
193
|
+
end
|
194
|
+
|
195
|
+
if attributes.key?(:'has_been_displayed')
|
196
|
+
self.has_been_displayed = attributes[:'has_been_displayed']
|
197
|
+
end
|
198
|
+
|
199
|
+
if attributes.key?(:'is_dismissed')
|
200
|
+
self.is_dismissed = attributes[:'is_dismissed']
|
201
|
+
end
|
202
|
+
|
203
|
+
if attributes.key?(:'micro_call_to_action')
|
204
|
+
self.micro_call_to_action = attributes[:'micro_call_to_action']
|
205
|
+
end
|
206
|
+
|
207
|
+
if attributes.key?(:'micro_description')
|
208
|
+
self.micro_description = attributes[:'micro_description']
|
209
|
+
end
|
210
|
+
|
211
|
+
if attributes.key?(:'micro_title')
|
212
|
+
self.micro_title = attributes[:'micro_title']
|
213
|
+
end
|
214
|
+
|
215
|
+
if attributes.key?(:'template')
|
216
|
+
self.template = attributes[:'template']
|
217
|
+
end
|
218
|
+
|
219
|
+
if attributes.key?(:'title')
|
220
|
+
self.title = attributes[:'title']
|
221
|
+
end
|
222
|
+
|
223
|
+
if attributes.key?(:'updated_at')
|
224
|
+
self.updated_at = attributes[:'updated_at']
|
225
|
+
end
|
226
|
+
|
227
|
+
if attributes.key?(:'user_guid')
|
228
|
+
self.user_guid = attributes[:'user_guid']
|
229
|
+
end
|
230
|
+
|
231
|
+
if attributes.key?(:'user_id')
|
232
|
+
self.user_id = attributes[:'user_id']
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
236
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
237
|
+
# @return Array for valid properties with the reasons
|
238
|
+
def list_invalid_properties
|
239
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
240
|
+
invalid_properties = Array.new
|
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
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
248
|
+
true
|
249
|
+
end
|
250
|
+
|
251
|
+
# Checks equality by comparing each attribute.
|
252
|
+
# @param [Object] Object to be compared
|
253
|
+
def ==(o)
|
254
|
+
return true if self.equal?(o)
|
255
|
+
self.class == o.class &&
|
256
|
+
active_at == o.active_at &&
|
257
|
+
client_guid == o.client_guid &&
|
258
|
+
created_at == o.created_at &&
|
259
|
+
cta_clicked_at == o.cta_clicked_at &&
|
260
|
+
description == o.description &&
|
261
|
+
guid == o.guid &&
|
262
|
+
has_associated_accounts == o.has_associated_accounts &&
|
263
|
+
has_associated_merchants == o.has_associated_merchants &&
|
264
|
+
has_associated_scheduled_payments == o.has_associated_scheduled_payments &&
|
265
|
+
has_associated_transactions == o.has_associated_transactions &&
|
266
|
+
has_been_displayed == o.has_been_displayed &&
|
267
|
+
is_dismissed == o.is_dismissed &&
|
268
|
+
micro_call_to_action == o.micro_call_to_action &&
|
269
|
+
micro_description == o.micro_description &&
|
270
|
+
micro_title == o.micro_title &&
|
271
|
+
template == o.template &&
|
272
|
+
title == o.title &&
|
273
|
+
updated_at == o.updated_at &&
|
274
|
+
user_guid == o.user_guid &&
|
275
|
+
user_id == o.user_id
|
276
|
+
end
|
277
|
+
|
278
|
+
# @see the `==` method
|
279
|
+
# @param [Object] Object to be compared
|
280
|
+
def eql?(o)
|
281
|
+
self == o
|
282
|
+
end
|
283
|
+
|
284
|
+
# Calculates hash code according to all attributes.
|
285
|
+
# @return [Integer] Hash code
|
286
|
+
def hash
|
287
|
+
[active_at, client_guid, created_at, cta_clicked_at, description, guid, has_associated_accounts, has_associated_merchants, has_associated_scheduled_payments, has_associated_transactions, has_been_displayed, is_dismissed, micro_call_to_action, micro_description, micro_title, template, title, updated_at, user_guid, user_id].hash
|
288
|
+
end
|
289
|
+
|
290
|
+
# Builds the object from hash
|
291
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
292
|
+
# @return [Object] Returns the model itself
|
293
|
+
def self.build_from_hash(attributes)
|
294
|
+
return nil unless attributes.is_a?(Hash)
|
295
|
+
attributes = attributes.transform_keys(&:to_sym)
|
296
|
+
transformed_hash = {}
|
297
|
+
openapi_types.each_pair do |key, type|
|
298
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
299
|
+
transformed_hash["#{key}"] = nil
|
300
|
+
elsif type =~ /\AArray<(.*)>/i
|
301
|
+
# check to ensure the input is an array given that the attribute
|
302
|
+
# is documented as an array but the input is not
|
303
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
304
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
305
|
+
end
|
306
|
+
elsif !attributes[attribute_map[key]].nil?
|
307
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
308
|
+
end
|
309
|
+
end
|
310
|
+
new(transformed_hash)
|
311
|
+
end
|
312
|
+
|
313
|
+
# Deserializes the data based on type
|
314
|
+
# @param string type Data type
|
315
|
+
# @param string value Value to be deserialized
|
316
|
+
# @return [Object] Deserialized data
|
317
|
+
def self._deserialize(type, value)
|
318
|
+
case type.to_sym
|
319
|
+
when :Time
|
320
|
+
Time.parse(value)
|
321
|
+
when :Date
|
322
|
+
Date.parse(value)
|
323
|
+
when :String
|
324
|
+
value.to_s
|
325
|
+
when :Integer
|
326
|
+
value.to_i
|
327
|
+
when :Float
|
328
|
+
value.to_f
|
329
|
+
when :Boolean
|
330
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
331
|
+
true
|
332
|
+
else
|
333
|
+
false
|
334
|
+
end
|
335
|
+
when :Object
|
336
|
+
# generic object (usually a Hash), return directly
|
337
|
+
value
|
338
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
339
|
+
inner_type = Regexp.last_match[:inner_type]
|
340
|
+
value.map { |v| _deserialize(inner_type, v) }
|
341
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
342
|
+
k_type = Regexp.last_match[:k_type]
|
343
|
+
v_type = Regexp.last_match[:v_type]
|
344
|
+
{}.tap do |hash|
|
345
|
+
value.each do |k, v|
|
346
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
347
|
+
end
|
348
|
+
end
|
349
|
+
else # model
|
350
|
+
# models (e.g. Pet) or oneOf
|
351
|
+
klass = MxPlatformRuby.const_get(type)
|
352
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
353
|
+
end
|
354
|
+
end
|
355
|
+
|
356
|
+
# Returns the string representation of the object
|
357
|
+
# @return [String] String presentation of the object
|
358
|
+
def to_s
|
359
|
+
to_hash.to_s
|
360
|
+
end
|
361
|
+
|
362
|
+
# to_body is an alias to to_hash (backward compatibility)
|
363
|
+
# @return [Hash] Returns the object in the form of hash
|
364
|
+
def to_body
|
365
|
+
to_hash
|
366
|
+
end
|
367
|
+
|
368
|
+
# Returns the object in the form of hash
|
369
|
+
# @return [Hash] Returns the object in the form of hash
|
370
|
+
def to_hash
|
371
|
+
hash = {}
|
372
|
+
self.class.attribute_map.each_pair do |attr, param|
|
373
|
+
value = self.send(attr)
|
374
|
+
if value.nil?
|
375
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
376
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
377
|
+
end
|
378
|
+
|
379
|
+
hash[param] = _to_hash(value)
|
380
|
+
end
|
381
|
+
hash
|
382
|
+
end
|
383
|
+
|
384
|
+
# Outputs non-array value in the form of hash
|
385
|
+
# For object, use to_hash. Otherwise, just return the value
|
386
|
+
# @param [Object] value Any valid value
|
387
|
+
# @return [Hash] Returns the value in the form of hash
|
388
|
+
def _to_hash(value)
|
389
|
+
if value.is_a?(Array)
|
390
|
+
value.compact.map { |v| _to_hash(v) }
|
391
|
+
elsif value.is_a?(Hash)
|
392
|
+
{}.tap do |hash|
|
393
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
394
|
+
end
|
395
|
+
elsif value.respond_to? :to_hash
|
396
|
+
value.to_hash
|
397
|
+
else
|
398
|
+
value
|
399
|
+
end
|
400
|
+
end
|
401
|
+
|
402
|
+
end
|
403
|
+
|
404
|
+
end
|