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,375 +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 WalletTxnResp
17
- # Token representing the user
18
- attr_accessor :user_token
19
-
20
- # Token representing the wallet
21
- attr_accessor :token
22
-
23
- # The wallet's current balance in USD
24
- attr_accessor :balance
25
-
26
- # The currency wallet balance is stored in. Using [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) format. In most cases this value will be USD
27
- attr_accessor :currency_code
28
-
29
- # Type of wallet
30
- attr_accessor :type
31
-
32
- # In case type of wallet is MASSPAY_CARD, card_type would be provided with the type of card it is
33
- attr_accessor :card_type
34
-
35
- # In case type of wallet is MASSPAY_CARD, last_4 would be provided with the last four digits of the card
36
- attr_accessor :last_4
37
-
38
- # An indicator whether the wallet is active. If inactive, can still retrieve historical transactions history
39
- attr_accessor :active
40
-
41
- # An indicator whether the fees for payouts using this wallet are paid by the client. If false, the user pays the fees
42
- attr_accessor :client_paying_fees
43
-
44
- class EnumAttributeValidator
45
- attr_reader :datatype
46
- attr_reader :allowable_values
47
-
48
- def initialize(datatype, allowable_values)
49
- @allowable_values = allowable_values.map do |value|
50
- case datatype.to_s
51
- when /Integer/i
52
- value.to_i
53
- when /Float/i
54
- value.to_f
55
- else
56
- value
57
- end
58
- end
59
- end
60
-
61
- def valid?(value)
62
- !value || allowable_values.include?(value)
63
- end
64
- end
65
-
66
- # Attribute mapping from ruby-style variable name to JSON key.
67
- def self.attribute_map
68
- {
69
- :'user_token' => :'user_token',
70
- :'token' => :'token',
71
- :'balance' => :'balance',
72
- :'currency_code' => :'currency_code',
73
- :'type' => :'type',
74
- :'card_type' => :'card_type',
75
- :'last_4' => :'last_4',
76
- :'active' => :'active',
77
- :'client_paying_fees' => :'client_paying_fees'
78
- }
79
- end
80
-
81
- # Returns all the JSON keys this model knows about
82
- def self.acceptable_attributes
83
- attribute_map.values
84
- end
85
-
86
- # Attribute type mapping.
87
- def self.openapi_types
88
- {
89
- :'user_token' => :'String',
90
- :'token' => :'String',
91
- :'balance' => :'Float',
92
- :'currency_code' => :'String',
93
- :'type' => :'String',
94
- :'card_type' => :'String',
95
- :'last_4' => :'String',
96
- :'active' => :'Boolean',
97
- :'client_paying_fees' => :'Boolean'
98
- }
99
- end
100
-
101
- # List of attributes with nullable: true
102
- def self.openapi_nullable
103
- Set.new([
104
- ])
105
- end
106
-
107
- # Initializes the object
108
- # @param [Hash] attributes Model attributes in the form of hash
109
- def initialize(attributes = {})
110
- if (!attributes.is_a?(Hash))
111
- fail ArgumentError, "The input argument (attributes) must be a hash in `MassPayRubySdk::WalletTxnResp` initialize method"
112
- end
113
-
114
- # check to see if the attribute exists and convert string to symbol for hash key
115
- attributes = attributes.each_with_object({}) { |(k, v), h|
116
- if (!self.class.attribute_map.key?(k.to_sym))
117
- fail ArgumentError, "`#{k}` is not a valid attribute in `MassPayRubySdk::WalletTxnResp`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
118
- end
119
- h[k.to_sym] = v
120
- }
121
-
122
- if attributes.key?(:'user_token')
123
- self.user_token = attributes[:'user_token']
124
- end
125
-
126
- if attributes.key?(:'token')
127
- self.token = attributes[:'token']
128
- end
129
-
130
- if attributes.key?(:'balance')
131
- self.balance = attributes[:'balance']
132
- end
133
-
134
- if attributes.key?(:'currency_code')
135
- self.currency_code = attributes[:'currency_code']
136
- end
137
-
138
- if attributes.key?(:'type')
139
- self.type = attributes[:'type']
140
- end
141
-
142
- if attributes.key?(:'card_type')
143
- self.card_type = attributes[:'card_type']
144
- end
145
-
146
- if attributes.key?(:'last_4')
147
- self.last_4 = attributes[:'last_4']
148
- end
149
-
150
- if attributes.key?(:'active')
151
- self.active = attributes[:'active']
152
- end
153
-
154
- if attributes.key?(:'client_paying_fees')
155
- self.client_paying_fees = attributes[:'client_paying_fees']
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 @user_token.nil?
164
- invalid_properties.push('invalid value for "user_token", user_token cannot be nil.')
165
- end
166
-
167
- if @token.nil?
168
- invalid_properties.push('invalid value for "token", token cannot be nil.')
169
- end
170
-
171
- if @balance.nil?
172
- invalid_properties.push('invalid value for "balance", balance cannot be nil.')
173
- end
174
-
175
- if @currency_code.nil?
176
- invalid_properties.push('invalid value for "currency_code", currency_code cannot be nil.')
177
- end
178
-
179
- if @type.nil?
180
- invalid_properties.push('invalid value for "type", type cannot be nil.')
181
- end
182
-
183
- if @active.nil?
184
- invalid_properties.push('invalid value for "active", active cannot be nil.')
185
- end
186
-
187
- invalid_properties
188
- end
189
-
190
- # Check to see if the all the properties in the model are valid
191
- # @return true if the model is valid
192
- def valid?
193
- return false if @user_token.nil?
194
- return false if @token.nil?
195
- return false if @balance.nil?
196
- return false if @currency_code.nil?
197
- return false if @type.nil?
198
- type_validator = EnumAttributeValidator.new('String', ["MASSPAY_CARD", "USER_FUNDS"])
199
- return false unless type_validator.valid?(@type)
200
- card_type_validator = EnumAttributeValidator.new('String', ["MASTERCARD", "VISA", "AMEX", "DISCOVER", "UNIONPAY"])
201
- return false unless card_type_validator.valid?(@card_type)
202
- return false if @active.nil?
203
- true
204
- end
205
-
206
- # Custom attribute writer method checking allowed values (enum).
207
- # @param [Object] type Object to be assigned
208
- def type=(type)
209
- validator = EnumAttributeValidator.new('String', ["MASSPAY_CARD", "USER_FUNDS"])
210
- unless validator.valid?(type)
211
- fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
212
- end
213
- @type = type
214
- end
215
-
216
- # Custom attribute writer method checking allowed values (enum).
217
- # @param [Object] card_type Object to be assigned
218
- def card_type=(card_type)
219
- validator = EnumAttributeValidator.new('String', ["MASTERCARD", "VISA", "AMEX", "DISCOVER", "UNIONPAY"])
220
- unless validator.valid?(card_type)
221
- fail ArgumentError, "invalid value for \"card_type\", must be one of #{validator.allowable_values}."
222
- end
223
- @card_type = card_type
224
- end
225
-
226
- # Checks equality by comparing each attribute.
227
- # @param [Object] Object to be compared
228
- def ==(o)
229
- return true if self.equal?(o)
230
- self.class == o.class &&
231
- user_token == o.user_token &&
232
- token == o.token &&
233
- balance == o.balance &&
234
- currency_code == o.currency_code &&
235
- type == o.type &&
236
- card_type == o.card_type &&
237
- last_4 == o.last_4 &&
238
- active == o.active &&
239
- client_paying_fees == o.client_paying_fees
240
- end
241
-
242
- # @see the `==` method
243
- # @param [Object] Object to be compared
244
- def eql?(o)
245
- self == o
246
- end
247
-
248
- # Calculates hash code according to all attributes.
249
- # @return [Integer] Hash code
250
- def hash
251
- [user_token, token, balance, currency_code, type, card_type, last_4, active, client_paying_fees].hash
252
- end
253
-
254
- # Builds the object from hash
255
- # @param [Hash] attributes Model attributes in the form of hash
256
- # @return [Object] Returns the model itself
257
- def self.build_from_hash(attributes)
258
- new.build_from_hash(attributes)
259
- end
260
-
261
- # Builds the object from hash
262
- # @param [Hash] attributes Model attributes in the form of hash
263
- # @return [Object] Returns the model itself
264
- def build_from_hash(attributes)
265
- return nil unless attributes.is_a?(Hash)
266
- attributes = attributes.transform_keys(&:to_sym)
267
- self.class.openapi_types.each_pair do |key, type|
268
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
269
- self.send("#{key}=", nil)
270
- elsif type =~ /\AArray<(.*)>/i
271
- # check to ensure the input is an array given that the attribute
272
- # is documented as an array but the input is not
273
- if attributes[self.class.attribute_map[key]].is_a?(Array)
274
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
275
- end
276
- elsif !attributes[self.class.attribute_map[key]].nil?
277
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
278
- end
279
- end
280
-
281
- self
282
- end
283
-
284
- # Deserializes the data based on type
285
- # @param string type Data type
286
- # @param string value Value to be deserialized
287
- # @return [Object] Deserialized data
288
- def _deserialize(type, value)
289
- case type.to_sym
290
- when :Time
291
- Time.parse(value)
292
- when :Date
293
- Date.parse(value)
294
- when :String
295
- value.to_s
296
- when :Integer
297
- value.to_i
298
- when :Float
299
- value.to_f
300
- when :Boolean
301
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
302
- true
303
- else
304
- false
305
- end
306
- when :Object
307
- # generic object (usually a Hash), return directly
308
- value
309
- when /\AArray<(?<inner_type>.+)>\z/
310
- inner_type = Regexp.last_match[:inner_type]
311
- value.map { |v| _deserialize(inner_type, v) }
312
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
313
- k_type = Regexp.last_match[:k_type]
314
- v_type = Regexp.last_match[:v_type]
315
- {}.tap do |hash|
316
- value.each do |k, v|
317
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
318
- end
319
- end
320
- else # model
321
- # models (e.g. Pet) or oneOf
322
- klass = MassPayRubySdk.const_get(type)
323
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
324
- end
325
- end
326
-
327
- # Returns the string representation of the object
328
- # @return [String] String presentation of the object
329
- def to_s
330
- to_hash.to_s
331
- end
332
-
333
- # to_body is an alias to to_hash (backward compatibility)
334
- # @return [Hash] Returns the object in the form of hash
335
- def to_body
336
- to_hash
337
- end
338
-
339
- # Returns the object in the form of hash
340
- # @return [Hash] Returns the object in the form of hash
341
- def to_hash
342
- hash = {}
343
- self.class.attribute_map.each_pair do |attr, param|
344
- value = self.send(attr)
345
- if value.nil?
346
- is_nullable = self.class.openapi_nullable.include?(attr)
347
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
348
- end
349
-
350
- hash[param] = _to_hash(value)
351
- end
352
- hash
353
- end
354
-
355
- # Outputs non-array value in the form of hash
356
- # For object, use to_hash. Otherwise, just return the value
357
- # @param [Object] value Any valid value
358
- # @return [Hash] Returns the value in the form of hash
359
- def _to_hash(value)
360
- if value.is_a?(Array)
361
- value.compact.map { |v| _to_hash(v) }
362
- elsif value.is_a?(Hash)
363
- {}.tap do |hash|
364
- value.each { |k, v| hash[k] = _to_hash(v) }
365
- end
366
- elsif value.respond_to? :to_hash
367
- value.to_hash
368
- else
369
- value
370
- end
371
- end
372
-
373
- end
374
-
375
- end
@@ -1,227 +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 'spec_helper'
13
-
14
- describe MassPayRubySdk::ApiClient do
15
- context 'initialization' do
16
- context 'URL stuff' do
17
- context 'host' do
18
- it 'removes http from host' do
19
- MassPayRubySdk.configure { |c| c.host = 'http://example.com' }
20
- expect(MassPayRubySdk::Configuration.default.host).to eq('example.com')
21
- end
22
-
23
- it 'removes https from host' do
24
- MassPayRubySdk.configure { |c| c.host = 'https://wookiee.com' }
25
- expect(MassPayRubySdk::ApiClient.default.config.host).to eq('wookiee.com')
26
- end
27
-
28
- it 'removes trailing path from host' do
29
- MassPayRubySdk.configure { |c| c.host = 'hobo.com/v4' }
30
- expect(MassPayRubySdk::Configuration.default.host).to eq('hobo.com')
31
- end
32
- end
33
-
34
- context 'base_path' do
35
- it "prepends a slash to base_path" do
36
- MassPayRubySdk.configure { |c| c.base_path = 'v4/dog' }
37
- expect(MassPayRubySdk::Configuration.default.base_path).to eq('/v4/dog')
38
- end
39
-
40
- it "doesn't prepend a slash if one is already there" do
41
- MassPayRubySdk.configure { |c| c.base_path = '/v4/dog' }
42
- expect(MassPayRubySdk::Configuration.default.base_path).to eq('/v4/dog')
43
- end
44
-
45
- it "ends up as a blank string if nil" do
46
- MassPayRubySdk.configure { |c| c.base_path = nil }
47
- expect(MassPayRubySdk::Configuration.default.base_path).to eq('')
48
- end
49
- end
50
- end
51
- end
52
-
53
- describe 'params_encoding in #build_request' do
54
- let(:config) { MassPayRubySdk::Configuration.new }
55
- let(:api_client) { MassPayRubySdk::ApiClient.new(config) }
56
-
57
- it 'defaults to nil' do
58
- expect(MassPayRubySdk::Configuration.default.params_encoding).to eq(nil)
59
- expect(config.params_encoding).to eq(nil)
60
-
61
- request = api_client.build_request(:get, '/test')
62
- expect(request.options[:params_encoding]).to eq(nil)
63
- end
64
-
65
- it 'can be customized' do
66
- config.params_encoding = :multi
67
- request = api_client.build_request(:get, '/test')
68
- expect(request.options[:params_encoding]).to eq(:multi)
69
- end
70
- end
71
-
72
- describe 'timeout in #build_request' do
73
- let(:config) { MassPayRubySdk::Configuration.new }
74
- let(:api_client) { MassPayRubySdk::ApiClient.new(config) }
75
-
76
- it 'defaults to 0' do
77
- expect(MassPayRubySdk::Configuration.default.timeout).to eq(0)
78
- expect(config.timeout).to eq(0)
79
-
80
- request = api_client.build_request(:get, '/test')
81
- expect(request.options[:timeout]).to eq(0)
82
- end
83
-
84
- it 'can be customized' do
85
- config.timeout = 100
86
- request = api_client.build_request(:get, '/test')
87
- expect(request.options[:timeout]).to eq(100)
88
- end
89
- end
90
-
91
-
92
-
93
- describe '#deserialize' do
94
- it "handles Array<Integer>" do
95
- api_client = MassPayRubySdk::ApiClient.new
96
- headers = { 'Content-Type' => 'application/json' }
97
- response = double('response', headers: headers, body: '[12, 34]')
98
- data = api_client.deserialize(response, 'Array<Integer>')
99
- expect(data).to be_instance_of(Array)
100
- expect(data).to eq([12, 34])
101
- end
102
-
103
- it 'handles Array<Array<Integer>>' do
104
- api_client = MassPayRubySdk::ApiClient.new
105
- headers = { 'Content-Type' => 'application/json' }
106
- response = double('response', headers: headers, body: '[[12, 34], [56]]')
107
- data = api_client.deserialize(response, 'Array<Array<Integer>>')
108
- expect(data).to be_instance_of(Array)
109
- expect(data).to eq([[12, 34], [56]])
110
- end
111
-
112
- it 'handles Hash<String, String>' do
113
- api_client = MassPayRubySdk::ApiClient.new
114
- headers = { 'Content-Type' => 'application/json' }
115
- response = double('response', headers: headers, body: '{"message": "Hello"}')
116
- data = api_client.deserialize(response, 'Hash<String, String>')
117
- expect(data).to be_instance_of(Hash)
118
- expect(data).to eq(:message => 'Hello')
119
- end
120
- end
121
-
122
- describe "#object_to_hash" do
123
- it 'ignores nils and includes empty arrays' do
124
- # uncomment below to test object_to_hash for model
125
- # api_client = MassPayRubySdk::ApiClient.new
126
- # _model = MassPayRubySdk::ModelName.new
127
- # update the model attribute below
128
- # _model.id = 1
129
- # update the expected value (hash) below
130
- # expected = {id: 1, name: '', tags: []}
131
- # expect(api_client.object_to_hash(_model)).to eq(expected)
132
- end
133
- end
134
-
135
- describe '#build_collection_param' do
136
- let(:param) { ['aa', 'bb', 'cc'] }
137
- let(:api_client) { MassPayRubySdk::ApiClient.new }
138
-
139
- it 'works for csv' do
140
- expect(api_client.build_collection_param(param, :csv)).to eq('aa,bb,cc')
141
- end
142
-
143
- it 'works for ssv' do
144
- expect(api_client.build_collection_param(param, :ssv)).to eq('aa bb cc')
145
- end
146
-
147
- it 'works for tsv' do
148
- expect(api_client.build_collection_param(param, :tsv)).to eq("aa\tbb\tcc")
149
- end
150
-
151
- it 'works for pipes' do
152
- expect(api_client.build_collection_param(param, :pipes)).to eq('aa|bb|cc')
153
- end
154
-
155
- it 'works for multi' do
156
- expect(api_client.build_collection_param(param, :multi)).to eq(['aa', 'bb', 'cc'])
157
- end
158
-
159
- it 'fails for invalid collection format' do
160
- expect { api_client.build_collection_param(param, :INVALID) }.to raise_error(RuntimeError, 'unknown collection format: :INVALID')
161
- end
162
- end
163
-
164
- describe '#json_mime?' do
165
- let(:api_client) { MassPayRubySdk::ApiClient.new }
166
-
167
- it 'works' do
168
- expect(api_client.json_mime?(nil)).to eq false
169
- expect(api_client.json_mime?('')).to eq false
170
-
171
- expect(api_client.json_mime?('application/json')).to eq true
172
- expect(api_client.json_mime?('application/json; charset=UTF8')).to eq true
173
- expect(api_client.json_mime?('APPLICATION/JSON')).to eq true
174
-
175
- expect(api_client.json_mime?('application/xml')).to eq false
176
- expect(api_client.json_mime?('text/plain')).to eq false
177
- expect(api_client.json_mime?('application/jsonp')).to eq false
178
- end
179
- end
180
-
181
- describe '#select_header_accept' do
182
- let(:api_client) { MassPayRubySdk::ApiClient.new }
183
-
184
- it 'works' do
185
- expect(api_client.select_header_accept(nil)).to be_nil
186
- expect(api_client.select_header_accept([])).to be_nil
187
-
188
- expect(api_client.select_header_accept(['application/json'])).to eq('application/json')
189
- expect(api_client.select_header_accept(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
190
- expect(api_client.select_header_accept(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
191
-
192
- expect(api_client.select_header_accept(['application/xml'])).to eq('application/xml')
193
- expect(api_client.select_header_accept(['text/html', 'application/xml'])).to eq('text/html,application/xml')
194
- end
195
- end
196
-
197
- describe '#select_header_content_type' do
198
- let(:api_client) { MassPayRubySdk::ApiClient.new }
199
-
200
- it 'works' do
201
- expect(api_client.select_header_content_type(nil)).to be_nil
202
- expect(api_client.select_header_content_type([])).to be_nil
203
-
204
- expect(api_client.select_header_content_type(['application/json'])).to eq('application/json')
205
- expect(api_client.select_header_content_type(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
206
- expect(api_client.select_header_content_type(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
207
- expect(api_client.select_header_content_type(['application/xml'])).to eq('application/xml')
208
- expect(api_client.select_header_content_type(['text/plain', 'application/xml'])).to eq('text/plain')
209
- end
210
- end
211
-
212
- describe '#sanitize_filename' do
213
- let(:api_client) { MassPayRubySdk::ApiClient.new }
214
-
215
- it 'works' do
216
- expect(api_client.sanitize_filename('sun')).to eq('sun')
217
- expect(api_client.sanitize_filename('sun.gif')).to eq('sun.gif')
218
- expect(api_client.sanitize_filename('../sun.gif')).to eq('sun.gif')
219
- expect(api_client.sanitize_filename('/var/tmp/sun.gif')).to eq('sun.gif')
220
- expect(api_client.sanitize_filename('./sun.gif')).to eq('sun.gif')
221
- expect(api_client.sanitize_filename('..\sun.gif')).to eq('sun.gif')
222
- expect(api_client.sanitize_filename('\var\tmp\sun.gif')).to eq('sun.gif')
223
- expect(api_client.sanitize_filename('c:\var\tmp\sun.gif')).to eq('sun.gif')
224
- expect(api_client.sanitize_filename('.\sun.gif')).to eq('sun.gif')
225
- end
226
- end
227
- end
@@ -1,41 +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 'spec_helper'
13
-
14
- describe MassPayRubySdk::Configuration do
15
- let(:config) { MassPayRubySdk::Configuration.default }
16
-
17
- before(:each) do
18
- # uncomment below to setup host and base_path
19
- # require 'URI'
20
- # uri = URI.parse("https://api.masspay.io/v0.1.4")
21
- # MassPayRubySdk.configure do |c|
22
- # c.host = uri.host
23
- # c.base_path = uri.path
24
- # end
25
- end
26
-
27
- describe '#base_url' do
28
- it 'should have the default value' do
29
- # uncomment below to test default value of the base path
30
- # expect(config.base_url).to eq("https://api.masspay.io/v0.1.4")
31
- end
32
-
33
- it 'should remove trailing slashes' do
34
- [nil, '', '/', '//'].each do |base_path|
35
- config.base_path = base_path
36
- # uncomment below to test trailing slashes
37
- # expect(config.base_url).to eq("https://api.masspay.io/v0.1.4")
38
- end
39
- end
40
- end
41
- end