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