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