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,571 +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
- # Record that represents a transaction
17
- class TxnHistoryResp
18
- # Token represnting the transaction
19
- attr_accessor :token
20
-
21
- # Type of transaction
22
- attr_accessor :type
23
-
24
- # Time the transaction was created. In UTC
25
- attr_accessor :time_of_txn
26
-
27
- # Source amount
28
- attr_accessor :source_amount
29
-
30
- # The currency originating balance is stored in. Using [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) format. In most cases this value will be USD, and therefore the defaut value if none is provided
31
- attr_accessor :source_currency_code
32
-
33
- # The amount that was received in `destination_currency_code`
34
- attr_accessor :destination_amount
35
-
36
- # The currency of the funds received. Using [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) format
37
- attr_accessor :destination_currency_code
38
-
39
- # Fee of the transaction
40
- attr_accessor :fee
41
-
42
- # Status of the transaction
43
- attr_accessor :status
44
-
45
- # Notes of the transaction when load or spend back
46
- attr_accessor :notes
47
-
48
- # Name of the payer when payout transaction
49
- attr_accessor :payer_name
50
-
51
- # Code/pin that is required when collecting the money when payout transaction
52
- attr_accessor :pickup_code
53
-
54
- # Token that represents the funding source i.e. bank account, wallet. 36 characters long
55
- attr_accessor :source_token
56
-
57
- # Token that represents the payout destination i.e. Omnex->Brazil->Bank Deposit->Itau. To be retrieved from the #pricing callback. If not provided, the last destination that was used for this user will be used. 36 characters long
58
- attr_accessor :destination_token
59
-
60
- # The type of service. I.e. cash pickup, home delivery, etc. Only provided for payouts
61
- attr_accessor :delivery_type
62
-
63
- # A client defined transfer identifier. This is the unique ID assigned to the transfer on your system. Max 50 characters.
64
- attr_accessor :client_transfer_id
65
-
66
- # The reason for the status change. Usually would include reason for an ERROR or CANCEL status
67
- attr_accessor :status_reason
68
-
69
- # Optional client id
70
- attr_accessor :client_id
71
-
72
- class EnumAttributeValidator
73
- attr_reader :datatype
74
- attr_reader :allowable_values
75
-
76
- def initialize(datatype, allowable_values)
77
- @allowable_values = allowable_values.map do |value|
78
- case datatype.to_s
79
- when /Integer/i
80
- value.to_i
81
- when /Float/i
82
- value.to_f
83
- else
84
- value
85
- end
86
- end
87
- end
88
-
89
- def valid?(value)
90
- !value || allowable_values.include?(value)
91
- end
92
- end
93
-
94
- # Attribute mapping from ruby-style variable name to JSON key.
95
- def self.attribute_map
96
- {
97
- :'token' => :'token',
98
- :'type' => :'type',
99
- :'time_of_txn' => :'time_of_txn',
100
- :'source_amount' => :'source_amount',
101
- :'source_currency_code' => :'source_currency_code',
102
- :'destination_amount' => :'destination_amount',
103
- :'destination_currency_code' => :'destination_currency_code',
104
- :'fee' => :'fee',
105
- :'status' => :'status',
106
- :'notes' => :'notes',
107
- :'payer_name' => :'payer_name',
108
- :'pickup_code' => :'pickup_code',
109
- :'source_token' => :'source_token',
110
- :'destination_token' => :'destination_token',
111
- :'delivery_type' => :'delivery_type',
112
- :'client_transfer_id' => :'client_transfer_id',
113
- :'status_reason' => :'status_reason',
114
- :'client_id' => :'client_id'
115
- }
116
- end
117
-
118
- # Returns all the JSON keys this model knows about
119
- def self.acceptable_attributes
120
- attribute_map.values
121
- end
122
-
123
- # Attribute type mapping.
124
- def self.openapi_types
125
- {
126
- :'token' => :'String',
127
- :'type' => :'String',
128
- :'time_of_txn' => :'Time',
129
- :'source_amount' => :'Float',
130
- :'source_currency_code' => :'String',
131
- :'destination_amount' => :'Float',
132
- :'destination_currency_code' => :'String',
133
- :'fee' => :'Float',
134
- :'status' => :'String',
135
- :'notes' => :'String',
136
- :'payer_name' => :'String',
137
- :'pickup_code' => :'String',
138
- :'source_token' => :'String',
139
- :'destination_token' => :'String',
140
- :'delivery_type' => :'String',
141
- :'client_transfer_id' => :'String',
142
- :'status_reason' => :'String',
143
- :'client_id' => :'Integer'
144
- }
145
- end
146
-
147
- # List of attributes with nullable: true
148
- def self.openapi_nullable
149
- Set.new([
150
- ])
151
- end
152
-
153
- # Initializes the object
154
- # @param [Hash] attributes Model attributes in the form of hash
155
- def initialize(attributes = {})
156
- if (!attributes.is_a?(Hash))
157
- fail ArgumentError, "The input argument (attributes) must be a hash in `MassPayRubySdk::TxnHistoryResp` initialize method"
158
- end
159
-
160
- # check to see if the attribute exists and convert string to symbol for hash key
161
- attributes = attributes.each_with_object({}) { |(k, v), h|
162
- if (!self.class.attribute_map.key?(k.to_sym))
163
- fail ArgumentError, "`#{k}` is not a valid attribute in `MassPayRubySdk::TxnHistoryResp`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
164
- end
165
- h[k.to_sym] = v
166
- }
167
-
168
- if attributes.key?(:'token')
169
- self.token = attributes[:'token']
170
- end
171
-
172
- if attributes.key?(:'type')
173
- self.type = attributes[:'type']
174
- end
175
-
176
- if attributes.key?(:'time_of_txn')
177
- self.time_of_txn = attributes[:'time_of_txn']
178
- end
179
-
180
- if attributes.key?(:'source_amount')
181
- self.source_amount = attributes[:'source_amount']
182
- end
183
-
184
- if attributes.key?(:'source_currency_code')
185
- self.source_currency_code = attributes[:'source_currency_code']
186
- else
187
- self.source_currency_code = 'USD'
188
- end
189
-
190
- if attributes.key?(:'destination_amount')
191
- self.destination_amount = attributes[:'destination_amount']
192
- end
193
-
194
- if attributes.key?(:'destination_currency_code')
195
- self.destination_currency_code = attributes[:'destination_currency_code']
196
- end
197
-
198
- if attributes.key?(:'fee')
199
- self.fee = attributes[:'fee']
200
- end
201
-
202
- if attributes.key?(:'status')
203
- self.status = attributes[:'status']
204
- end
205
-
206
- if attributes.key?(:'notes')
207
- self.notes = attributes[:'notes']
208
- end
209
-
210
- if attributes.key?(:'payer_name')
211
- self.payer_name = attributes[:'payer_name']
212
- end
213
-
214
- if attributes.key?(:'pickup_code')
215
- self.pickup_code = attributes[:'pickup_code']
216
- end
217
-
218
- if attributes.key?(:'source_token')
219
- self.source_token = attributes[:'source_token']
220
- end
221
-
222
- if attributes.key?(:'destination_token')
223
- self.destination_token = attributes[:'destination_token']
224
- end
225
-
226
- if attributes.key?(:'delivery_type')
227
- self.delivery_type = attributes[:'delivery_type']
228
- end
229
-
230
- if attributes.key?(:'client_transfer_id')
231
- self.client_transfer_id = attributes[:'client_transfer_id']
232
- end
233
-
234
- if attributes.key?(:'status_reason')
235
- self.status_reason = attributes[:'status_reason']
236
- end
237
-
238
- if attributes.key?(:'client_id')
239
- self.client_id = attributes[:'client_id']
240
- end
241
- end
242
-
243
- # Show invalid properties with the reasons. Usually used together with valid?
244
- # @return Array for valid properties with the reasons
245
- def list_invalid_properties
246
- invalid_properties = Array.new
247
- if @token.nil?
248
- invalid_properties.push('invalid value for "token", token cannot be nil.')
249
- end
250
-
251
- if @type.nil?
252
- invalid_properties.push('invalid value for "type", type cannot be nil.')
253
- end
254
-
255
- if @time_of_txn.nil?
256
- invalid_properties.push('invalid value for "time_of_txn", time_of_txn cannot be nil.')
257
- end
258
-
259
- if @source_amount.nil?
260
- invalid_properties.push('invalid value for "source_amount", source_amount cannot be nil.')
261
- end
262
-
263
- if @source_currency_code.nil?
264
- invalid_properties.push('invalid value for "source_currency_code", source_currency_code cannot be nil.')
265
- end
266
-
267
- if @source_currency_code.to_s.length > 3
268
- invalid_properties.push('invalid value for "source_currency_code", the character length must be smaller than or equal to 3.')
269
- end
270
-
271
- if @source_currency_code.to_s.length < 3
272
- invalid_properties.push('invalid value for "source_currency_code", the character length must be great than or equal to 3.')
273
- end
274
-
275
- if @destination_amount.nil?
276
- invalid_properties.push('invalid value for "destination_amount", destination_amount cannot be nil.')
277
- end
278
-
279
- if @destination_currency_code.nil?
280
- invalid_properties.push('invalid value for "destination_currency_code", destination_currency_code cannot be nil.')
281
- end
282
-
283
- if @destination_currency_code.to_s.length > 3
284
- invalid_properties.push('invalid value for "destination_currency_code", the character length must be smaller than or equal to 3.')
285
- end
286
-
287
- if @destination_currency_code.to_s.length < 3
288
- invalid_properties.push('invalid value for "destination_currency_code", the character length must be great than or equal to 3.')
289
- end
290
-
291
- if @fee.nil?
292
- invalid_properties.push('invalid value for "fee", fee cannot be nil.')
293
- end
294
-
295
- if @status.nil?
296
- invalid_properties.push('invalid value for "status", status cannot be nil.')
297
- end
298
-
299
- if @destination_token.nil?
300
- invalid_properties.push('invalid value for "destination_token", destination_token cannot be nil.')
301
- end
302
-
303
- if !@client_transfer_id.nil? && @client_transfer_id.to_s.length > 50
304
- invalid_properties.push('invalid value for "client_transfer_id", the character length must be smaller than or equal to 50.')
305
- end
306
-
307
- invalid_properties
308
- end
309
-
310
- # Check to see if the all the properties in the model are valid
311
- # @return true if the model is valid
312
- def valid?
313
- return false if @token.nil?
314
- return false if @type.nil?
315
- type_validator = EnumAttributeValidator.new('String', ["load", "payout", "spend back", "info"])
316
- return false unless type_validator.valid?(@type)
317
- return false if @time_of_txn.nil?
318
- return false if @source_amount.nil?
319
- return false if @source_currency_code.nil?
320
- return false if @source_currency_code.to_s.length > 3
321
- return false if @source_currency_code.to_s.length < 3
322
- return false if @destination_amount.nil?
323
- return false if @destination_currency_code.nil?
324
- return false if @destination_currency_code.to_s.length > 3
325
- return false if @destination_currency_code.to_s.length < 3
326
- return false if @fee.nil?
327
- return false if @status.nil?
328
- status_validator = EnumAttributeValidator.new('String', ["PENDING", "PROCESSING", "COMPLETED", "CANCELLED", "SCHEDULED", "READY_FOR_PICKUP", "HOLD", "ERROR"])
329
- return false unless status_validator.valid?(@status)
330
- return false if @destination_token.nil?
331
- delivery_type_validator = EnumAttributeValidator.new('String', ["CASH_PICKUP", "BANK_DEPOSIT", "HOME_DELIVERY", "MOBILE_WALLET", "MASSPAY_CARD", "PAPER_CHECK", "BILL", "CRYPTOCURRENCY"])
332
- return false unless delivery_type_validator.valid?(@delivery_type)
333
- return false if !@client_transfer_id.nil? && @client_transfer_id.to_s.length > 50
334
- true
335
- end
336
-
337
- # Custom attribute writer method checking allowed values (enum).
338
- # @param [Object] type Object to be assigned
339
- def type=(type)
340
- validator = EnumAttributeValidator.new('String', ["load", "payout", "spend back", "info"])
341
- unless validator.valid?(type)
342
- fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
343
- end
344
- @type = type
345
- end
346
-
347
- # Custom attribute writer method with validation
348
- # @param [Object] source_currency_code Value to be assigned
349
- def source_currency_code=(source_currency_code)
350
- if source_currency_code.nil?
351
- fail ArgumentError, 'source_currency_code cannot be nil'
352
- end
353
-
354
- if source_currency_code.to_s.length > 3
355
- fail ArgumentError, 'invalid value for "source_currency_code", the character length must be smaller than or equal to 3.'
356
- end
357
-
358
- if source_currency_code.to_s.length < 3
359
- fail ArgumentError, 'invalid value for "source_currency_code", the character length must be great than or equal to 3.'
360
- end
361
-
362
- @source_currency_code = source_currency_code
363
- end
364
-
365
- # Custom attribute writer method with validation
366
- # @param [Object] destination_currency_code Value to be assigned
367
- def destination_currency_code=(destination_currency_code)
368
- if destination_currency_code.nil?
369
- fail ArgumentError, 'destination_currency_code cannot be nil'
370
- end
371
-
372
- if destination_currency_code.to_s.length > 3
373
- fail ArgumentError, 'invalid value for "destination_currency_code", the character length must be smaller than or equal to 3.'
374
- end
375
-
376
- if destination_currency_code.to_s.length < 3
377
- fail ArgumentError, 'invalid value for "destination_currency_code", the character length must be great than or equal to 3.'
378
- end
379
-
380
- @destination_currency_code = destination_currency_code
381
- end
382
-
383
- # Custom attribute writer method checking allowed values (enum).
384
- # @param [Object] status Object to be assigned
385
- def status=(status)
386
- validator = EnumAttributeValidator.new('String', ["PENDING", "PROCESSING", "COMPLETED", "CANCELLED", "SCHEDULED", "READY_FOR_PICKUP", "HOLD", "ERROR"])
387
- unless validator.valid?(status)
388
- fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
389
- end
390
- @status = status
391
- end
392
-
393
- # Custom attribute writer method checking allowed values (enum).
394
- # @param [Object] delivery_type Object to be assigned
395
- def delivery_type=(delivery_type)
396
- validator = EnumAttributeValidator.new('String', ["CASH_PICKUP", "BANK_DEPOSIT", "HOME_DELIVERY", "MOBILE_WALLET", "MASSPAY_CARD", "PAPER_CHECK", "BILL", "CRYPTOCURRENCY"])
397
- unless validator.valid?(delivery_type)
398
- fail ArgumentError, "invalid value for \"delivery_type\", must be one of #{validator.allowable_values}."
399
- end
400
- @delivery_type = delivery_type
401
- end
402
-
403
- # Custom attribute writer method with validation
404
- # @param [Object] client_transfer_id Value to be assigned
405
- def client_transfer_id=(client_transfer_id)
406
- if !client_transfer_id.nil? && client_transfer_id.to_s.length > 50
407
- fail ArgumentError, 'invalid value for "client_transfer_id", the character length must be smaller than or equal to 50.'
408
- end
409
-
410
- @client_transfer_id = client_transfer_id
411
- end
412
-
413
- # Checks equality by comparing each attribute.
414
- # @param [Object] Object to be compared
415
- def ==(o)
416
- return true if self.equal?(o)
417
- self.class == o.class &&
418
- token == o.token &&
419
- type == o.type &&
420
- time_of_txn == o.time_of_txn &&
421
- source_amount == o.source_amount &&
422
- source_currency_code == o.source_currency_code &&
423
- destination_amount == o.destination_amount &&
424
- destination_currency_code == o.destination_currency_code &&
425
- fee == o.fee &&
426
- status == o.status &&
427
- notes == o.notes &&
428
- payer_name == o.payer_name &&
429
- pickup_code == o.pickup_code &&
430
- source_token == o.source_token &&
431
- destination_token == o.destination_token &&
432
- delivery_type == o.delivery_type &&
433
- client_transfer_id == o.client_transfer_id &&
434
- status_reason == o.status_reason &&
435
- client_id == o.client_id
436
- end
437
-
438
- # @see the `==` method
439
- # @param [Object] Object to be compared
440
- def eql?(o)
441
- self == o
442
- end
443
-
444
- # Calculates hash code according to all attributes.
445
- # @return [Integer] Hash code
446
- def hash
447
- [token, type, time_of_txn, source_amount, source_currency_code, destination_amount, destination_currency_code, fee, status, notes, payer_name, pickup_code, source_token, destination_token, delivery_type, client_transfer_id, status_reason, client_id].hash
448
- end
449
-
450
- # Builds the object from hash
451
- # @param [Hash] attributes Model attributes in the form of hash
452
- # @return [Object] Returns the model itself
453
- def self.build_from_hash(attributes)
454
- new.build_from_hash(attributes)
455
- end
456
-
457
- # Builds the object from hash
458
- # @param [Hash] attributes Model attributes in the form of hash
459
- # @return [Object] Returns the model itself
460
- def build_from_hash(attributes)
461
- return nil unless attributes.is_a?(Hash)
462
- attributes = attributes.transform_keys(&:to_sym)
463
- self.class.openapi_types.each_pair do |key, type|
464
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
465
- self.send("#{key}=", nil)
466
- elsif type =~ /\AArray<(.*)>/i
467
- # check to ensure the input is an array given that the attribute
468
- # is documented as an array but the input is not
469
- if attributes[self.class.attribute_map[key]].is_a?(Array)
470
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
471
- end
472
- elsif !attributes[self.class.attribute_map[key]].nil?
473
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
474
- end
475
- end
476
-
477
- self
478
- end
479
-
480
- # Deserializes the data based on type
481
- # @param string type Data type
482
- # @param string value Value to be deserialized
483
- # @return [Object] Deserialized data
484
- def _deserialize(type, value)
485
- case type.to_sym
486
- when :Time
487
- Time.parse(value)
488
- when :Date
489
- Date.parse(value)
490
- when :String
491
- value.to_s
492
- when :Integer
493
- value.to_i
494
- when :Float
495
- value.to_f
496
- when :Boolean
497
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
498
- true
499
- else
500
- false
501
- end
502
- when :Object
503
- # generic object (usually a Hash), return directly
504
- value
505
- when /\AArray<(?<inner_type>.+)>\z/
506
- inner_type = Regexp.last_match[:inner_type]
507
- value.map { |v| _deserialize(inner_type, v) }
508
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
509
- k_type = Regexp.last_match[:k_type]
510
- v_type = Regexp.last_match[:v_type]
511
- {}.tap do |hash|
512
- value.each do |k, v|
513
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
514
- end
515
- end
516
- else # model
517
- # models (e.g. Pet) or oneOf
518
- klass = MassPayRubySdk.const_get(type)
519
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
520
- end
521
- end
522
-
523
- # Returns the string representation of the object
524
- # @return [String] String presentation of the object
525
- def to_s
526
- to_hash.to_s
527
- end
528
-
529
- # to_body is an alias to to_hash (backward compatibility)
530
- # @return [Hash] Returns the object in the form of hash
531
- def to_body
532
- to_hash
533
- end
534
-
535
- # Returns the object in the form of hash
536
- # @return [Hash] Returns the object in the form of hash
537
- def to_hash
538
- hash = {}
539
- self.class.attribute_map.each_pair do |attr, param|
540
- value = self.send(attr)
541
- if value.nil?
542
- is_nullable = self.class.openapi_nullable.include?(attr)
543
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
544
- end
545
-
546
- hash[param] = _to_hash(value)
547
- end
548
- hash
549
- end
550
-
551
- # Outputs non-array value in the form of hash
552
- # For object, use to_hash. Otherwise, just return the value
553
- # @param [Object] value Any valid value
554
- # @return [Hash] Returns the value in the form of hash
555
- def _to_hash(value)
556
- if value.is_a?(Array)
557
- value.compact.map { |v| _to_hash(v) }
558
- elsif value.is_a?(Hash)
559
- {}.tap do |hash|
560
- value.each { |k, v| hash[k] = _to_hash(v) }
561
- end
562
- elsif value.respond_to? :to_hash
563
- value.to_hash
564
- else
565
- value
566
- end
567
- end
568
-
569
- end
570
-
571
- end