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,373 +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 ServicePayersInner
17
- # Token that represents the payout destination. 36 characters long
18
- attr_accessor :destination_token
19
-
20
- # base64 representation of the payer logo
21
- attr_accessor :payer_logo
22
-
23
- # Name of payer
24
- attr_accessor :payer_name
25
-
26
- # Lists all available currencies and their estimated rates
27
- attr_accessor :exchange_rate
28
-
29
- # Service fee
30
- attr_accessor :fee
31
-
32
- # The maximum amount (inclusive) the user can send with this service. 0 if no upper limit
33
- attr_accessor :max_limit
34
-
35
- # The minimum amount (inclusive) the user can send with this service. 0 if no lower limit
36
- attr_accessor :min_limit
37
-
38
- # Optional return field. Will only show if `limit` parameter is provided
39
- attr_accessor :source_amount
40
-
41
- # Total number of locations. Mostly relevant for cash pickup services. 0 if unknown or irrelevant
42
- attr_accessor :number_of_locations
43
-
44
- # Estimated availability of funds. When funds would be available to pickup/deposited
45
- attr_accessor :estimated_availability
46
-
47
- # When available, additional description that explains the service offered or requirements for funds delivery.
48
- attr_accessor :additional_description
49
-
50
- # Attribute mapping from ruby-style variable name to JSON key.
51
- def self.attribute_map
52
- {
53
- :'destination_token' => :'destination_token',
54
- :'payer_logo' => :'payer_logo',
55
- :'payer_name' => :'payer_name',
56
- :'exchange_rate' => :'exchange_rate',
57
- :'fee' => :'fee',
58
- :'max_limit' => :'max_limit',
59
- :'min_limit' => :'min_limit',
60
- :'source_amount' => :'source_amount',
61
- :'number_of_locations' => :'number_of_locations',
62
- :'estimated_availability' => :'estimated_availability',
63
- :'additional_description' => :'additional_description'
64
- }
65
- end
66
-
67
- # Returns all the JSON keys this model knows about
68
- def self.acceptable_attributes
69
- attribute_map.values
70
- end
71
-
72
- # Attribute type mapping.
73
- def self.openapi_types
74
- {
75
- :'destination_token' => :'String',
76
- :'payer_logo' => :'String',
77
- :'payer_name' => :'String',
78
- :'exchange_rate' => :'Array<ServicePayersInnerExchangeRateInner>',
79
- :'fee' => :'Float',
80
- :'max_limit' => :'Float',
81
- :'min_limit' => :'Float',
82
- :'source_amount' => :'Float',
83
- :'number_of_locations' => :'Integer',
84
- :'estimated_availability' => :'Time',
85
- :'additional_description' => :'String'
86
- }
87
- end
88
-
89
- # List of attributes with nullable: true
90
- def self.openapi_nullable
91
- Set.new([
92
- ])
93
- end
94
-
95
- # Initializes the object
96
- # @param [Hash] attributes Model attributes in the form of hash
97
- def initialize(attributes = {})
98
- if (!attributes.is_a?(Hash))
99
- fail ArgumentError, "The input argument (attributes) must be a hash in `MassPayRubySdk::ServicePayersInner` initialize method"
100
- end
101
-
102
- # check to see if the attribute exists and convert string to symbol for hash key
103
- attributes = attributes.each_with_object({}) { |(k, v), h|
104
- if (!self.class.attribute_map.key?(k.to_sym))
105
- fail ArgumentError, "`#{k}` is not a valid attribute in `MassPayRubySdk::ServicePayersInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
106
- end
107
- h[k.to_sym] = v
108
- }
109
-
110
- if attributes.key?(:'destination_token')
111
- self.destination_token = attributes[:'destination_token']
112
- end
113
-
114
- if attributes.key?(:'payer_logo')
115
- self.payer_logo = attributes[:'payer_logo']
116
- end
117
-
118
- if attributes.key?(:'payer_name')
119
- self.payer_name = attributes[:'payer_name']
120
- end
121
-
122
- if attributes.key?(:'exchange_rate')
123
- if (value = attributes[:'exchange_rate']).is_a?(Array)
124
- self.exchange_rate = value
125
- end
126
- end
127
-
128
- if attributes.key?(:'fee')
129
- self.fee = attributes[:'fee']
130
- end
131
-
132
- if attributes.key?(:'max_limit')
133
- self.max_limit = attributes[:'max_limit']
134
- end
135
-
136
- if attributes.key?(:'min_limit')
137
- self.min_limit = attributes[:'min_limit']
138
- end
139
-
140
- if attributes.key?(:'source_amount')
141
- self.source_amount = attributes[:'source_amount']
142
- end
143
-
144
- if attributes.key?(:'number_of_locations')
145
- self.number_of_locations = attributes[:'number_of_locations']
146
- else
147
- self.number_of_locations = 0
148
- end
149
-
150
- if attributes.key?(:'estimated_availability')
151
- self.estimated_availability = attributes[:'estimated_availability']
152
- end
153
-
154
- if attributes.key?(:'additional_description')
155
- self.additional_description = attributes[:'additional_description']
156
- end
157
- end
158
-
159
- # Show invalid properties with the reasons. Usually used together with valid?
160
- # @return Array for valid properties with the reasons
161
- def list_invalid_properties
162
- invalid_properties = Array.new
163
- if @destination_token.nil?
164
- invalid_properties.push('invalid value for "destination_token", destination_token cannot be nil.')
165
- end
166
-
167
- if @payer_logo.nil?
168
- invalid_properties.push('invalid value for "payer_logo", payer_logo cannot be nil.')
169
- end
170
-
171
- if @payer_name.nil?
172
- invalid_properties.push('invalid value for "payer_name", payer_name cannot be nil.')
173
- end
174
-
175
- if @exchange_rate.nil?
176
- invalid_properties.push('invalid value for "exchange_rate", exchange_rate cannot be nil.')
177
- end
178
-
179
- if @fee.nil?
180
- invalid_properties.push('invalid value for "fee", fee cannot be nil.')
181
- end
182
-
183
- if @max_limit.nil?
184
- invalid_properties.push('invalid value for "max_limit", max_limit cannot be nil.')
185
- end
186
-
187
- if @min_limit.nil?
188
- invalid_properties.push('invalid value for "min_limit", min_limit cannot be nil.')
189
- end
190
-
191
- if !@number_of_locations.nil? && @number_of_locations < 0
192
- invalid_properties.push('invalid value for "number_of_locations", must be greater than or equal to 0.')
193
- end
194
-
195
- invalid_properties
196
- end
197
-
198
- # Check to see if the all the properties in the model are valid
199
- # @return true if the model is valid
200
- def valid?
201
- return false if @destination_token.nil?
202
- return false if @payer_logo.nil?
203
- return false if @payer_name.nil?
204
- return false if @exchange_rate.nil?
205
- return false if @fee.nil?
206
- return false if @max_limit.nil?
207
- return false if @min_limit.nil?
208
- return false if !@number_of_locations.nil? && @number_of_locations < 0
209
- true
210
- end
211
-
212
- # Custom attribute writer method with validation
213
- # @param [Object] number_of_locations Value to be assigned
214
- def number_of_locations=(number_of_locations)
215
- if !number_of_locations.nil? && number_of_locations < 0
216
- fail ArgumentError, 'invalid value for "number_of_locations", must be greater than or equal to 0.'
217
- end
218
-
219
- @number_of_locations = number_of_locations
220
- end
221
-
222
- # Checks equality by comparing each attribute.
223
- # @param [Object] Object to be compared
224
- def ==(o)
225
- return true if self.equal?(o)
226
- self.class == o.class &&
227
- destination_token == o.destination_token &&
228
- payer_logo == o.payer_logo &&
229
- payer_name == o.payer_name &&
230
- exchange_rate == o.exchange_rate &&
231
- fee == o.fee &&
232
- max_limit == o.max_limit &&
233
- min_limit == o.min_limit &&
234
- source_amount == o.source_amount &&
235
- number_of_locations == o.number_of_locations &&
236
- estimated_availability == o.estimated_availability &&
237
- additional_description == o.additional_description
238
- end
239
-
240
- # @see the `==` method
241
- # @param [Object] Object to be compared
242
- def eql?(o)
243
- self == o
244
- end
245
-
246
- # Calculates hash code according to all attributes.
247
- # @return [Integer] Hash code
248
- def hash
249
- [destination_token, payer_logo, payer_name, exchange_rate, fee, max_limit, min_limit, source_amount, number_of_locations, estimated_availability, additional_description].hash
250
- end
251
-
252
- # Builds the object from hash
253
- # @param [Hash] attributes Model attributes in the form of hash
254
- # @return [Object] Returns the model itself
255
- def self.build_from_hash(attributes)
256
- new.build_from_hash(attributes)
257
- end
258
-
259
- # Builds the object from hash
260
- # @param [Hash] attributes Model attributes in the form of hash
261
- # @return [Object] Returns the model itself
262
- def build_from_hash(attributes)
263
- return nil unless attributes.is_a?(Hash)
264
- attributes = attributes.transform_keys(&:to_sym)
265
- self.class.openapi_types.each_pair do |key, type|
266
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
267
- self.send("#{key}=", nil)
268
- elsif type =~ /\AArray<(.*)>/i
269
- # check to ensure the input is an array given that the attribute
270
- # is documented as an array but the input is not
271
- if attributes[self.class.attribute_map[key]].is_a?(Array)
272
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
273
- end
274
- elsif !attributes[self.class.attribute_map[key]].nil?
275
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
276
- end
277
- end
278
-
279
- self
280
- end
281
-
282
- # Deserializes the data based on type
283
- # @param string type Data type
284
- # @param string value Value to be deserialized
285
- # @return [Object] Deserialized data
286
- def _deserialize(type, value)
287
- case type.to_sym
288
- when :Time
289
- Time.parse(value)
290
- when :Date
291
- Date.parse(value)
292
- when :String
293
- value.to_s
294
- when :Integer
295
- value.to_i
296
- when :Float
297
- value.to_f
298
- when :Boolean
299
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
300
- true
301
- else
302
- false
303
- end
304
- when :Object
305
- # generic object (usually a Hash), return directly
306
- value
307
- when /\AArray<(?<inner_type>.+)>\z/
308
- inner_type = Regexp.last_match[:inner_type]
309
- value.map { |v| _deserialize(inner_type, v) }
310
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
311
- k_type = Regexp.last_match[:k_type]
312
- v_type = Regexp.last_match[:v_type]
313
- {}.tap do |hash|
314
- value.each do |k, v|
315
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
316
- end
317
- end
318
- else # model
319
- # models (e.g. Pet) or oneOf
320
- klass = MassPayRubySdk.const_get(type)
321
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
322
- end
323
- end
324
-
325
- # Returns the string representation of the object
326
- # @return [String] String presentation of the object
327
- def to_s
328
- to_hash.to_s
329
- end
330
-
331
- # to_body is an alias to to_hash (backward compatibility)
332
- # @return [Hash] Returns the object in the form of hash
333
- def to_body
334
- to_hash
335
- end
336
-
337
- # Returns the object in the form of hash
338
- # @return [Hash] Returns the object in the form of hash
339
- def to_hash
340
- hash = {}
341
- self.class.attribute_map.each_pair do |attr, param|
342
- value = self.send(attr)
343
- if value.nil?
344
- is_nullable = self.class.openapi_nullable.include?(attr)
345
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
346
- end
347
-
348
- hash[param] = _to_hash(value)
349
- end
350
- hash
351
- end
352
-
353
- # Outputs non-array value in the form of hash
354
- # For object, use to_hash. Otherwise, just return the value
355
- # @param [Object] value Any valid value
356
- # @return [Hash] Returns the value in the form of hash
357
- def _to_hash(value)
358
- if value.is_a?(Array)
359
- value.compact.map { |v| _to_hash(v) }
360
- elsif value.is_a?(Hash)
361
- {}.tap do |hash|
362
- value.each { |k, v| hash[k] = _to_hash(v) }
363
- end
364
- elsif value.respond_to? :to_hash
365
- value.to_hash
366
- else
367
- value
368
- end
369
- end
370
-
371
- end
372
-
373
- end
@@ -1,239 +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 ServicePayersInnerExchangeRateInner
17
- # Using [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) format.
18
- attr_accessor :currency_symbol
19
-
20
- # Estimated rate
21
- attr_accessor :exchange_rate
22
-
23
- # Attribute mapping from ruby-style variable name to JSON key.
24
- def self.attribute_map
25
- {
26
- :'currency_symbol' => :'currency_symbol',
27
- :'exchange_rate' => :'exchange_rate'
28
- }
29
- end
30
-
31
- # Returns all the JSON keys this model knows about
32
- def self.acceptable_attributes
33
- attribute_map.values
34
- end
35
-
36
- # Attribute type mapping.
37
- def self.openapi_types
38
- {
39
- :'currency_symbol' => :'String',
40
- :'exchange_rate' => :'Float'
41
- }
42
- end
43
-
44
- # List of attributes with nullable: true
45
- def self.openapi_nullable
46
- Set.new([
47
- ])
48
- end
49
-
50
- # Initializes the object
51
- # @param [Hash] attributes Model attributes in the form of hash
52
- def initialize(attributes = {})
53
- if (!attributes.is_a?(Hash))
54
- fail ArgumentError, "The input argument (attributes) must be a hash in `MassPayRubySdk::ServicePayersInnerExchangeRateInner` initialize method"
55
- end
56
-
57
- # check to see if the attribute exists and convert string to symbol for hash key
58
- attributes = attributes.each_with_object({}) { |(k, v), h|
59
- if (!self.class.attribute_map.key?(k.to_sym))
60
- fail ArgumentError, "`#{k}` is not a valid attribute in `MassPayRubySdk::ServicePayersInnerExchangeRateInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
61
- end
62
- h[k.to_sym] = v
63
- }
64
-
65
- if attributes.key?(:'currency_symbol')
66
- self.currency_symbol = attributes[:'currency_symbol']
67
- end
68
-
69
- if attributes.key?(:'exchange_rate')
70
- self.exchange_rate = attributes[:'exchange_rate']
71
- end
72
- end
73
-
74
- # Show invalid properties with the reasons. Usually used together with valid?
75
- # @return Array for valid properties with the reasons
76
- def list_invalid_properties
77
- invalid_properties = Array.new
78
- if @currency_symbol.nil?
79
- invalid_properties.push('invalid value for "currency_symbol", currency_symbol cannot be nil.')
80
- end
81
-
82
- if @exchange_rate.nil?
83
- invalid_properties.push('invalid value for "exchange_rate", exchange_rate cannot be nil.')
84
- end
85
-
86
- invalid_properties
87
- end
88
-
89
- # Check to see if the all the properties in the model are valid
90
- # @return true if the model is valid
91
- def valid?
92
- return false if @currency_symbol.nil?
93
- return false if @exchange_rate.nil?
94
- true
95
- end
96
-
97
- # Checks equality by comparing each attribute.
98
- # @param [Object] Object to be compared
99
- def ==(o)
100
- return true if self.equal?(o)
101
- self.class == o.class &&
102
- currency_symbol == o.currency_symbol &&
103
- exchange_rate == o.exchange_rate
104
- end
105
-
106
- # @see the `==` method
107
- # @param [Object] Object to be compared
108
- def eql?(o)
109
- self == o
110
- end
111
-
112
- # Calculates hash code according to all attributes.
113
- # @return [Integer] Hash code
114
- def hash
115
- [currency_symbol, exchange_rate].hash
116
- end
117
-
118
- # Builds the object from hash
119
- # @param [Hash] attributes Model attributes in the form of hash
120
- # @return [Object] Returns the model itself
121
- def self.build_from_hash(attributes)
122
- new.build_from_hash(attributes)
123
- end
124
-
125
- # Builds the object from hash
126
- # @param [Hash] attributes Model attributes in the form of hash
127
- # @return [Object] Returns the model itself
128
- def build_from_hash(attributes)
129
- return nil unless attributes.is_a?(Hash)
130
- attributes = attributes.transform_keys(&:to_sym)
131
- self.class.openapi_types.each_pair do |key, type|
132
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
133
- self.send("#{key}=", nil)
134
- elsif type =~ /\AArray<(.*)>/i
135
- # check to ensure the input is an array given that the attribute
136
- # is documented as an array but the input is not
137
- if attributes[self.class.attribute_map[key]].is_a?(Array)
138
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
139
- end
140
- elsif !attributes[self.class.attribute_map[key]].nil?
141
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
142
- end
143
- end
144
-
145
- self
146
- end
147
-
148
- # Deserializes the data based on type
149
- # @param string type Data type
150
- # @param string value Value to be deserialized
151
- # @return [Object] Deserialized data
152
- def _deserialize(type, value)
153
- case type.to_sym
154
- when :Time
155
- Time.parse(value)
156
- when :Date
157
- Date.parse(value)
158
- when :String
159
- value.to_s
160
- when :Integer
161
- value.to_i
162
- when :Float
163
- value.to_f
164
- when :Boolean
165
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
166
- true
167
- else
168
- false
169
- end
170
- when :Object
171
- # generic object (usually a Hash), return directly
172
- value
173
- when /\AArray<(?<inner_type>.+)>\z/
174
- inner_type = Regexp.last_match[:inner_type]
175
- value.map { |v| _deserialize(inner_type, v) }
176
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
177
- k_type = Regexp.last_match[:k_type]
178
- v_type = Regexp.last_match[:v_type]
179
- {}.tap do |hash|
180
- value.each do |k, v|
181
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
182
- end
183
- end
184
- else # model
185
- # models (e.g. Pet) or oneOf
186
- klass = MassPayRubySdk.const_get(type)
187
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
188
- end
189
- end
190
-
191
- # Returns the string representation of the object
192
- # @return [String] String presentation of the object
193
- def to_s
194
- to_hash.to_s
195
- end
196
-
197
- # to_body is an alias to to_hash (backward compatibility)
198
- # @return [Hash] Returns the object in the form of hash
199
- def to_body
200
- to_hash
201
- end
202
-
203
- # Returns the object in the form of hash
204
- # @return [Hash] Returns the object in the form of hash
205
- def to_hash
206
- hash = {}
207
- self.class.attribute_map.each_pair do |attr, param|
208
- value = self.send(attr)
209
- if value.nil?
210
- is_nullable = self.class.openapi_nullable.include?(attr)
211
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
212
- end
213
-
214
- hash[param] = _to_hash(value)
215
- end
216
- hash
217
- end
218
-
219
- # Outputs non-array value in the form of hash
220
- # For object, use to_hash. Otherwise, just return the value
221
- # @param [Object] value Any valid value
222
- # @return [Hash] Returns the value in the form of hash
223
- def _to_hash(value)
224
- if value.is_a?(Array)
225
- value.compact.map { |v| _to_hash(v) }
226
- elsif value.is_a?(Hash)
227
- {}.tap do |hash|
228
- value.each { |k, v| hash[k] = _to_hash(v) }
229
- end
230
- elsif value.respond_to? :to_hash
231
- value.to_hash
232
- else
233
- value
234
- end
235
- end
236
-
237
- end
238
-
239
- end