bleumi_pay_sdk_ruby 1.0.3 → 1.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/README.md +31 -26
  4. data/assets/images/BleumiPay.png +0 -0
  5. data/bleumi_pay_sdk_ruby.gemspec +4 -4
  6. data/docs/AlgorandAddress.md +28 -0
  7. data/docs/AlgorandBalance.md +28 -0
  8. data/docs/AlgorandWalletAddress.md +24 -0
  9. data/docs/AlgorandWalletInputs.md +23 -0
  10. data/docs/BadRequest.md +1 -1
  11. data/docs/Chain.md +6 -3
  12. data/docs/CheckoutToken.md +8 -3
  13. data/docs/CreateCheckoutUrlRequest.md +7 -8
  14. data/docs/CreatePayoutRequest.md +1 -1
  15. data/docs/CreatePayoutResponse.md +1 -1
  16. data/docs/EthereumAddress.md +29 -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 +31 -23
  21. data/docs/PaginatedPaymentOperations.md +2 -3
  22. data/docs/PaginatedPayments.md +41 -10
  23. data/docs/PaginatedPayoutItems.md +1 -1
  24. data/docs/Payment.md +13 -7
  25. data/docs/PaymentAddresses.md +29 -7
  26. data/docs/PaymentBalances.md +20 -8
  27. data/docs/PaymentOperation.md +2 -2
  28. data/docs/PaymentOperationInputs.md +3 -4
  29. data/docs/PaymentRefundRequest.md +1 -3
  30. data/docs/PaymentSettleRequest.md +1 -1
  31. data/docs/PaymentsApi.md +15 -73
  32. data/docs/Payout.md +2 -1
  33. data/docs/PayoutItem.md +1 -1
  34. data/docs/PayoutItemInputs.md +1 -1
  35. data/docs/PayoutsApi.md +10 -10
  36. data/docs/RskAddress.md +29 -0
  37. data/docs/RskBalance.md +28 -0
  38. data/docs/ValidateCheckoutRequest.md +2 -2
  39. data/docs/WalletBalance.md +13 -9
  40. data/lib/bleumi_pay_sdk_ruby.rb +13 -8
  41. data/lib/bleumi_pay_sdk_ruby/api/hosted_checkouts_api.rb +17 -5
  42. data/lib/bleumi_pay_sdk_ruby/api/payments_api.rb +34 -78
  43. data/lib/bleumi_pay_sdk_ruby/api/payouts_api.rb +2 -2
  44. data/lib/bleumi_pay_sdk_ruby/api/request_validator.rb +261 -0
  45. data/lib/bleumi_pay_sdk_ruby/api_client.rb +10 -8
  46. data/lib/bleumi_pay_sdk_ruby/api_error.rb +2 -2
  47. data/lib/bleumi_pay_sdk_ruby/configuration.rb +3 -3
  48. data/lib/bleumi_pay_sdk_ruby/models/algorand_address.rb +219 -0
  49. data/lib/bleumi_pay_sdk_ruby/models/algorand_balance.rb +219 -0
  50. data/lib/bleumi_pay_sdk_ruby/models/{create_payment_response.rb → algorand_wallet_address.rb} +20 -11
  51. data/lib/bleumi_pay_sdk_ruby/models/algorand_wallet_inputs.rb +247 -0
  52. data/lib/bleumi_pay_sdk_ruby/models/bad_request.rb +3 -3
  53. data/lib/bleumi_pay_sdk_ruby/models/chain.rb +6 -5
  54. data/lib/bleumi_pay_sdk_ruby/models/checkout_token.rb +46 -16
  55. data/lib/bleumi_pay_sdk_ruby/models/create_checkout_url_request.rb +26 -13
  56. data/lib/bleumi_pay_sdk_ruby/models/create_checkout_url_response.rb +2 -2
  57. data/lib/bleumi_pay_sdk_ruby/models/create_payout_request.rb +4 -3
  58. data/lib/bleumi_pay_sdk_ruby/models/create_payout_response.rb +2 -2
  59. data/lib/bleumi_pay_sdk_ruby/models/{create_payment_request.rb → ethereum_address.rb} +39 -38
  60. data/lib/bleumi_pay_sdk_ruby/models/{network_balance.rb → ethereum_balance.rb} +13 -46
  61. data/lib/bleumi_pay_sdk_ruby/models/{wallet_address.rb → ethereum_wallet_address.rb} +19 -10
  62. data/lib/bleumi_pay_sdk_ruby/models/ethereum_wallet_inputs.rb +247 -0
  63. data/lib/bleumi_pay_sdk_ruby/models/paginated_payment_operations.rb +2 -2
  64. data/lib/bleumi_pay_sdk_ruby/models/paginated_payments.rb +2 -2
  65. data/lib/bleumi_pay_sdk_ruby/models/paginated_payout_items.rb +2 -2
  66. data/lib/bleumi_pay_sdk_ruby/models/payment.rb +2 -2
  67. data/lib/bleumi_pay_sdk_ruby/models/payment_addresses.rb +25 -9
  68. data/lib/bleumi_pay_sdk_ruby/models/payment_balances.rb +24 -6
  69. data/lib/bleumi_pay_sdk_ruby/models/payment_operation.rb +4 -3
  70. data/lib/bleumi_pay_sdk_ruby/models/payment_operation_inputs.rb +3 -3
  71. data/lib/bleumi_pay_sdk_ruby/models/payment_operation_response.rb +2 -2
  72. data/lib/bleumi_pay_sdk_ruby/models/payment_refund_request.rb +3 -3
  73. data/lib/bleumi_pay_sdk_ruby/models/payment_settle_request.rb +3 -3
  74. data/lib/bleumi_pay_sdk_ruby/models/payout.rb +16 -6
  75. data/lib/bleumi_pay_sdk_ruby/models/payout_item.rb +2 -2
  76. data/lib/bleumi_pay_sdk_ruby/models/payout_item_inputs.rb +2 -2
  77. data/lib/bleumi_pay_sdk_ruby/models/rsk_address.rb +219 -0
  78. data/lib/bleumi_pay_sdk_ruby/models/{token.rb → rsk_balance.rb} +41 -36
  79. data/lib/bleumi_pay_sdk_ruby/models/validate_checkout_request.rb +2 -2
  80. data/lib/bleumi_pay_sdk_ruby/models/validate_checkout_response.rb +2 -2
  81. data/lib/bleumi_pay_sdk_ruby/models/wallet_balance.rb +21 -6
  82. data/lib/bleumi_pay_sdk_ruby/version.rb +3 -3
  83. data/spec/api/hosted_checkouts_api_spec.rb +1 -1
  84. data/spec/api/payments_api_spec.rb +6 -17
  85. data/spec/api_client_spec.rb +1 -1
  86. data/spec/models/{create_payment_response_spec.rb → algorand_address_spec.rb} +13 -7
  87. data/spec/models/{token_spec.rb → algorand_balance_spec.rb} +15 -9
  88. data/spec/models/algorand_wallet_address_spec.rb +47 -0
  89. data/spec/models/algorand_wallet_inputs_spec.rb +65 -0
  90. data/spec/models/checkout_token_spec.rb +13 -1
  91. data/spec/models/create_checkout_url_request_spec.rb +7 -1
  92. data/spec/models/{create_payment_request_spec.rb → ethereum_address_spec.rb} +15 -9
  93. data/spec/models/{network_balance_spec.rb → ethereum_balance_spec.rb} +9 -27
  94. data/spec/models/ethereum_wallet_address_spec.rb +47 -0
  95. data/spec/models/ethereum_wallet_inputs_spec.rb +65 -0
  96. data/spec/models/payment_addresses_spec.rb +12 -0
  97. data/spec/models/payment_balances_spec.rb +12 -0
  98. data/spec/models/payout_spec.rb +6 -0
  99. data/spec/models/{eth_address_spec.rb → rsk_address_spec.rb} +13 -7
  100. data/spec/models/{wallet_address_spec.rb → rsk_balance_spec.rb} +13 -7
  101. data/spec/models/wallet_balance_spec.rb +6 -0
  102. metadata +48 -28
  103. data/docs/CreatePaymentRequest.md +0 -19
  104. data/docs/CreatePaymentResponse.md +0 -15
  105. data/docs/EthAddress.md +0 -13
  106. data/docs/NetworkBalance.md +0 -29
  107. data/docs/Token.md +0 -15
  108. data/docs/WalletAddress.md +0 -14
  109. data/lib/bleumi_pay_sdk_ruby/models/eth_address.rb +0 -208
@@ -1,7 +1,7 @@
1
1
  =begin
2
- #Bleumi Pay API
2
+ #Bleumi Pay REST API
3
3
 
4
- #A simple and powerful REST API to integrate ERC-20, Ethereum, xDai payments and/or payouts 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
@@ -13,18 +13,12 @@ OpenAPI Generator version: 4.2.2
13
13
  require 'date'
14
14
 
15
15
  module BleumiPay
16
- class NetworkBalance
16
+ class EthereumBalance
17
17
  attr_accessor :mainnet
18
18
 
19
- attr_accessor :xdai
20
-
21
19
  attr_accessor :goerli
22
20
 
23
- attr_accessor :kovan
24
-
25
- attr_accessor :rinkeby
26
-
27
- attr_accessor :ropsten
21
+ attr_accessor :xdai
28
22
 
29
23
  attr_accessor :xdai_testnet
30
24
 
@@ -32,11 +26,8 @@ module BleumiPay
32
26
  def self.attribute_map
33
27
  {
34
28
  :'mainnet' => :'mainnet',
35
- :'xdai' => :'xdai',
36
29
  :'goerli' => :'goerli',
37
- :'kovan' => :'kovan',
38
- :'rinkeby' => :'rinkeby',
39
- :'ropsten' => :'ropsten',
30
+ :'xdai' => :'xdai',
40
31
  :'xdai_testnet' => :'xdai_testnet'
41
32
  }
42
33
  end
@@ -45,11 +36,8 @@ module BleumiPay
45
36
  def self.openapi_types
46
37
  {
47
38
  :'mainnet' => :'Hash<String, WalletBalance>',
48
- :'xdai' => :'Hash<String, WalletBalance>',
49
39
  :'goerli' => :'Hash<String, WalletBalance>',
50
- :'kovan' => :'Hash<String, WalletBalance>',
51
- :'rinkeby' => :'Hash<String, WalletBalance>',
52
- :'ropsten' => :'Hash<String, WalletBalance>',
40
+ :'xdai' => :'Hash<String, WalletBalance>',
53
41
  :'xdai_testnet' => :'Hash<String, WalletBalance>'
54
42
  }
55
43
  end
@@ -64,13 +52,13 @@ module BleumiPay
64
52
  # @param [Hash] attributes Model attributes in the form of hash
65
53
  def initialize(attributes = {})
66
54
  if (!attributes.is_a?(Hash))
67
- fail ArgumentError, "The input argument (attributes) must be a hash in `BleumiPay::NetworkBalance` initialize method"
55
+ fail ArgumentError, "The input argument (attributes) must be a hash in `BleumiPay::EthereumBalance` initialize method"
68
56
  end
69
57
 
70
58
  # check to see if the attribute exists and convert string to symbol for hash key
71
59
  attributes = attributes.each_with_object({}) { |(k, v), h|
72
60
  if (!self.class.attribute_map.key?(k.to_sym))
73
- fail ArgumentError, "`#{k}` is not a valid attribute in `BleumiPay::NetworkBalance`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
61
+ fail ArgumentError, "`#{k}` is not a valid attribute in `BleumiPay::EthereumBalance`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
74
62
  end
75
63
  h[k.to_sym] = v
76
64
  }
@@ -81,33 +69,15 @@ module BleumiPay
81
69
  end
82
70
  end
83
71
 
84
- if attributes.key?(:'xdai')
85
- if (value = attributes[:'xdai']).is_a?(Hash)
86
- self.xdai = value
87
- end
88
- end
89
-
90
72
  if attributes.key?(:'goerli')
91
73
  if (value = attributes[:'goerli']).is_a?(Hash)
92
74
  self.goerli = value
93
75
  end
94
76
  end
95
77
 
96
- if attributes.key?(:'kovan')
97
- if (value = attributes[:'kovan']).is_a?(Hash)
98
- self.kovan = value
99
- end
100
- end
101
-
102
- if attributes.key?(:'rinkeby')
103
- if (value = attributes[:'rinkeby']).is_a?(Hash)
104
- self.rinkeby = value
105
- end
106
- end
107
-
108
- if attributes.key?(:'ropsten')
109
- if (value = attributes[:'ropsten']).is_a?(Hash)
110
- self.ropsten = value
78
+ if attributes.key?(:'xdai')
79
+ if (value = attributes[:'xdai']).is_a?(Hash)
80
+ self.xdai = value
111
81
  end
112
82
  end
113
83
 
@@ -137,11 +107,8 @@ module BleumiPay
137
107
  return true if self.equal?(o)
138
108
  self.class == o.class &&
139
109
  mainnet == o.mainnet &&
140
- xdai == o.xdai &&
141
110
  goerli == o.goerli &&
142
- kovan == o.kovan &&
143
- rinkeby == o.rinkeby &&
144
- ropsten == o.ropsten &&
111
+ xdai == o.xdai &&
145
112
  xdai_testnet == o.xdai_testnet
146
113
  end
147
114
 
@@ -154,7 +121,7 @@ module BleumiPay
154
121
  # Calculates hash code according to all attributes.
155
122
  # @return [Integer] Hash code
156
123
  def hash
157
- [mainnet, xdai, goerli, kovan, rinkeby, ropsten, xdai_testnet].hash
124
+ [mainnet, goerli, xdai, xdai_testnet].hash
158
125
  end
159
126
 
160
127
  # Builds the object from hash
@@ -1,33 +1,37 @@
1
1
  =begin
2
- #Bleumi Pay API
2
+ #Bleumi Pay REST API
3
3
 
4
- #A simple and powerful REST API to integrate ERC-20, Ethereum, xDai payments and/or payouts into your business or application
4
+ #A simple and powerful REST API to integrate Algorand, Ethereum, ERC-20 and xDai payments and/or payouts into your business
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.2
9
+ OpenAPI Generator version: 4.2.3
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
14
 
15
15
  module BleumiPay
16
- class WalletAddress
16
+ class EthereumWalletAddress
17
17
  # Wallet address for the payment in the network
18
18
  attr_accessor :addr
19
19
 
20
+ attr_accessor :inputs
21
+
20
22
  # Attribute mapping from ruby-style variable name to JSON key.
21
23
  def self.attribute_map
22
24
  {
23
- :'addr' => :'addr'
25
+ :'addr' => :'addr',
26
+ :'inputs' => :'inputs'
24
27
  }
25
28
  end
26
29
 
27
30
  # Attribute type mapping.
28
31
  def self.openapi_types
29
32
  {
30
- :'addr' => :'String'
33
+ :'addr' => :'String',
34
+ :'inputs' => :'EthereumWalletInputs'
31
35
  }
32
36
  end
33
37
 
@@ -41,13 +45,13 @@ module BleumiPay
41
45
  # @param [Hash] attributes Model attributes in the form of hash
42
46
  def initialize(attributes = {})
43
47
  if (!attributes.is_a?(Hash))
44
- fail ArgumentError, "The input argument (attributes) must be a hash in `BleumiPay::WalletAddress` initialize method"
48
+ fail ArgumentError, "The input argument (attributes) must be a hash in `BleumiPay::EthereumWalletAddress` initialize method"
45
49
  end
46
50
 
47
51
  # check to see if the attribute exists and convert string to symbol for hash key
48
52
  attributes = attributes.each_with_object({}) { |(k, v), h|
49
53
  if (!self.class.attribute_map.key?(k.to_sym))
50
- fail ArgumentError, "`#{k}` is not a valid attribute in `BleumiPay::WalletAddress`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
54
+ fail ArgumentError, "`#{k}` is not a valid attribute in `BleumiPay::EthereumWalletAddress`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
51
55
  end
52
56
  h[k.to_sym] = v
53
57
  }
@@ -55,6 +59,10 @@ module BleumiPay
55
59
  if attributes.key?(:'addr')
56
60
  self.addr = attributes[:'addr']
57
61
  end
62
+
63
+ if attributes.key?(:'inputs')
64
+ self.inputs = attributes[:'inputs']
65
+ end
58
66
  end
59
67
 
60
68
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -80,7 +88,8 @@ module BleumiPay
80
88
  def ==(o)
81
89
  return true if self.equal?(o)
82
90
  self.class == o.class &&
83
- addr == o.addr
91
+ addr == o.addr &&
92
+ inputs == o.inputs
84
93
  end
85
94
 
86
95
  # @see the `==` method
@@ -92,7 +101,7 @@ module BleumiPay
92
101
  # Calculates hash code according to all attributes.
93
102
  # @return [Integer] Hash code
94
103
  def hash
95
- [addr].hash
104
+ [addr, inputs].hash
96
105
  end
97
106
 
98
107
  # Builds the object from hash
@@ -0,0 +1,247 @@
1
+ =begin
2
+ #Bleumi Pay REST API
3
+
4
+ #A simple and powerful REST API to integrate Algorand, Ethereum, ERC-20 and xDai payments and/or payouts into your business
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.3
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module BleumiPay
16
+ class EthereumWalletInputs
17
+ # Buyer Address
18
+ attr_accessor :buyer
19
+
20
+ # Merchant Address
21
+ attr_accessor :merchant
22
+
23
+ # Salt
24
+ attr_accessor :salt
25
+
26
+ # Wallet Library
27
+ attr_accessor :wallet_library
28
+
29
+ # Wallet Proxy
30
+ attr_accessor :wallet_proxy
31
+
32
+ # Attribute mapping from ruby-style variable name to JSON key.
33
+ def self.attribute_map
34
+ {
35
+ :'buyer' => :'buyer',
36
+ :'merchant' => :'merchant',
37
+ :'salt' => :'salt',
38
+ :'wallet_library' => :'walletLibrary',
39
+ :'wallet_proxy' => :'walletProxy'
40
+ }
41
+ end
42
+
43
+ # Attribute type mapping.
44
+ def self.openapi_types
45
+ {
46
+ :'buyer' => :'String',
47
+ :'merchant' => :'String',
48
+ :'salt' => :'String',
49
+ :'wallet_library' => :'String',
50
+ :'wallet_proxy' => :'String'
51
+ }
52
+ end
53
+
54
+ # List of attributes with nullable: true
55
+ def self.openapi_nullable
56
+ Set.new([
57
+ ])
58
+ end
59
+
60
+ # Initializes the object
61
+ # @param [Hash] attributes Model attributes in the form of hash
62
+ def initialize(attributes = {})
63
+ if (!attributes.is_a?(Hash))
64
+ fail ArgumentError, "The input argument (attributes) must be a hash in `BleumiPay::EthereumWalletInputs` initialize method"
65
+ end
66
+
67
+ # check to see if the attribute exists and convert string to symbol for hash key
68
+ attributes = attributes.each_with_object({}) { |(k, v), h|
69
+ if (!self.class.attribute_map.key?(k.to_sym))
70
+ fail ArgumentError, "`#{k}` is not a valid attribute in `BleumiPay::EthereumWalletInputs`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
71
+ end
72
+ h[k.to_sym] = v
73
+ }
74
+
75
+ if attributes.key?(:'buyer')
76
+ self.buyer = attributes[:'buyer']
77
+ end
78
+
79
+ if attributes.key?(:'merchant')
80
+ self.merchant = attributes[:'merchant']
81
+ end
82
+
83
+ if attributes.key?(:'salt')
84
+ self.salt = attributes[:'salt']
85
+ end
86
+
87
+ if attributes.key?(:'wallet_library')
88
+ self.wallet_library = attributes[:'wallet_library']
89
+ end
90
+
91
+ if attributes.key?(:'wallet_proxy')
92
+ self.wallet_proxy = attributes[:'wallet_proxy']
93
+ end
94
+ end
95
+
96
+ # Show invalid properties with the reasons. Usually used together with valid?
97
+ # @return Array for valid properties with the reasons
98
+ def list_invalid_properties
99
+ invalid_properties = Array.new
100
+ invalid_properties
101
+ end
102
+
103
+ # Check to see if the all the properties in the model are valid
104
+ # @return true if the model is valid
105
+ def valid?
106
+ true
107
+ end
108
+
109
+ # Checks equality by comparing each attribute.
110
+ # @param [Object] Object to be compared
111
+ def ==(o)
112
+ return true if self.equal?(o)
113
+ self.class == o.class &&
114
+ buyer == o.buyer &&
115
+ merchant == o.merchant &&
116
+ salt == o.salt &&
117
+ wallet_library == o.wallet_library &&
118
+ wallet_proxy == o.wallet_proxy
119
+ end
120
+
121
+ # @see the `==` method
122
+ # @param [Object] Object to be compared
123
+ def eql?(o)
124
+ self == o
125
+ end
126
+
127
+ # Calculates hash code according to all attributes.
128
+ # @return [Integer] Hash code
129
+ def hash
130
+ [buyer, merchant, salt, wallet_library, wallet_proxy].hash
131
+ end
132
+
133
+ # Builds the object from hash
134
+ # @param [Hash] attributes Model attributes in the form of hash
135
+ # @return [Object] Returns the model itself
136
+ def self.build_from_hash(attributes)
137
+ new.build_from_hash(attributes)
138
+ end
139
+
140
+ # Builds the object from hash
141
+ # @param [Hash] attributes Model attributes in the form of hash
142
+ # @return [Object] Returns the model itself
143
+ def build_from_hash(attributes)
144
+ return nil unless attributes.is_a?(Hash)
145
+ self.class.openapi_types.each_pair do |key, type|
146
+ if type =~ /\AArray<(.*)>/i
147
+ # check to ensure the input is an array given that the attribute
148
+ # is documented as an array but the input is not
149
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
150
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
151
+ end
152
+ elsif !attributes[self.class.attribute_map[key]].nil?
153
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
154
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
155
+ end
156
+
157
+ self
158
+ end
159
+
160
+ # Deserializes the data based on type
161
+ # @param string type Data type
162
+ # @param string value Value to be deserialized
163
+ # @return [Object] Deserialized data
164
+ def _deserialize(type, value)
165
+ case type.to_sym
166
+ when :DateTime
167
+ DateTime.parse(value)
168
+ when :Date
169
+ Date.parse(value)
170
+ when :String
171
+ value.to_s
172
+ when :Integer
173
+ value.to_i
174
+ when :Float
175
+ value.to_f
176
+ when :Boolean
177
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
178
+ true
179
+ else
180
+ false
181
+ end
182
+ when :Object
183
+ # generic object (usually a Hash), return directly
184
+ value
185
+ when /\AArray<(?<inner_type>.+)>\z/
186
+ inner_type = Regexp.last_match[:inner_type]
187
+ value.map { |v| _deserialize(inner_type, v) }
188
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
189
+ k_type = Regexp.last_match[:k_type]
190
+ v_type = Regexp.last_match[:v_type]
191
+ {}.tap do |hash|
192
+ value.each do |k, v|
193
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
194
+ end
195
+ end
196
+ else # model
197
+ BleumiPay.const_get(type).build_from_hash(value)
198
+ end
199
+ end
200
+
201
+ # Returns the string representation of the object
202
+ # @return [String] String presentation of the object
203
+ def to_s
204
+ to_hash.to_s
205
+ end
206
+
207
+ # to_body is an alias to to_hash (backward compatibility)
208
+ # @return [Hash] Returns the object in the form of hash
209
+ def to_body
210
+ to_hash
211
+ end
212
+
213
+ # Returns the object in the form of hash
214
+ # @return [Hash] Returns the object in the form of hash
215
+ def to_hash
216
+ hash = {}
217
+ self.class.attribute_map.each_pair do |attr, param|
218
+ value = self.send(attr)
219
+ if value.nil?
220
+ is_nullable = self.class.openapi_nullable.include?(attr)
221
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
222
+ end
223
+
224
+ hash[param] = _to_hash(value)
225
+ end
226
+ hash
227
+ end
228
+
229
+ # Outputs non-array value in the form of hash
230
+ # For object, use to_hash. Otherwise, just return the value
231
+ # @param [Object] value Any valid value
232
+ # @return [Hash] Returns the value in the form of hash
233
+ def _to_hash(value)
234
+ if value.is_a?(Array)
235
+ value.compact.map { |v| _to_hash(v) }
236
+ elsif value.is_a?(Hash)
237
+ {}.tap do |hash|
238
+ value.each { |k, v| hash[k] = _to_hash(v) }
239
+ end
240
+ elsif value.respond_to? :to_hash
241
+ value.to_hash
242
+ else
243
+ value
244
+ end
245
+ end
246
+ end
247
+ end