bleumi_pay_sdk_ruby 1.0.2 → 1.0.3

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 (124) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +61 -43
  3. data/bleumi_pay_sdk_ruby.gemspec +2 -3
  4. data/docs/BadRequest.md +1 -0
  5. data/docs/Chain.md +11 -0
  6. data/docs/CheckoutToken.md +23 -0
  7. data/docs/CreateCheckoutUrlRequest.md +30 -0
  8. data/docs/CreateCheckoutUrlResponse.md +17 -0
  9. data/docs/CreatePaymentRequest.md +19 -0
  10. data/docs/CreatePaymentResponse.md +15 -0
  11. data/docs/CreatePayoutRequest.md +28 -0
  12. data/docs/CreatePayoutResponse.md +15 -0
  13. data/docs/EthAddress.md +6 -1
  14. data/docs/HostedCheckoutsApi.md +190 -0
  15. data/docs/NetworkBalance.md +29 -0
  16. data/docs/PaginatedPaymentOperations.md +29 -0
  17. data/docs/PaginatedPayments.md +68 -0
  18. data/docs/PaginatedPayoutItems.md +59 -0
  19. data/docs/Payment.md +44 -0
  20. data/docs/PaymentAddresses.md +22 -0
  21. data/docs/PaymentBalances.md +24 -0
  22. data/docs/PaymentOperation.md +46 -0
  23. data/docs/PaymentOperationInputs.md +32 -0
  24. data/docs/PaymentOperationResponse.md +15 -0
  25. data/docs/PaymentRefundRequest.md +16 -0
  26. data/docs/PaymentSettleRequest.md +17 -0
  27. data/docs/PaymentsApi.md +426 -0
  28. data/docs/Payout.md +17 -0
  29. data/docs/PayoutItem.md +39 -0
  30. data/docs/PayoutItemInputs.md +28 -0
  31. data/docs/PayoutsApi.md +137 -0
  32. data/docs/Token.md +15 -0
  33. data/docs/ValidateCheckoutRequest.md +21 -0
  34. data/docs/ValidateCheckoutResponse.md +15 -0
  35. data/docs/WalletAddress.md +14 -0
  36. data/docs/WalletBalance.md +14 -4
  37. data/lib/bleumi_pay_sdk_ruby.rb +32 -15
  38. data/lib/bleumi_pay_sdk_ruby/api/hosted_checkouts_api.rb +200 -0
  39. data/lib/bleumi_pay_sdk_ruby/api/{erc20_payments_api.rb → payments_api.rb} +130 -124
  40. data/lib/bleumi_pay_sdk_ruby/api/payouts_api.rb +157 -0
  41. data/lib/bleumi_pay_sdk_ruby/api_client.rb +2 -2
  42. data/lib/bleumi_pay_sdk_ruby/api_error.rb +2 -2
  43. data/lib/bleumi_pay_sdk_ruby/configuration.rb +2 -2
  44. data/lib/bleumi_pay_sdk_ruby/models/bad_request.rb +13 -3
  45. data/lib/bleumi_pay_sdk_ruby/models/{eth_network.rb → chain.rb} +7 -5
  46. data/lib/bleumi_pay_sdk_ruby/models/checkout_token.rb +272 -0
  47. data/lib/bleumi_pay_sdk_ruby/models/create_checkout_url_request.rb +299 -0
  48. data/lib/bleumi_pay_sdk_ruby/models/create_checkout_url_response.rb +227 -0
  49. data/lib/bleumi_pay_sdk_ruby/models/{wallet_create_input.rb → create_payment_request.rb} +17 -7
  50. data/lib/bleumi_pay_sdk_ruby/models/{wallet_create_output.rb → create_payment_response.rb} +18 -22
  51. data/lib/bleumi_pay_sdk_ruby/models/create_payout_request.rb +243 -0
  52. data/lib/bleumi_pay_sdk_ruby/models/create_payout_response.rb +212 -0
  53. data/lib/bleumi_pay_sdk_ruby/models/eth_address.rb +2 -2
  54. data/lib/bleumi_pay_sdk_ruby/models/network_balance.rb +274 -0
  55. data/lib/bleumi_pay_sdk_ruby/models/paginated_payment_operations.rb +224 -0
  56. data/lib/bleumi_pay_sdk_ruby/models/{paginated_wallet_operations.rb → paginated_payments.rb} +18 -8
  57. data/lib/bleumi_pay_sdk_ruby/models/{paginated_wallets.rb → paginated_payout_items.rb} +18 -8
  58. data/lib/bleumi_pay_sdk_ruby/models/{wallet.rb → payment.rb} +30 -53
  59. data/lib/bleumi_pay_sdk_ruby/models/payment_addresses.rb +209 -0
  60. data/lib/bleumi_pay_sdk_ruby/models/payment_balances.rb +207 -0
  61. data/lib/bleumi_pay_sdk_ruby/models/{wallet_operation.rb → payment_operation.rb} +42 -17
  62. data/lib/bleumi_pay_sdk_ruby/models/{wallet_operation_inputs.rb → payment_operation_inputs.rb} +37 -11
  63. data/lib/bleumi_pay_sdk_ruby/models/{wallet_operation_output.rb → payment_operation_response.rb} +17 -7
  64. data/lib/bleumi_pay_sdk_ruby/models/{wallet_refund_operation_input.rb → payment_refund_request.rb} +17 -7
  65. data/lib/bleumi_pay_sdk_ruby/models/{wallet_settle_operation_input.rb → payment_settle_request.rb} +17 -7
  66. data/lib/bleumi_pay_sdk_ruby/models/payout.rb +227 -0
  67. data/lib/bleumi_pay_sdk_ruby/models/payout_item.rb +286 -0
  68. data/lib/bleumi_pay_sdk_ruby/models/payout_item_inputs.rb +244 -0
  69. data/lib/bleumi_pay_sdk_ruby/models/token.rb +214 -0
  70. data/lib/bleumi_pay_sdk_ruby/models/{wallet_inputs.rb → validate_checkout_request.rb} +57 -62
  71. data/lib/bleumi_pay_sdk_ruby/models/validate_checkout_response.rb +212 -0
  72. data/lib/bleumi_pay_sdk_ruby/models/wallet_address.rb +212 -0
  73. data/lib/bleumi_pay_sdk_ruby/models/wallet_balance.rb +17 -7
  74. data/lib/bleumi_pay_sdk_ruby/version.rb +3 -3
  75. data/spec/api/hosted_checkouts_api_spec.rb +67 -0
  76. data/spec/api/payments_api_spec.rb +122 -0
  77. data/spec/api/payouts_api_spec.rb +61 -0
  78. data/spec/api_client_spec.rb +226 -0
  79. data/spec/configuration_spec.rb +42 -0
  80. data/spec/models/bad_request_spec.rb +47 -0
  81. data/spec/models/chain_spec.rb +35 -0
  82. data/spec/models/checkout_token_spec.rb +65 -0
  83. data/spec/models/create_checkout_url_request_spec.rb +83 -0
  84. data/spec/models/create_checkout_url_response_spec.rb +47 -0
  85. data/spec/models/create_payment_request_spec.rb +53 -0
  86. data/spec/models/create_payment_response_spec.rb +41 -0
  87. data/spec/models/create_payout_request_spec.rb +53 -0
  88. data/spec/models/create_payout_response_spec.rb +41 -0
  89. data/spec/models/eth_address_spec.rb +41 -0
  90. data/spec/models/network_balance_spec.rb +77 -0
  91. data/spec/models/paginated_payment_operations_spec.rb +47 -0
  92. data/spec/models/paginated_payments_spec.rb +47 -0
  93. data/spec/models/paginated_payout_items_spec.rb +47 -0
  94. data/spec/models/payment_addresses_spec.rb +41 -0
  95. data/spec/models/payment_balances_spec.rb +41 -0
  96. data/spec/models/payment_operation_inputs_spec.rb +65 -0
  97. data/spec/models/payment_operation_response_spec.rb +41 -0
  98. data/spec/models/payment_operation_spec.rb +71 -0
  99. data/spec/models/payment_refund_request_spec.rb +41 -0
  100. data/spec/models/payment_settle_request_spec.rb +47 -0
  101. data/spec/models/payment_spec.rb +65 -0
  102. data/spec/models/payout_item_inputs_spec.rb +53 -0
  103. data/spec/models/payout_item_spec.rb +71 -0
  104. data/spec/models/payout_spec.rb +47 -0
  105. data/spec/models/token_spec.rb +41 -0
  106. data/spec/models/validate_checkout_request_spec.rb +59 -0
  107. data/spec/models/validate_checkout_response_spec.rb +41 -0
  108. data/spec/models/wallet_address_spec.rb +41 -0
  109. data/spec/models/wallet_balance_spec.rb +59 -0
  110. data/spec/spec_helper.rb +111 -0
  111. metadata +149 -45
  112. data/docs/Erc20PaymentsApi.md +0 -334
  113. data/docs/EthNetwork.md +0 -9
  114. data/docs/PaginatedWalletOperations.md +0 -8
  115. data/docs/PaginatedWallets.md +0 -8
  116. data/docs/Wallet.md +0 -13
  117. data/docs/WalletCreateInput.md +0 -9
  118. data/docs/WalletCreateOutput.md +0 -10
  119. data/docs/WalletInputs.md +0 -11
  120. data/docs/WalletOperation.md +0 -11
  121. data/docs/WalletOperationInputs.md +0 -10
  122. data/docs/WalletOperationOutput.md +0 -8
  123. data/docs/WalletRefundOperationInput.md +0 -7
  124. data/docs/WalletSettleOperationInput.md +0 -8
@@ -1,20 +1,20 @@
1
1
  =begin
2
2
  #Bleumi Pay 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 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
2
  #Bleumi Pay 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 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
2
  #Bleumi Pay 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 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,209 @@
1
+ =begin
2
+ #Bleumi Pay API
3
+
4
+ #A simple and powerful REST API to integrate ERC-20, Ethereum, xDai 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
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'ethereum' => :'ethereum'
24
+ }
25
+ end
26
+
27
+ # Attribute type mapping.
28
+ def self.openapi_types
29
+ {
30
+ :'ethereum' => :'Hash<String, WalletAddress>'
31
+ }
32
+ end
33
+
34
+ # List of attributes with nullable: true
35
+ def self.openapi_nullable
36
+ Set.new([
37
+ ])
38
+ end
39
+
40
+ # Initializes the object
41
+ # @param [Hash] attributes Model attributes in the form of hash
42
+ def initialize(attributes = {})
43
+ if (!attributes.is_a?(Hash))
44
+ fail ArgumentError, "The input argument (attributes) must be a hash in `BleumiPay::PaymentAddresses` initialize method"
45
+ end
46
+
47
+ # check to see if the attribute exists and convert string to symbol for hash key
48
+ attributes = attributes.each_with_object({}) { |(k, v), h|
49
+ if (!self.class.attribute_map.key?(k.to_sym))
50
+ 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
51
+ end
52
+ h[k.to_sym] = v
53
+ }
54
+
55
+ if attributes.key?(:'ethereum')
56
+ if (value = attributes[:'ethereum']).is_a?(Hash)
57
+ self.ethereum = value
58
+ end
59
+ end
60
+ end
61
+
62
+ # Show invalid properties with the reasons. Usually used together with valid?
63
+ # @return Array for valid properties with the reasons
64
+ def list_invalid_properties
65
+ invalid_properties = Array.new
66
+ invalid_properties
67
+ end
68
+
69
+ # Check to see if the all the properties in the model are valid
70
+ # @return true if the model is valid
71
+ def valid?
72
+ true
73
+ end
74
+
75
+ # Checks equality by comparing each attribute.
76
+ # @param [Object] Object to be compared
77
+ def ==(o)
78
+ return true if self.equal?(o)
79
+ self.class == o.class &&
80
+ ethereum == o.ethereum
81
+ end
82
+
83
+ # @see the `==` method
84
+ # @param [Object] Object to be compared
85
+ def eql?(o)
86
+ self == o
87
+ end
88
+
89
+ # Calculates hash code according to all attributes.
90
+ # @return [Integer] Hash code
91
+ def hash
92
+ [ethereum].hash
93
+ end
94
+
95
+ # Builds the object from hash
96
+ # @param [Hash] attributes Model attributes in the form of hash
97
+ # @return [Object] Returns the model itself
98
+ def self.build_from_hash(attributes)
99
+ new.build_from_hash(attributes)
100
+ end
101
+
102
+ # Builds the object from hash
103
+ # @param [Hash] attributes Model attributes in the form of hash
104
+ # @return [Object] Returns the model itself
105
+ def build_from_hash(attributes)
106
+ return nil unless attributes.is_a?(Hash)
107
+ self.class.openapi_types.each_pair do |key, type|
108
+ if type =~ /\AArray<(.*)>/i
109
+ # check to ensure the input is an array given that the attribute
110
+ # is documented as an array but the input is not
111
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
112
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
113
+ end
114
+ elsif !attributes[self.class.attribute_map[key]].nil?
115
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
116
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
117
+ end
118
+
119
+ self
120
+ end
121
+
122
+ # Deserializes the data based on type
123
+ # @param string type Data type
124
+ # @param string value Value to be deserialized
125
+ # @return [Object] Deserialized data
126
+ def _deserialize(type, value)
127
+ case type.to_sym
128
+ when :DateTime
129
+ DateTime.parse(value)
130
+ when :Date
131
+ Date.parse(value)
132
+ when :String
133
+ value.to_s
134
+ when :Integer
135
+ value.to_i
136
+ when :Float
137
+ value.to_f
138
+ when :Boolean
139
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
140
+ true
141
+ else
142
+ false
143
+ end
144
+ when :Object
145
+ # generic object (usually a Hash), return directly
146
+ value
147
+ when /\AArray<(?<inner_type>.+)>\z/
148
+ inner_type = Regexp.last_match[:inner_type]
149
+ value.map { |v| _deserialize(inner_type, v) }
150
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
151
+ k_type = Regexp.last_match[:k_type]
152
+ v_type = Regexp.last_match[:v_type]
153
+ {}.tap do |hash|
154
+ value.each do |k, v|
155
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
156
+ end
157
+ end
158
+ else # model
159
+ BleumiPay.const_get(type).build_from_hash(value)
160
+ end
161
+ end
162
+
163
+ # Returns the string representation of the object
164
+ # @return [String] String presentation of the object
165
+ def to_s
166
+ to_hash.to_s
167
+ end
168
+
169
+ # to_body is an alias to to_hash (backward compatibility)
170
+ # @return [Hash] Returns the object in the form of hash
171
+ def to_body
172
+ to_hash
173
+ end
174
+
175
+ # Returns the object in the form of hash
176
+ # @return [Hash] Returns the object in the form of hash
177
+ def to_hash
178
+ hash = {}
179
+ self.class.attribute_map.each_pair do |attr, param|
180
+ value = self.send(attr)
181
+ if value.nil?
182
+ is_nullable = self.class.openapi_nullable.include?(attr)
183
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
184
+ end
185
+
186
+ hash[param] = _to_hash(value)
187
+ end
188
+ hash
189
+ end
190
+
191
+ # Outputs non-array value in the form of hash
192
+ # For object, use to_hash. Otherwise, just return the value
193
+ # @param [Object] value Any valid value
194
+ # @return [Hash] Returns the value in the form of hash
195
+ def _to_hash(value)
196
+ if value.is_a?(Array)
197
+ value.compact.map { |v| _to_hash(v) }
198
+ elsif value.is_a?(Hash)
199
+ {}.tap do |hash|
200
+ value.each { |k, v| hash[k] = _to_hash(v) }
201
+ end
202
+ elsif value.respond_to? :to_hash
203
+ value.to_hash
204
+ else
205
+ value
206
+ end
207
+ end
208
+ end
209
+ end