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 WalletOperationOutput
17
- # Unique identifier for the wallet operation transaction
16
+ class PaymentOperationResponse
17
+ # Unique identifier for the payment operation transaction
18
18
  attr_accessor :txid
19
19
 
20
20
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -31,17 +31,23 @@ module BleumiPay
31
31
  }
32
32
  end
33
33
 
34
+ # List of attributes with nullable: true
35
+ def self.openapi_nullable
36
+ Set.new([
37
+ ])
38
+ end
39
+
34
40
  # Initializes the object
35
41
  # @param [Hash] attributes Model attributes in the form of hash
36
42
  def initialize(attributes = {})
37
43
  if (!attributes.is_a?(Hash))
38
- fail ArgumentError, "The input argument (attributes) must be a hash in `BleumiPay::WalletOperationOutput` initialize method"
44
+ fail ArgumentError, "The input argument (attributes) must be a hash in `BleumiPay::PaymentOperationResponse` initialize method"
39
45
  end
40
46
 
41
47
  # check to see if the attribute exists and convert string to symbol for hash key
42
48
  attributes = attributes.each_with_object({}) { |(k, v), h|
43
49
  if (!self.class.attribute_map.key?(k.to_sym))
44
- fail ArgumentError, "`#{k}` is not a valid attribute in `BleumiPay::WalletOperationOutput`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
50
+ fail ArgumentError, "`#{k}` is not a valid attribute in `BleumiPay::PaymentOperationResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
45
51
  end
46
52
  h[k.to_sym] = v
47
53
  }
@@ -175,7 +181,11 @@ module BleumiPay
175
181
  hash = {}
176
182
  self.class.attribute_map.each_pair do |attr, param|
177
183
  value = self.send(attr)
178
- next if value.nil?
184
+ if value.nil?
185
+ is_nullable = self.class.openapi_nullable.include?(attr)
186
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
187
+ end
188
+
179
189
  hash[param] = _to_hash(value)
180
190
  end
181
191
  hash
@@ -1,19 +1,19 @@
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 WalletRefundOperationInput
16
+ class PaymentRefundRequest
17
17
  attr_accessor :token
18
18
 
19
19
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -26,21 +26,27 @@ module BleumiPay
26
26
  # Attribute type mapping.
27
27
  def self.openapi_types
28
28
  {
29
- :'token' => :'EthAddress'
29
+ :'token' => :'Token'
30
30
  }
31
31
  end
32
32
 
33
+ # List of attributes with nullable: true
34
+ def self.openapi_nullable
35
+ Set.new([
36
+ ])
37
+ end
38
+
33
39
  # Initializes the object
34
40
  # @param [Hash] attributes Model attributes in the form of hash
35
41
  def initialize(attributes = {})
36
42
  if (!attributes.is_a?(Hash))
37
- fail ArgumentError, "The input argument (attributes) must be a hash in `BleumiPay::WalletRefundOperationInput` initialize method"
43
+ fail ArgumentError, "The input argument (attributes) must be a hash in `BleumiPay::PaymentRefundRequest` initialize method"
38
44
  end
39
45
 
40
46
  # check to see if the attribute exists and convert string to symbol for hash key
41
47
  attributes = attributes.each_with_object({}) { |(k, v), h|
42
48
  if (!self.class.attribute_map.key?(k.to_sym))
43
- fail ArgumentError, "`#{k}` is not a valid attribute in `BleumiPay::WalletRefundOperationInput`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
49
+ fail ArgumentError, "`#{k}` is not a valid attribute in `BleumiPay::PaymentRefundRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
44
50
  end
45
51
  h[k.to_sym] = v
46
52
  }
@@ -174,7 +180,11 @@ module BleumiPay
174
180
  hash = {}
175
181
  self.class.attribute_map.each_pair do |attr, param|
176
182
  value = self.send(attr)
177
- next if value.nil?
183
+ if value.nil?
184
+ is_nullable = self.class.openapi_nullable.include?(attr)
185
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
186
+ end
187
+
178
188
  hash[param] = _to_hash(value)
179
189
  end
180
190
  hash
@@ -1,19 +1,19 @@
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 WalletSettleOperationInput
16
+ class PaymentSettleRequest
17
17
  attr_accessor :token
18
18
 
19
19
  # Amount to be settled
@@ -30,22 +30,28 @@ module BleumiPay
30
30
  # Attribute type mapping.
31
31
  def self.openapi_types
32
32
  {
33
- :'token' => :'EthAddress',
33
+ :'token' => :'Token',
34
34
  :'amount' => :'String'
35
35
  }
36
36
  end
37
37
 
38
+ # List of attributes with nullable: true
39
+ def self.openapi_nullable
40
+ Set.new([
41
+ ])
42
+ end
43
+
38
44
  # Initializes the object
39
45
  # @param [Hash] attributes Model attributes in the form of hash
40
46
  def initialize(attributes = {})
41
47
  if (!attributes.is_a?(Hash))
42
- fail ArgumentError, "The input argument (attributes) must be a hash in `BleumiPay::WalletSettleOperationInput` initialize method"
48
+ fail ArgumentError, "The input argument (attributes) must be a hash in `BleumiPay::PaymentSettleRequest` initialize method"
43
49
  end
44
50
 
45
51
  # check to see if the attribute exists and convert string to symbol for hash key
46
52
  attributes = attributes.each_with_object({}) { |(k, v), h|
47
53
  if (!self.class.attribute_map.key?(k.to_sym))
48
- fail ArgumentError, "`#{k}` is not a valid attribute in `BleumiPay::WalletSettleOperationInput`. 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::PaymentSettleRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
49
55
  end
50
56
  h[k.to_sym] = v
51
57
  }
@@ -189,7 +195,11 @@ module BleumiPay
189
195
  hash = {}
190
196
  self.class.attribute_map.each_pair do |attr, param|
191
197
  value = self.send(attr)
192
- next if value.nil?
198
+ if value.nil?
199
+ is_nullable = self.class.openapi_nullable.include?(attr)
200
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
201
+ end
202
+
193
203
  hash[param] = _to_hash(value)
194
204
  end
195
205
  hash
@@ -0,0 +1,227 @@
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
+ class Payout
17
+ # Address of receiver. This address must be able to receive payments from smart contracts.
18
+ attr_accessor :transfer_address
19
+
20
+ # Amount of token to transfer
21
+ attr_accessor :amount
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'transfer_address' => :'transferAddress',
27
+ :'amount' => :'amount'
28
+ }
29
+ end
30
+
31
+ # Attribute type mapping.
32
+ def self.openapi_types
33
+ {
34
+ :'transfer_address' => :'String',
35
+ :'amount' => :'String'
36
+ }
37
+ end
38
+
39
+ # List of attributes with nullable: true
40
+ def self.openapi_nullable
41
+ Set.new([
42
+ ])
43
+ end
44
+
45
+ # Initializes the object
46
+ # @param [Hash] attributes Model attributes in the form of hash
47
+ def initialize(attributes = {})
48
+ if (!attributes.is_a?(Hash))
49
+ fail ArgumentError, "The input argument (attributes) must be a hash in `BleumiPay::Payout` initialize method"
50
+ end
51
+
52
+ # check to see if the attribute exists and convert string to symbol for hash key
53
+ attributes = attributes.each_with_object({}) { |(k, v), h|
54
+ if (!self.class.attribute_map.key?(k.to_sym))
55
+ fail ArgumentError, "`#{k}` is not a valid attribute in `BleumiPay::Payout`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
56
+ end
57
+ h[k.to_sym] = v
58
+ }
59
+
60
+ if attributes.key?(:'transfer_address')
61
+ self.transfer_address = attributes[:'transfer_address']
62
+ end
63
+
64
+ if attributes.key?(:'amount')
65
+ self.amount = attributes[:'amount']
66
+ end
67
+ end
68
+
69
+ # Show invalid properties with the reasons. Usually used together with valid?
70
+ # @return Array for valid properties with the reasons
71
+ def list_invalid_properties
72
+ invalid_properties = Array.new
73
+ if @transfer_address.nil?
74
+ invalid_properties.push('invalid value for "transfer_address", transfer_address cannot be nil.')
75
+ end
76
+
77
+ if @amount.nil?
78
+ invalid_properties.push('invalid value for "amount", amount cannot be nil.')
79
+ end
80
+
81
+ invalid_properties
82
+ end
83
+
84
+ # Check to see if the all the properties in the model are valid
85
+ # @return true if the model is valid
86
+ def valid?
87
+ return false if @transfer_address.nil?
88
+ return false if @amount.nil?
89
+ true
90
+ end
91
+
92
+ # Checks equality by comparing each attribute.
93
+ # @param [Object] Object to be compared
94
+ def ==(o)
95
+ return true if self.equal?(o)
96
+ self.class == o.class &&
97
+ transfer_address == o.transfer_address &&
98
+ amount == o.amount
99
+ end
100
+
101
+ # @see the `==` method
102
+ # @param [Object] Object to be compared
103
+ def eql?(o)
104
+ self == o
105
+ end
106
+
107
+ # Calculates hash code according to all attributes.
108
+ # @return [Integer] Hash code
109
+ def hash
110
+ [transfer_address, amount].hash
111
+ end
112
+
113
+ # Builds the object from hash
114
+ # @param [Hash] attributes Model attributes in the form of hash
115
+ # @return [Object] Returns the model itself
116
+ def self.build_from_hash(attributes)
117
+ new.build_from_hash(attributes)
118
+ end
119
+
120
+ # Builds the object from hash
121
+ # @param [Hash] attributes Model attributes in the form of hash
122
+ # @return [Object] Returns the model itself
123
+ def build_from_hash(attributes)
124
+ return nil unless attributes.is_a?(Hash)
125
+ self.class.openapi_types.each_pair do |key, type|
126
+ if type =~ /\AArray<(.*)>/i
127
+ # check to ensure the input is an array given that the attribute
128
+ # is documented as an array but the input is not
129
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
130
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
131
+ end
132
+ elsif !attributes[self.class.attribute_map[key]].nil?
133
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
134
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
135
+ end
136
+
137
+ self
138
+ end
139
+
140
+ # Deserializes the data based on type
141
+ # @param string type Data type
142
+ # @param string value Value to be deserialized
143
+ # @return [Object] Deserialized data
144
+ def _deserialize(type, value)
145
+ case type.to_sym
146
+ when :DateTime
147
+ DateTime.parse(value)
148
+ when :Date
149
+ Date.parse(value)
150
+ when :String
151
+ value.to_s
152
+ when :Integer
153
+ value.to_i
154
+ when :Float
155
+ value.to_f
156
+ when :Boolean
157
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
158
+ true
159
+ else
160
+ false
161
+ end
162
+ when :Object
163
+ # generic object (usually a Hash), return directly
164
+ value
165
+ when /\AArray<(?<inner_type>.+)>\z/
166
+ inner_type = Regexp.last_match[:inner_type]
167
+ value.map { |v| _deserialize(inner_type, v) }
168
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
169
+ k_type = Regexp.last_match[:k_type]
170
+ v_type = Regexp.last_match[:v_type]
171
+ {}.tap do |hash|
172
+ value.each do |k, v|
173
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
174
+ end
175
+ end
176
+ else # model
177
+ BleumiPay.const_get(type).build_from_hash(value)
178
+ end
179
+ end
180
+
181
+ # Returns the string representation of the object
182
+ # @return [String] String presentation of the object
183
+ def to_s
184
+ to_hash.to_s
185
+ end
186
+
187
+ # to_body is an alias to to_hash (backward compatibility)
188
+ # @return [Hash] Returns the object in the form of hash
189
+ def to_body
190
+ to_hash
191
+ end
192
+
193
+ # Returns the object in the form of hash
194
+ # @return [Hash] Returns the object in the form of hash
195
+ def to_hash
196
+ hash = {}
197
+ self.class.attribute_map.each_pair do |attr, param|
198
+ value = self.send(attr)
199
+ if value.nil?
200
+ is_nullable = self.class.openapi_nullable.include?(attr)
201
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
202
+ end
203
+
204
+ hash[param] = _to_hash(value)
205
+ end
206
+ hash
207
+ end
208
+
209
+ # Outputs non-array value in the form of hash
210
+ # For object, use to_hash. Otherwise, just return the value
211
+ # @param [Object] value Any valid value
212
+ # @return [Hash] Returns the value in the form of hash
213
+ def _to_hash(value)
214
+ if value.is_a?(Array)
215
+ value.compact.map { |v| _to_hash(v) }
216
+ elsif value.is_a?(Hash)
217
+ {}.tap do |hash|
218
+ value.each { |k, v| hash[k] = _to_hash(v) }
219
+ end
220
+ elsif value.respond_to? :to_hash
221
+ value.to_hash
222
+ else
223
+ value
224
+ end
225
+ end
226
+ end
227
+ end
@@ -0,0 +1,286 @@
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
+ class PayoutItem
17
+ # Unique identifier for this payout
18
+ attr_accessor :txid
19
+
20
+ # null- Operation in progress ; true - Operation confirmed by network; false - Operation rejected by network;
21
+ attr_accessor :status
22
+
23
+ # Transaction hash of the operation submitted to the network. This field is blank when the operation is in progress.
24
+ attr_accessor :hash
25
+
26
+ # UNIX timestamp when the payout was created
27
+ attr_accessor :created_at
28
+
29
+ # UNIX timestamp when the lastest operation was performed
30
+ attr_accessor :updated_at
31
+
32
+ attr_accessor :inputs
33
+
34
+ # Attribute mapping from ruby-style variable name to JSON key.
35
+ def self.attribute_map
36
+ {
37
+ :'txid' => :'txid',
38
+ :'status' => :'status',
39
+ :'hash' => :'hash',
40
+ :'created_at' => :'createdAt',
41
+ :'updated_at' => :'updatedAt',
42
+ :'inputs' => :'inputs'
43
+ }
44
+ end
45
+
46
+ # Attribute type mapping.
47
+ def self.openapi_types
48
+ {
49
+ :'txid' => :'String',
50
+ :'status' => :'Boolean',
51
+ :'hash' => :'String',
52
+ :'created_at' => :'Integer',
53
+ :'updated_at' => :'Integer',
54
+ :'inputs' => :'PayoutItemInputs'
55
+ }
56
+ end
57
+
58
+ # List of attributes with nullable: true
59
+ def self.openapi_nullable
60
+ Set.new([
61
+ ])
62
+ end
63
+
64
+ # Initializes the object
65
+ # @param [Hash] attributes Model attributes in the form of hash
66
+ def initialize(attributes = {})
67
+ if (!attributes.is_a?(Hash))
68
+ fail ArgumentError, "The input argument (attributes) must be a hash in `BleumiPay::PayoutItem` initialize method"
69
+ end
70
+
71
+ # check to see if the attribute exists and convert string to symbol for hash key
72
+ attributes = attributes.each_with_object({}) { |(k, v), h|
73
+ if (!self.class.attribute_map.key?(k.to_sym))
74
+ fail ArgumentError, "`#{k}` is not a valid attribute in `BleumiPay::PayoutItem`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
75
+ end
76
+ h[k.to_sym] = v
77
+ }
78
+
79
+ if attributes.key?(:'txid')
80
+ self.txid = attributes[:'txid']
81
+ end
82
+
83
+ if attributes.key?(:'status')
84
+ self.status = attributes[:'status']
85
+ end
86
+
87
+ if attributes.key?(:'hash')
88
+ self.hash = attributes[:'hash']
89
+ end
90
+
91
+ if attributes.key?(:'created_at')
92
+ self.created_at = attributes[:'created_at']
93
+ end
94
+
95
+ if attributes.key?(:'updated_at')
96
+ self.updated_at = attributes[:'updated_at']
97
+ end
98
+
99
+ if attributes.key?(:'inputs')
100
+ self.inputs = attributes[:'inputs']
101
+ end
102
+ end
103
+
104
+ # Show invalid properties with the reasons. Usually used together with valid?
105
+ # @return Array for valid properties with the reasons
106
+ def list_invalid_properties
107
+ invalid_properties = Array.new
108
+ if @txid.nil?
109
+ invalid_properties.push('invalid value for "txid", txid cannot be nil.')
110
+ end
111
+
112
+ if @status.nil?
113
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
114
+ end
115
+
116
+ if @hash.nil?
117
+ invalid_properties.push('invalid value for "hash", hash cannot be nil.')
118
+ end
119
+
120
+ if @created_at.nil?
121
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
122
+ end
123
+
124
+ if @updated_at.nil?
125
+ invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
126
+ end
127
+
128
+ if @inputs.nil?
129
+ invalid_properties.push('invalid value for "inputs", inputs cannot be nil.')
130
+ end
131
+
132
+ invalid_properties
133
+ end
134
+
135
+ # Check to see if the all the properties in the model are valid
136
+ # @return true if the model is valid
137
+ def valid?
138
+ return false if @txid.nil?
139
+ return false if @status.nil?
140
+ return false if @hash.nil?
141
+ return false if @created_at.nil?
142
+ return false if @updated_at.nil?
143
+ return false if @inputs.nil?
144
+ true
145
+ end
146
+
147
+ # Checks equality by comparing each attribute.
148
+ # @param [Object] Object to be compared
149
+ def ==(o)
150
+ return true if self.equal?(o)
151
+ self.class == o.class &&
152
+ txid == o.txid &&
153
+ status == o.status &&
154
+ hash == o.hash &&
155
+ created_at == o.created_at &&
156
+ updated_at == o.updated_at &&
157
+ inputs == o.inputs
158
+ end
159
+
160
+ # @see the `==` method
161
+ # @param [Object] Object to be compared
162
+ def eql?(o)
163
+ self == o
164
+ end
165
+
166
+ # Calculates hash code according to all attributes.
167
+ # @return [Integer] Hash code
168
+ def hash
169
+ [txid, status, hash, created_at, updated_at, inputs].hash
170
+ end
171
+
172
+ # Builds the object from hash
173
+ # @param [Hash] attributes Model attributes in the form of hash
174
+ # @return [Object] Returns the model itself
175
+ def self.build_from_hash(attributes)
176
+ new.build_from_hash(attributes)
177
+ end
178
+
179
+ # Builds the object from hash
180
+ # @param [Hash] attributes Model attributes in the form of hash
181
+ # @return [Object] Returns the model itself
182
+ def build_from_hash(attributes)
183
+ return nil unless attributes.is_a?(Hash)
184
+ self.class.openapi_types.each_pair do |key, type|
185
+ if type =~ /\AArray<(.*)>/i
186
+ # check to ensure the input is an array given that the attribute
187
+ # is documented as an array but the input is not
188
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
189
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
190
+ end
191
+ elsif !attributes[self.class.attribute_map[key]].nil?
192
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
193
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
194
+ end
195
+
196
+ self
197
+ end
198
+
199
+ # Deserializes the data based on type
200
+ # @param string type Data type
201
+ # @param string value Value to be deserialized
202
+ # @return [Object] Deserialized data
203
+ def _deserialize(type, value)
204
+ case type.to_sym
205
+ when :DateTime
206
+ DateTime.parse(value)
207
+ when :Date
208
+ Date.parse(value)
209
+ when :String
210
+ value.to_s
211
+ when :Integer
212
+ value.to_i
213
+ when :Float
214
+ value.to_f
215
+ when :Boolean
216
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
217
+ true
218
+ else
219
+ false
220
+ end
221
+ when :Object
222
+ # generic object (usually a Hash), return directly
223
+ value
224
+ when /\AArray<(?<inner_type>.+)>\z/
225
+ inner_type = Regexp.last_match[:inner_type]
226
+ value.map { |v| _deserialize(inner_type, v) }
227
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
228
+ k_type = Regexp.last_match[:k_type]
229
+ v_type = Regexp.last_match[:v_type]
230
+ {}.tap do |hash|
231
+ value.each do |k, v|
232
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
233
+ end
234
+ end
235
+ else # model
236
+ BleumiPay.const_get(type).build_from_hash(value)
237
+ end
238
+ end
239
+
240
+ # Returns the string representation of the object
241
+ # @return [String] String presentation of the object
242
+ def to_s
243
+ to_hash.to_s
244
+ end
245
+
246
+ # to_body is an alias to to_hash (backward compatibility)
247
+ # @return [Hash] Returns the object in the form of hash
248
+ def to_body
249
+ to_hash
250
+ end
251
+
252
+ # Returns the object in the form of hash
253
+ # @return [Hash] Returns the object in the form of hash
254
+ def to_hash
255
+ hash = {}
256
+ self.class.attribute_map.each_pair do |attr, param|
257
+ value = self.send(attr)
258
+ if value.nil?
259
+ is_nullable = self.class.openapi_nullable.include?(attr)
260
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
261
+ end
262
+
263
+ hash[param] = _to_hash(value)
264
+ end
265
+ hash
266
+ end
267
+
268
+ # Outputs non-array value in the form of hash
269
+ # For object, use to_hash. Otherwise, just return the value
270
+ # @param [Object] value Any valid value
271
+ # @return [Hash] Returns the value in the form of hash
272
+ def _to_hash(value)
273
+ if value.is_a?(Array)
274
+ value.compact.map { |v| _to_hash(v) }
275
+ elsif value.is_a?(Hash)
276
+ {}.tap do |hash|
277
+ value.each { |k, v| hash[k] = _to_hash(v) }
278
+ end
279
+ elsif value.respond_to? :to_hash
280
+ value.to_hash
281
+ else
282
+ value
283
+ end
284
+ end
285
+ end
286
+ end