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