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,325 @@
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 SpendBackTxn
17
+ # A client defined spend back identifier. This is the unique ID assigned to the load on your system. Max 50 characters.
18
+ attr_accessor :client_spendback_id
19
+
20
+ # Token that represents the funding source i.e. bank account, wallet. 36 characters long
21
+ attr_accessor :source_token
22
+
23
+ # 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
24
+ attr_accessor :source_currency_code
25
+
26
+ # The amount to debit the user's wallet in source currency
27
+ attr_accessor :amount
28
+
29
+ # A description for the spend back
30
+ attr_accessor :notes
31
+
32
+ # Optional JSON object with attributes that can later be searched to locate this spendback. Do not include PII as this object is not encrypted.
33
+ attr_accessor :metadata
34
+
35
+ # Attribute mapping from ruby-style variable name to JSON key.
36
+ def self.attribute_map
37
+ {
38
+ :'client_spendback_id' => :'client_spendback_id',
39
+ :'source_token' => :'source_token',
40
+ :'source_currency_code' => :'source_currency_code',
41
+ :'amount' => :'amount',
42
+ :'notes' => :'notes',
43
+ :'metadata' => :'metadata'
44
+ }
45
+ end
46
+
47
+ # Returns all the JSON keys this model knows about
48
+ def self.acceptable_attributes
49
+ attribute_map.values
50
+ end
51
+
52
+ # Attribute type mapping.
53
+ def self.openapi_types
54
+ {
55
+ :'client_spendback_id' => :'String',
56
+ :'source_token' => :'String',
57
+ :'source_currency_code' => :'String',
58
+ :'amount' => :'Float',
59
+ :'notes' => :'String',
60
+ :'metadata' => :'Object'
61
+ }
62
+ end
63
+
64
+ # List of attributes with nullable: true
65
+ def self.openapi_nullable
66
+ Set.new([
67
+ ])
68
+ end
69
+
70
+ # Initializes the object
71
+ # @param [Hash] attributes Model attributes in the form of hash
72
+ def initialize(attributes = {})
73
+ if (!attributes.is_a?(Hash))
74
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MassPayRubySdk::SpendBackTxn` initialize method"
75
+ end
76
+
77
+ # check to see if the attribute exists and convert string to symbol for hash key
78
+ attributes = attributes.each_with_object({}) { |(k, v), h|
79
+ if (!self.class.attribute_map.key?(k.to_sym))
80
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MassPayRubySdk::SpendBackTxn`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
81
+ end
82
+ h[k.to_sym] = v
83
+ }
84
+
85
+ if attributes.key?(:'client_spendback_id')
86
+ self.client_spendback_id = attributes[:'client_spendback_id']
87
+ end
88
+
89
+ if attributes.key?(:'source_token')
90
+ self.source_token = attributes[:'source_token']
91
+ end
92
+
93
+ if attributes.key?(:'source_currency_code')
94
+ self.source_currency_code = attributes[:'source_currency_code']
95
+ else
96
+ self.source_currency_code = 'USD'
97
+ end
98
+
99
+ if attributes.key?(:'amount')
100
+ self.amount = attributes[:'amount']
101
+ end
102
+
103
+ if attributes.key?(:'notes')
104
+ self.notes = attributes[:'notes']
105
+ end
106
+
107
+ if attributes.key?(:'metadata')
108
+ self.metadata = attributes[:'metadata']
109
+ end
110
+ end
111
+
112
+ # Show invalid properties with the reasons. Usually used together with valid?
113
+ # @return Array for valid properties with the reasons
114
+ def list_invalid_properties
115
+ invalid_properties = Array.new
116
+ if @client_spendback_id.nil?
117
+ invalid_properties.push('invalid value for "client_spendback_id", client_spendback_id cannot be nil.')
118
+ end
119
+
120
+ if @client_spendback_id.to_s.length > 50
121
+ invalid_properties.push('invalid value for "client_spendback_id", the character length must be smaller than or equal to 50.')
122
+ end
123
+
124
+ if @source_token.nil?
125
+ invalid_properties.push('invalid value for "source_token", source_token cannot be nil.')
126
+ end
127
+
128
+ if @source_currency_code.nil?
129
+ invalid_properties.push('invalid value for "source_currency_code", source_currency_code cannot be nil.')
130
+ end
131
+
132
+ if @amount.nil?
133
+ invalid_properties.push('invalid value for "amount", amount cannot be nil.')
134
+ end
135
+
136
+ if !@notes.nil? && @notes.to_s.length > 255
137
+ invalid_properties.push('invalid value for "notes", the character length must be smaller than or equal to 255.')
138
+ end
139
+
140
+ invalid_properties
141
+ end
142
+
143
+ # Check to see if the all the properties in the model are valid
144
+ # @return true if the model is valid
145
+ def valid?
146
+ return false if @client_spendback_id.nil?
147
+ return false if @client_spendback_id.to_s.length > 50
148
+ return false if @source_token.nil?
149
+ return false if @source_currency_code.nil?
150
+ return false if @amount.nil?
151
+ return false if !@notes.nil? && @notes.to_s.length > 255
152
+ true
153
+ end
154
+
155
+ # Custom attribute writer method with validation
156
+ # @param [Object] client_spendback_id Value to be assigned
157
+ def client_spendback_id=(client_spendback_id)
158
+ if client_spendback_id.nil?
159
+ fail ArgumentError, 'client_spendback_id cannot be nil'
160
+ end
161
+
162
+ if client_spendback_id.to_s.length > 50
163
+ fail ArgumentError, 'invalid value for "client_spendback_id", the character length must be smaller than or equal to 50.'
164
+ end
165
+
166
+ @client_spendback_id = client_spendback_id
167
+ end
168
+
169
+ # Custom attribute writer method with validation
170
+ # @param [Object] notes Value to be assigned
171
+ def notes=(notes)
172
+ if !notes.nil? && notes.to_s.length > 255
173
+ fail ArgumentError, 'invalid value for "notes", the character length must be smaller than or equal to 255.'
174
+ end
175
+
176
+ @notes = notes
177
+ end
178
+
179
+ # Checks equality by comparing each attribute.
180
+ # @param [Object] Object to be compared
181
+ def ==(o)
182
+ return true if self.equal?(o)
183
+ self.class == o.class &&
184
+ client_spendback_id == o.client_spendback_id &&
185
+ source_token == o.source_token &&
186
+ source_currency_code == o.source_currency_code &&
187
+ amount == o.amount &&
188
+ notes == o.notes &&
189
+ metadata == o.metadata
190
+ end
191
+
192
+ # @see the `==` method
193
+ # @param [Object] Object to be compared
194
+ def eql?(o)
195
+ self == o
196
+ end
197
+
198
+ # Calculates hash code according to all attributes.
199
+ # @return [Integer] Hash code
200
+ def hash
201
+ [client_spendback_id, source_token, source_currency_code, amount, notes, metadata].hash
202
+ end
203
+
204
+ # Builds the object from hash
205
+ # @param [Hash] attributes Model attributes in the form of hash
206
+ # @return [Object] Returns the model itself
207
+ def self.build_from_hash(attributes)
208
+ new.build_from_hash(attributes)
209
+ end
210
+
211
+ # Builds the object from hash
212
+ # @param [Hash] attributes Model attributes in the form of hash
213
+ # @return [Object] Returns the model itself
214
+ def build_from_hash(attributes)
215
+ return nil unless attributes.is_a?(Hash)
216
+ attributes = attributes.transform_keys(&:to_sym)
217
+ self.class.openapi_types.each_pair do |key, type|
218
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
219
+ self.send("#{key}=", nil)
220
+ elsif type =~ /\AArray<(.*)>/i
221
+ # check to ensure the input is an array given that the attribute
222
+ # is documented as an array but the input is not
223
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
224
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
225
+ end
226
+ elsif !attributes[self.class.attribute_map[key]].nil?
227
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
228
+ end
229
+ end
230
+
231
+ self
232
+ end
233
+
234
+ # Deserializes the data based on type
235
+ # @param string type Data type
236
+ # @param string value Value to be deserialized
237
+ # @return [Object] Deserialized data
238
+ def _deserialize(type, value)
239
+ case type.to_sym
240
+ when :Time
241
+ Time.parse(value)
242
+ when :Date
243
+ Date.parse(value)
244
+ when :String
245
+ value.to_s
246
+ when :Integer
247
+ value.to_i
248
+ when :Float
249
+ value.to_f
250
+ when :Boolean
251
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
252
+ true
253
+ else
254
+ false
255
+ end
256
+ when :Object
257
+ # generic object (usually a Hash), return directly
258
+ value
259
+ when /\AArray<(?<inner_type>.+)>\z/
260
+ inner_type = Regexp.last_match[:inner_type]
261
+ value.map { |v| _deserialize(inner_type, v) }
262
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
263
+ k_type = Regexp.last_match[:k_type]
264
+ v_type = Regexp.last_match[:v_type]
265
+ {}.tap do |hash|
266
+ value.each do |k, v|
267
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
268
+ end
269
+ end
270
+ else # model
271
+ # models (e.g. Pet) or oneOf
272
+ klass = MassPayRubySdk.const_get(type)
273
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
274
+ end
275
+ end
276
+
277
+ # Returns the string representation of the object
278
+ # @return [String] String presentation of the object
279
+ def to_s
280
+ to_hash.to_s
281
+ end
282
+
283
+ # to_body is an alias to to_hash (backward compatibility)
284
+ # @return [Hash] Returns the object in the form of hash
285
+ def to_body
286
+ to_hash
287
+ end
288
+
289
+ # Returns the object in the form of hash
290
+ # @return [Hash] Returns the object in the form of hash
291
+ def to_hash
292
+ hash = {}
293
+ self.class.attribute_map.each_pair do |attr, param|
294
+ value = self.send(attr)
295
+ if value.nil?
296
+ is_nullable = self.class.openapi_nullable.include?(attr)
297
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
298
+ end
299
+
300
+ hash[param] = _to_hash(value)
301
+ end
302
+ hash
303
+ end
304
+
305
+ # Outputs non-array value in the form of hash
306
+ # For object, use to_hash. Otherwise, just return the value
307
+ # @param [Object] value Any valid value
308
+ # @return [Hash] Returns the value in the form of hash
309
+ def _to_hash(value)
310
+ if value.is_a?(Array)
311
+ value.compact.map { |v| _to_hash(v) }
312
+ elsif value.is_a?(Hash)
313
+ {}.tap do |hash|
314
+ value.each { |k, v| hash[k] = _to_hash(v) }
315
+ end
316
+ elsif value.respond_to? :to_hash
317
+ value.to_hash
318
+ else
319
+ value
320
+ end
321
+ end
322
+
323
+ end
324
+
325
+ end
@@ -0,0 +1,307 @@
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 SpendBackTxnResp
17
+ # Token that represents the spend back that was just created.
18
+ attr_accessor :spendback_token
19
+
20
+ # A client defined spend back identifier. This is the unique ID assigned to the load on your system. Max 50 characters.
21
+ attr_accessor :client_spendback_id
22
+
23
+ # Status that indicates whether the transaction was successfully processed. If `success`, everything was processed correctly. `failure` indicates a generic error.
24
+ attr_accessor :status
25
+
26
+ class EnumAttributeValidator
27
+ attr_reader :datatype
28
+ attr_reader :allowable_values
29
+
30
+ def initialize(datatype, allowable_values)
31
+ @allowable_values = allowable_values.map do |value|
32
+ case datatype.to_s
33
+ when /Integer/i
34
+ value.to_i
35
+ when /Float/i
36
+ value.to_f
37
+ else
38
+ value
39
+ end
40
+ end
41
+ end
42
+
43
+ def valid?(value)
44
+ !value || allowable_values.include?(value)
45
+ end
46
+ end
47
+
48
+ # Attribute mapping from ruby-style variable name to JSON key.
49
+ def self.attribute_map
50
+ {
51
+ :'spendback_token' => :'spendback_token',
52
+ :'client_spendback_id' => :'client_spendback_id',
53
+ :'status' => :'status'
54
+ }
55
+ end
56
+
57
+ # Returns all the JSON keys this model knows about
58
+ def self.acceptable_attributes
59
+ attribute_map.values
60
+ end
61
+
62
+ # Attribute type mapping.
63
+ def self.openapi_types
64
+ {
65
+ :'spendback_token' => :'String',
66
+ :'client_spendback_id' => :'String',
67
+ :'status' => :'String'
68
+ }
69
+ end
70
+
71
+ # List of attributes with nullable: true
72
+ def self.openapi_nullable
73
+ Set.new([
74
+ ])
75
+ end
76
+
77
+ # Initializes the object
78
+ # @param [Hash] attributes Model attributes in the form of hash
79
+ def initialize(attributes = {})
80
+ if (!attributes.is_a?(Hash))
81
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MassPayRubySdk::SpendBackTxnResp` initialize method"
82
+ end
83
+
84
+ # check to see if the attribute exists and convert string to symbol for hash key
85
+ attributes = attributes.each_with_object({}) { |(k, v), h|
86
+ if (!self.class.attribute_map.key?(k.to_sym))
87
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MassPayRubySdk::SpendBackTxnResp`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
88
+ end
89
+ h[k.to_sym] = v
90
+ }
91
+
92
+ if attributes.key?(:'spendback_token')
93
+ self.spendback_token = attributes[:'spendback_token']
94
+ end
95
+
96
+ if attributes.key?(:'client_spendback_id')
97
+ self.client_spendback_id = attributes[:'client_spendback_id']
98
+ end
99
+
100
+ if attributes.key?(:'status')
101
+ self.status = attributes[:'status']
102
+ end
103
+ end
104
+
105
+ # Show invalid properties with the reasons. Usually used together with valid?
106
+ # @return Array for valid properties with the reasons
107
+ def list_invalid_properties
108
+ invalid_properties = Array.new
109
+ if @spendback_token.nil?
110
+ invalid_properties.push('invalid value for "spendback_token", spendback_token cannot be nil.')
111
+ end
112
+
113
+ if @client_spendback_id.nil?
114
+ invalid_properties.push('invalid value for "client_spendback_id", client_spendback_id cannot be nil.')
115
+ end
116
+
117
+ if @client_spendback_id.to_s.length > 50
118
+ invalid_properties.push('invalid value for "client_spendback_id", the character length must be smaller than or equal to 50.')
119
+ end
120
+
121
+ if @status.nil?
122
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
123
+ end
124
+
125
+ invalid_properties
126
+ end
127
+
128
+ # Check to see if the all the properties in the model are valid
129
+ # @return true if the model is valid
130
+ def valid?
131
+ return false if @spendback_token.nil?
132
+ return false if @client_spendback_id.nil?
133
+ return false if @client_spendback_id.to_s.length > 50
134
+ return false if @status.nil?
135
+ status_validator = EnumAttributeValidator.new('String', ["success", "failure"])
136
+ return false unless status_validator.valid?(@status)
137
+ true
138
+ end
139
+
140
+ # Custom attribute writer method with validation
141
+ # @param [Object] client_spendback_id Value to be assigned
142
+ def client_spendback_id=(client_spendback_id)
143
+ if client_spendback_id.nil?
144
+ fail ArgumentError, 'client_spendback_id cannot be nil'
145
+ end
146
+
147
+ if client_spendback_id.to_s.length > 50
148
+ fail ArgumentError, 'invalid value for "client_spendback_id", the character length must be smaller than or equal to 50.'
149
+ end
150
+
151
+ @client_spendback_id = client_spendback_id
152
+ end
153
+
154
+ # Custom attribute writer method checking allowed values (enum).
155
+ # @param [Object] status Object to be assigned
156
+ def status=(status)
157
+ validator = EnumAttributeValidator.new('String', ["success", "failure"])
158
+ unless validator.valid?(status)
159
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
160
+ end
161
+ @status = status
162
+ end
163
+
164
+ # Checks equality by comparing each attribute.
165
+ # @param [Object] Object to be compared
166
+ def ==(o)
167
+ return true if self.equal?(o)
168
+ self.class == o.class &&
169
+ spendback_token == o.spendback_token &&
170
+ client_spendback_id == o.client_spendback_id &&
171
+ status == o.status
172
+ end
173
+
174
+ # @see the `==` method
175
+ # @param [Object] Object to be compared
176
+ def eql?(o)
177
+ self == o
178
+ end
179
+
180
+ # Calculates hash code according to all attributes.
181
+ # @return [Integer] Hash code
182
+ def hash
183
+ [spendback_token, client_spendback_id, status].hash
184
+ end
185
+
186
+ # Builds the object from hash
187
+ # @param [Hash] attributes Model attributes in the form of hash
188
+ # @return [Object] Returns the model itself
189
+ def self.build_from_hash(attributes)
190
+ new.build_from_hash(attributes)
191
+ end
192
+
193
+ # Builds the object from hash
194
+ # @param [Hash] attributes Model attributes in the form of hash
195
+ # @return [Object] Returns the model itself
196
+ def build_from_hash(attributes)
197
+ return nil unless attributes.is_a?(Hash)
198
+ attributes = attributes.transform_keys(&:to_sym)
199
+ self.class.openapi_types.each_pair do |key, type|
200
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
201
+ self.send("#{key}=", nil)
202
+ elsif type =~ /\AArray<(.*)>/i
203
+ # check to ensure the input is an array given that the attribute
204
+ # is documented as an array but the input is not
205
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
206
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
207
+ end
208
+ elsif !attributes[self.class.attribute_map[key]].nil?
209
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
210
+ end
211
+ end
212
+
213
+ self
214
+ end
215
+
216
+ # Deserializes the data based on type
217
+ # @param string type Data type
218
+ # @param string value Value to be deserialized
219
+ # @return [Object] Deserialized data
220
+ def _deserialize(type, value)
221
+ case type.to_sym
222
+ when :Time
223
+ Time.parse(value)
224
+ when :Date
225
+ Date.parse(value)
226
+ when :String
227
+ value.to_s
228
+ when :Integer
229
+ value.to_i
230
+ when :Float
231
+ value.to_f
232
+ when :Boolean
233
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
234
+ true
235
+ else
236
+ false
237
+ end
238
+ when :Object
239
+ # generic object (usually a Hash), return directly
240
+ value
241
+ when /\AArray<(?<inner_type>.+)>\z/
242
+ inner_type = Regexp.last_match[:inner_type]
243
+ value.map { |v| _deserialize(inner_type, v) }
244
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
245
+ k_type = Regexp.last_match[:k_type]
246
+ v_type = Regexp.last_match[:v_type]
247
+ {}.tap do |hash|
248
+ value.each do |k, v|
249
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
250
+ end
251
+ end
252
+ else # model
253
+ # models (e.g. Pet) or oneOf
254
+ klass = MassPayRubySdk.const_get(type)
255
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
256
+ end
257
+ end
258
+
259
+ # Returns the string representation of the object
260
+ # @return [String] String presentation of the object
261
+ def to_s
262
+ to_hash.to_s
263
+ end
264
+
265
+ # to_body is an alias to to_hash (backward compatibility)
266
+ # @return [Hash] Returns the object in the form of hash
267
+ def to_body
268
+ to_hash
269
+ end
270
+
271
+ # Returns the object in the form of hash
272
+ # @return [Hash] Returns the object in the form of hash
273
+ def to_hash
274
+ hash = {}
275
+ self.class.attribute_map.each_pair do |attr, param|
276
+ value = self.send(attr)
277
+ if value.nil?
278
+ is_nullable = self.class.openapi_nullable.include?(attr)
279
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
280
+ end
281
+
282
+ hash[param] = _to_hash(value)
283
+ end
284
+ hash
285
+ end
286
+
287
+ # Outputs non-array value in the form of hash
288
+ # For object, use to_hash. Otherwise, just return the value
289
+ # @param [Object] value Any valid value
290
+ # @return [Hash] Returns the value in the form of hash
291
+ def _to_hash(value)
292
+ if value.is_a?(Array)
293
+ value.compact.map { |v| _to_hash(v) }
294
+ elsif value.is_a?(Hash)
295
+ {}.tap do |hash|
296
+ value.each { |k, v| hash[k] = _to_hash(v) }
297
+ end
298
+ elsif value.respond_to? :to_hash
299
+ value.to_hash
300
+ else
301
+ value
302
+ end
303
+ end
304
+
305
+ end
306
+
307
+ end