bleumi_pay_sdk_ruby 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
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,89 +1,86 @@
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 WalletInputs
17
- # Address of the buyer
18
- attr_accessor :buyer
16
+ class ValidateCheckoutRequest
17
+ # Payment Details. Passed as GET parameter in successUrl.
18
+ attr_accessor :hmac_input
19
19
 
20
- # Address of the merchant
21
- attr_accessor :merchant
20
+ # KeyId used to generate the HMAC. Passed as GET parameter in successUrl.
21
+ attr_accessor :hmac_key_id
22
22
 
23
- # Wallet Library address
24
- attr_accessor :wallet_library
23
+ # Algorithm used to generate the HMAC. Passed as GET parameter in successUrl.
24
+ attr_accessor :hmac_alg
25
25
 
26
- # Wallet Proxy address
27
- attr_accessor :wallet_proxy
28
-
29
- # Salt used to create the wallet
30
- attr_accessor :salt
26
+ # HMAC passed as GET parameter in successUrl.
27
+ attr_accessor :hmac_value
31
28
 
32
29
  # Attribute mapping from ruby-style variable name to JSON key.
33
30
  def self.attribute_map
34
31
  {
35
- :'buyer' => :'buyer',
36
- :'merchant' => :'merchant',
37
- :'wallet_library' => :'walletLibrary',
38
- :'wallet_proxy' => :'walletProxy',
39
- :'salt' => :'salt'
32
+ :'hmac_input' => :'hmac_input',
33
+ :'hmac_key_id' => :'hmac_keyId',
34
+ :'hmac_alg' => :'hmac_alg',
35
+ :'hmac_value' => :'hmac_value'
40
36
  }
41
37
  end
42
38
 
43
39
  # Attribute type mapping.
44
40
  def self.openapi_types
45
41
  {
46
- :'buyer' => :'String',
47
- :'merchant' => :'String',
48
- :'wallet_library' => :'String',
49
- :'wallet_proxy' => :'String',
50
- :'salt' => :'String'
42
+ :'hmac_input' => :'String',
43
+ :'hmac_key_id' => :'String',
44
+ :'hmac_alg' => :'String',
45
+ :'hmac_value' => :'String'
51
46
  }
52
47
  end
53
48
 
49
+ # List of attributes with nullable: true
50
+ def self.openapi_nullable
51
+ Set.new([
52
+ ])
53
+ end
54
+
54
55
  # Initializes the object
55
56
  # @param [Hash] attributes Model attributes in the form of hash
56
57
  def initialize(attributes = {})
57
58
  if (!attributes.is_a?(Hash))
58
- fail ArgumentError, "The input argument (attributes) must be a hash in `BleumiPay::WalletInputs` initialize method"
59
+ fail ArgumentError, "The input argument (attributes) must be a hash in `BleumiPay::ValidateCheckoutRequest` initialize method"
59
60
  end
60
61
 
61
62
  # check to see if the attribute exists and convert string to symbol for hash key
62
63
  attributes = attributes.each_with_object({}) { |(k, v), h|
63
64
  if (!self.class.attribute_map.key?(k.to_sym))
64
- fail ArgumentError, "`#{k}` is not a valid attribute in `BleumiPay::WalletInputs`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
65
+ fail ArgumentError, "`#{k}` is not a valid attribute in `BleumiPay::ValidateCheckoutRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
65
66
  end
66
67
  h[k.to_sym] = v
67
68
  }
68
69
 
69
- if attributes.key?(:'buyer')
70
- self.buyer = attributes[:'buyer']
71
- end
72
-
73
- if attributes.key?(:'merchant')
74
- self.merchant = attributes[:'merchant']
70
+ if attributes.key?(:'hmac_input')
71
+ self.hmac_input = attributes[:'hmac_input']
75
72
  end
76
73
 
77
- if attributes.key?(:'wallet_library')
78
- self.wallet_library = attributes[:'wallet_library']
74
+ if attributes.key?(:'hmac_key_id')
75
+ self.hmac_key_id = attributes[:'hmac_key_id']
79
76
  end
80
77
 
81
- if attributes.key?(:'wallet_proxy')
82
- self.wallet_proxy = attributes[:'wallet_proxy']
78
+ if attributes.key?(:'hmac_alg')
79
+ self.hmac_alg = attributes[:'hmac_alg']
83
80
  end
84
81
 
85
- if attributes.key?(:'salt')
86
- self.salt = attributes[:'salt']
82
+ if attributes.key?(:'hmac_value')
83
+ self.hmac_value = attributes[:'hmac_value']
87
84
  end
88
85
  end
89
86
 
@@ -91,24 +88,20 @@ module BleumiPay
91
88
  # @return Array for valid properties with the reasons
92
89
  def list_invalid_properties
93
90
  invalid_properties = Array.new
94
- if @buyer.nil?
95
- invalid_properties.push('invalid value for "buyer", buyer cannot be nil.')
96
- end
97
-
98
- if @merchant.nil?
99
- invalid_properties.push('invalid value for "merchant", merchant cannot be nil.')
91
+ if @hmac_input.nil?
92
+ invalid_properties.push('invalid value for "hmac_input", hmac_input cannot be nil.')
100
93
  end
101
94
 
102
- if @wallet_library.nil?
103
- invalid_properties.push('invalid value for "wallet_library", wallet_library cannot be nil.')
95
+ if @hmac_key_id.nil?
96
+ invalid_properties.push('invalid value for "hmac_key_id", hmac_key_id cannot be nil.')
104
97
  end
105
98
 
106
- if @wallet_proxy.nil?
107
- invalid_properties.push('invalid value for "wallet_proxy", wallet_proxy cannot be nil.')
99
+ if @hmac_alg.nil?
100
+ invalid_properties.push('invalid value for "hmac_alg", hmac_alg cannot be nil.')
108
101
  end
109
102
 
110
- if @salt.nil?
111
- invalid_properties.push('invalid value for "salt", salt cannot be nil.')
103
+ if @hmac_value.nil?
104
+ invalid_properties.push('invalid value for "hmac_value", hmac_value cannot be nil.')
112
105
  end
113
106
 
114
107
  invalid_properties
@@ -117,11 +110,10 @@ module BleumiPay
117
110
  # Check to see if the all the properties in the model are valid
118
111
  # @return true if the model is valid
119
112
  def valid?
120
- return false if @buyer.nil?
121
- return false if @merchant.nil?
122
- return false if @wallet_library.nil?
123
- return false if @wallet_proxy.nil?
124
- return false if @salt.nil?
113
+ return false if @hmac_input.nil?
114
+ return false if @hmac_key_id.nil?
115
+ return false if @hmac_alg.nil?
116
+ return false if @hmac_value.nil?
125
117
  true
126
118
  end
127
119
 
@@ -130,11 +122,10 @@ module BleumiPay
130
122
  def ==(o)
131
123
  return true if self.equal?(o)
132
124
  self.class == o.class &&
133
- buyer == o.buyer &&
134
- merchant == o.merchant &&
135
- wallet_library == o.wallet_library &&
136
- wallet_proxy == o.wallet_proxy &&
137
- salt == o.salt
125
+ hmac_input == o.hmac_input &&
126
+ hmac_key_id == o.hmac_key_id &&
127
+ hmac_alg == o.hmac_alg &&
128
+ hmac_value == o.hmac_value
138
129
  end
139
130
 
140
131
  # @see the `==` method
@@ -146,7 +137,7 @@ module BleumiPay
146
137
  # Calculates hash code according to all attributes.
147
138
  # @return [Integer] Hash code
148
139
  def hash
149
- [buyer, merchant, wallet_library, wallet_proxy, salt].hash
140
+ [hmac_input, hmac_key_id, hmac_alg, hmac_value].hash
150
141
  end
151
142
 
152
143
  # Builds the object from hash
@@ -235,7 +226,11 @@ module BleumiPay
235
226
  hash = {}
236
227
  self.class.attribute_map.each_pair do |attr, param|
237
228
  value = self.send(attr)
238
- next if value.nil?
229
+ if value.nil?
230
+ is_nullable = self.class.openapi_nullable.include?(attr)
231
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
232
+ end
233
+
239
234
  hash[param] = _to_hash(value)
240
235
  end
241
236
  hash
@@ -0,0 +1,212 @@
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 ValidateCheckoutResponse
17
+ # true - The data has been generated by Bleumi Pay ; false - The data has not been generated by Bleumi Pay, the payment must be treated as unpaid
18
+ attr_accessor :valid
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'valid' => :'valid'
24
+ }
25
+ end
26
+
27
+ # Attribute type mapping.
28
+ def self.openapi_types
29
+ {
30
+ :'valid' => :'Boolean'
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::ValidateCheckoutResponse` 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::ValidateCheckoutResponse`. 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?(:'valid')
56
+ self.valid = attributes[:'valid']
57
+ end
58
+ end
59
+
60
+ # Show invalid properties with the reasons. Usually used together with valid?
61
+ # @return Array for valid properties with the reasons
62
+ def list_invalid_properties
63
+ invalid_properties = Array.new
64
+ if @valid.nil?
65
+ invalid_properties.push('invalid value for "valid", valid cannot be nil.')
66
+ end
67
+
68
+ invalid_properties
69
+ end
70
+
71
+ # Check to see if the all the properties in the model are valid
72
+ # @return true if the model is valid
73
+ def valid?
74
+ return false if @valid.nil?
75
+ true
76
+ end
77
+
78
+ # Checks equality by comparing each attribute.
79
+ # @param [Object] Object to be compared
80
+ def ==(o)
81
+ return true if self.equal?(o)
82
+ self.class == o.class &&
83
+ valid == o.valid
84
+ end
85
+
86
+ # @see the `==` method
87
+ # @param [Object] Object to be compared
88
+ def eql?(o)
89
+ self == o
90
+ end
91
+
92
+ # Calculates hash code according to all attributes.
93
+ # @return [Integer] Hash code
94
+ def hash
95
+ [valid].hash
96
+ end
97
+
98
+ # Builds the object from hash
99
+ # @param [Hash] attributes Model attributes in the form of hash
100
+ # @return [Object] Returns the model itself
101
+ def self.build_from_hash(attributes)
102
+ new.build_from_hash(attributes)
103
+ end
104
+
105
+ # Builds the object from hash
106
+ # @param [Hash] attributes Model attributes in the form of hash
107
+ # @return [Object] Returns the model itself
108
+ def build_from_hash(attributes)
109
+ return nil unless attributes.is_a?(Hash)
110
+ self.class.openapi_types.each_pair do |key, type|
111
+ if type =~ /\AArray<(.*)>/i
112
+ # check to ensure the input is an array given that the attribute
113
+ # is documented as an array but the input is not
114
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
115
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
116
+ end
117
+ elsif !attributes[self.class.attribute_map[key]].nil?
118
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
119
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
120
+ end
121
+
122
+ self
123
+ end
124
+
125
+ # Deserializes the data based on type
126
+ # @param string type Data type
127
+ # @param string value Value to be deserialized
128
+ # @return [Object] Deserialized data
129
+ def _deserialize(type, value)
130
+ case type.to_sym
131
+ when :DateTime
132
+ DateTime.parse(value)
133
+ when :Date
134
+ Date.parse(value)
135
+ when :String
136
+ value.to_s
137
+ when :Integer
138
+ value.to_i
139
+ when :Float
140
+ value.to_f
141
+ when :Boolean
142
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
143
+ true
144
+ else
145
+ false
146
+ end
147
+ when :Object
148
+ # generic object (usually a Hash), return directly
149
+ value
150
+ when /\AArray<(?<inner_type>.+)>\z/
151
+ inner_type = Regexp.last_match[:inner_type]
152
+ value.map { |v| _deserialize(inner_type, v) }
153
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
154
+ k_type = Regexp.last_match[:k_type]
155
+ v_type = Regexp.last_match[:v_type]
156
+ {}.tap do |hash|
157
+ value.each do |k, v|
158
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
159
+ end
160
+ end
161
+ else # model
162
+ BleumiPay.const_get(type).build_from_hash(value)
163
+ end
164
+ end
165
+
166
+ # Returns the string representation of the object
167
+ # @return [String] String presentation of the object
168
+ def to_s
169
+ to_hash.to_s
170
+ end
171
+
172
+ # to_body is an alias to to_hash (backward compatibility)
173
+ # @return [Hash] Returns the object in the form of hash
174
+ def to_body
175
+ to_hash
176
+ end
177
+
178
+ # Returns the object in the form of hash
179
+ # @return [Hash] Returns the object in the form of hash
180
+ def to_hash
181
+ hash = {}
182
+ self.class.attribute_map.each_pair do |attr, param|
183
+ value = self.send(attr)
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
+
189
+ hash[param] = _to_hash(value)
190
+ end
191
+ hash
192
+ end
193
+
194
+ # Outputs non-array value in the form of hash
195
+ # For object, use to_hash. Otherwise, just return the value
196
+ # @param [Object] value Any valid value
197
+ # @return [Hash] Returns the value in the form of hash
198
+ def _to_hash(value)
199
+ if value.is_a?(Array)
200
+ value.compact.map { |v| _to_hash(v) }
201
+ elsif value.is_a?(Hash)
202
+ {}.tap do |hash|
203
+ value.each { |k, v| hash[k] = _to_hash(v) }
204
+ end
205
+ elsif value.respond_to? :to_hash
206
+ value.to_hash
207
+ else
208
+ value
209
+ end
210
+ end
211
+ end
212
+ end
@@ -0,0 +1,212 @@
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 WalletAddress
17
+ # Wallet address for the payment in the network
18
+ attr_accessor :addr
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'addr' => :'addr'
24
+ }
25
+ end
26
+
27
+ # Attribute type mapping.
28
+ def self.openapi_types
29
+ {
30
+ :'addr' => :'String'
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::WalletAddress` 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::WalletAddress`. 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?(:'addr')
56
+ self.addr = attributes[:'addr']
57
+ end
58
+ end
59
+
60
+ # Show invalid properties with the reasons. Usually used together with valid?
61
+ # @return Array for valid properties with the reasons
62
+ def list_invalid_properties
63
+ invalid_properties = Array.new
64
+ if @addr.nil?
65
+ invalid_properties.push('invalid value for "addr", addr cannot be nil.')
66
+ end
67
+
68
+ invalid_properties
69
+ end
70
+
71
+ # Check to see if the all the properties in the model are valid
72
+ # @return true if the model is valid
73
+ def valid?
74
+ return false if @addr.nil?
75
+ true
76
+ end
77
+
78
+ # Checks equality by comparing each attribute.
79
+ # @param [Object] Object to be compared
80
+ def ==(o)
81
+ return true if self.equal?(o)
82
+ self.class == o.class &&
83
+ addr == o.addr
84
+ end
85
+
86
+ # @see the `==` method
87
+ # @param [Object] Object to be compared
88
+ def eql?(o)
89
+ self == o
90
+ end
91
+
92
+ # Calculates hash code according to all attributes.
93
+ # @return [Integer] Hash code
94
+ def hash
95
+ [addr].hash
96
+ end
97
+
98
+ # Builds the object from hash
99
+ # @param [Hash] attributes Model attributes in the form of hash
100
+ # @return [Object] Returns the model itself
101
+ def self.build_from_hash(attributes)
102
+ new.build_from_hash(attributes)
103
+ end
104
+
105
+ # Builds the object from hash
106
+ # @param [Hash] attributes Model attributes in the form of hash
107
+ # @return [Object] Returns the model itself
108
+ def build_from_hash(attributes)
109
+ return nil unless attributes.is_a?(Hash)
110
+ self.class.openapi_types.each_pair do |key, type|
111
+ if type =~ /\AArray<(.*)>/i
112
+ # check to ensure the input is an array given that the attribute
113
+ # is documented as an array but the input is not
114
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
115
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
116
+ end
117
+ elsif !attributes[self.class.attribute_map[key]].nil?
118
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
119
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
120
+ end
121
+
122
+ self
123
+ end
124
+
125
+ # Deserializes the data based on type
126
+ # @param string type Data type
127
+ # @param string value Value to be deserialized
128
+ # @return [Object] Deserialized data
129
+ def _deserialize(type, value)
130
+ case type.to_sym
131
+ when :DateTime
132
+ DateTime.parse(value)
133
+ when :Date
134
+ Date.parse(value)
135
+ when :String
136
+ value.to_s
137
+ when :Integer
138
+ value.to_i
139
+ when :Float
140
+ value.to_f
141
+ when :Boolean
142
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
143
+ true
144
+ else
145
+ false
146
+ end
147
+ when :Object
148
+ # generic object (usually a Hash), return directly
149
+ value
150
+ when /\AArray<(?<inner_type>.+)>\z/
151
+ inner_type = Regexp.last_match[:inner_type]
152
+ value.map { |v| _deserialize(inner_type, v) }
153
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
154
+ k_type = Regexp.last_match[:k_type]
155
+ v_type = Regexp.last_match[:v_type]
156
+ {}.tap do |hash|
157
+ value.each do |k, v|
158
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
159
+ end
160
+ end
161
+ else # model
162
+ BleumiPay.const_get(type).build_from_hash(value)
163
+ end
164
+ end
165
+
166
+ # Returns the string representation of the object
167
+ # @return [String] String presentation of the object
168
+ def to_s
169
+ to_hash.to_s
170
+ end
171
+
172
+ # to_body is an alias to to_hash (backward compatibility)
173
+ # @return [Hash] Returns the object in the form of hash
174
+ def to_body
175
+ to_hash
176
+ end
177
+
178
+ # Returns the object in the form of hash
179
+ # @return [Hash] Returns the object in the form of hash
180
+ def to_hash
181
+ hash = {}
182
+ self.class.attribute_map.each_pair do |attr, param|
183
+ value = self.send(attr)
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
+
189
+ hash[param] = _to_hash(value)
190
+ end
191
+ hash
192
+ end
193
+
194
+ # Outputs non-array value in the form of hash
195
+ # For object, use to_hash. Otherwise, just return the value
196
+ # @param [Object] value Any valid value
197
+ # @return [Hash] Returns the value in the form of hash
198
+ def _to_hash(value)
199
+ if value.is_a?(Array)
200
+ value.compact.map { |v| _to_hash(v) }
201
+ elsif value.is_a?(Hash)
202
+ {}.tap do |hash|
203
+ value.each { |k, v| hash[k] = _to_hash(v) }
204
+ end
205
+ elsif value.respond_to? :to_hash
206
+ value.to_hash
207
+ else
208
+ value
209
+ end
210
+ end
211
+ end
212
+ end