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,267 @@
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
+ class InlineObject
18
+ attr_accessor :success
19
+
20
+ # Machine-readable code.
21
+ attr_accessor :error
22
+
23
+ # Human-readable description.
24
+ attr_accessor :message
25
+
26
+ attr_accessor :existing_transaction
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'success' => :'success',
32
+ :'error' => :'error',
33
+ :'message' => :'message',
34
+ :'existing_transaction' => :'existing_transaction'
35
+ }
36
+ end
37
+
38
+ # Returns all the JSON keys this model knows about
39
+ def self.acceptable_attributes
40
+ attribute_map.values
41
+ end
42
+
43
+ # Attribute type mapping.
44
+ def self.openapi_types
45
+ {
46
+ :'success' => :'Object',
47
+ :'error' => :'String',
48
+ :'message' => :'String',
49
+ :'existing_transaction' => :'InlineObjectAllOfExistingTransaction'
50
+ }
51
+ end
52
+
53
+ # List of attributes with nullable: true
54
+ def self.openapi_nullable
55
+ Set.new([
56
+ :'success',
57
+ ])
58
+ end
59
+
60
+ # List of class defined in allOf (OpenAPI v3)
61
+ def self.openapi_all_of
62
+ [
63
+ :'Error'
64
+ ]
65
+ end
66
+
67
+ # Initializes the object
68
+ # @param [Hash] attributes Model attributes in the form of hash
69
+ def initialize(attributes = {})
70
+ if (!attributes.is_a?(Hash))
71
+ fail ArgumentError, "The input argument (attributes) must be a hash in `GriffNode::InlineObject` initialize method"
72
+ end
73
+
74
+ # check to see if the attribute exists and convert string to symbol for hash key
75
+ attributes = attributes.each_with_object({}) { |(k, v), h|
76
+ if (!self.class.attribute_map.key?(k.to_sym))
77
+ fail ArgumentError, "`#{k}` is not a valid attribute in `GriffNode::InlineObject`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
78
+ end
79
+ h[k.to_sym] = v
80
+ }
81
+
82
+ if attributes.key?(:'success')
83
+ self.success = attributes[:'success']
84
+ else
85
+ self.success = nil
86
+ end
87
+
88
+ if attributes.key?(:'error')
89
+ self.error = attributes[:'error']
90
+ else
91
+ self.error = nil
92
+ end
93
+
94
+ if attributes.key?(:'message')
95
+ self.message = attributes[:'message']
96
+ else
97
+ self.message = nil
98
+ end
99
+
100
+ if attributes.key?(:'existing_transaction')
101
+ self.existing_transaction = attributes[:'existing_transaction']
102
+ end
103
+ end
104
+
105
+ # Show invalid properties with the reasons. Usually used together with valid?
106
+ # @return Array for valid properties with the reasons
107
+ def list_invalid_properties
108
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
109
+ invalid_properties = Array.new
110
+ if @error.nil?
111
+ invalid_properties.push('invalid value for "error", error cannot be nil.')
112
+ end
113
+
114
+ if @message.nil?
115
+ invalid_properties.push('invalid value for "message", message cannot be nil.')
116
+ end
117
+
118
+ invalid_properties
119
+ end
120
+
121
+ # Check to see if the all the properties in the model are valid
122
+ # @return true if the model is valid
123
+ def valid?
124
+ warn '[DEPRECATED] the `valid?` method is obsolete'
125
+ return false if @error.nil?
126
+ return false if @message.nil?
127
+ true
128
+ end
129
+
130
+ # Checks equality by comparing each attribute.
131
+ # @param [Object] Object to be compared
132
+ def ==(o)
133
+ return true if self.equal?(o)
134
+ self.class == o.class &&
135
+ success == o.success &&
136
+ error == o.error &&
137
+ message == o.message &&
138
+ existing_transaction == o.existing_transaction
139
+ end
140
+
141
+ # @see the `==` method
142
+ # @param [Object] Object to be compared
143
+ def eql?(o)
144
+ self == o
145
+ end
146
+
147
+ # Calculates hash code according to all attributes.
148
+ # @return [Integer] Hash code
149
+ def hash
150
+ [success, error, message, existing_transaction].hash
151
+ end
152
+
153
+ # Builds the object from hash
154
+ # @param [Hash] attributes Model attributes in the form of hash
155
+ # @return [Object] Returns the model itself
156
+ def self.build_from_hash(attributes)
157
+ return nil unless attributes.is_a?(Hash)
158
+ attributes = attributes.transform_keys(&:to_sym)
159
+ transformed_hash = {}
160
+ openapi_types.each_pair do |key, type|
161
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
162
+ transformed_hash["#{key}"] = nil
163
+ elsif type =~ /\AArray<(.*)>/i
164
+ # check to ensure the input is an array given that the attribute
165
+ # is documented as an array but the input is not
166
+ if attributes[attribute_map[key]].is_a?(Array)
167
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
168
+ end
169
+ elsif !attributes[attribute_map[key]].nil?
170
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
171
+ end
172
+ end
173
+ new(transformed_hash)
174
+ end
175
+
176
+ # Deserializes the data based on type
177
+ # @param string type Data type
178
+ # @param string value Value to be deserialized
179
+ # @return [Object] Deserialized data
180
+ def self._deserialize(type, value)
181
+ case type.to_sym
182
+ when :Time
183
+ Time.parse(value)
184
+ when :Date
185
+ Date.parse(value)
186
+ when :String
187
+ value.to_s
188
+ when :Integer
189
+ value.to_i
190
+ when :Float
191
+ value.to_f
192
+ when :Boolean
193
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
194
+ true
195
+ else
196
+ false
197
+ end
198
+ when :Object
199
+ # generic object (usually a Hash), return directly
200
+ value
201
+ when /\AArray<(?<inner_type>.+)>\z/
202
+ inner_type = Regexp.last_match[:inner_type]
203
+ value.map { |v| _deserialize(inner_type, v) }
204
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
205
+ k_type = Regexp.last_match[:k_type]
206
+ v_type = Regexp.last_match[:v_type]
207
+ {}.tap do |hash|
208
+ value.each do |k, v|
209
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
210
+ end
211
+ end
212
+ else # model
213
+ # models (e.g. Pet) or oneOf
214
+ klass = GriffNode.const_get(type)
215
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
216
+ end
217
+ end
218
+
219
+ # Returns the string representation of the object
220
+ # @return [String] String presentation of the object
221
+ def to_s
222
+ to_hash.to_s
223
+ end
224
+
225
+ # to_body is an alias to to_hash (backward compatibility)
226
+ # @return [Hash] Returns the object in the form of hash
227
+ def to_body
228
+ to_hash
229
+ end
230
+
231
+ # Returns the object in the form of hash
232
+ # @return [Hash] Returns the object in the form of hash
233
+ def to_hash
234
+ hash = {}
235
+ self.class.attribute_map.each_pair do |attr, param|
236
+ value = self.send(attr)
237
+ if value.nil?
238
+ is_nullable = self.class.openapi_nullable.include?(attr)
239
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
240
+ end
241
+
242
+ hash[param] = _to_hash(value)
243
+ end
244
+ hash
245
+ end
246
+
247
+ # Outputs non-array value in the form of hash
248
+ # For object, use to_hash. Otherwise, just return the value
249
+ # @param [Object] value Any valid value
250
+ # @return [Hash] Returns the value in the form of hash
251
+ def _to_hash(value)
252
+ if value.is_a?(Array)
253
+ value.compact.map { |v| _to_hash(v) }
254
+ elsif value.is_a?(Hash)
255
+ {}.tap do |hash|
256
+ value.each { |k, v| hash[k] = _to_hash(v) }
257
+ end
258
+ elsif value.respond_to? :to_hash
259
+ value.to_hash
260
+ else
261
+ value
262
+ end
263
+ end
264
+
265
+ end
266
+
267
+ end
@@ -0,0 +1,254 @@
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
+ class InlineObjectAllOfExistingTransaction
18
+ attr_accessor :transaction_id
19
+
20
+ attr_accessor :status
21
+
22
+ attr_accessor :payment_url
23
+
24
+ class EnumAttributeValidator
25
+ attr_reader :datatype
26
+ attr_reader :allowable_values
27
+
28
+ def initialize(datatype, allowable_values)
29
+ @allowable_values = allowable_values.map do |value|
30
+ case datatype.to_s
31
+ when /Integer/i
32
+ value.to_i
33
+ when /Float/i
34
+ value.to_f
35
+ else
36
+ value
37
+ end
38
+ end
39
+ end
40
+
41
+ def valid?(value)
42
+ !value || allowable_values.include?(value)
43
+ end
44
+ end
45
+
46
+ # Attribute mapping from ruby-style variable name to JSON key.
47
+ def self.attribute_map
48
+ {
49
+ :'transaction_id' => :'transaction_id',
50
+ :'status' => :'status',
51
+ :'payment_url' => :'payment_url'
52
+ }
53
+ end
54
+
55
+ # Returns all the JSON keys this model knows about
56
+ def self.acceptable_attributes
57
+ attribute_map.values
58
+ end
59
+
60
+ # Attribute type mapping.
61
+ def self.openapi_types
62
+ {
63
+ :'transaction_id' => :'String',
64
+ :'status' => :'TransactionStatus',
65
+ :'payment_url' => :'String'
66
+ }
67
+ end
68
+
69
+ # List of attributes with nullable: true
70
+ def self.openapi_nullable
71
+ Set.new([
72
+ ])
73
+ end
74
+
75
+ # Initializes the object
76
+ # @param [Hash] attributes Model attributes in the form of hash
77
+ def initialize(attributes = {})
78
+ if (!attributes.is_a?(Hash))
79
+ fail ArgumentError, "The input argument (attributes) must be a hash in `GriffNode::InlineObjectAllOfExistingTransaction` initialize method"
80
+ end
81
+
82
+ # check to see if the attribute exists and convert string to symbol for hash key
83
+ attributes = attributes.each_with_object({}) { |(k, v), h|
84
+ if (!self.class.attribute_map.key?(k.to_sym))
85
+ fail ArgumentError, "`#{k}` is not a valid attribute in `GriffNode::InlineObjectAllOfExistingTransaction`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
86
+ end
87
+ h[k.to_sym] = v
88
+ }
89
+
90
+ if attributes.key?(:'transaction_id')
91
+ self.transaction_id = attributes[:'transaction_id']
92
+ end
93
+
94
+ if attributes.key?(:'status')
95
+ self.status = attributes[:'status']
96
+ end
97
+
98
+ if attributes.key?(:'payment_url')
99
+ self.payment_url = attributes[:'payment_url']
100
+ end
101
+ end
102
+
103
+ # Show invalid properties with the reasons. Usually used together with valid?
104
+ # @return Array for valid properties with the reasons
105
+ def list_invalid_properties
106
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
107
+ invalid_properties = Array.new
108
+ invalid_properties
109
+ end
110
+
111
+ # Check to see if the all the properties in the model are valid
112
+ # @return true if the model is valid
113
+ def valid?
114
+ warn '[DEPRECATED] the `valid?` method is obsolete'
115
+ true
116
+ end
117
+
118
+ # Checks equality by comparing each attribute.
119
+ # @param [Object] Object to be compared
120
+ def ==(o)
121
+ return true if self.equal?(o)
122
+ self.class == o.class &&
123
+ transaction_id == o.transaction_id &&
124
+ status == o.status &&
125
+ payment_url == o.payment_url
126
+ end
127
+
128
+ # @see the `==` method
129
+ # @param [Object] Object to be compared
130
+ def eql?(o)
131
+ self == o
132
+ end
133
+
134
+ # Calculates hash code according to all attributes.
135
+ # @return [Integer] Hash code
136
+ def hash
137
+ [transaction_id, status, payment_url].hash
138
+ end
139
+
140
+ # Builds the object from hash
141
+ # @param [Hash] attributes Model attributes in the form of hash
142
+ # @return [Object] Returns the model itself
143
+ def self.build_from_hash(attributes)
144
+ return nil unless attributes.is_a?(Hash)
145
+ attributes = attributes.transform_keys(&:to_sym)
146
+ transformed_hash = {}
147
+ openapi_types.each_pair do |key, type|
148
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
149
+ transformed_hash["#{key}"] = nil
150
+ elsif type =~ /\AArray<(.*)>/i
151
+ # check to ensure the input is an array given that the attribute
152
+ # is documented as an array but the input is not
153
+ if attributes[attribute_map[key]].is_a?(Array)
154
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
155
+ end
156
+ elsif !attributes[attribute_map[key]].nil?
157
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
158
+ end
159
+ end
160
+ new(transformed_hash)
161
+ end
162
+
163
+ # Deserializes the data based on type
164
+ # @param string type Data type
165
+ # @param string value Value to be deserialized
166
+ # @return [Object] Deserialized data
167
+ def self._deserialize(type, value)
168
+ case type.to_sym
169
+ when :Time
170
+ Time.parse(value)
171
+ when :Date
172
+ Date.parse(value)
173
+ when :String
174
+ value.to_s
175
+ when :Integer
176
+ value.to_i
177
+ when :Float
178
+ value.to_f
179
+ when :Boolean
180
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
181
+ true
182
+ else
183
+ false
184
+ end
185
+ when :Object
186
+ # generic object (usually a Hash), return directly
187
+ value
188
+ when /\AArray<(?<inner_type>.+)>\z/
189
+ inner_type = Regexp.last_match[:inner_type]
190
+ value.map { |v| _deserialize(inner_type, v) }
191
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
192
+ k_type = Regexp.last_match[:k_type]
193
+ v_type = Regexp.last_match[:v_type]
194
+ {}.tap do |hash|
195
+ value.each do |k, v|
196
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
197
+ end
198
+ end
199
+ else # model
200
+ # models (e.g. Pet) or oneOf
201
+ klass = GriffNode.const_get(type)
202
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
203
+ end
204
+ end
205
+
206
+ # Returns the string representation of the object
207
+ # @return [String] String presentation of the object
208
+ def to_s
209
+ to_hash.to_s
210
+ end
211
+
212
+ # to_body is an alias to to_hash (backward compatibility)
213
+ # @return [Hash] Returns the object in the form of hash
214
+ def to_body
215
+ to_hash
216
+ end
217
+
218
+ # Returns the object in the form of hash
219
+ # @return [Hash] Returns the object in the form of hash
220
+ def to_hash
221
+ hash = {}
222
+ self.class.attribute_map.each_pair do |attr, param|
223
+ value = self.send(attr)
224
+ if value.nil?
225
+ is_nullable = self.class.openapi_nullable.include?(attr)
226
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
227
+ end
228
+
229
+ hash[param] = _to_hash(value)
230
+ end
231
+ hash
232
+ end
233
+
234
+ # Outputs non-array value in the form of hash
235
+ # For object, use to_hash. Otherwise, just return the value
236
+ # @param [Object] value Any valid value
237
+ # @return [Hash] Returns the value in the form of hash
238
+ def _to_hash(value)
239
+ if value.is_a?(Array)
240
+ value.compact.map { |v| _to_hash(v) }
241
+ elsif value.is_a?(Hash)
242
+ {}.tap do |hash|
243
+ value.each { |k, v| hash[k] = _to_hash(v) }
244
+ end
245
+ elsif value.respond_to? :to_hash
246
+ value.to_hash
247
+ else
248
+ value
249
+ end
250
+ end
251
+
252
+ end
253
+
254
+ end