masspay_ruby_sdk 1.0.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.
Files changed (119) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +8 -0
  3. data/CONTRIBUTING.md +13 -0
  4. data/Gemfile +9 -0
  5. data/README.md +197 -0
  6. data/Rakefile +10 -0
  7. data/docs/AccountApi.md +150 -0
  8. data/docs/ApiResponse.md +22 -0
  9. data/docs/AttrTxn.md +20 -0
  10. data/docs/AttrValue.md +20 -0
  11. data/docs/AttrVelocityRequestInner.md +20 -0
  12. data/docs/AttributeApi.md +168 -0
  13. data/docs/AttrsRequirement.md +36 -0
  14. data/docs/AutopayResp.md +22 -0
  15. data/docs/AutopayRule.md +20 -0
  16. data/docs/AvailableBalanceTxnResp.md +22 -0
  17. data/docs/CardApi.md +160 -0
  18. data/docs/CatalogApi.md +469 -0
  19. data/docs/CompaniesResp.md +18 -0
  20. data/docs/Company.md +26 -0
  21. data/docs/Country.md +22 -0
  22. data/docs/Exception.md +20 -0
  23. data/docs/FoundUser.md +24 -0
  24. data/docs/GetAccountStatement200Response.md +18 -0
  25. data/docs/GetTransactionConfirmationDetails200Response.md +18 -0
  26. data/docs/GetUserAgreement200Response.md +26 -0
  27. data/docs/GetUserAgreementsNames200ResponseInner.md +24 -0
  28. data/docs/GetUserUserTokenKycAu10tix200Response.md +18 -0
  29. data/docs/GetUserUserTokenKycVeriff200Response.md +18 -0
  30. data/docs/GetWalletCardInfo200Response.md +30 -0
  31. data/docs/IDUpload.md +20 -0
  32. data/docs/KYCApi.md +305 -0
  33. data/docs/LoadApi.md +621 -0
  34. data/docs/LoadTxn.md +32 -0
  35. data/docs/LoadTxnResp.md +20 -0
  36. data/docs/Loads.md +36 -0
  37. data/docs/PayoutApi.md +403 -0
  38. data/docs/PayoutTxn.md +36 -0
  39. data/docs/PayoutTxnCommitResp.md +24 -0
  40. data/docs/PayoutTxnResp.md +60 -0
  41. data/docs/ResendBalanceNotification200Response.md +18 -0
  42. data/docs/Service.md +22 -0
  43. data/docs/ServicePayersInner.md +38 -0
  44. data/docs/ServicePayersInnerExchangeRateInner.md +20 -0
  45. data/docs/SpendBackApi.md +161 -0
  46. data/docs/SpendBackTxn.md +28 -0
  47. data/docs/SpendBackTxnResp.md +22 -0
  48. data/docs/SpendBacks.md +34 -0
  49. data/docs/StoredUser.md +56 -0
  50. data/docs/TaxApi.md +81 -0
  51. data/docs/TaxYearUserResp.md +48 -0
  52. data/docs/TxnHistoryResp.md +52 -0
  53. data/docs/UpdateUser.md +52 -0
  54. data/docs/User.md +50 -0
  55. data/docs/UserApi.md +403 -0
  56. data/docs/WalletApi.md +463 -0
  57. data/docs/WalletTxnResp.md +34 -0
  58. data/docs/logo.webp +0 -0
  59. data/lib/masspay_ruby_sdk/api/account_api.rb +149 -0
  60. data/lib/masspay_ruby_sdk/api/attribute_api.rb +214 -0
  61. data/lib/masspay_ruby_sdk/api/card_api.rb +174 -0
  62. data/lib/masspay_ruby_sdk/api/catalog_api.rb +443 -0
  63. data/lib/masspay_ruby_sdk/api/kyc_api.rb +290 -0
  64. data/lib/masspay_ruby_sdk/api/load_api.rb +598 -0
  65. data/lib/masspay_ruby_sdk/api/payout_api.rb +397 -0
  66. data/lib/masspay_ruby_sdk/api/spend_back_api.rb +160 -0
  67. data/lib/masspay_ruby_sdk/api/tax_api.rb +82 -0
  68. data/lib/masspay_ruby_sdk/api/user_api.rb +418 -0
  69. data/lib/masspay_ruby_sdk/api/wallet_api.rb +461 -0
  70. data/lib/masspay_ruby_sdk/api_client.rb +391 -0
  71. data/lib/masspay_ruby_sdk/api_error.rb +57 -0
  72. data/lib/masspay_ruby_sdk/configuration.rb +315 -0
  73. data/lib/masspay_ruby_sdk/models/api_response.rb +236 -0
  74. data/lib/masspay_ruby_sdk/models/attr_txn.rb +235 -0
  75. data/lib/masspay_ruby_sdk/models/attr_value.rb +239 -0
  76. data/lib/masspay_ruby_sdk/models/attr_velocity_request_inner.rb +273 -0
  77. data/lib/masspay_ruby_sdk/models/attrs_requirement.rb +372 -0
  78. data/lib/masspay_ruby_sdk/models/autopay_resp.rb +256 -0
  79. data/lib/masspay_ruby_sdk/models/autopay_rule.rb +241 -0
  80. data/lib/masspay_ruby_sdk/models/available_balance_txn_resp.rb +254 -0
  81. data/lib/masspay_ruby_sdk/models/companies_resp.rb +225 -0
  82. data/lib/masspay_ruby_sdk/models/company.rb +285 -0
  83. data/lib/masspay_ruby_sdk/models/country.rb +296 -0
  84. data/lib/masspay_ruby_sdk/models/exception.rb +241 -0
  85. data/lib/masspay_ruby_sdk/models/found_user.rb +270 -0
  86. data/lib/masspay_ruby_sdk/models/get_account_statement200_response.rb +225 -0
  87. data/lib/masspay_ruby_sdk/models/get_transaction_confirmation_details200_response.rb +218 -0
  88. data/lib/masspay_ruby_sdk/models/get_user_agreement200_response.rb +280 -0
  89. data/lib/masspay_ruby_sdk/models/get_user_agreements_names200_response_inner.rb +270 -0
  90. data/lib/masspay_ruby_sdk/models/get_user_user_token_kyc_au10tix200_response.rb +224 -0
  91. data/lib/masspay_ruby_sdk/models/get_user_user_token_kyc_veriff200_response.rb +224 -0
  92. data/lib/masspay_ruby_sdk/models/get_wallet_card_info200_response.rb +460 -0
  93. data/lib/masspay_ruby_sdk/models/id_upload.rb +273 -0
  94. data/lib/masspay_ruby_sdk/models/load_txn.rb +321 -0
  95. data/lib/masspay_ruby_sdk/models/load_txn_resp.rb +273 -0
  96. data/lib/masspay_ruby_sdk/models/loads.rb +388 -0
  97. data/lib/masspay_ruby_sdk/models/payout_txn.rb +328 -0
  98. data/lib/masspay_ruby_sdk/models/payout_txn_commit_resp.rb +293 -0
  99. data/lib/masspay_ruby_sdk/models/payout_txn_resp.rb +613 -0
  100. data/lib/masspay_ruby_sdk/models/resend_balance_notification200_response.rb +225 -0
  101. data/lib/masspay_ruby_sdk/models/service.rb +318 -0
  102. data/lib/masspay_ruby_sdk/models/service_payers_inner.rb +373 -0
  103. data/lib/masspay_ruby_sdk/models/service_payers_inner_exchange_rate_inner.rb +239 -0
  104. data/lib/masspay_ruby_sdk/models/spend_back_txn.rb +325 -0
  105. data/lib/masspay_ruby_sdk/models/spend_back_txn_resp.rb +307 -0
  106. data/lib/masspay_ruby_sdk/models/spend_backs.rb +340 -0
  107. data/lib/masspay_ruby_sdk/models/stored_user.rb +500 -0
  108. data/lib/masspay_ruby_sdk/models/tax_year_user_resp.rb +388 -0
  109. data/lib/masspay_ruby_sdk/models/txn_history_resp.rb +571 -0
  110. data/lib/masspay_ruby_sdk/models/update_user.rb +490 -0
  111. data/lib/masspay_ruby_sdk/models/user.rb +423 -0
  112. data/lib/masspay_ruby_sdk/models/wallet_txn_resp.rb +375 -0
  113. data/lib/masspay_ruby_sdk/version.rb +14 -0
  114. data/lib/masspay_ruby_sdk.rb +89 -0
  115. data/masspay_ruby_sdk.gemspec +37 -0
  116. data/spec/api_client_spec.rb +227 -0
  117. data/spec/configuration_spec.rb +41 -0
  118. data/spec/spec_helper.rb +110 -0
  119. metadata +203 -0
@@ -0,0 +1,500 @@
1
+ =begin
2
+ #MassPay API
3
+
4
+ #MassPay API
5
+
6
+ The version of the OpenAPI document: 0.1.4
7
+ Contact: support@masspay.io
8
+ Generated by: MassPay Inc.
9
+ OpenAPI Generator version: 6.5.0
10
+ =end
11
+
12
+ require 'date'
13
+ require 'time'
14
+
15
+ module MassPayRubySdk
16
+ class StoredUser
17
+ # Token representing the user that was just created
18
+ attr_accessor :user_token
19
+
20
+ # The status of the user
21
+ attr_accessor :status
22
+
23
+ # The timestamp the user was created in the system. Using UTC timestamp.[ISO 8601](https://en.wikipedia.org/wiki/ISO_8601)
24
+ attr_accessor :created_on
25
+
26
+ # A client-defined identifier for the user. This is the unique ID assigned to the user on your system. Max 75 characters. Allows letters, numbers, and + , - . / _ ~ |
27
+ attr_accessor :internal_user_id
28
+
29
+ # The user's street address.
30
+ attr_accessor :address1
31
+
32
+ # The user's street address, line 2.
33
+ attr_accessor :address2
34
+
35
+ # The user's city.
36
+ attr_accessor :city
37
+
38
+ # The user's state/province.
39
+ attr_accessor :state_province
40
+
41
+ # The user's postal code.
42
+ attr_accessor :postal_code
43
+
44
+ # The user's country code. ISO_3166-1_alpha-3 code
45
+ attr_accessor :country
46
+
47
+ # The user's first name. (If Business account, the first name of the representative)
48
+ attr_accessor :first_name
49
+
50
+ # The user's middle name. (If Business account, the middle name of the representative)
51
+ attr_accessor :middle_name
52
+
53
+ # The user's last name. (If Business account, the last name of the representative)
54
+ attr_accessor :last_name
55
+
56
+ # The user's e-mail address. Must be unique. Cannot have two users with the same e-mail address.
57
+ attr_accessor :email
58
+
59
+ # The user's preferred language of communication. If not provided, defaults to English (en)
60
+ attr_accessor :language
61
+
62
+ # (Optional) Mobile number of user. Allows for SMS notifications upon availability of funds
63
+ attr_accessor :mobile_number
64
+
65
+ # Company legal name (Only if Business account)
66
+ attr_accessor :business_name
67
+
68
+ # User's computed timezone
69
+ attr_accessor :timezone
70
+
71
+ # Date of birth. (optional). Minimum 18 years old
72
+ attr_accessor :date_of_birth
73
+
74
+ # Optional JSON object with attributes that can later be searched to locate this user. Do not include PII as this object is not encrypted.
75
+ attr_accessor :metadata
76
+
77
+ class EnumAttributeValidator
78
+ attr_reader :datatype
79
+ attr_reader :allowable_values
80
+
81
+ def initialize(datatype, allowable_values)
82
+ @allowable_values = allowable_values.map do |value|
83
+ case datatype.to_s
84
+ when /Integer/i
85
+ value.to_i
86
+ when /Float/i
87
+ value.to_f
88
+ else
89
+ value
90
+ end
91
+ end
92
+ end
93
+
94
+ def valid?(value)
95
+ !value || allowable_values.include?(value)
96
+ end
97
+ end
98
+
99
+ # Attribute mapping from ruby-style variable name to JSON key.
100
+ def self.attribute_map
101
+ {
102
+ :'user_token' => :'user_token',
103
+ :'status' => :'status',
104
+ :'created_on' => :'created_on',
105
+ :'internal_user_id' => :'internal_user_id',
106
+ :'address1' => :'address1',
107
+ :'address2' => :'address2',
108
+ :'city' => :'city',
109
+ :'state_province' => :'state_province',
110
+ :'postal_code' => :'postal_code',
111
+ :'country' => :'country',
112
+ :'first_name' => :'first_name',
113
+ :'middle_name' => :'middle_name',
114
+ :'last_name' => :'last_name',
115
+ :'email' => :'email',
116
+ :'language' => :'language',
117
+ :'mobile_number' => :'mobile_number',
118
+ :'business_name' => :'business_name',
119
+ :'timezone' => :'timezone',
120
+ :'date_of_birth' => :'date_of_birth',
121
+ :'metadata' => :'metadata'
122
+ }
123
+ end
124
+
125
+ # Returns all the JSON keys this model knows about
126
+ def self.acceptable_attributes
127
+ attribute_map.values
128
+ end
129
+
130
+ # Attribute type mapping.
131
+ def self.openapi_types
132
+ {
133
+ :'user_token' => :'String',
134
+ :'status' => :'String',
135
+ :'created_on' => :'String',
136
+ :'internal_user_id' => :'String',
137
+ :'address1' => :'String',
138
+ :'address2' => :'String',
139
+ :'city' => :'String',
140
+ :'state_province' => :'String',
141
+ :'postal_code' => :'String',
142
+ :'country' => :'String',
143
+ :'first_name' => :'String',
144
+ :'middle_name' => :'String',
145
+ :'last_name' => :'String',
146
+ :'email' => :'String',
147
+ :'language' => :'String',
148
+ :'mobile_number' => :'String',
149
+ :'business_name' => :'String',
150
+ :'timezone' => :'String',
151
+ :'date_of_birth' => :'Date',
152
+ :'metadata' => :'Object'
153
+ }
154
+ end
155
+
156
+ # List of attributes with nullable: true
157
+ def self.openapi_nullable
158
+ Set.new([
159
+ ])
160
+ end
161
+
162
+ # Initializes the object
163
+ # @param [Hash] attributes Model attributes in the form of hash
164
+ def initialize(attributes = {})
165
+ if (!attributes.is_a?(Hash))
166
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MassPayRubySdk::StoredUser` initialize method"
167
+ end
168
+
169
+ # check to see if the attribute exists and convert string to symbol for hash key
170
+ attributes = attributes.each_with_object({}) { |(k, v), h|
171
+ if (!self.class.attribute_map.key?(k.to_sym))
172
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MassPayRubySdk::StoredUser`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
173
+ end
174
+ h[k.to_sym] = v
175
+ }
176
+
177
+ if attributes.key?(:'user_token')
178
+ self.user_token = attributes[:'user_token']
179
+ end
180
+
181
+ if attributes.key?(:'status')
182
+ self.status = attributes[:'status']
183
+ end
184
+
185
+ if attributes.key?(:'created_on')
186
+ self.created_on = attributes[:'created_on']
187
+ end
188
+
189
+ if attributes.key?(:'internal_user_id')
190
+ self.internal_user_id = attributes[:'internal_user_id']
191
+ end
192
+
193
+ if attributes.key?(:'address1')
194
+ self.address1 = attributes[:'address1']
195
+ end
196
+
197
+ if attributes.key?(:'address2')
198
+ self.address2 = attributes[:'address2']
199
+ end
200
+
201
+ if attributes.key?(:'city')
202
+ self.city = attributes[:'city']
203
+ end
204
+
205
+ if attributes.key?(:'state_province')
206
+ self.state_province = attributes[:'state_province']
207
+ end
208
+
209
+ if attributes.key?(:'postal_code')
210
+ self.postal_code = attributes[:'postal_code']
211
+ end
212
+
213
+ if attributes.key?(:'country')
214
+ self.country = attributes[:'country']
215
+ end
216
+
217
+ if attributes.key?(:'first_name')
218
+ self.first_name = attributes[:'first_name']
219
+ end
220
+
221
+ if attributes.key?(:'middle_name')
222
+ self.middle_name = attributes[:'middle_name']
223
+ end
224
+
225
+ if attributes.key?(:'last_name')
226
+ self.last_name = attributes[:'last_name']
227
+ end
228
+
229
+ if attributes.key?(:'email')
230
+ self.email = attributes[:'email']
231
+ end
232
+
233
+ if attributes.key?(:'language')
234
+ self.language = attributes[:'language']
235
+ end
236
+
237
+ if attributes.key?(:'mobile_number')
238
+ self.mobile_number = attributes[:'mobile_number']
239
+ end
240
+
241
+ if attributes.key?(:'business_name')
242
+ self.business_name = attributes[:'business_name']
243
+ end
244
+
245
+ if attributes.key?(:'timezone')
246
+ self.timezone = attributes[:'timezone']
247
+ end
248
+
249
+ if attributes.key?(:'date_of_birth')
250
+ self.date_of_birth = attributes[:'date_of_birth']
251
+ end
252
+
253
+ if attributes.key?(:'metadata')
254
+ self.metadata = attributes[:'metadata']
255
+ end
256
+ end
257
+
258
+ # Show invalid properties with the reasons. Usually used together with valid?
259
+ # @return Array for valid properties with the reasons
260
+ def list_invalid_properties
261
+ invalid_properties = Array.new
262
+ if @user_token.nil?
263
+ invalid_properties.push('invalid value for "user_token", user_token cannot be nil.')
264
+ end
265
+
266
+ if @status.nil?
267
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
268
+ end
269
+
270
+ if @created_on.nil?
271
+ invalid_properties.push('invalid value for "created_on", created_on cannot be nil.')
272
+ end
273
+
274
+ if @internal_user_id.nil?
275
+ invalid_properties.push('invalid value for "internal_user_id", internal_user_id cannot be nil.')
276
+ end
277
+
278
+ if @first_name.nil?
279
+ invalid_properties.push('invalid value for "first_name", first_name cannot be nil.')
280
+ end
281
+
282
+ if @last_name.nil?
283
+ invalid_properties.push('invalid value for "last_name", last_name cannot be nil.')
284
+ end
285
+
286
+ if @email.nil?
287
+ invalid_properties.push('invalid value for "email", email cannot be nil.')
288
+ end
289
+
290
+ pattern = Regexp.new(/^[0-9]+$/)
291
+ if !@mobile_number.nil? && @mobile_number !~ pattern
292
+ invalid_properties.push("invalid value for \"mobile_number\", must conform to the pattern #{pattern}.")
293
+ end
294
+
295
+ if @timezone.nil?
296
+ invalid_properties.push('invalid value for "timezone", timezone cannot be nil.')
297
+ end
298
+
299
+ invalid_properties
300
+ end
301
+
302
+ # Check to see if the all the properties in the model are valid
303
+ # @return true if the model is valid
304
+ def valid?
305
+ return false if @user_token.nil?
306
+ return false if @status.nil?
307
+ status_validator = EnumAttributeValidator.new('String', ["ACTIVE", "LOCKED", "DEACTIVE"])
308
+ return false unless status_validator.valid?(@status)
309
+ return false if @created_on.nil?
310
+ return false if @internal_user_id.nil?
311
+ return false if @first_name.nil?
312
+ return false if @last_name.nil?
313
+ return false if @email.nil?
314
+ return false if !@mobile_number.nil? && @mobile_number !~ Regexp.new(/^[0-9]+$/)
315
+ return false if @timezone.nil?
316
+ true
317
+ end
318
+
319
+ # Custom attribute writer method checking allowed values (enum).
320
+ # @param [Object] status Object to be assigned
321
+ def status=(status)
322
+ validator = EnumAttributeValidator.new('String', ["ACTIVE", "LOCKED", "DEACTIVE"])
323
+ unless validator.valid?(status)
324
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
325
+ end
326
+ @status = status
327
+ end
328
+
329
+ # Custom attribute writer method with validation
330
+ # @param [Object] mobile_number Value to be assigned
331
+ def mobile_number=(mobile_number)
332
+ pattern = Regexp.new(/^[0-9]+$/)
333
+ if !mobile_number.nil? && mobile_number !~ pattern
334
+ fail ArgumentError, "invalid value for \"mobile_number\", must conform to the pattern #{pattern}."
335
+ end
336
+
337
+ @mobile_number = mobile_number
338
+ end
339
+
340
+ # Checks equality by comparing each attribute.
341
+ # @param [Object] Object to be compared
342
+ def ==(o)
343
+ return true if self.equal?(o)
344
+ self.class == o.class &&
345
+ user_token == o.user_token &&
346
+ status == o.status &&
347
+ created_on == o.created_on &&
348
+ internal_user_id == o.internal_user_id &&
349
+ address1 == o.address1 &&
350
+ address2 == o.address2 &&
351
+ city == o.city &&
352
+ state_province == o.state_province &&
353
+ postal_code == o.postal_code &&
354
+ country == o.country &&
355
+ first_name == o.first_name &&
356
+ middle_name == o.middle_name &&
357
+ last_name == o.last_name &&
358
+ email == o.email &&
359
+ language == o.language &&
360
+ mobile_number == o.mobile_number &&
361
+ business_name == o.business_name &&
362
+ timezone == o.timezone &&
363
+ date_of_birth == o.date_of_birth &&
364
+ metadata == o.metadata
365
+ end
366
+
367
+ # @see the `==` method
368
+ # @param [Object] Object to be compared
369
+ def eql?(o)
370
+ self == o
371
+ end
372
+
373
+ # Calculates hash code according to all attributes.
374
+ # @return [Integer] Hash code
375
+ def hash
376
+ [user_token, status, created_on, internal_user_id, address1, address2, city, state_province, postal_code, country, first_name, middle_name, last_name, email, language, mobile_number, business_name, timezone, date_of_birth, metadata].hash
377
+ end
378
+
379
+ # Builds the object from hash
380
+ # @param [Hash] attributes Model attributes in the form of hash
381
+ # @return [Object] Returns the model itself
382
+ def self.build_from_hash(attributes)
383
+ new.build_from_hash(attributes)
384
+ end
385
+
386
+ # Builds the object from hash
387
+ # @param [Hash] attributes Model attributes in the form of hash
388
+ # @return [Object] Returns the model itself
389
+ def build_from_hash(attributes)
390
+ return nil unless attributes.is_a?(Hash)
391
+ attributes = attributes.transform_keys(&:to_sym)
392
+ self.class.openapi_types.each_pair do |key, type|
393
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
394
+ self.send("#{key}=", nil)
395
+ elsif type =~ /\AArray<(.*)>/i
396
+ # check to ensure the input is an array given that the attribute
397
+ # is documented as an array but the input is not
398
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
399
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
400
+ end
401
+ elsif !attributes[self.class.attribute_map[key]].nil?
402
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
403
+ end
404
+ end
405
+
406
+ self
407
+ end
408
+
409
+ # Deserializes the data based on type
410
+ # @param string type Data type
411
+ # @param string value Value to be deserialized
412
+ # @return [Object] Deserialized data
413
+ def _deserialize(type, value)
414
+ case type.to_sym
415
+ when :Time
416
+ Time.parse(value)
417
+ when :Date
418
+ Date.parse(value)
419
+ when :String
420
+ value.to_s
421
+ when :Integer
422
+ value.to_i
423
+ when :Float
424
+ value.to_f
425
+ when :Boolean
426
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
427
+ true
428
+ else
429
+ false
430
+ end
431
+ when :Object
432
+ # generic object (usually a Hash), return directly
433
+ value
434
+ when /\AArray<(?<inner_type>.+)>\z/
435
+ inner_type = Regexp.last_match[:inner_type]
436
+ value.map { |v| _deserialize(inner_type, v) }
437
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
438
+ k_type = Regexp.last_match[:k_type]
439
+ v_type = Regexp.last_match[:v_type]
440
+ {}.tap do |hash|
441
+ value.each do |k, v|
442
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
443
+ end
444
+ end
445
+ else # model
446
+ # models (e.g. Pet) or oneOf
447
+ klass = MassPayRubySdk.const_get(type)
448
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
449
+ end
450
+ end
451
+
452
+ # Returns the string representation of the object
453
+ # @return [String] String presentation of the object
454
+ def to_s
455
+ to_hash.to_s
456
+ end
457
+
458
+ # to_body is an alias to to_hash (backward compatibility)
459
+ # @return [Hash] Returns the object in the form of hash
460
+ def to_body
461
+ to_hash
462
+ end
463
+
464
+ # Returns the object in the form of hash
465
+ # @return [Hash] Returns the object in the form of hash
466
+ def to_hash
467
+ hash = {}
468
+ self.class.attribute_map.each_pair do |attr, param|
469
+ value = self.send(attr)
470
+ if value.nil?
471
+ is_nullable = self.class.openapi_nullable.include?(attr)
472
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
473
+ end
474
+
475
+ hash[param] = _to_hash(value)
476
+ end
477
+ hash
478
+ end
479
+
480
+ # Outputs non-array value in the form of hash
481
+ # For object, use to_hash. Otherwise, just return the value
482
+ # @param [Object] value Any valid value
483
+ # @return [Hash] Returns the value in the form of hash
484
+ def _to_hash(value)
485
+ if value.is_a?(Array)
486
+ value.compact.map { |v| _to_hash(v) }
487
+ elsif value.is_a?(Hash)
488
+ {}.tap do |hash|
489
+ value.each { |k, v| hash[k] = _to_hash(v) }
490
+ end
491
+ elsif value.respond_to? :to_hash
492
+ value.to_hash
493
+ else
494
+ value
495
+ end
496
+ end
497
+
498
+ end
499
+
500
+ end