griffnode 1.0.0

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 (154) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/LICENSE +17 -0
  4. data/README.md +24 -0
  5. data/Rakefile +10 -0
  6. data/docs/Account.md +22 -0
  7. data/docs/AccountApi.md +339 -0
  8. data/docs/AccountLimits.md +22 -0
  9. data/docs/AccountPlan.md +24 -0
  10. data/docs/AccountUsage.md +22 -0
  11. data/docs/Balance.md +24 -0
  12. data/docs/BillingApi.md +75 -0
  13. data/docs/CreateBillingCheckoutRequest.md +22 -0
  14. data/docs/CreateDetailedTransactionRequest.md +32 -0
  15. data/docs/CreateTransactionRequest.md +30 -0
  16. data/docs/CryptoSymbol.md +15 -0
  17. data/docs/Cryptocurrency.md +26 -0
  18. data/docs/DefaultApi.md +78 -0
  19. data/docs/Error.md +22 -0
  20. data/docs/FiatCurrency.md +15 -0
  21. data/docs/GetAccount200Response.md +20 -0
  22. data/docs/GetHealth200Response.md +22 -0
  23. data/docs/GetPrices200Response.md +20 -0
  24. data/docs/GetPrices200ResponseData.md +22 -0
  25. data/docs/GetStats200Response.md +20 -0
  26. data/docs/GetStats200ResponseData.md +24 -0
  27. data/docs/InlineObject.md +24 -0
  28. data/docs/InlineObjectAllOfExistingTransaction.md +22 -0
  29. data/docs/Invoice.md +34 -0
  30. data/docs/LineItem.md +22 -0
  31. data/docs/ListBalances200Response.md +20 -0
  32. data/docs/ListBalances200ResponseData.md +18 -0
  33. data/docs/ListCryptocurrencies200Response.md +20 -0
  34. data/docs/ListCryptocurrencies200ResponseData.md +20 -0
  35. data/docs/ListInvoices200Response.md +20 -0
  36. data/docs/ListInvoices200ResponseData.md +20 -0
  37. data/docs/ListPlans200Response.md +20 -0
  38. data/docs/ListPlans200ResponseData.md +20 -0
  39. data/docs/ListTransactions200Response.md +20 -0
  40. data/docs/ListTransactions200ResponseData.md +20 -0
  41. data/docs/MarketDataApi.md +202 -0
  42. data/docs/Pagination.md +22 -0
  43. data/docs/PaymentSplit.md +28 -0
  44. data/docs/Plan.md +38 -0
  45. data/docs/PlanTier.md +15 -0
  46. data/docs/SystemApi.md +139 -0
  47. data/docs/Transaction.md +66 -0
  48. data/docs/TransactionEnvelope.md +20 -0
  49. data/docs/TransactionStatus.md +15 -0
  50. data/docs/TransactionsApi.md +295 -0
  51. data/docs/WebhookPayload.md +40 -0
  52. data/git_push.sh +57 -0
  53. data/griffnode.gemspec +43 -0
  54. data/lib/griffnode/api/account_api.rb +315 -0
  55. data/lib/griffnode/api/billing_api.rb +88 -0
  56. data/lib/griffnode/api/default_api.rb +84 -0
  57. data/lib/griffnode/api/market_data_api.rb +187 -0
  58. data/lib/griffnode/api/system_api.rb +158 -0
  59. data/lib/griffnode/api/transactions_api.rb +300 -0
  60. data/lib/griffnode/api_client.rb +394 -0
  61. data/lib/griffnode/api_error.rb +58 -0
  62. data/lib/griffnode/configuration.rb +308 -0
  63. data/lib/griffnode/models/account.rb +232 -0
  64. data/lib/griffnode/models/account_limits.rb +232 -0
  65. data/lib/griffnode/models/account_plan.rb +264 -0
  66. data/lib/griffnode/models/account_usage.rb +234 -0
  67. data/lib/griffnode/models/balance.rb +241 -0
  68. data/lib/griffnode/models/create_billing_checkout_request.rb +284 -0
  69. data/lib/griffnode/models/create_detailed_transaction_request.rb +349 -0
  70. data/lib/griffnode/models/create_transaction_request.rb +313 -0
  71. data/lib/griffnode/models/crypto_symbol.rb +53 -0
  72. data/lib/griffnode/models/cryptocurrency.rb +284 -0
  73. data/lib/griffnode/models/error.rb +251 -0
  74. data/lib/griffnode/models/fiat_currency.rb +42 -0
  75. data/lib/griffnode/models/get_account200_response.rb +233 -0
  76. data/lib/griffnode/models/get_health200_response.rb +232 -0
  77. data/lib/griffnode/models/get_prices200_response.rb +233 -0
  78. data/lib/griffnode/models/get_prices200_response_data.rb +238 -0
  79. data/lib/griffnode/models/get_stats200_response.rb +233 -0
  80. data/lib/griffnode/models/get_stats200_response_data.rb +241 -0
  81. data/lib/griffnode/models/inline_object.rb +267 -0
  82. data/lib/griffnode/models/inline_object_all_of_existing_transaction.rb +254 -0
  83. data/lib/griffnode/models/invoice.rb +311 -0
  84. data/lib/griffnode/models/line_item.rb +267 -0
  85. data/lib/griffnode/models/list_balances200_response.rb +233 -0
  86. data/lib/griffnode/models/list_balances200_response_data.rb +216 -0
  87. data/lib/griffnode/models/list_cryptocurrencies200_response.rb +233 -0
  88. data/lib/griffnode/models/list_cryptocurrencies200_response_data.rb +225 -0
  89. data/lib/griffnode/models/list_invoices200_response.rb +233 -0
  90. data/lib/griffnode/models/list_invoices200_response_data.rb +225 -0
  91. data/lib/griffnode/models/list_plans200_response.rb +233 -0
  92. data/lib/griffnode/models/list_plans200_response_data.rb +227 -0
  93. data/lib/griffnode/models/list_transactions200_response.rb +233 -0
  94. data/lib/griffnode/models/list_transactions200_response_data.rb +239 -0
  95. data/lib/griffnode/models/pagination.rb +253 -0
  96. data/lib/griffnode/models/payment_split.rb +262 -0
  97. data/lib/griffnode/models/plan.rb +330 -0
  98. data/lib/griffnode/models/plan_tier.rb +42 -0
  99. data/lib/griffnode/models/transaction.rb +535 -0
  100. data/lib/griffnode/models/transaction_envelope.rb +233 -0
  101. data/lib/griffnode/models/transaction_status.rb +44 -0
  102. data/lib/griffnode/models/webhook_payload.rb +387 -0
  103. data/lib/griffnode/version.rb +15 -0
  104. data/lib/griffnode.rb +84 -0
  105. data/openapi.yaml +791 -0
  106. data/openapitools.json +15 -0
  107. data/spec/api/account_api_spec.rb +87 -0
  108. data/spec/api/billing_api_spec.rb +46 -0
  109. data/spec/api/default_api_spec.rb +47 -0
  110. data/spec/api/market_data_api_spec.rb +65 -0
  111. data/spec/api/system_api_spec.rb +60 -0
  112. data/spec/api/transactions_api_spec.rb +84 -0
  113. data/spec/models/account_limits_spec.rb +48 -0
  114. data/spec/models/account_plan_spec.rb +54 -0
  115. data/spec/models/account_spec.rb +48 -0
  116. data/spec/models/account_usage_spec.rb +48 -0
  117. data/spec/models/balance_spec.rb +54 -0
  118. data/spec/models/create_billing_checkout_request_spec.rb +48 -0
  119. data/spec/models/create_detailed_transaction_request_spec.rb +78 -0
  120. data/spec/models/create_transaction_request_spec.rb +72 -0
  121. data/spec/models/crypto_symbol_spec.rb +30 -0
  122. data/spec/models/cryptocurrency_spec.rb +64 -0
  123. data/spec/models/error_spec.rb +48 -0
  124. data/spec/models/fiat_currency_spec.rb +30 -0
  125. data/spec/models/get_account200_response_spec.rb +42 -0
  126. data/spec/models/get_health200_response_spec.rb +48 -0
  127. data/spec/models/get_prices200_response_data_spec.rb +48 -0
  128. data/spec/models/get_prices200_response_spec.rb +42 -0
  129. data/spec/models/get_stats200_response_data_spec.rb +54 -0
  130. data/spec/models/get_stats200_response_spec.rb +42 -0
  131. data/spec/models/inline_object_all_of_existing_transaction_spec.rb +48 -0
  132. data/spec/models/inline_object_spec.rb +54 -0
  133. data/spec/models/invoice_spec.rb +84 -0
  134. data/spec/models/line_item_spec.rb +48 -0
  135. data/spec/models/list_balances200_response_data_spec.rb +36 -0
  136. data/spec/models/list_balances200_response_spec.rb +42 -0
  137. data/spec/models/list_cryptocurrencies200_response_data_spec.rb +42 -0
  138. data/spec/models/list_cryptocurrencies200_response_spec.rb +42 -0
  139. data/spec/models/list_invoices200_response_data_spec.rb +42 -0
  140. data/spec/models/list_invoices200_response_spec.rb +42 -0
  141. data/spec/models/list_plans200_response_data_spec.rb +42 -0
  142. data/spec/models/list_plans200_response_spec.rb +42 -0
  143. data/spec/models/list_transactions200_response_data_spec.rb +42 -0
  144. data/spec/models/list_transactions200_response_spec.rb +42 -0
  145. data/spec/models/pagination_spec.rb +48 -0
  146. data/spec/models/payment_split_spec.rb +66 -0
  147. data/spec/models/plan_spec.rb +96 -0
  148. data/spec/models/plan_tier_spec.rb +30 -0
  149. data/spec/models/transaction_envelope_spec.rb +42 -0
  150. data/spec/models/transaction_spec.rb +184 -0
  151. data/spec/models/transaction_status_spec.rb +30 -0
  152. data/spec/models/webhook_payload_spec.rb +106 -0
  153. data/spec/spec_helper.rb +111 -0
  154. metadata +286 -0
@@ -0,0 +1,535 @@
1
+ =begin
2
+ #GriffNode API
3
+
4
+ #Accept Bitcoin, Litecoin, Dogecoin, Dash, Ethereum and ERC-20 tokens. Server-to-server, authenticated with a secret API key (`Authorization: Bearer sk_live_…` for live, or `sk_test_…` for test mode — same base URL). All monetary amounts in API responses are JSON numbers; **webhook** amounts are strings to preserve decimal precision (see the `webhooks` section). **Rate limits.** Every request is rate-limited per API key in two windows — per minute and per hour — by plan tier (min/hour): starter 30/500, business 100/2000, professional 300/5000, enterprise 1000/20000. Every response carries `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset` (Unix seconds) for the per-minute window. On `429` the body is `error: \"RATE_LIMIT_EXCEEDED\"` (either window) with a `Retry-After` header (seconds) — clients should retry after it. A separate `429` with `error: \"MONTHLY_LIMIT_REACHED\"` means the plan's monthly transaction quota (not the request rate).
5
+
6
+ The version of the OpenAPI document: 1.0.1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.10.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module GriffNode
17
+ # The canonical, curated public view of a transaction (same shape from create, get and list). Internal fields (capability tokens, client_ip, address_index, derivation/db internals) are deliberately NOT exposed.
18
+ class Transaction
19
+ attr_accessor :transaction_id
20
+
21
+ attr_accessor :status
22
+
23
+ attr_accessor :type
24
+
25
+ attr_accessor :crypto
26
+
27
+ attr_accessor :deposit_address
28
+
29
+ attr_accessor :amount_crypto
30
+
31
+ attr_accessor :amount_fiat
32
+
33
+ attr_accessor :amount_usd
34
+
35
+ attr_accessor :amount_paid
36
+
37
+ attr_accessor :amount_remaining
38
+
39
+ attr_accessor :currency_fiat
40
+
41
+ attr_accessor :fiat_to_usd_rate
42
+
43
+ # USD per unit of crypto, locked at creation.
44
+ attr_accessor :exchange_rate
45
+
46
+ attr_accessor :confirmations_required
47
+
48
+ attr_accessor :payment_url
49
+
50
+ attr_accessor :order_id
51
+
52
+ attr_accessor :customer_email
53
+
54
+ attr_accessor :items
55
+
56
+ # On-chain payments detected toward this transaction.
57
+ attr_accessor :payments
58
+
59
+ # Free-form key/value (≤20 keys, string values ≤500 chars, ≤4 KB total).
60
+ attr_accessor :metadata
61
+
62
+ attr_accessor :success_url
63
+
64
+ attr_accessor :cancel_url
65
+
66
+ attr_accessor :created_at
67
+
68
+ attr_accessor :updated_at
69
+
70
+ attr_accessor :expires_at
71
+
72
+ class EnumAttributeValidator
73
+ attr_reader :datatype
74
+ attr_reader :allowable_values
75
+
76
+ def initialize(datatype, allowable_values)
77
+ @allowable_values = allowable_values.map do |value|
78
+ case datatype.to_s
79
+ when /Integer/i
80
+ value.to_i
81
+ when /Float/i
82
+ value.to_f
83
+ else
84
+ value
85
+ end
86
+ end
87
+ end
88
+
89
+ def valid?(value)
90
+ !value || allowable_values.include?(value)
91
+ end
92
+ end
93
+
94
+ # Attribute mapping from ruby-style variable name to JSON key.
95
+ def self.attribute_map
96
+ {
97
+ :'transaction_id' => :'transaction_id',
98
+ :'status' => :'status',
99
+ :'type' => :'type',
100
+ :'crypto' => :'crypto',
101
+ :'deposit_address' => :'deposit_address',
102
+ :'amount_crypto' => :'amount_crypto',
103
+ :'amount_fiat' => :'amount_fiat',
104
+ :'amount_usd' => :'amount_usd',
105
+ :'amount_paid' => :'amount_paid',
106
+ :'amount_remaining' => :'amount_remaining',
107
+ :'currency_fiat' => :'currency_fiat',
108
+ :'fiat_to_usd_rate' => :'fiat_to_usd_rate',
109
+ :'exchange_rate' => :'exchange_rate',
110
+ :'confirmations_required' => :'confirmations_required',
111
+ :'payment_url' => :'payment_url',
112
+ :'order_id' => :'order_id',
113
+ :'customer_email' => :'customer_email',
114
+ :'items' => :'items',
115
+ :'payments' => :'payments',
116
+ :'metadata' => :'metadata',
117
+ :'success_url' => :'success_url',
118
+ :'cancel_url' => :'cancel_url',
119
+ :'created_at' => :'created_at',
120
+ :'updated_at' => :'updated_at',
121
+ :'expires_at' => :'expires_at'
122
+ }
123
+ end
124
+
125
+ # Returns all the JSON keys this model knows about
126
+ def self.acceptable_attributes
127
+ attribute_map.values
128
+ end
129
+
130
+ # Attribute type mapping.
131
+ def self.openapi_types
132
+ {
133
+ :'transaction_id' => :'String',
134
+ :'status' => :'TransactionStatus',
135
+ :'type' => :'String',
136
+ :'crypto' => :'CryptoSymbol',
137
+ :'deposit_address' => :'String',
138
+ :'amount_crypto' => :'Float',
139
+ :'amount_fiat' => :'Float',
140
+ :'amount_usd' => :'Float',
141
+ :'amount_paid' => :'Float',
142
+ :'amount_remaining' => :'Float',
143
+ :'currency_fiat' => :'FiatCurrency',
144
+ :'fiat_to_usd_rate' => :'Float',
145
+ :'exchange_rate' => :'Float',
146
+ :'confirmations_required' => :'Integer',
147
+ :'payment_url' => :'String',
148
+ :'order_id' => :'String',
149
+ :'customer_email' => :'String',
150
+ :'items' => :'Array<LineItem>',
151
+ :'payments' => :'Array<PaymentSplit>',
152
+ :'metadata' => :'Hash<String, String>',
153
+ :'success_url' => :'String',
154
+ :'cancel_url' => :'String',
155
+ :'created_at' => :'Time',
156
+ :'updated_at' => :'Time',
157
+ :'expires_at' => :'Time'
158
+ }
159
+ end
160
+
161
+ # List of attributes with nullable: true
162
+ def self.openapi_nullable
163
+ Set.new([
164
+ :'order_id',
165
+ :'customer_email',
166
+ :'items',
167
+ :'success_url',
168
+ :'cancel_url',
169
+ ])
170
+ end
171
+
172
+ # Initializes the object
173
+ # @param [Hash] attributes Model attributes in the form of hash
174
+ def initialize(attributes = {})
175
+ if (!attributes.is_a?(Hash))
176
+ fail ArgumentError, "The input argument (attributes) must be a hash in `GriffNode::Transaction` initialize method"
177
+ end
178
+
179
+ # check to see if the attribute exists and convert string to symbol for hash key
180
+ attributes = attributes.each_with_object({}) { |(k, v), h|
181
+ if (!self.class.attribute_map.key?(k.to_sym))
182
+ fail ArgumentError, "`#{k}` is not a valid attribute in `GriffNode::Transaction`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
183
+ end
184
+ h[k.to_sym] = v
185
+ }
186
+
187
+ if attributes.key?(:'transaction_id')
188
+ self.transaction_id = attributes[:'transaction_id']
189
+ else
190
+ self.transaction_id = nil
191
+ end
192
+
193
+ if attributes.key?(:'status')
194
+ self.status = attributes[:'status']
195
+ else
196
+ self.status = nil
197
+ end
198
+
199
+ if attributes.key?(:'type')
200
+ self.type = attributes[:'type']
201
+ end
202
+
203
+ if attributes.key?(:'crypto')
204
+ self.crypto = attributes[:'crypto']
205
+ else
206
+ self.crypto = nil
207
+ end
208
+
209
+ if attributes.key?(:'deposit_address')
210
+ self.deposit_address = attributes[:'deposit_address']
211
+ end
212
+
213
+ if attributes.key?(:'amount_crypto')
214
+ self.amount_crypto = attributes[:'amount_crypto']
215
+ end
216
+
217
+ if attributes.key?(:'amount_fiat')
218
+ self.amount_fiat = attributes[:'amount_fiat']
219
+ else
220
+ self.amount_fiat = nil
221
+ end
222
+
223
+ if attributes.key?(:'amount_usd')
224
+ self.amount_usd = attributes[:'amount_usd']
225
+ else
226
+ self.amount_usd = nil
227
+ end
228
+
229
+ if attributes.key?(:'amount_paid')
230
+ self.amount_paid = attributes[:'amount_paid']
231
+ end
232
+
233
+ if attributes.key?(:'amount_remaining')
234
+ self.amount_remaining = attributes[:'amount_remaining']
235
+ end
236
+
237
+ if attributes.key?(:'currency_fiat')
238
+ self.currency_fiat = attributes[:'currency_fiat']
239
+ else
240
+ self.currency_fiat = 'USD'
241
+ end
242
+
243
+ if attributes.key?(:'fiat_to_usd_rate')
244
+ self.fiat_to_usd_rate = attributes[:'fiat_to_usd_rate']
245
+ end
246
+
247
+ if attributes.key?(:'exchange_rate')
248
+ self.exchange_rate = attributes[:'exchange_rate']
249
+ end
250
+
251
+ if attributes.key?(:'confirmations_required')
252
+ self.confirmations_required = attributes[:'confirmations_required']
253
+ end
254
+
255
+ if attributes.key?(:'payment_url')
256
+ self.payment_url = attributes[:'payment_url']
257
+ end
258
+
259
+ if attributes.key?(:'order_id')
260
+ self.order_id = attributes[:'order_id']
261
+ end
262
+
263
+ if attributes.key?(:'customer_email')
264
+ self.customer_email = attributes[:'customer_email']
265
+ end
266
+
267
+ if attributes.key?(:'items')
268
+ if (value = attributes[:'items']).is_a?(Array)
269
+ self.items = value
270
+ end
271
+ end
272
+
273
+ if attributes.key?(:'payments')
274
+ if (value = attributes[:'payments']).is_a?(Array)
275
+ self.payments = value
276
+ end
277
+ end
278
+
279
+ if attributes.key?(:'metadata')
280
+ if (value = attributes[:'metadata']).is_a?(Hash)
281
+ self.metadata = value
282
+ end
283
+ end
284
+
285
+ if attributes.key?(:'success_url')
286
+ self.success_url = attributes[:'success_url']
287
+ end
288
+
289
+ if attributes.key?(:'cancel_url')
290
+ self.cancel_url = attributes[:'cancel_url']
291
+ end
292
+
293
+ if attributes.key?(:'created_at')
294
+ self.created_at = attributes[:'created_at']
295
+ else
296
+ self.created_at = nil
297
+ end
298
+
299
+ if attributes.key?(:'updated_at')
300
+ self.updated_at = attributes[:'updated_at']
301
+ end
302
+
303
+ if attributes.key?(:'expires_at')
304
+ self.expires_at = attributes[:'expires_at']
305
+ else
306
+ self.expires_at = nil
307
+ end
308
+ end
309
+
310
+ # Show invalid properties with the reasons. Usually used together with valid?
311
+ # @return Array for valid properties with the reasons
312
+ def list_invalid_properties
313
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
314
+ invalid_properties = Array.new
315
+ if @transaction_id.nil?
316
+ invalid_properties.push('invalid value for "transaction_id", transaction_id cannot be nil.')
317
+ end
318
+
319
+ if @status.nil?
320
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
321
+ end
322
+
323
+ if @crypto.nil?
324
+ invalid_properties.push('invalid value for "crypto", crypto cannot be nil.')
325
+ end
326
+
327
+ if @amount_fiat.nil?
328
+ invalid_properties.push('invalid value for "amount_fiat", amount_fiat cannot be nil.')
329
+ end
330
+
331
+ if @amount_usd.nil?
332
+ invalid_properties.push('invalid value for "amount_usd", amount_usd cannot be nil.')
333
+ end
334
+
335
+ if @currency_fiat.nil?
336
+ invalid_properties.push('invalid value for "currency_fiat", currency_fiat cannot be nil.')
337
+ end
338
+
339
+ if @created_at.nil?
340
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
341
+ end
342
+
343
+ if @expires_at.nil?
344
+ invalid_properties.push('invalid value for "expires_at", expires_at cannot be nil.')
345
+ end
346
+
347
+ invalid_properties
348
+ end
349
+
350
+ # Check to see if the all the properties in the model are valid
351
+ # @return true if the model is valid
352
+ def valid?
353
+ warn '[DEPRECATED] the `valid?` method is obsolete'
354
+ return false if @transaction_id.nil?
355
+ return false if @status.nil?
356
+ type_validator = EnumAttributeValidator.new('String', ["basic", "detailed"])
357
+ return false unless type_validator.valid?(@type)
358
+ return false if @crypto.nil?
359
+ return false if @amount_fiat.nil?
360
+ return false if @amount_usd.nil?
361
+ return false if @currency_fiat.nil?
362
+ return false if @created_at.nil?
363
+ return false if @expires_at.nil?
364
+ true
365
+ end
366
+
367
+ # Custom attribute writer method checking allowed values (enum).
368
+ # @param [Object] type Object to be assigned
369
+ def type=(type)
370
+ validator = EnumAttributeValidator.new('String', ["basic", "detailed"])
371
+ unless validator.valid?(type)
372
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
373
+ end
374
+ @type = type
375
+ end
376
+
377
+ # Checks equality by comparing each attribute.
378
+ # @param [Object] Object to be compared
379
+ def ==(o)
380
+ return true if self.equal?(o)
381
+ self.class == o.class &&
382
+ transaction_id == o.transaction_id &&
383
+ status == o.status &&
384
+ type == o.type &&
385
+ crypto == o.crypto &&
386
+ deposit_address == o.deposit_address &&
387
+ amount_crypto == o.amount_crypto &&
388
+ amount_fiat == o.amount_fiat &&
389
+ amount_usd == o.amount_usd &&
390
+ amount_paid == o.amount_paid &&
391
+ amount_remaining == o.amount_remaining &&
392
+ currency_fiat == o.currency_fiat &&
393
+ fiat_to_usd_rate == o.fiat_to_usd_rate &&
394
+ exchange_rate == o.exchange_rate &&
395
+ confirmations_required == o.confirmations_required &&
396
+ payment_url == o.payment_url &&
397
+ order_id == o.order_id &&
398
+ customer_email == o.customer_email &&
399
+ items == o.items &&
400
+ payments == o.payments &&
401
+ metadata == o.metadata &&
402
+ success_url == o.success_url &&
403
+ cancel_url == o.cancel_url &&
404
+ created_at == o.created_at &&
405
+ updated_at == o.updated_at &&
406
+ expires_at == o.expires_at
407
+ end
408
+
409
+ # @see the `==` method
410
+ # @param [Object] Object to be compared
411
+ def eql?(o)
412
+ self == o
413
+ end
414
+
415
+ # Calculates hash code according to all attributes.
416
+ # @return [Integer] Hash code
417
+ def hash
418
+ [transaction_id, status, type, crypto, deposit_address, amount_crypto, amount_fiat, amount_usd, amount_paid, amount_remaining, currency_fiat, fiat_to_usd_rate, exchange_rate, confirmations_required, payment_url, order_id, customer_email, items, payments, metadata, success_url, cancel_url, created_at, updated_at, expires_at].hash
419
+ end
420
+
421
+ # Builds the object from hash
422
+ # @param [Hash] attributes Model attributes in the form of hash
423
+ # @return [Object] Returns the model itself
424
+ def self.build_from_hash(attributes)
425
+ return nil unless attributes.is_a?(Hash)
426
+ attributes = attributes.transform_keys(&:to_sym)
427
+ transformed_hash = {}
428
+ openapi_types.each_pair do |key, type|
429
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
430
+ transformed_hash["#{key}"] = nil
431
+ elsif type =~ /\AArray<(.*)>/i
432
+ # check to ensure the input is an array given that the attribute
433
+ # is documented as an array but the input is not
434
+ if attributes[attribute_map[key]].is_a?(Array)
435
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
436
+ end
437
+ elsif !attributes[attribute_map[key]].nil?
438
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
439
+ end
440
+ end
441
+ new(transformed_hash)
442
+ end
443
+
444
+ # Deserializes the data based on type
445
+ # @param string type Data type
446
+ # @param string value Value to be deserialized
447
+ # @return [Object] Deserialized data
448
+ def self._deserialize(type, value)
449
+ case type.to_sym
450
+ when :Time
451
+ Time.parse(value)
452
+ when :Date
453
+ Date.parse(value)
454
+ when :String
455
+ value.to_s
456
+ when :Integer
457
+ value.to_i
458
+ when :Float
459
+ value.to_f
460
+ when :Boolean
461
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
462
+ true
463
+ else
464
+ false
465
+ end
466
+ when :Object
467
+ # generic object (usually a Hash), return directly
468
+ value
469
+ when /\AArray<(?<inner_type>.+)>\z/
470
+ inner_type = Regexp.last_match[:inner_type]
471
+ value.map { |v| _deserialize(inner_type, v) }
472
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
473
+ k_type = Regexp.last_match[:k_type]
474
+ v_type = Regexp.last_match[:v_type]
475
+ {}.tap do |hash|
476
+ value.each do |k, v|
477
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
478
+ end
479
+ end
480
+ else # model
481
+ # models (e.g. Pet) or oneOf
482
+ klass = GriffNode.const_get(type)
483
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
484
+ end
485
+ end
486
+
487
+ # Returns the string representation of the object
488
+ # @return [String] String presentation of the object
489
+ def to_s
490
+ to_hash.to_s
491
+ end
492
+
493
+ # to_body is an alias to to_hash (backward compatibility)
494
+ # @return [Hash] Returns the object in the form of hash
495
+ def to_body
496
+ to_hash
497
+ end
498
+
499
+ # Returns the object in the form of hash
500
+ # @return [Hash] Returns the object in the form of hash
501
+ def to_hash
502
+ hash = {}
503
+ self.class.attribute_map.each_pair do |attr, param|
504
+ value = self.send(attr)
505
+ if value.nil?
506
+ is_nullable = self.class.openapi_nullable.include?(attr)
507
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
508
+ end
509
+
510
+ hash[param] = _to_hash(value)
511
+ end
512
+ hash
513
+ end
514
+
515
+ # Outputs non-array value in the form of hash
516
+ # For object, use to_hash. Otherwise, just return the value
517
+ # @param [Object] value Any valid value
518
+ # @return [Hash] Returns the value in the form of hash
519
+ def _to_hash(value)
520
+ if value.is_a?(Array)
521
+ value.compact.map { |v| _to_hash(v) }
522
+ elsif value.is_a?(Hash)
523
+ {}.tap do |hash|
524
+ value.each { |k, v| hash[k] = _to_hash(v) }
525
+ end
526
+ elsif value.respond_to? :to_hash
527
+ value.to_hash
528
+ else
529
+ value
530
+ end
531
+ end
532
+
533
+ end
534
+
535
+ end