bleumi_pay_sdk_ruby 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +105 -0
  4. data/Rakefile +10 -0
  5. data/bleumi_pay_sdk_ruby.gemspec +39 -0
  6. data/docs/BadRequest.md +17 -0
  7. data/docs/Erc20PaymentsApi.md +318 -0
  8. data/docs/EthAddress.md +17 -0
  9. data/docs/EthNetwork.md +16 -0
  10. data/docs/PaginatedWalletOperations.md +8 -0
  11. data/docs/PaginatedWallets.md +8 -0
  12. data/docs/Wallet.md +29 -0
  13. data/docs/WalletBalance.md +23 -0
  14. data/docs/WalletCreateInput.md +21 -0
  15. data/docs/WalletCreateOutput.md +19 -0
  16. data/docs/WalletInputs.md +12 -0
  17. data/docs/WalletOperation.md +12 -0
  18. data/docs/WalletOperationInputs.md +21 -0
  19. data/docs/WalletOperationOutput.md +15 -0
  20. data/docs/WalletRefundOperationInput.md +15 -0
  21. data/docs/WalletSettleOperationInput.md +19 -0
  22. data/lib/bleumi_pay_sdk_ruby.rb +55 -0
  23. data/lib/bleumi_pay_sdk_ruby/api/erc20_payments_api.rb +482 -0
  24. data/lib/bleumi_pay_sdk_ruby/api_client.rb +386 -0
  25. data/lib/bleumi_pay_sdk_ruby/api_error.rb +57 -0
  26. data/lib/bleumi_pay_sdk_ruby/configuration.rb +248 -0
  27. data/lib/bleumi_pay_sdk_ruby/models/bad_request.rb +213 -0
  28. data/lib/bleumi_pay_sdk_ruby/models/eth_address.rb +208 -0
  29. data/lib/bleumi_pay_sdk_ruby/models/eth_network.rb +39 -0
  30. data/lib/bleumi_pay_sdk_ruby/models/paginated_wallet_operations.rb +214 -0
  31. data/lib/bleumi_pay_sdk_ruby/models/paginated_wallets.rb +214 -0
  32. data/lib/bleumi_pay_sdk_ruby/models/wallet.rb +293 -0
  33. data/lib/bleumi_pay_sdk_ruby/models/wallet_balance.rb +247 -0
  34. data/lib/bleumi_pay_sdk_ruby/models/wallet_create_input.rb +230 -0
  35. data/lib/bleumi_pay_sdk_ruby/models/wallet_create_output.rb +216 -0
  36. data/lib/bleumi_pay_sdk_ruby/models/wallet_inputs.rb +262 -0
  37. data/lib/bleumi_pay_sdk_ruby/models/wallet_operation.rb +256 -0
  38. data/lib/bleumi_pay_sdk_ruby/models/wallet_operation_inputs.rb +246 -0
  39. data/lib/bleumi_pay_sdk_ruby/models/wallet_operation_output.rb +202 -0
  40. data/lib/bleumi_pay_sdk_ruby/models/wallet_refund_operation_input.rb +201 -0
  41. data/lib/bleumi_pay_sdk_ruby/models/wallet_settle_operation_input.rb +216 -0
  42. data/lib/bleumi_pay_sdk_ruby/version.rb +15 -0
  43. data/spec/api/erc20_payments_api_spec.rb +120 -0
  44. data/spec/api_client_spec.rb +226 -0
  45. data/spec/configuration_spec.rb +42 -0
  46. data/spec/models/bad_request_spec.rb +47 -0
  47. data/spec/models/eth_address_spec.rb +41 -0
  48. data/spec/models/eth_network_spec.rb +35 -0
  49. data/spec/models/paginated_wallet_operations_spec.rb +47 -0
  50. data/spec/models/paginated_wallets_spec.rb +47 -0
  51. data/spec/models/wallet_balance_spec.rb +59 -0
  52. data/spec/models/wallet_create_input_spec.rb +53 -0
  53. data/spec/models/wallet_create_output_spec.rb +47 -0
  54. data/spec/models/wallet_inputs_spec.rb +65 -0
  55. data/spec/models/wallet_operation_inputs_spec.rb +59 -0
  56. data/spec/models/wallet_operation_output_spec.rb +41 -0
  57. data/spec/models/wallet_operation_spec.rb +65 -0
  58. data/spec/models/wallet_refund_operation_input_spec.rb +41 -0
  59. data/spec/models/wallet_settle_operation_input_spec.rb +47 -0
  60. data/spec/models/wallet_spec.rb +77 -0
  61. data/spec/spec_helper.rb +111 -0
  62. metadata +184 -0
@@ -0,0 +1,214 @@
1
+ =begin
2
+ #Bleumi Pay API
3
+
4
+ #A simple and powerful REST API to integrate ERC20 payments 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.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module BleumiPay
16
+ class PaginatedWalletOperations
17
+ # List of operations of the wallet in the current page
18
+ attr_accessor :results
19
+
20
+ # Cursor to fetch next page of results, empty if no more results
21
+ attr_accessor :next_token
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'results' => :'results',
27
+ :'next_token' => :'nextToken'
28
+ }
29
+ end
30
+
31
+ # Attribute type mapping.
32
+ def self.openapi_types
33
+ {
34
+ :'results' => :'Array<WalletOperation>',
35
+ :'next_token' => :'String'
36
+ }
37
+ end
38
+
39
+ # Initializes the object
40
+ # @param [Hash] attributes Model attributes in the form of hash
41
+ def initialize(attributes = {})
42
+ if (!attributes.is_a?(Hash))
43
+ fail ArgumentError, "The input argument (attributes) must be a hash in `BleumiPay::PaginatedWalletOperations` initialize method"
44
+ end
45
+
46
+ # check to see if the attribute exists and convert string to symbol for hash key
47
+ attributes = attributes.each_with_object({}) { |(k, v), h|
48
+ 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
50
+ end
51
+ h[k.to_sym] = v
52
+ }
53
+
54
+ if attributes.key?(:'results')
55
+ if (value = attributes[:'results']).is_a?(Array)
56
+ self.results = value
57
+ end
58
+ end
59
+
60
+ if attributes.key?(:'next_token')
61
+ self.next_token = attributes[:'next_token']
62
+ end
63
+ end
64
+
65
+ # Show invalid properties with the reasons. Usually used together with valid?
66
+ # @return Array for valid properties with the reasons
67
+ def list_invalid_properties
68
+ invalid_properties = Array.new
69
+ if @results.nil?
70
+ invalid_properties.push('invalid value for "results", results cannot be nil.')
71
+ end
72
+
73
+ invalid_properties
74
+ end
75
+
76
+ # Check to see if the all the properties in the model are valid
77
+ # @return true if the model is valid
78
+ def valid?
79
+ return false if @results.nil?
80
+ true
81
+ end
82
+
83
+ # Checks equality by comparing each attribute.
84
+ # @param [Object] Object to be compared
85
+ def ==(o)
86
+ return true if self.equal?(o)
87
+ self.class == o.class &&
88
+ results == o.results &&
89
+ next_token == o.next_token
90
+ end
91
+
92
+ # @see the `==` method
93
+ # @param [Object] Object to be compared
94
+ def eql?(o)
95
+ self == o
96
+ end
97
+
98
+ # Calculates hash code according to all attributes.
99
+ # @return [Integer] Hash code
100
+ def hash
101
+ [results, next_token].hash
102
+ end
103
+
104
+ # Builds the object from hash
105
+ # @param [Hash] attributes Model attributes in the form of hash
106
+ # @return [Object] Returns the model itself
107
+ def self.build_from_hash(attributes)
108
+ new.build_from_hash(attributes)
109
+ end
110
+
111
+ # Builds the object from hash
112
+ # @param [Hash] attributes Model attributes in the form of hash
113
+ # @return [Object] Returns the model itself
114
+ def build_from_hash(attributes)
115
+ return nil unless attributes.is_a?(Hash)
116
+ self.class.openapi_types.each_pair do |key, type|
117
+ if type =~ /\AArray<(.*)>/i
118
+ # check to ensure the input is an array given that the attribute
119
+ # is documented as an array but the input is not
120
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
121
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
122
+ end
123
+ elsif !attributes[self.class.attribute_map[key]].nil?
124
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
125
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
126
+ end
127
+
128
+ self
129
+ end
130
+
131
+ # Deserializes the data based on type
132
+ # @param string type Data type
133
+ # @param string value Value to be deserialized
134
+ # @return [Object] Deserialized data
135
+ def _deserialize(type, value)
136
+ case type.to_sym
137
+ when :DateTime
138
+ DateTime.parse(value)
139
+ when :Date
140
+ Date.parse(value)
141
+ when :String
142
+ value.to_s
143
+ when :Integer
144
+ value.to_i
145
+ when :Float
146
+ value.to_f
147
+ when :Boolean
148
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
149
+ true
150
+ else
151
+ false
152
+ end
153
+ when :Object
154
+ # generic object (usually a Hash), return directly
155
+ value
156
+ when /\AArray<(?<inner_type>.+)>\z/
157
+ inner_type = Regexp.last_match[:inner_type]
158
+ value.map { |v| _deserialize(inner_type, v) }
159
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
160
+ k_type = Regexp.last_match[:k_type]
161
+ v_type = Regexp.last_match[:v_type]
162
+ {}.tap do |hash|
163
+ value.each do |k, v|
164
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
165
+ end
166
+ end
167
+ else # model
168
+ BleumiPay.const_get(type).build_from_hash(value)
169
+ end
170
+ end
171
+
172
+ # Returns the string representation of the object
173
+ # @return [String] String presentation of the object
174
+ def to_s
175
+ to_hash.to_s
176
+ end
177
+
178
+ # to_body is an alias to to_hash (backward compatibility)
179
+ # @return [Hash] Returns the object in the form of hash
180
+ def to_body
181
+ to_hash
182
+ end
183
+
184
+ # Returns the object in the form of hash
185
+ # @return [Hash] Returns the object in the form of hash
186
+ def to_hash
187
+ hash = {}
188
+ self.class.attribute_map.each_pair do |attr, param|
189
+ value = self.send(attr)
190
+ next if value.nil?
191
+ hash[param] = _to_hash(value)
192
+ end
193
+ hash
194
+ end
195
+
196
+ # Outputs non-array value in the form of hash
197
+ # For object, use to_hash. Otherwise, just return the value
198
+ # @param [Object] value Any valid value
199
+ # @return [Hash] Returns the value in the form of hash
200
+ def _to_hash(value)
201
+ if value.is_a?(Array)
202
+ value.compact.map { |v| _to_hash(v) }
203
+ elsif value.is_a?(Hash)
204
+ {}.tap do |hash|
205
+ value.each { |k, v| hash[k] = _to_hash(v) }
206
+ end
207
+ elsif value.respond_to? :to_hash
208
+ value.to_hash
209
+ else
210
+ value
211
+ end
212
+ end
213
+ end
214
+ end
@@ -0,0 +1,214 @@
1
+ =begin
2
+ #Bleumi Pay API
3
+
4
+ #A simple and powerful REST API to integrate ERC20 payments 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.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module BleumiPay
16
+ class PaginatedWallets
17
+ # List of wallets in the current page
18
+ attr_accessor :results
19
+
20
+ # Cursor to fetch next page of results, empty if no more results
21
+ attr_accessor :next_token
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'results' => :'results',
27
+ :'next_token' => :'nextToken'
28
+ }
29
+ end
30
+
31
+ # Attribute type mapping.
32
+ def self.openapi_types
33
+ {
34
+ :'results' => :'Array<Wallet>',
35
+ :'next_token' => :'String'
36
+ }
37
+ end
38
+
39
+ # Initializes the object
40
+ # @param [Hash] attributes Model attributes in the form of hash
41
+ def initialize(attributes = {})
42
+ if (!attributes.is_a?(Hash))
43
+ fail ArgumentError, "The input argument (attributes) must be a hash in `BleumiPay::PaginatedWallets` initialize method"
44
+ end
45
+
46
+ # check to see if the attribute exists and convert string to symbol for hash key
47
+ attributes = attributes.each_with_object({}) { |(k, v), h|
48
+ 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
50
+ end
51
+ h[k.to_sym] = v
52
+ }
53
+
54
+ if attributes.key?(:'results')
55
+ if (value = attributes[:'results']).is_a?(Array)
56
+ self.results = value
57
+ end
58
+ end
59
+
60
+ if attributes.key?(:'next_token')
61
+ self.next_token = attributes[:'next_token']
62
+ end
63
+ end
64
+
65
+ # Show invalid properties with the reasons. Usually used together with valid?
66
+ # @return Array for valid properties with the reasons
67
+ def list_invalid_properties
68
+ invalid_properties = Array.new
69
+ if @results.nil?
70
+ invalid_properties.push('invalid value for "results", results cannot be nil.')
71
+ end
72
+
73
+ invalid_properties
74
+ end
75
+
76
+ # Check to see if the all the properties in the model are valid
77
+ # @return true if the model is valid
78
+ def valid?
79
+ return false if @results.nil?
80
+ true
81
+ end
82
+
83
+ # Checks equality by comparing each attribute.
84
+ # @param [Object] Object to be compared
85
+ def ==(o)
86
+ return true if self.equal?(o)
87
+ self.class == o.class &&
88
+ results == o.results &&
89
+ next_token == o.next_token
90
+ end
91
+
92
+ # @see the `==` method
93
+ # @param [Object] Object to be compared
94
+ def eql?(o)
95
+ self == o
96
+ end
97
+
98
+ # Calculates hash code according to all attributes.
99
+ # @return [Integer] Hash code
100
+ def hash
101
+ [results, next_token].hash
102
+ end
103
+
104
+ # Builds the object from hash
105
+ # @param [Hash] attributes Model attributes in the form of hash
106
+ # @return [Object] Returns the model itself
107
+ def self.build_from_hash(attributes)
108
+ new.build_from_hash(attributes)
109
+ end
110
+
111
+ # Builds the object from hash
112
+ # @param [Hash] attributes Model attributes in the form of hash
113
+ # @return [Object] Returns the model itself
114
+ def build_from_hash(attributes)
115
+ return nil unless attributes.is_a?(Hash)
116
+ self.class.openapi_types.each_pair do |key, type|
117
+ if type =~ /\AArray<(.*)>/i
118
+ # check to ensure the input is an array given that the attribute
119
+ # is documented as an array but the input is not
120
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
121
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
122
+ end
123
+ elsif !attributes[self.class.attribute_map[key]].nil?
124
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
125
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
126
+ end
127
+
128
+ self
129
+ end
130
+
131
+ # Deserializes the data based on type
132
+ # @param string type Data type
133
+ # @param string value Value to be deserialized
134
+ # @return [Object] Deserialized data
135
+ def _deserialize(type, value)
136
+ case type.to_sym
137
+ when :DateTime
138
+ DateTime.parse(value)
139
+ when :Date
140
+ Date.parse(value)
141
+ when :String
142
+ value.to_s
143
+ when :Integer
144
+ value.to_i
145
+ when :Float
146
+ value.to_f
147
+ when :Boolean
148
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
149
+ true
150
+ else
151
+ false
152
+ end
153
+ when :Object
154
+ # generic object (usually a Hash), return directly
155
+ value
156
+ when /\AArray<(?<inner_type>.+)>\z/
157
+ inner_type = Regexp.last_match[:inner_type]
158
+ value.map { |v| _deserialize(inner_type, v) }
159
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
160
+ k_type = Regexp.last_match[:k_type]
161
+ v_type = Regexp.last_match[:v_type]
162
+ {}.tap do |hash|
163
+ value.each do |k, v|
164
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
165
+ end
166
+ end
167
+ else # model
168
+ BleumiPay.const_get(type).build_from_hash(value)
169
+ end
170
+ end
171
+
172
+ # Returns the string representation of the object
173
+ # @return [String] String presentation of the object
174
+ def to_s
175
+ to_hash.to_s
176
+ end
177
+
178
+ # to_body is an alias to to_hash (backward compatibility)
179
+ # @return [Hash] Returns the object in the form of hash
180
+ def to_body
181
+ to_hash
182
+ end
183
+
184
+ # Returns the object in the form of hash
185
+ # @return [Hash] Returns the object in the form of hash
186
+ def to_hash
187
+ hash = {}
188
+ self.class.attribute_map.each_pair do |attr, param|
189
+ value = self.send(attr)
190
+ next if value.nil?
191
+ hash[param] = _to_hash(value)
192
+ end
193
+ hash
194
+ end
195
+
196
+ # Outputs non-array value in the form of hash
197
+ # For object, use to_hash. Otherwise, just return the value
198
+ # @param [Object] value Any valid value
199
+ # @return [Hash] Returns the value in the form of hash
200
+ def _to_hash(value)
201
+ if value.is_a?(Array)
202
+ value.compact.map { |v| _to_hash(v) }
203
+ elsif value.is_a?(Hash)
204
+ {}.tap do |hash|
205
+ value.each { |k, v| hash[k] = _to_hash(v) }
206
+ end
207
+ elsif value.respond_to? :to_hash
208
+ value.to_hash
209
+ else
210
+ value
211
+ end
212
+ end
213
+ end
214
+ end
@@ -0,0 +1,293 @@
1
+ =begin
2
+ #Bleumi Pay API
3
+
4
+ #A simple and powerful REST API to integrate ERC20 payments 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.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module BleumiPay
16
+ class Wallet
17
+ # Unique ID identifying the wallet; specified when it was created by your system
18
+ attr_accessor :id
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
22
+
23
+ # Wallet address
24
+ attr_accessor :addr
25
+
26
+ # The current token balance
27
+ attr_accessor :balances
28
+
29
+ attr_accessor :inputs
30
+
31
+ # UNIX timestamp when the wallet was created
32
+ attr_accessor :created_at
33
+
34
+ # UNIX timestamp when the lastest operation was performed
35
+ attr_accessor :updated_at
36
+
37
+ # Attribute mapping from ruby-style variable name to JSON key.
38
+ def self.attribute_map
39
+ {
40
+ :'id' => :'id',
41
+ :'chain' => :'chain',
42
+ :'addr' => :'addr',
43
+ :'balances' => :'balances',
44
+ :'inputs' => :'inputs',
45
+ :'created_at' => :'createdAt',
46
+ :'updated_at' => :'updatedAt'
47
+ }
48
+ end
49
+
50
+ # Attribute type mapping.
51
+ def self.openapi_types
52
+ {
53
+ :'id' => :'String',
54
+ :'chain' => :'String',
55
+ :'addr' => :'String',
56
+ :'balances' => :'Hash<String, WalletBalance>',
57
+ :'inputs' => :'WalletInputs',
58
+ :'created_at' => :'Integer',
59
+ :'updated_at' => :'Integer'
60
+ }
61
+ end
62
+
63
+ # Initializes the object
64
+ # @param [Hash] attributes Model attributes in the form of hash
65
+ def initialize(attributes = {})
66
+ if (!attributes.is_a?(Hash))
67
+ fail ArgumentError, "The input argument (attributes) must be a hash in `BleumiPay::Wallet` initialize method"
68
+ end
69
+
70
+ # check to see if the attribute exists and convert string to symbol for hash key
71
+ attributes = attributes.each_with_object({}) { |(k, v), h|
72
+ 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
74
+ end
75
+ h[k.to_sym] = v
76
+ }
77
+
78
+ if attributes.key?(:'id')
79
+ self.id = attributes[:'id']
80
+ end
81
+
82
+ if attributes.key?(:'chain')
83
+ self.chain = attributes[:'chain']
84
+ end
85
+
86
+ if attributes.key?(:'addr')
87
+ self.addr = attributes[:'addr']
88
+ end
89
+
90
+ 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']
98
+ end
99
+
100
+ if attributes.key?(:'created_at')
101
+ self.created_at = attributes[:'created_at']
102
+ end
103
+
104
+ if attributes.key?(:'updated_at')
105
+ self.updated_at = attributes[:'updated_at']
106
+ end
107
+ end
108
+
109
+ # Show invalid properties with the reasons. Usually used together with valid?
110
+ # @return Array for valid properties with the reasons
111
+ def list_invalid_properties
112
+ invalid_properties = Array.new
113
+ if @id.nil?
114
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
115
+ end
116
+
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.')
123
+ end
124
+
125
+ if @balances.nil?
126
+ invalid_properties.push('invalid value for "balances", balances cannot be nil.')
127
+ end
128
+
129
+ if @inputs.nil?
130
+ invalid_properties.push('invalid value for "inputs", inputs cannot be nil.')
131
+ end
132
+
133
+ if @created_at.nil?
134
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
135
+ end
136
+
137
+ if @updated_at.nil?
138
+ invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
139
+ end
140
+
141
+ invalid_properties
142
+ end
143
+
144
+ # Check to see if the all the properties in the model are valid
145
+ # @return true if the model is valid
146
+ def valid?
147
+ return false if @id.nil?
148
+ return false if @chain.nil?
149
+ return false if @addr.nil?
150
+ return false if @balances.nil?
151
+ return false if @inputs.nil?
152
+ return false if @created_at.nil?
153
+ return false if @updated_at.nil?
154
+ true
155
+ end
156
+
157
+ # Checks equality by comparing each attribute.
158
+ # @param [Object] Object to be compared
159
+ def ==(o)
160
+ return true if self.equal?(o)
161
+ self.class == o.class &&
162
+ id == o.id &&
163
+ chain == o.chain &&
164
+ addr == o.addr &&
165
+ balances == o.balances &&
166
+ inputs == o.inputs &&
167
+ created_at == o.created_at &&
168
+ updated_at == o.updated_at
169
+ end
170
+
171
+ # @see the `==` method
172
+ # @param [Object] Object to be compared
173
+ def eql?(o)
174
+ self == o
175
+ end
176
+
177
+ # Calculates hash code according to all attributes.
178
+ # @return [Integer] Hash code
179
+ def hash
180
+ [id, chain, addr, balances, inputs, created_at, updated_at].hash
181
+ end
182
+
183
+ # Builds the object from hash
184
+ # @param [Hash] attributes Model attributes in the form of hash
185
+ # @return [Object] Returns the model itself
186
+ def self.build_from_hash(attributes)
187
+ new.build_from_hash(attributes)
188
+ end
189
+
190
+ # Builds the object from hash
191
+ # @param [Hash] attributes Model attributes in the form of hash
192
+ # @return [Object] Returns the model itself
193
+ def build_from_hash(attributes)
194
+ return nil unless attributes.is_a?(Hash)
195
+ self.class.openapi_types.each_pair do |key, type|
196
+ if type =~ /\AArray<(.*)>/i
197
+ # check to ensure the input is an array given that the attribute
198
+ # is documented as an array but the input is not
199
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
200
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
201
+ end
202
+ elsif !attributes[self.class.attribute_map[key]].nil?
203
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
204
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
205
+ end
206
+
207
+ self
208
+ end
209
+
210
+ # Deserializes the data based on type
211
+ # @param string type Data type
212
+ # @param string value Value to be deserialized
213
+ # @return [Object] Deserialized data
214
+ def _deserialize(type, value)
215
+ case type.to_sym
216
+ when :DateTime
217
+ DateTime.parse(value)
218
+ when :Date
219
+ Date.parse(value)
220
+ when :String
221
+ value.to_s
222
+ when :Integer
223
+ value.to_i
224
+ when :Float
225
+ value.to_f
226
+ when :Boolean
227
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
228
+ true
229
+ else
230
+ false
231
+ end
232
+ when :Object
233
+ # generic object (usually a Hash), return directly
234
+ value
235
+ when /\AArray<(?<inner_type>.+)>\z/
236
+ inner_type = Regexp.last_match[:inner_type]
237
+ value.map { |v| _deserialize(inner_type, v) }
238
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
239
+ k_type = Regexp.last_match[:k_type]
240
+ v_type = Regexp.last_match[:v_type]
241
+ {}.tap do |hash|
242
+ value.each do |k, v|
243
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
244
+ end
245
+ end
246
+ else # model
247
+ BleumiPay.const_get(type).build_from_hash(value)
248
+ end
249
+ end
250
+
251
+ # Returns the string representation of the object
252
+ # @return [String] String presentation of the object
253
+ def to_s
254
+ to_hash.to_s
255
+ end
256
+
257
+ # to_body is an alias to to_hash (backward compatibility)
258
+ # @return [Hash] Returns the object in the form of hash
259
+ def to_body
260
+ to_hash
261
+ end
262
+
263
+ # Returns the object in the form of hash
264
+ # @return [Hash] Returns the object in the form of hash
265
+ def to_hash
266
+ hash = {}
267
+ self.class.attribute_map.each_pair do |attr, param|
268
+ value = self.send(attr)
269
+ next if value.nil?
270
+ hash[param] = _to_hash(value)
271
+ end
272
+ hash
273
+ end
274
+
275
+ # Outputs non-array value in the form of hash
276
+ # For object, use to_hash. Otherwise, just return the value
277
+ # @param [Object] value Any valid value
278
+ # @return [Hash] Returns the value in the form of hash
279
+ def _to_hash(value)
280
+ if value.is_a?(Array)
281
+ value.compact.map { |v| _to_hash(v) }
282
+ elsif value.is_a?(Hash)
283
+ {}.tap do |hash|
284
+ value.each { |k, v| hash[k] = _to_hash(v) }
285
+ end
286
+ elsif value.respond_to? :to_hash
287
+ value.to_hash
288
+ else
289
+ value
290
+ end
291
+ end
292
+ end
293
+ end