bleumi_pay_sdk_ruby 1.0.2 → 1.0.7

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 (150) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/README.md +67 -47
  4. data/bleumi_pay_sdk_ruby.gemspec +4 -5
  5. data/docs/AlgorandBalance.md +28 -0
  6. data/docs/AlgorandWalletAddress.md +24 -0
  7. data/docs/AlgorandWalletInputs.md +23 -0
  8. data/docs/BadRequest.md +2 -1
  9. data/docs/Chain.md +14 -0
  10. data/docs/CheckoutToken.md +28 -0
  11. data/docs/CreateCheckoutUrlRequest.md +28 -0
  12. data/docs/CreateCheckoutUrlResponse.md +17 -0
  13. data/docs/CreatePaymentRequest.md +19 -0
  14. data/docs/CreatePaymentResponse.md +15 -0
  15. data/docs/CreatePayoutRequest.md +28 -0
  16. data/docs/CreatePayoutResponse.md +15 -0
  17. data/docs/EthereumBalance.md +30 -0
  18. data/docs/EthereumWalletAddress.md +23 -0
  19. data/docs/EthereumWalletInputs.md +23 -0
  20. data/docs/HostedCheckoutsApi.md +197 -0
  21. data/docs/PaginatedPaymentOperations.md +28 -0
  22. data/docs/PaginatedPayments.md +95 -0
  23. data/docs/PaginatedPayoutItems.md +59 -0
  24. data/docs/Payment.md +67 -0
  25. data/docs/PaymentAddresses.md +21 -0
  26. data/docs/PaymentBalances.md +21 -0
  27. data/docs/PaymentOperation.md +46 -0
  28. data/docs/PaymentOperationInputs.md +31 -0
  29. data/docs/PaymentOperationResponse.md +15 -0
  30. data/docs/PaymentRefundRequest.md +14 -0
  31. data/docs/PaymentSettleRequest.md +17 -0
  32. data/docs/PaymentsApi.md +368 -0
  33. data/docs/Payout.md +18 -0
  34. data/docs/PayoutItem.md +39 -0
  35. data/docs/PayoutItemInputs.md +28 -0
  36. data/docs/PayoutsApi.md +137 -0
  37. data/docs/RskBalance.md +28 -0
  38. data/docs/ValidateCheckoutRequest.md +21 -0
  39. data/docs/ValidateCheckoutResponse.md +15 -0
  40. data/docs/WalletBalance.md +18 -4
  41. data/hc_create.rb +40 -0
  42. data/hc_list.rb +17 -0
  43. data/hc_validate.rb +22 -0
  44. data/lib/bleumi_pay_sdk_ruby.rb +38 -17
  45. data/lib/bleumi_pay_sdk_ruby/api/hosted_checkouts_api.rb +212 -0
  46. data/lib/bleumi_pay_sdk_ruby/api/payments_api.rb +517 -0
  47. data/lib/bleumi_pay_sdk_ruby/api/payouts_api.rb +157 -0
  48. data/lib/bleumi_pay_sdk_ruby/api/request_validator.rb +288 -0
  49. data/lib/bleumi_pay_sdk_ruby/api_client.rb +11 -9
  50. data/lib/bleumi_pay_sdk_ruby/api_error.rb +3 -3
  51. data/lib/bleumi_pay_sdk_ruby/configuration.rb +4 -4
  52. data/lib/bleumi_pay_sdk_ruby/models/algorand_balance.rb +219 -0
  53. data/lib/bleumi_pay_sdk_ruby/models/algorand_wallet_address.rb +221 -0
  54. data/lib/bleumi_pay_sdk_ruby/models/algorand_wallet_inputs.rb +247 -0
  55. data/lib/bleumi_pay_sdk_ruby/models/bad_request.rb +15 -5
  56. data/lib/bleumi_pay_sdk_ruby/models/{eth_network.rb → chain.rb} +12 -9
  57. data/lib/bleumi_pay_sdk_ruby/models/checkout_token.rb +302 -0
  58. data/lib/bleumi_pay_sdk_ruby/models/create_checkout_url_request.rb +312 -0
  59. data/lib/bleumi_pay_sdk_ruby/models/create_checkout_url_response.rb +227 -0
  60. data/lib/bleumi_pay_sdk_ruby/models/{wallet_create_input.rb → create_payment_request.rb} +33 -11
  61. data/lib/bleumi_pay_sdk_ruby/models/{wallet_create_output.rb → create_payment_response.rb} +19 -23
  62. data/lib/bleumi_pay_sdk_ruby/models/create_payout_request.rb +244 -0
  63. data/lib/bleumi_pay_sdk_ruby/models/create_payout_response.rb +212 -0
  64. data/lib/bleumi_pay_sdk_ruby/models/ethereum_balance.rb +241 -0
  65. data/lib/bleumi_pay_sdk_ruby/models/ethereum_wallet_address.rb +221 -0
  66. data/lib/bleumi_pay_sdk_ruby/models/{wallet_inputs.rb → ethereum_wallet_inputs.rb} +35 -50
  67. data/lib/bleumi_pay_sdk_ruby/models/paginated_payment_operations.rb +224 -0
  68. data/lib/bleumi_pay_sdk_ruby/models/{paginated_wallet_operations.rb → paginated_payments.rb} +19 -9
  69. data/lib/bleumi_pay_sdk_ruby/models/{paginated_wallets.rb → paginated_payout_items.rb} +19 -9
  70. data/lib/bleumi_pay_sdk_ruby/models/{wallet.rb → payment.rb} +31 -54
  71. data/lib/bleumi_pay_sdk_ruby/models/payment_addresses.rb +231 -0
  72. data/lib/bleumi_pay_sdk_ruby/models/payment_balances.rb +225 -0
  73. data/lib/bleumi_pay_sdk_ruby/models/{wallet_operation.rb → payment_operation.rb} +44 -18
  74. data/lib/bleumi_pay_sdk_ruby/models/{wallet_operation_inputs.rb → payment_operation_inputs.rb} +38 -12
  75. data/lib/bleumi_pay_sdk_ruby/models/{wallet_operation_output.rb → payment_operation_response.rb} +18 -8
  76. data/lib/bleumi_pay_sdk_ruby/models/{wallet_refund_operation_input.rb → payment_refund_request.rb} +18 -8
  77. data/lib/bleumi_pay_sdk_ruby/models/{wallet_settle_operation_input.rb → payment_settle_request.rb} +18 -8
  78. data/lib/bleumi_pay_sdk_ruby/models/payout.rb +237 -0
  79. data/lib/bleumi_pay_sdk_ruby/models/payout_item.rb +286 -0
  80. data/lib/bleumi_pay_sdk_ruby/models/payout_item_inputs.rb +244 -0
  81. data/lib/bleumi_pay_sdk_ruby/models/rsk_balance.rb +219 -0
  82. data/lib/bleumi_pay_sdk_ruby/models/validate_checkout_request.rb +257 -0
  83. data/lib/bleumi_pay_sdk_ruby/models/validate_checkout_response.rb +212 -0
  84. data/lib/bleumi_pay_sdk_ruby/models/wallet_balance.rb +37 -12
  85. data/lib/bleumi_pay_sdk_ruby/version.rb +4 -4
  86. data/po_create.rb +39 -0
  87. data/po_list.rb +23 -0
  88. data/py_create.rb +48 -0
  89. data/py_get.rb +18 -0
  90. data/py_getop.rb +19 -0
  91. data/py_list.rb +24 -0
  92. data/py_listops.rb +21 -0
  93. data/py_refund.rb +43 -0
  94. data/py_settle.rb +43 -0
  95. data/spec/api/hosted_checkouts_api_spec.rb +67 -0
  96. data/spec/api/payments_api_spec.rb +123 -0
  97. data/spec/api/payouts_api_spec.rb +61 -0
  98. data/spec/api_client_spec.rb +226 -0
  99. data/spec/configuration_spec.rb +42 -0
  100. data/spec/models/algorand_balance_spec.rb +47 -0
  101. data/spec/models/algorand_wallet_address_spec.rb +47 -0
  102. data/spec/models/algorand_wallet_inputs_spec.rb +65 -0
  103. data/spec/models/bad_request_spec.rb +47 -0
  104. data/spec/models/chain_spec.rb +35 -0
  105. data/spec/models/checkout_token_spec.rb +77 -0
  106. data/spec/models/create_checkout_url_request_spec.rb +89 -0
  107. data/spec/models/create_checkout_url_response_spec.rb +47 -0
  108. data/spec/models/create_payment_request_spec.rb +59 -0
  109. data/spec/models/create_payment_response_spec.rb +41 -0
  110. data/spec/models/create_payout_request_spec.rb +53 -0
  111. data/spec/models/create_payout_response_spec.rb +41 -0
  112. data/spec/models/ethereum_balance_spec.rb +59 -0
  113. data/spec/models/ethereum_wallet_address_spec.rb +47 -0
  114. data/spec/models/ethereum_wallet_inputs_spec.rb +65 -0
  115. data/spec/models/paginated_payment_operations_spec.rb +47 -0
  116. data/spec/models/paginated_payments_spec.rb +47 -0
  117. data/spec/models/paginated_payout_items_spec.rb +47 -0
  118. data/spec/models/payment_addresses_spec.rb +53 -0
  119. data/spec/models/payment_balances_spec.rb +53 -0
  120. data/spec/models/payment_operation_inputs_spec.rb +65 -0
  121. data/spec/models/payment_operation_response_spec.rb +41 -0
  122. data/spec/models/payment_operation_spec.rb +71 -0
  123. data/spec/models/payment_refund_request_spec.rb +41 -0
  124. data/spec/models/payment_settle_request_spec.rb +47 -0
  125. data/spec/models/payment_spec.rb +65 -0
  126. data/spec/models/payout_item_inputs_spec.rb +53 -0
  127. data/spec/models/payout_item_spec.rb +71 -0
  128. data/spec/models/payout_spec.rb +53 -0
  129. data/spec/models/rsk_balance_spec.rb +47 -0
  130. data/spec/models/validate_checkout_request_spec.rb +59 -0
  131. data/spec/models/validate_checkout_response_spec.rb +41 -0
  132. data/spec/models/wallet_balance_spec.rb +65 -0
  133. data/spec/spec_helper.rb +111 -0
  134. metadata +180 -49
  135. data/docs/Erc20PaymentsApi.md +0 -334
  136. data/docs/EthAddress.md +0 -8
  137. data/docs/EthNetwork.md +0 -9
  138. data/docs/PaginatedWalletOperations.md +0 -8
  139. data/docs/PaginatedWallets.md +0 -8
  140. data/docs/Wallet.md +0 -13
  141. data/docs/WalletCreateInput.md +0 -9
  142. data/docs/WalletCreateOutput.md +0 -10
  143. data/docs/WalletInputs.md +0 -11
  144. data/docs/WalletOperation.md +0 -11
  145. data/docs/WalletOperationInputs.md +0 -10
  146. data/docs/WalletOperationOutput.md +0 -8
  147. data/docs/WalletRefundOperationInput.md +0 -7
  148. data/docs/WalletSettleOperationInput.md +0 -8
  149. data/lib/bleumi_pay_sdk_ruby/api/erc20_payments_api.rb +0 -482
  150. data/lib/bleumi_pay_sdk_ruby/models/eth_address.rb +0 -208
@@ -1,20 +1,20 @@
1
1
  =begin
2
- #Bleumi Pay API
2
+ #Bleumi Pay REST API
3
3
 
4
- #A simple and powerful REST API to integrate ERC20 payments into your business or application
4
+ #A simple and powerful REST API to integrate ERC-20, Ethereum, xDai, Algorand payments and/or payouts into your business or application
5
5
 
6
6
  The version of the OpenAPI document: 1.0.0
7
7
  Contact: info@bleumi.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.2.0
9
+ OpenAPI Generator version: 4.2.2
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
14
 
15
15
  module BleumiPay
16
- class PaginatedWalletOperations
17
- # List of operations of the wallet in the current page
16
+ class PaginatedPayments
17
+ # List of payments in the current page
18
18
  attr_accessor :results
19
19
 
20
20
  # Cursor to fetch next page of results, empty if no more results
@@ -31,22 +31,28 @@ module BleumiPay
31
31
  # Attribute type mapping.
32
32
  def self.openapi_types
33
33
  {
34
- :'results' => :'Array<WalletOperation>',
34
+ :'results' => :'Array<Payment>',
35
35
  :'next_token' => :'String'
36
36
  }
37
37
  end
38
38
 
39
+ # List of attributes with nullable: true
40
+ def self.openapi_nullable
41
+ Set.new([
42
+ ])
43
+ end
44
+
39
45
  # Initializes the object
40
46
  # @param [Hash] attributes Model attributes in the form of hash
41
47
  def initialize(attributes = {})
42
48
  if (!attributes.is_a?(Hash))
43
- fail ArgumentError, "The input argument (attributes) must be a hash in `BleumiPay::PaginatedWalletOperations` initialize method"
49
+ fail ArgumentError, "The input argument (attributes) must be a hash in `BleumiPay::PaginatedPayments` initialize method"
44
50
  end
45
51
 
46
52
  # check to see if the attribute exists and convert string to symbol for hash key
47
53
  attributes = attributes.each_with_object({}) { |(k, v), h|
48
54
  if (!self.class.attribute_map.key?(k.to_sym))
49
- fail ArgumentError, "`#{k}` is not a valid attribute in `BleumiPay::PaginatedWalletOperations`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
55
+ fail ArgumentError, "`#{k}` is not a valid attribute in `BleumiPay::PaginatedPayments`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
50
56
  end
51
57
  h[k.to_sym] = v
52
58
  }
@@ -187,7 +193,11 @@ module BleumiPay
187
193
  hash = {}
188
194
  self.class.attribute_map.each_pair do |attr, param|
189
195
  value = self.send(attr)
190
- next if value.nil?
196
+ if value.nil?
197
+ is_nullable = self.class.openapi_nullable.include?(attr)
198
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
199
+ end
200
+
191
201
  hash[param] = _to_hash(value)
192
202
  end
193
203
  hash
@@ -1,20 +1,20 @@
1
1
  =begin
2
- #Bleumi Pay API
2
+ #Bleumi Pay REST API
3
3
 
4
- #A simple and powerful REST API to integrate ERC20 payments into your business or application
4
+ #A simple and powerful REST API to integrate ERC-20, Ethereum, xDai, Algorand payments and/or payouts into your business or application
5
5
 
6
6
  The version of the OpenAPI document: 1.0.0
7
7
  Contact: info@bleumi.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.2.0
9
+ OpenAPI Generator version: 4.2.2
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
14
 
15
15
  module BleumiPay
16
- class PaginatedWallets
17
- # List of wallets in the current page
16
+ class PaginatedPayoutItems
17
+ # List of payouts of the payment in the current page
18
18
  attr_accessor :results
19
19
 
20
20
  # Cursor to fetch next page of results, empty if no more results
@@ -31,22 +31,28 @@ module BleumiPay
31
31
  # Attribute type mapping.
32
32
  def self.openapi_types
33
33
  {
34
- :'results' => :'Array<Wallet>',
34
+ :'results' => :'Array<PayoutItem>',
35
35
  :'next_token' => :'String'
36
36
  }
37
37
  end
38
38
 
39
+ # List of attributes with nullable: true
40
+ def self.openapi_nullable
41
+ Set.new([
42
+ ])
43
+ end
44
+
39
45
  # Initializes the object
40
46
  # @param [Hash] attributes Model attributes in the form of hash
41
47
  def initialize(attributes = {})
42
48
  if (!attributes.is_a?(Hash))
43
- fail ArgumentError, "The input argument (attributes) must be a hash in `BleumiPay::PaginatedWallets` initialize method"
49
+ fail ArgumentError, "The input argument (attributes) must be a hash in `BleumiPay::PaginatedPayoutItems` initialize method"
44
50
  end
45
51
 
46
52
  # check to see if the attribute exists and convert string to symbol for hash key
47
53
  attributes = attributes.each_with_object({}) { |(k, v), h|
48
54
  if (!self.class.attribute_map.key?(k.to_sym))
49
- fail ArgumentError, "`#{k}` is not a valid attribute in `BleumiPay::PaginatedWallets`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
55
+ fail ArgumentError, "`#{k}` is not a valid attribute in `BleumiPay::PaginatedPayoutItems`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
50
56
  end
51
57
  h[k.to_sym] = v
52
58
  }
@@ -187,7 +193,11 @@ module BleumiPay
187
193
  hash = {}
188
194
  self.class.attribute_map.each_pair do |attr, param|
189
195
  value = self.send(attr)
190
- next if value.nil?
196
+ if value.nil?
197
+ is_nullable = self.class.openapi_nullable.include?(attr)
198
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
199
+ end
200
+
191
201
  hash[param] = _to_hash(value)
192
202
  end
193
203
  hash
@@ -1,34 +1,27 @@
1
1
  =begin
2
- #Bleumi Pay API
2
+ #Bleumi Pay REST API
3
3
 
4
- #A simple and powerful REST API to integrate ERC20 payments into your business or application
4
+ #A simple and powerful REST API to integrate ERC-20, Ethereum, xDai, Algorand payments and/or payouts into your business or application
5
5
 
6
6
  The version of the OpenAPI document: 1.0.0
7
7
  Contact: info@bleumi.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.2.0
9
+ OpenAPI Generator version: 4.2.2
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
14
 
15
15
  module BleumiPay
16
- class Wallet
17
- # Unique ID identifying the wallet; specified when it was created by your system
16
+ class Payment
17
+ # Unique ID identifying the payment; specified when it was created by your system
18
18
  attr_accessor :id
19
19
 
20
- # Ethereum network in which wallet is to be created. Please refer to the [network list](https://pay.bleumi.com/docs/#supported-ethereum-networks)
21
- attr_accessor :chain
20
+ attr_accessor :addresses
22
21
 
23
- # Wallet address
24
- attr_accessor :addr
25
-
26
- # The current token balance
27
22
  attr_accessor :balances
28
23
 
29
- attr_accessor :inputs
30
-
31
- # UNIX timestamp when the wallet was created
24
+ # UNIX timestamp when the payment was created
32
25
  attr_accessor :created_at
33
26
 
34
27
  # UNIX timestamp when the lastest operation was performed
@@ -38,10 +31,8 @@ module BleumiPay
38
31
  def self.attribute_map
39
32
  {
40
33
  :'id' => :'id',
41
- :'chain' => :'chain',
42
- :'addr' => :'addr',
34
+ :'addresses' => :'addresses',
43
35
  :'balances' => :'balances',
44
- :'inputs' => :'inputs',
45
36
  :'created_at' => :'createdAt',
46
37
  :'updated_at' => :'updatedAt'
47
38
  }
@@ -51,26 +42,30 @@ module BleumiPay
51
42
  def self.openapi_types
52
43
  {
53
44
  :'id' => :'String',
54
- :'chain' => :'String',
55
- :'addr' => :'String',
56
- :'balances' => :'Hash<String, WalletBalance>',
57
- :'inputs' => :'WalletInputs',
45
+ :'addresses' => :'PaymentAddresses',
46
+ :'balances' => :'PaymentBalances',
58
47
  :'created_at' => :'Integer',
59
48
  :'updated_at' => :'Integer'
60
49
  }
61
50
  end
62
51
 
52
+ # List of attributes with nullable: true
53
+ def self.openapi_nullable
54
+ Set.new([
55
+ ])
56
+ end
57
+
63
58
  # Initializes the object
64
59
  # @param [Hash] attributes Model attributes in the form of hash
65
60
  def initialize(attributes = {})
66
61
  if (!attributes.is_a?(Hash))
67
- fail ArgumentError, "The input argument (attributes) must be a hash in `BleumiPay::Wallet` initialize method"
62
+ fail ArgumentError, "The input argument (attributes) must be a hash in `BleumiPay::Payment` initialize method"
68
63
  end
69
64
 
70
65
  # check to see if the attribute exists and convert string to symbol for hash key
71
66
  attributes = attributes.each_with_object({}) { |(k, v), h|
72
67
  if (!self.class.attribute_map.key?(k.to_sym))
73
- fail ArgumentError, "`#{k}` is not a valid attribute in `BleumiPay::Wallet`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
68
+ fail ArgumentError, "`#{k}` is not a valid attribute in `BleumiPay::Payment`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
74
69
  end
75
70
  h[k.to_sym] = v
76
71
  }
@@ -79,22 +74,12 @@ module BleumiPay
79
74
  self.id = attributes[:'id']
80
75
  end
81
76
 
82
- if attributes.key?(:'chain')
83
- self.chain = attributes[:'chain']
84
- end
85
-
86
- if attributes.key?(:'addr')
87
- self.addr = attributes[:'addr']
77
+ if attributes.key?(:'addresses')
78
+ self.addresses = attributes[:'addresses']
88
79
  end
89
80
 
90
81
  if attributes.key?(:'balances')
91
- if (value = attributes[:'balances']).is_a?(Hash)
92
- self.balances = value
93
- end
94
- end
95
-
96
- if attributes.key?(:'inputs')
97
- self.inputs = attributes[:'inputs']
82
+ self.balances = attributes[:'balances']
98
83
  end
99
84
 
100
85
  if attributes.key?(:'created_at')
@@ -114,22 +99,14 @@ module BleumiPay
114
99
  invalid_properties.push('invalid value for "id", id cannot be nil.')
115
100
  end
116
101
 
117
- if @chain.nil?
118
- invalid_properties.push('invalid value for "chain", chain cannot be nil.')
119
- end
120
-
121
- if @addr.nil?
122
- invalid_properties.push('invalid value for "addr", addr cannot be nil.')
102
+ if @addresses.nil?
103
+ invalid_properties.push('invalid value for "addresses", addresses cannot be nil.')
123
104
  end
124
105
 
125
106
  if @balances.nil?
126
107
  invalid_properties.push('invalid value for "balances", balances cannot be nil.')
127
108
  end
128
109
 
129
- if @inputs.nil?
130
- invalid_properties.push('invalid value for "inputs", inputs cannot be nil.')
131
- end
132
-
133
110
  if @created_at.nil?
134
111
  invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
135
112
  end
@@ -145,10 +122,8 @@ module BleumiPay
145
122
  # @return true if the model is valid
146
123
  def valid?
147
124
  return false if @id.nil?
148
- return false if @chain.nil?
149
- return false if @addr.nil?
125
+ return false if @addresses.nil?
150
126
  return false if @balances.nil?
151
- return false if @inputs.nil?
152
127
  return false if @created_at.nil?
153
128
  return false if @updated_at.nil?
154
129
  true
@@ -160,10 +135,8 @@ module BleumiPay
160
135
  return true if self.equal?(o)
161
136
  self.class == o.class &&
162
137
  id == o.id &&
163
- chain == o.chain &&
164
- addr == o.addr &&
138
+ addresses == o.addresses &&
165
139
  balances == o.balances &&
166
- inputs == o.inputs &&
167
140
  created_at == o.created_at &&
168
141
  updated_at == o.updated_at
169
142
  end
@@ -177,7 +150,7 @@ module BleumiPay
177
150
  # Calculates hash code according to all attributes.
178
151
  # @return [Integer] Hash code
179
152
  def hash
180
- [id, chain, addr, balances, inputs, created_at, updated_at].hash
153
+ [id, addresses, balances, created_at, updated_at].hash
181
154
  end
182
155
 
183
156
  # Builds the object from hash
@@ -266,7 +239,11 @@ module BleumiPay
266
239
  hash = {}
267
240
  self.class.attribute_map.each_pair do |attr, param|
268
241
  value = self.send(attr)
269
- next if value.nil?
242
+ if value.nil?
243
+ is_nullable = self.class.openapi_nullable.include?(attr)
244
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
245
+ end
246
+
270
247
  hash[param] = _to_hash(value)
271
248
  end
272
249
  hash
@@ -0,0 +1,231 @@
1
+ =begin
2
+ #Bleumi Pay REST API
3
+
4
+ #A simple and powerful REST API to integrate ERC-20, Ethereum, xDai, Algorand payments and/or payouts into your business or application
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: info@bleumi.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.2.2
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module BleumiPay
16
+ # Payment addresses
17
+ class PaymentAddresses
18
+ attr_accessor :ethereum
19
+
20
+ attr_accessor :algorand
21
+
22
+ attr_accessor :rsk
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'ethereum' => :'ethereum',
28
+ :'algorand' => :'algorand',
29
+ :'rsk' => :'rsk'
30
+ }
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.openapi_types
35
+ {
36
+ :'ethereum' => :'Hash<String, EthereumWalletAddress>',
37
+ :'algorand' => :'Hash<String, AlgorandWalletAddress>',
38
+ :'rsk' => :'Hash<String, EthereumWalletAddress>'
39
+ }
40
+ end
41
+
42
+ # List of attributes with nullable: true
43
+ def self.openapi_nullable
44
+ Set.new([
45
+ ])
46
+ end
47
+
48
+ # Initializes the object
49
+ # @param [Hash] attributes Model attributes in the form of hash
50
+ def initialize(attributes = {})
51
+ if (!attributes.is_a?(Hash))
52
+ fail ArgumentError, "The input argument (attributes) must be a hash in `BleumiPay::PaymentAddresses` initialize method"
53
+ end
54
+
55
+ # check to see if the attribute exists and convert string to symbol for hash key
56
+ attributes = attributes.each_with_object({}) { |(k, v), h|
57
+ if (!self.class.attribute_map.key?(k.to_sym))
58
+ fail ArgumentError, "`#{k}` is not a valid attribute in `BleumiPay::PaymentAddresses`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
59
+ end
60
+ h[k.to_sym] = v
61
+ }
62
+
63
+ if attributes.key?(:'ethereum')
64
+ if (value = attributes[:'ethereum']).is_a?(Hash)
65
+ self.ethereum = value
66
+ end
67
+ end
68
+
69
+ if attributes.key?(:'algorand')
70
+ if (value = attributes[:'algorand']).is_a?(Hash)
71
+ self.algorand = value
72
+ end
73
+ end
74
+
75
+ if attributes.key?(:'rsk')
76
+ if (value = attributes[:'rsk']).is_a?(Hash)
77
+ self.rsk = value
78
+ end
79
+ end
80
+ end
81
+
82
+ # Show invalid properties with the reasons. Usually used together with valid?
83
+ # @return Array for valid properties with the reasons
84
+ def list_invalid_properties
85
+ invalid_properties = Array.new
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
+ true
93
+ end
94
+
95
+ # Checks equality by comparing each attribute.
96
+ # @param [Object] Object to be compared
97
+ def ==(o)
98
+ return true if self.equal?(o)
99
+ self.class == o.class &&
100
+ ethereum == o.ethereum &&
101
+ algorand == o.algorand &&
102
+ rsk == o.rsk
103
+ end
104
+
105
+ # @see the `==` method
106
+ # @param [Object] Object to be compared
107
+ def eql?(o)
108
+ self == o
109
+ end
110
+
111
+ # Calculates hash code according to all attributes.
112
+ # @return [Integer] Hash code
113
+ def hash
114
+ [ethereum, algorand, rsk].hash
115
+ end
116
+
117
+ # Builds the object from hash
118
+ # @param [Hash] attributes Model attributes in the form of hash
119
+ # @return [Object] Returns the model itself
120
+ def self.build_from_hash(attributes)
121
+ new.build_from_hash(attributes)
122
+ end
123
+
124
+ # Builds the object from hash
125
+ # @param [Hash] attributes Model attributes in the form of hash
126
+ # @return [Object] Returns the model itself
127
+ def build_from_hash(attributes)
128
+ return nil unless attributes.is_a?(Hash)
129
+ self.class.openapi_types.each_pair do |key, type|
130
+ if type =~ /\AArray<(.*)>/i
131
+ # check to ensure the input is an array given that the attribute
132
+ # is documented as an array but the input is not
133
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
134
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
135
+ end
136
+ elsif !attributes[self.class.attribute_map[key]].nil?
137
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
138
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
139
+ end
140
+
141
+ self
142
+ end
143
+
144
+ # Deserializes the data based on type
145
+ # @param string type Data type
146
+ # @param string value Value to be deserialized
147
+ # @return [Object] Deserialized data
148
+ def _deserialize(type, value)
149
+ case type.to_sym
150
+ when :DateTime
151
+ DateTime.parse(value)
152
+ when :Date
153
+ Date.parse(value)
154
+ when :String
155
+ value.to_s
156
+ when :Integer
157
+ value.to_i
158
+ when :Float
159
+ value.to_f
160
+ when :Boolean
161
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
162
+ true
163
+ else
164
+ false
165
+ end
166
+ when :Object
167
+ # generic object (usually a Hash), return directly
168
+ value
169
+ when /\AArray<(?<inner_type>.+)>\z/
170
+ inner_type = Regexp.last_match[:inner_type]
171
+ value.map { |v| _deserialize(inner_type, v) }
172
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
173
+ k_type = Regexp.last_match[:k_type]
174
+ v_type = Regexp.last_match[:v_type]
175
+ {}.tap do |hash|
176
+ value.each do |k, v|
177
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
178
+ end
179
+ end
180
+ else # model
181
+ BleumiPay.const_get(type).build_from_hash(value)
182
+ end
183
+ end
184
+
185
+ # Returns the string representation of the object
186
+ # @return [String] String presentation of the object
187
+ def to_s
188
+ to_hash.to_s
189
+ end
190
+
191
+ # to_body is an alias to to_hash (backward compatibility)
192
+ # @return [Hash] Returns the object in the form of hash
193
+ def to_body
194
+ to_hash
195
+ end
196
+
197
+ # Returns the object in the form of hash
198
+ # @return [Hash] Returns the object in the form of hash
199
+ def to_hash
200
+ hash = {}
201
+ self.class.attribute_map.each_pair do |attr, param|
202
+ value = self.send(attr)
203
+ if value.nil?
204
+ is_nullable = self.class.openapi_nullable.include?(attr)
205
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
206
+ end
207
+
208
+ hash[param] = _to_hash(value)
209
+ end
210
+ hash
211
+ end
212
+
213
+ # Outputs non-array value in the form of hash
214
+ # For object, use to_hash. Otherwise, just return the value
215
+ # @param [Object] value Any valid value
216
+ # @return [Hash] Returns the value in the form of hash
217
+ def _to_hash(value)
218
+ if value.is_a?(Array)
219
+ value.compact.map { |v| _to_hash(v) }
220
+ elsif value.is_a?(Hash)
221
+ {}.tap do |hash|
222
+ value.each { |k, v| hash[k] = _to_hash(v) }
223
+ end
224
+ elsif value.respond_to? :to_hash
225
+ value.to_hash
226
+ else
227
+ value
228
+ end
229
+ end
230
+ end
231
+ end