weft-sdk 0.2.1

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 (81) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +9 -0
  3. data/docs/APIKeysApi.md +208 -0
  4. data/docs/AccountApi.md +72 -0
  5. data/docs/AccountDetails.md +30 -0
  6. data/docs/Agent.md +38 -0
  7. data/docs/AgentListResponse.md +20 -0
  8. data/docs/AgentResponse.md +18 -0
  9. data/docs/AgentStats.md +30 -0
  10. data/docs/AgentsApi.md +147 -0
  11. data/docs/ApiKey.md +28 -0
  12. data/docs/ApiKeyCreated.md +26 -0
  13. data/docs/ApiKeyCreatedResponse.md +18 -0
  14. data/docs/ApiKeyListResponse.md +18 -0
  15. data/docs/AuthApi.md +385 -0
  16. data/docs/AuthResponse.md +18 -0
  17. data/docs/AuthResponseData.md +22 -0
  18. data/docs/ConfirmRequest.md +18 -0
  19. data/docs/CreateApiKeyRequest.md +18 -0
  20. data/docs/DefaultApi.md +67 -0
  21. data/docs/Error.md +24 -0
  22. data/docs/ErrorResponse.md +18 -0
  23. data/docs/MeResponse.md +18 -0
  24. data/docs/MessageResponse.md +18 -0
  25. data/docs/MessageResponseData.md +18 -0
  26. data/docs/Pagination.md +24 -0
  27. data/docs/PasswordResetRequest.md +18 -0
  28. data/docs/PasswordUpdateRequest.md +22 -0
  29. data/docs/Payment.md +44 -0
  30. data/docs/PaymentListResponse.md +20 -0
  31. data/docs/PaymentResponse.md +18 -0
  32. data/docs/PaymentsApi.md +147 -0
  33. data/docs/ResendConfirmationRequest.md +18 -0
  34. data/docs/SignInRequest.md +20 -0
  35. data/docs/SignUpRequest.md +22 -0
  36. data/docs/User.md +22 -0
  37. data/lib/weft/facilitator/client.rb +89 -0
  38. data/lib/weft/facilitator/fee.rb +47 -0
  39. data/lib/weft/facilitator/middleware.rb +190 -0
  40. data/lib/weft/generated/api/account_api.rb +77 -0
  41. data/lib/weft/generated/api/agents_api.rb +148 -0
  42. data/lib/weft/generated/api/api_keys_api.rb +204 -0
  43. data/lib/weft/generated/api/auth_api.rb +418 -0
  44. data/lib/weft/generated/api/default_api.rb +77 -0
  45. data/lib/weft/generated/api/payments_api.rb +148 -0
  46. data/lib/weft/generated/api_client.rb +397 -0
  47. data/lib/weft/generated/api_error.rb +58 -0
  48. data/lib/weft/generated/api_model_base.rb +88 -0
  49. data/lib/weft/generated/configuration.rb +317 -0
  50. data/lib/weft/generated/models/account_details.rb +310 -0
  51. data/lib/weft/generated/models/agent.rb +417 -0
  52. data/lib/weft/generated/models/agent_list_response.rb +192 -0
  53. data/lib/weft/generated/models/agent_response.rb +164 -0
  54. data/lib/weft/generated/models/agent_stats.rb +201 -0
  55. data/lib/weft/generated/models/api_key.rb +244 -0
  56. data/lib/weft/generated/models/api_key_created.rb +252 -0
  57. data/lib/weft/generated/models/api_key_created_response.rb +164 -0
  58. data/lib/weft/generated/models/api_key_list_response.rb +166 -0
  59. data/lib/weft/generated/models/auth_response.rb +164 -0
  60. data/lib/weft/generated/models/auth_response_data.rb +199 -0
  61. data/lib/weft/generated/models/confirm_request.rb +164 -0
  62. data/lib/weft/generated/models/create_api_key_request.rb +148 -0
  63. data/lib/weft/generated/models/error.rb +208 -0
  64. data/lib/weft/generated/models/error_response.rb +164 -0
  65. data/lib/weft/generated/models/me_response.rb +164 -0
  66. data/lib/weft/generated/models/message_response.rb +164 -0
  67. data/lib/weft/generated/models/message_response_data.rb +164 -0
  68. data/lib/weft/generated/models/pagination.rb +242 -0
  69. data/lib/weft/generated/models/password_reset_request.rb +164 -0
  70. data/lib/weft/generated/models/password_update_request.rb +216 -0
  71. data/lib/weft/generated/models/payment.rb +437 -0
  72. data/lib/weft/generated/models/payment_list_response.rb +192 -0
  73. data/lib/weft/generated/models/payment_response.rb +164 -0
  74. data/lib/weft/generated/models/resend_confirmation_request.rb +164 -0
  75. data/lib/weft/generated/models/sign_in_request.rb +190 -0
  76. data/lib/weft/generated/models/sign_up_request.rb +216 -0
  77. data/lib/weft/generated/models/user.rb +199 -0
  78. data/lib/weft/generated/version.rb +15 -0
  79. data/lib/weft/generated.rb +4 -0
  80. data/lib/weft/sdk.rb +10 -0
  81. metadata +123 -0
@@ -0,0 +1,216 @@
1
+ =begin
2
+ #Weft API
3
+
4
+ #API for agent-first payments and discovery.
5
+
6
+ The version of the OpenAPI document: 0.2.1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.19.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Weft
17
+ class PasswordUpdateRequest < ApiModelBase
18
+ attr_accessor :reset_password_token
19
+
20
+ attr_accessor :password
21
+
22
+ attr_accessor :password_confirmation
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'reset_password_token' => :'reset_password_token',
28
+ :'password' => :'password',
29
+ :'password_confirmation' => :'password_confirmation'
30
+ }
31
+ end
32
+
33
+ # Returns attribute mapping this model knows about
34
+ def self.acceptable_attribute_map
35
+ attribute_map
36
+ end
37
+
38
+ # Returns all the JSON keys this model knows about
39
+ def self.acceptable_attributes
40
+ acceptable_attribute_map.values
41
+ end
42
+
43
+ # Attribute type mapping.
44
+ def self.openapi_types
45
+ {
46
+ :'reset_password_token' => :'String',
47
+ :'password' => :'String',
48
+ :'password_confirmation' => :'String'
49
+ }
50
+ end
51
+
52
+ # List of attributes with nullable: true
53
+ def self.openapi_nullable
54
+ Set.new([
55
+ ])
56
+ end
57
+
58
+ # Initializes the object
59
+ # @param [Hash] attributes Model attributes in the form of hash
60
+ def initialize(attributes = {})
61
+ if (!attributes.is_a?(Hash))
62
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Weft::PasswordUpdateRequest` initialize method"
63
+ end
64
+
65
+ # check to see if the attribute exists and convert string to symbol for hash key
66
+ acceptable_attribute_map = self.class.acceptable_attribute_map
67
+ attributes = attributes.each_with_object({}) { |(k, v), h|
68
+ if (!acceptable_attribute_map.key?(k.to_sym))
69
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Weft::PasswordUpdateRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
70
+ end
71
+ h[k.to_sym] = v
72
+ }
73
+
74
+ if attributes.key?(:'reset_password_token')
75
+ self.reset_password_token = attributes[:'reset_password_token']
76
+ else
77
+ self.reset_password_token = nil
78
+ end
79
+
80
+ if attributes.key?(:'password')
81
+ self.password = attributes[:'password']
82
+ else
83
+ self.password = nil
84
+ end
85
+
86
+ if attributes.key?(:'password_confirmation')
87
+ self.password_confirmation = attributes[:'password_confirmation']
88
+ else
89
+ self.password_confirmation = nil
90
+ end
91
+ end
92
+
93
+ # Show invalid properties with the reasons. Usually used together with valid?
94
+ # @return Array for valid properties with the reasons
95
+ def list_invalid_properties
96
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
97
+ invalid_properties = Array.new
98
+ if @reset_password_token.nil?
99
+ invalid_properties.push('invalid value for "reset_password_token", reset_password_token cannot be nil.')
100
+ end
101
+
102
+ if @password.nil?
103
+ invalid_properties.push('invalid value for "password", password cannot be nil.')
104
+ end
105
+
106
+ if @password_confirmation.nil?
107
+ invalid_properties.push('invalid value for "password_confirmation", password_confirmation cannot be nil.')
108
+ end
109
+
110
+ invalid_properties
111
+ end
112
+
113
+ # Check to see if the all the properties in the model are valid
114
+ # @return true if the model is valid
115
+ def valid?
116
+ warn '[DEPRECATED] the `valid?` method is obsolete'
117
+ return false if @reset_password_token.nil?
118
+ return false if @password.nil?
119
+ return false if @password_confirmation.nil?
120
+ true
121
+ end
122
+
123
+ # Custom attribute writer method with validation
124
+ # @param [Object] reset_password_token Value to be assigned
125
+ def reset_password_token=(reset_password_token)
126
+ if reset_password_token.nil?
127
+ fail ArgumentError, 'reset_password_token cannot be nil'
128
+ end
129
+
130
+ @reset_password_token = reset_password_token
131
+ end
132
+
133
+ # Custom attribute writer method with validation
134
+ # @param [Object] password Value to be assigned
135
+ def password=(password)
136
+ if password.nil?
137
+ fail ArgumentError, 'password cannot be nil'
138
+ end
139
+
140
+ @password = password
141
+ end
142
+
143
+ # Custom attribute writer method with validation
144
+ # @param [Object] password_confirmation Value to be assigned
145
+ def password_confirmation=(password_confirmation)
146
+ if password_confirmation.nil?
147
+ fail ArgumentError, 'password_confirmation cannot be nil'
148
+ end
149
+
150
+ @password_confirmation = password_confirmation
151
+ end
152
+
153
+ # Checks equality by comparing each attribute.
154
+ # @param [Object] Object to be compared
155
+ def ==(o)
156
+ return true if self.equal?(o)
157
+ self.class == o.class &&
158
+ reset_password_token == o.reset_password_token &&
159
+ password == o.password &&
160
+ password_confirmation == o.password_confirmation
161
+ end
162
+
163
+ # @see the `==` method
164
+ # @param [Object] Object to be compared
165
+ def eql?(o)
166
+ self == o
167
+ end
168
+
169
+ # Calculates hash code according to all attributes.
170
+ # @return [Integer] Hash code
171
+ def hash
172
+ [reset_password_token, password, password_confirmation].hash
173
+ end
174
+
175
+ # Builds the object from hash
176
+ # @param [Hash] attributes Model attributes in the form of hash
177
+ # @return [Object] Returns the model itself
178
+ def self.build_from_hash(attributes)
179
+ return nil unless attributes.is_a?(Hash)
180
+ attributes = attributes.transform_keys(&:to_sym)
181
+ transformed_hash = {}
182
+ openapi_types.each_pair do |key, type|
183
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
184
+ transformed_hash["#{key}"] = nil
185
+ elsif 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[attribute_map[key]].is_a?(Array)
189
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
190
+ end
191
+ elsif !attributes[attribute_map[key]].nil?
192
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
193
+ end
194
+ end
195
+ new(transformed_hash)
196
+ end
197
+
198
+ # Returns the object in the form of hash
199
+ # @return [Hash] Returns the object in the form of hash
200
+ def to_hash
201
+ hash = {}
202
+ self.class.attribute_map.each_pair do |attr, param|
203
+ value = self.send(attr)
204
+ if value.nil?
205
+ is_nullable = self.class.openapi_nullable.include?(attr)
206
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
207
+ end
208
+
209
+ hash[param] = _to_hash(value)
210
+ end
211
+ hash
212
+ end
213
+
214
+ end
215
+
216
+ end
@@ -0,0 +1,437 @@
1
+ =begin
2
+ #Weft API
3
+
4
+ #API for agent-first payments and discovery.
5
+
6
+ The version of the OpenAPI document: 0.2.1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.19.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Weft
17
+ class Payment < ApiModelBase
18
+ attr_accessor :id
19
+
20
+ attr_accessor :tx_hash
21
+
22
+ attr_accessor :payer_address
23
+
24
+ attr_accessor :recipient_address
25
+
26
+ # Amount in atomic units (1 USDC = 1,000,000)
27
+ attr_accessor :amount
28
+
29
+ # Human-readable amount (e.g. \"1.00 USDC\")
30
+ attr_accessor :amount_formatted
31
+
32
+ attr_accessor :currency
33
+
34
+ # CAIP-2 chain identifier
35
+ attr_accessor :network
36
+
37
+ attr_accessor :resource_url
38
+
39
+ attr_accessor :resource_host
40
+
41
+ attr_accessor :fee_amount
42
+
43
+ attr_accessor :settlement_latency_ms
44
+
45
+ attr_accessor :settled_at
46
+
47
+ attr_accessor :api_key_name
48
+
49
+ # Attribute mapping from ruby-style variable name to JSON key.
50
+ def self.attribute_map
51
+ {
52
+ :'id' => :'id',
53
+ :'tx_hash' => :'tx_hash',
54
+ :'payer_address' => :'payer_address',
55
+ :'recipient_address' => :'recipient_address',
56
+ :'amount' => :'amount',
57
+ :'amount_formatted' => :'amount_formatted',
58
+ :'currency' => :'currency',
59
+ :'network' => :'network',
60
+ :'resource_url' => :'resource_url',
61
+ :'resource_host' => :'resource_host',
62
+ :'fee_amount' => :'fee_amount',
63
+ :'settlement_latency_ms' => :'settlement_latency_ms',
64
+ :'settled_at' => :'settled_at',
65
+ :'api_key_name' => :'api_key_name'
66
+ }
67
+ end
68
+
69
+ # Returns attribute mapping this model knows about
70
+ def self.acceptable_attribute_map
71
+ attribute_map
72
+ end
73
+
74
+ # Returns all the JSON keys this model knows about
75
+ def self.acceptable_attributes
76
+ acceptable_attribute_map.values
77
+ end
78
+
79
+ # Attribute type mapping.
80
+ def self.openapi_types
81
+ {
82
+ :'id' => :'Integer',
83
+ :'tx_hash' => :'String',
84
+ :'payer_address' => :'String',
85
+ :'recipient_address' => :'String',
86
+ :'amount' => :'Integer',
87
+ :'amount_formatted' => :'String',
88
+ :'currency' => :'String',
89
+ :'network' => :'String',
90
+ :'resource_url' => :'String',
91
+ :'resource_host' => :'String',
92
+ :'fee_amount' => :'Integer',
93
+ :'settlement_latency_ms' => :'Integer',
94
+ :'settled_at' => :'Time',
95
+ :'api_key_name' => :'String'
96
+ }
97
+ end
98
+
99
+ # List of attributes with nullable: true
100
+ def self.openapi_nullable
101
+ Set.new([
102
+ ])
103
+ end
104
+
105
+ # Initializes the object
106
+ # @param [Hash] attributes Model attributes in the form of hash
107
+ def initialize(attributes = {})
108
+ if (!attributes.is_a?(Hash))
109
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Weft::Payment` initialize method"
110
+ end
111
+
112
+ # check to see if the attribute exists and convert string to symbol for hash key
113
+ acceptable_attribute_map = self.class.acceptable_attribute_map
114
+ attributes = attributes.each_with_object({}) { |(k, v), h|
115
+ if (!acceptable_attribute_map.key?(k.to_sym))
116
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Weft::Payment`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
117
+ end
118
+ h[k.to_sym] = v
119
+ }
120
+
121
+ if attributes.key?(:'id')
122
+ self.id = attributes[:'id']
123
+ else
124
+ self.id = nil
125
+ end
126
+
127
+ if attributes.key?(:'tx_hash')
128
+ self.tx_hash = attributes[:'tx_hash']
129
+ else
130
+ self.tx_hash = nil
131
+ end
132
+
133
+ if attributes.key?(:'payer_address')
134
+ self.payer_address = attributes[:'payer_address']
135
+ else
136
+ self.payer_address = nil
137
+ end
138
+
139
+ if attributes.key?(:'recipient_address')
140
+ self.recipient_address = attributes[:'recipient_address']
141
+ else
142
+ self.recipient_address = nil
143
+ end
144
+
145
+ if attributes.key?(:'amount')
146
+ self.amount = attributes[:'amount']
147
+ else
148
+ self.amount = nil
149
+ end
150
+
151
+ if attributes.key?(:'amount_formatted')
152
+ self.amount_formatted = attributes[:'amount_formatted']
153
+ else
154
+ self.amount_formatted = nil
155
+ end
156
+
157
+ if attributes.key?(:'currency')
158
+ self.currency = attributes[:'currency']
159
+ else
160
+ self.currency = nil
161
+ end
162
+
163
+ if attributes.key?(:'network')
164
+ self.network = attributes[:'network']
165
+ else
166
+ self.network = nil
167
+ end
168
+
169
+ if attributes.key?(:'resource_url')
170
+ self.resource_url = attributes[:'resource_url']
171
+ end
172
+
173
+ if attributes.key?(:'resource_host')
174
+ self.resource_host = attributes[:'resource_host']
175
+ end
176
+
177
+ if attributes.key?(:'fee_amount')
178
+ self.fee_amount = attributes[:'fee_amount']
179
+ end
180
+
181
+ if attributes.key?(:'settlement_latency_ms')
182
+ self.settlement_latency_ms = attributes[:'settlement_latency_ms']
183
+ end
184
+
185
+ if attributes.key?(:'settled_at')
186
+ self.settled_at = attributes[:'settled_at']
187
+ else
188
+ self.settled_at = nil
189
+ end
190
+
191
+ if attributes.key?(:'api_key_name')
192
+ self.api_key_name = attributes[:'api_key_name']
193
+ else
194
+ self.api_key_name = nil
195
+ end
196
+ end
197
+
198
+ # Show invalid properties with the reasons. Usually used together with valid?
199
+ # @return Array for valid properties with the reasons
200
+ def list_invalid_properties
201
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
202
+ invalid_properties = Array.new
203
+ if @id.nil?
204
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
205
+ end
206
+
207
+ if @tx_hash.nil?
208
+ invalid_properties.push('invalid value for "tx_hash", tx_hash cannot be nil.')
209
+ end
210
+
211
+ if @payer_address.nil?
212
+ invalid_properties.push('invalid value for "payer_address", payer_address cannot be nil.')
213
+ end
214
+
215
+ if @recipient_address.nil?
216
+ invalid_properties.push('invalid value for "recipient_address", recipient_address cannot be nil.')
217
+ end
218
+
219
+ if @amount.nil?
220
+ invalid_properties.push('invalid value for "amount", amount cannot be nil.')
221
+ end
222
+
223
+ if @amount_formatted.nil?
224
+ invalid_properties.push('invalid value for "amount_formatted", amount_formatted cannot be nil.')
225
+ end
226
+
227
+ if @currency.nil?
228
+ invalid_properties.push('invalid value for "currency", currency cannot be nil.')
229
+ end
230
+
231
+ if @network.nil?
232
+ invalid_properties.push('invalid value for "network", network cannot be nil.')
233
+ end
234
+
235
+ if @settled_at.nil?
236
+ invalid_properties.push('invalid value for "settled_at", settled_at cannot be nil.')
237
+ end
238
+
239
+ if @api_key_name.nil?
240
+ invalid_properties.push('invalid value for "api_key_name", api_key_name cannot be nil.')
241
+ end
242
+
243
+ invalid_properties
244
+ end
245
+
246
+ # Check to see if the all the properties in the model are valid
247
+ # @return true if the model is valid
248
+ def valid?
249
+ warn '[DEPRECATED] the `valid?` method is obsolete'
250
+ return false if @id.nil?
251
+ return false if @tx_hash.nil?
252
+ return false if @payer_address.nil?
253
+ return false if @recipient_address.nil?
254
+ return false if @amount.nil?
255
+ return false if @amount_formatted.nil?
256
+ return false if @currency.nil?
257
+ return false if @network.nil?
258
+ return false if @settled_at.nil?
259
+ return false if @api_key_name.nil?
260
+ true
261
+ end
262
+
263
+ # Custom attribute writer method with validation
264
+ # @param [Object] id Value to be assigned
265
+ def id=(id)
266
+ if id.nil?
267
+ fail ArgumentError, 'id cannot be nil'
268
+ end
269
+
270
+ @id = id
271
+ end
272
+
273
+ # Custom attribute writer method with validation
274
+ # @param [Object] tx_hash Value to be assigned
275
+ def tx_hash=(tx_hash)
276
+ if tx_hash.nil?
277
+ fail ArgumentError, 'tx_hash cannot be nil'
278
+ end
279
+
280
+ @tx_hash = tx_hash
281
+ end
282
+
283
+ # Custom attribute writer method with validation
284
+ # @param [Object] payer_address Value to be assigned
285
+ def payer_address=(payer_address)
286
+ if payer_address.nil?
287
+ fail ArgumentError, 'payer_address cannot be nil'
288
+ end
289
+
290
+ @payer_address = payer_address
291
+ end
292
+
293
+ # Custom attribute writer method with validation
294
+ # @param [Object] recipient_address Value to be assigned
295
+ def recipient_address=(recipient_address)
296
+ if recipient_address.nil?
297
+ fail ArgumentError, 'recipient_address cannot be nil'
298
+ end
299
+
300
+ @recipient_address = recipient_address
301
+ end
302
+
303
+ # Custom attribute writer method with validation
304
+ # @param [Object] amount Value to be assigned
305
+ def amount=(amount)
306
+ if amount.nil?
307
+ fail ArgumentError, 'amount cannot be nil'
308
+ end
309
+
310
+ @amount = amount
311
+ end
312
+
313
+ # Custom attribute writer method with validation
314
+ # @param [Object] amount_formatted Value to be assigned
315
+ def amount_formatted=(amount_formatted)
316
+ if amount_formatted.nil?
317
+ fail ArgumentError, 'amount_formatted cannot be nil'
318
+ end
319
+
320
+ @amount_formatted = amount_formatted
321
+ end
322
+
323
+ # Custom attribute writer method with validation
324
+ # @param [Object] currency Value to be assigned
325
+ def currency=(currency)
326
+ if currency.nil?
327
+ fail ArgumentError, 'currency cannot be nil'
328
+ end
329
+
330
+ @currency = currency
331
+ end
332
+
333
+ # Custom attribute writer method with validation
334
+ # @param [Object] network Value to be assigned
335
+ def network=(network)
336
+ if network.nil?
337
+ fail ArgumentError, 'network cannot be nil'
338
+ end
339
+
340
+ @network = network
341
+ end
342
+
343
+ # Custom attribute writer method with validation
344
+ # @param [Object] settled_at Value to be assigned
345
+ def settled_at=(settled_at)
346
+ if settled_at.nil?
347
+ fail ArgumentError, 'settled_at cannot be nil'
348
+ end
349
+
350
+ @settled_at = settled_at
351
+ end
352
+
353
+ # Custom attribute writer method with validation
354
+ # @param [Object] api_key_name Value to be assigned
355
+ def api_key_name=(api_key_name)
356
+ if api_key_name.nil?
357
+ fail ArgumentError, 'api_key_name cannot be nil'
358
+ end
359
+
360
+ @api_key_name = api_key_name
361
+ end
362
+
363
+ # Checks equality by comparing each attribute.
364
+ # @param [Object] Object to be compared
365
+ def ==(o)
366
+ return true if self.equal?(o)
367
+ self.class == o.class &&
368
+ id == o.id &&
369
+ tx_hash == o.tx_hash &&
370
+ payer_address == o.payer_address &&
371
+ recipient_address == o.recipient_address &&
372
+ amount == o.amount &&
373
+ amount_formatted == o.amount_formatted &&
374
+ currency == o.currency &&
375
+ network == o.network &&
376
+ resource_url == o.resource_url &&
377
+ resource_host == o.resource_host &&
378
+ fee_amount == o.fee_amount &&
379
+ settlement_latency_ms == o.settlement_latency_ms &&
380
+ settled_at == o.settled_at &&
381
+ api_key_name == o.api_key_name
382
+ end
383
+
384
+ # @see the `==` method
385
+ # @param [Object] Object to be compared
386
+ def eql?(o)
387
+ self == o
388
+ end
389
+
390
+ # Calculates hash code according to all attributes.
391
+ # @return [Integer] Hash code
392
+ def hash
393
+ [id, tx_hash, payer_address, recipient_address, amount, amount_formatted, currency, network, resource_url, resource_host, fee_amount, settlement_latency_ms, settled_at, api_key_name].hash
394
+ end
395
+
396
+ # Builds the object from hash
397
+ # @param [Hash] attributes Model attributes in the form of hash
398
+ # @return [Object] Returns the model itself
399
+ def self.build_from_hash(attributes)
400
+ return nil unless attributes.is_a?(Hash)
401
+ attributes = attributes.transform_keys(&:to_sym)
402
+ transformed_hash = {}
403
+ openapi_types.each_pair do |key, type|
404
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
405
+ transformed_hash["#{key}"] = nil
406
+ elsif type =~ /\AArray<(.*)>/i
407
+ # check to ensure the input is an array given that the attribute
408
+ # is documented as an array but the input is not
409
+ if attributes[attribute_map[key]].is_a?(Array)
410
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
411
+ end
412
+ elsif !attributes[attribute_map[key]].nil?
413
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
414
+ end
415
+ end
416
+ new(transformed_hash)
417
+ end
418
+
419
+ # Returns the object in the form of hash
420
+ # @return [Hash] Returns the object in the form of hash
421
+ def to_hash
422
+ hash = {}
423
+ self.class.attribute_map.each_pair do |attr, param|
424
+ value = self.send(attr)
425
+ if value.nil?
426
+ is_nullable = self.class.openapi_nullable.include?(attr)
427
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
428
+ end
429
+
430
+ hash[param] = _to_hash(value)
431
+ end
432
+ hash
433
+ end
434
+
435
+ end
436
+
437
+ end