turnkey_client 0.0.18 → 0.0.19

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 (158) hide show
  1. checksums.yaml +4 -4
  2. data/lib/turnkey_client/api/default_api.rb +46 -0
  3. data/lib/turnkey_client/api/ip_allowlist_api.rb +193 -0
  4. data/lib/turnkey_client/api/organizations_api.rb +290 -0
  5. data/lib/turnkey_client/api/signing_api.rb +232 -0
  6. data/lib/turnkey_client/api/tvc_api.rb +773 -0
  7. data/lib/turnkey_client/api/wallets_api.rb +4 -4
  8. data/lib/turnkey_client/configuration.rb +7 -0
  9. data/lib/turnkey_client/models/activate_billing_tier_intent.rb +14 -4
  10. data/lib/turnkey_client/models/activity_type.rb +21 -0
  11. data/lib/turnkey_client/models/address_format.rb +2 -0
  12. data/lib/turnkey_client/models/app_status.rb +243 -0
  13. data/lib/turnkey_client/models/boot_proof.rb +17 -6
  14. data/lib/turnkey_client/models/create_oauth_providers_intent_v2.rb +228 -0
  15. data/lib/turnkey_client/models/create_oauth_providers_request.rb +2 -2
  16. data/lib/turnkey_client/models/create_oauth_providers_result_v2.rb +213 -0
  17. data/lib/turnkey_client/models/create_read_write_session_intent_v2.rb +1 -1
  18. data/lib/turnkey_client/models/create_sub_organization_intent_v8.rb +316 -0
  19. data/lib/turnkey_client/models/create_sub_organization_request.rb +2 -2
  20. data/lib/turnkey_client/models/create_sub_organization_result_v8.rb +230 -0
  21. data/lib/turnkey_client/models/create_tvc_app_intent.rb +9 -9
  22. data/lib/turnkey_client/models/create_tvc_app_request.rb +288 -0
  23. data/lib/turnkey_client/models/create_tvc_deployment_intent.rb +45 -48
  24. data/lib/turnkey_client/models/create_tvc_deployment_request.rb +288 -0
  25. data/lib/turnkey_client/models/create_tvc_manifest_approvals_request.rb +288 -0
  26. data/lib/turnkey_client/models/create_users_intent_v4.rb +213 -0
  27. data/lib/turnkey_client/models/create_users_request.rb +2 -2
  28. data/lib/turnkey_client/models/create_webhook_endpoint_intent.rb +238 -0
  29. data/lib/turnkey_client/models/create_webhook_endpoint_request.rb +298 -0
  30. data/lib/turnkey_client/models/create_webhook_endpoint_result.rb +225 -0
  31. data/lib/turnkey_client/models/delete_tvc_app_and_deployments_intent.rb +211 -0
  32. data/lib/turnkey_client/models/delete_tvc_app_and_deployments_request.rb +298 -0
  33. data/lib/turnkey_client/models/delete_tvc_app_and_deployments_result.rb +211 -0
  34. data/lib/turnkey_client/models/delete_tvc_deployment_intent.rb +211 -0
  35. data/lib/turnkey_client/models/delete_tvc_deployment_request.rb +298 -0
  36. data/lib/turnkey_client/models/delete_tvc_deployment_result.rb +211 -0
  37. data/lib/turnkey_client/models/delete_webhook_endpoint_intent.rb +211 -0
  38. data/lib/turnkey_client/models/delete_webhook_endpoint_request.rb +298 -0
  39. data/lib/turnkey_client/models/delete_webhook_endpoint_result.rb +211 -0
  40. data/lib/turnkey_client/models/deployment_status.rb +255 -0
  41. data/lib/turnkey_client/models/eth_failure_details.rb +208 -0
  42. data/lib/turnkey_client/models/eth_send_transaction_intent.rb +12 -1
  43. data/lib/turnkey_client/models/feature_name.rb +1 -0
  44. data/lib/turnkey_client/models/get_app_status_request.rb +226 -0
  45. data/lib/turnkey_client/models/get_app_status_response.rb +210 -0
  46. data/lib/turnkey_client/models/get_ip_allowlist_request.rb +222 -0
  47. data/lib/turnkey_client/models/get_ip_allowlist_response.rb +210 -0
  48. data/lib/turnkey_client/models/get_send_transaction_status_response.rb +10 -1
  49. data/lib/turnkey_client/models/get_tvc_app_deployments_request.rb +226 -0
  50. data/lib/turnkey_client/models/get_tvc_app_deployments_response.rb +213 -0
  51. data/lib/turnkey_client/models/get_tvc_app_request.rb +226 -0
  52. data/lib/turnkey_client/models/get_tvc_app_response.rb +210 -0
  53. data/lib/turnkey_client/models/get_tvc_apps_request.rb +211 -0
  54. data/lib/turnkey_client/models/get_tvc_apps_response.rb +213 -0
  55. data/lib/turnkey_client/models/get_tvc_deployment_request.rb +226 -0
  56. data/lib/turnkey_client/models/get_tvc_deployment_response.rb +210 -0
  57. data/lib/turnkey_client/models/get_wallet_address_balances_request.rb +4 -4
  58. data/lib/turnkey_client/models/init_otp_auth_intent.rb +1 -1
  59. data/lib/turnkey_client/models/init_otp_auth_intent_v2.rb +1 -1
  60. data/lib/turnkey_client/models/init_otp_intent_v3.rb +336 -0
  61. data/lib/turnkey_client/models/init_otp_request.rb +2 -2
  62. data/lib/turnkey_client/models/init_otp_result_v2.rb +226 -0
  63. data/lib/turnkey_client/models/intent.rb +193 -4
  64. data/lib/turnkey_client/models/ip_allowlist.rb +261 -0
  65. data/lib/turnkey_client/models/ip_allowlist_intent_rule.rb +222 -0
  66. data/lib/turnkey_client/models/ip_allowlist_rule.rb +232 -0
  67. data/lib/turnkey_client/models/list_supported_assets_request.rb +3 -3
  68. data/lib/turnkey_client/models/list_webhook_endpoints_request.rb +211 -0
  69. data/lib/turnkey_client/models/list_webhook_endpoints_response.rb +212 -0
  70. data/lib/turnkey_client/models/login_usage.rb +211 -0
  71. data/lib/turnkey_client/models/noop_codegen_anchor_response.rb +219 -0
  72. data/lib/turnkey_client/models/oauth2_authenticate_intent.rb +6 -2
  73. data/lib/turnkey_client/models/oauth_provider_params_v2.rb +230 -0
  74. data/lib/turnkey_client/models/oidc_claims.rb +241 -0
  75. data/lib/turnkey_client/models/otp_login_intent_v2.rb +262 -0
  76. data/lib/turnkey_client/models/otp_login_request.rb +2 -2
  77. data/lib/turnkey_client/models/post_tvc_quorum_key_share_intent.rb +240 -0
  78. data/lib/turnkey_client/models/post_tvc_quorum_key_share_result.rb +211 -0
  79. data/lib/turnkey_client/models/quorum_key_share_approval_bundle.rb +241 -0
  80. data/lib/turnkey_client/models/remove_ip_allowlist_intent.rb +207 -0
  81. data/lib/turnkey_client/models/remove_ip_allowlist_request.rb +298 -0
  82. data/lib/turnkey_client/models/remove_ip_allowlist_result.rb +196 -0
  83. data/lib/turnkey_client/models/restore_tvc_deployment_intent.rb +211 -0
  84. data/lib/turnkey_client/models/restore_tvc_deployment_request.rb +298 -0
  85. data/lib/turnkey_client/models/restore_tvc_deployment_result.rb +211 -0
  86. data/lib/turnkey_client/models/result.rb +166 -4
  87. data/lib/turnkey_client/models/root_user_params_v5.rb +284 -0
  88. data/lib/turnkey_client/models/set_ip_allowlist_intent.rb +241 -0
  89. data/lib/turnkey_client/models/set_ip_allowlist_request.rb +298 -0
  90. data/lib/turnkey_client/models/set_ip_allowlist_result.rb +196 -0
  91. data/lib/turnkey_client/models/signup_usage.rb +249 -0
  92. data/lib/turnkey_client/models/signup_usage_v2.rb +249 -0
  93. data/lib/turnkey_client/models/sol_send_transaction_intent.rb +3 -3
  94. data/lib/turnkey_client/models/solana_config.rb +207 -0
  95. data/lib/turnkey_client/models/solana_failure_details.rb +273 -0
  96. data/lib/turnkey_client/models/solana_send_transaction_status.rb +207 -0
  97. data/lib/turnkey_client/models/spark_claim_leaf.rb +241 -0
  98. data/lib/turnkey_client/models/spark_claim_package.rb +275 -0
  99. data/lib/turnkey_client/models/spark_claim_transfer_intent.rb +225 -0
  100. data/lib/turnkey_client/models/spark_claim_transfer_request.rb +288 -0
  101. data/lib/turnkey_client/models/spark_claim_transfer_result.rb +230 -0
  102. data/lib/turnkey_client/models/spark_deposit_derivation.rb +196 -0
  103. data/lib/turnkey_client/models/spark_encrypted_operator_package.rb +226 -0
  104. data/lib/turnkey_client/models/spark_frost_commitment.rb +241 -0
  105. data/lib/turnkey_client/models/spark_htlc_preimage_derivation.rb +196 -0
  106. data/lib/turnkey_client/models/spark_identity_derivation.rb +196 -0
  107. data/lib/turnkey_client/models/spark_key_derivation.rb +241 -0
  108. data/lib/turnkey_client/models/spark_leaf_public_key.rb +226 -0
  109. data/lib/turnkey_client/models/spark_lightning_receive_package.rb +228 -0
  110. data/lib/turnkey_client/models/spark_operator_recipient.rb +226 -0
  111. data/lib/turnkey_client/models/spark_partial_signature.rb +241 -0
  112. data/lib/turnkey_client/models/spark_prepare_lightning_receive_intent.rb +225 -0
  113. data/lib/turnkey_client/models/spark_prepare_lightning_receive_request.rb +288 -0
  114. data/lib/turnkey_client/models/spark_prepare_lightning_receive_result.rb +228 -0
  115. data/lib/turnkey_client/models/spark_prepare_transfer_intent.rb +225 -0
  116. data/lib/turnkey_client/models/spark_prepare_transfer_request.rb +288 -0
  117. data/lib/turnkey_client/models/spark_prepare_transfer_result.rb +245 -0
  118. data/lib/turnkey_client/models/spark_sign_frost_intent.rb +228 -0
  119. data/lib/turnkey_client/models/spark_sign_frost_request.rb +288 -0
  120. data/lib/turnkey_client/models/spark_sign_frost_result.rb +213 -0
  121. data/lib/turnkey_client/models/spark_signature_request.rb +268 -0
  122. data/lib/turnkey_client/models/spark_signing_leaf_derivation.rb +211 -0
  123. data/lib/turnkey_client/models/spark_static_deposit_derivation.rb +211 -0
  124. data/lib/turnkey_client/models/spark_transfer_leaf.rb +272 -0
  125. data/lib/turnkey_client/models/spark_transfer_package.rb +275 -0
  126. data/lib/turnkey_client/models/token_usage.rb +252 -0
  127. data/lib/turnkey_client/models/tvc_app.rb +353 -0
  128. data/lib/turnkey_client/models/tvc_container_spec.rb +302 -0
  129. data/lib/turnkey_client/models/tvc_deployment.rb +372 -0
  130. data/lib/turnkey_client/models/tvc_health_check_type.rb +27 -0
  131. data/lib/turnkey_client/models/tvc_manifest.rb +254 -0
  132. data/lib/turnkey_client/models/tvc_operator.rb +269 -0
  133. data/lib/turnkey_client/models/tvc_operator_approval.rb +283 -0
  134. data/lib/turnkey_client/models/tvc_operator_set.rb +301 -0
  135. data/lib/turnkey_client/models/tx_error.rb +22 -4
  136. data/lib/turnkey_client/models/update_auth_proxy_config_intent.rb +17 -5
  137. data/lib/turnkey_client/models/update_organization_name_intent.rb +211 -0
  138. data/lib/turnkey_client/models/update_organization_name_request.rb +298 -0
  139. data/lib/turnkey_client/models/update_organization_name_result.rb +226 -0
  140. data/lib/turnkey_client/models/update_tvc_app_live_deployment_intent.rb +211 -0
  141. data/lib/turnkey_client/models/update_tvc_app_live_deployment_request.rb +298 -0
  142. data/lib/turnkey_client/models/update_tvc_app_live_deployment_result.rb +196 -0
  143. data/lib/turnkey_client/models/update_webhook_endpoint_intent.rb +244 -0
  144. data/lib/turnkey_client/models/update_webhook_endpoint_request.rb +298 -0
  145. data/lib/turnkey_client/models/update_webhook_endpoint_result.rb +225 -0
  146. data/lib/turnkey_client/models/upsert_gas_usage_config_intent.rb +15 -6
  147. data/lib/turnkey_client/models/usage_type.rb +27 -0
  148. data/lib/turnkey_client/models/user_params_v4.rb +301 -0
  149. data/lib/turnkey_client/models/validate_tvc_image_request.rb +237 -0
  150. data/lib/turnkey_client/models/validate_tvc_image_response.rb +205 -0
  151. data/lib/turnkey_client/models/verify_otp_intent_v2.rb +237 -0
  152. data/lib/turnkey_client/models/verify_otp_request.rb +2 -2
  153. data/lib/turnkey_client/models/web_authn_stamp.rb +256 -0
  154. data/lib/turnkey_client/models/webhook_endpoint_data.rb +283 -0
  155. data/lib/turnkey_client/models/webhook_subscription_params.rb +233 -0
  156. data/lib/turnkey_client/version.rb +1 -1
  157. data/lib/turnkey_client.rb +122 -0
  158. metadata +124 -2
@@ -0,0 +1,275 @@
1
+ =begin
2
+ #API Reference
3
+
4
+ #Review our [API Introduction](../api-introduction) to get started.
5
+
6
+ OpenAPI spec version: 1.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ =end
10
+
11
+ require 'date'
12
+
13
+ module TurnkeyClient
14
+ class SparkTransferPackage
15
+ # Spark transfer identifier (UUID).
16
+ attr_accessor :transfer_id
17
+
18
+ # Leaves being transferred.
19
+ attr_accessor :leaves
20
+
21
+ # Feldman VSS threshold for reconstructing the per-leaf tweak scalar.
22
+ attr_accessor :threshold
23
+
24
+ # Operators that will receive Feldman shares of the per-leaf tweak. Order must match the operators' numeric IDs in the Spark operator config - share index is the 1-based position in this list.
25
+ attr_accessor :operator_recipients
26
+
27
+ # Recipient's identity pubkey (hex-encoded compressed secp256k1 point). Each leaf's new_priv is ECIES-encrypted to this key and embedded in the per-operator package for claim-time delivery.
28
+ attr_accessor :receiver_public_key
29
+
30
+ # Attribute mapping from ruby-style variable name to JSON key.
31
+ def self.attribute_map
32
+ {
33
+ :'transfer_id' => :'transferId',
34
+ :'leaves' => :'leaves',
35
+ :'threshold' => :'threshold',
36
+ :'operator_recipients' => :'operatorRecipients',
37
+ :'receiver_public_key' => :'receiverPublicKey'
38
+ }
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.openapi_types
43
+ {
44
+ :'transfer_id' => :'Object',
45
+ :'leaves' => :'Object',
46
+ :'threshold' => :'Object',
47
+ :'operator_recipients' => :'Object',
48
+ :'receiver_public_key' => :'Object'
49
+ }
50
+ end
51
+
52
+ # List of attributes with nullable: true
53
+ def self.openapi_nullable
54
+ Set.new([
55
+ ])
56
+ end
57
+
58
+ # Initializes the object
59
+ # @param [Hash] attributes Model attributes in the form of hash
60
+ def initialize(attributes = {})
61
+ if (!attributes.is_a?(Hash))
62
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TurnkeyClient::SparkTransferPackage` initialize method"
63
+ end
64
+
65
+ # check to see if the attribute exists and convert string to symbol for hash key
66
+ attributes = attributes.each_with_object({}) { |(k, v), h|
67
+ if (!self.class.attribute_map.key?(k.to_sym))
68
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TurnkeyClient::SparkTransferPackage`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
69
+ end
70
+ h[k.to_sym] = v
71
+ }
72
+
73
+ if attributes.key?(:'transfer_id')
74
+ self.transfer_id = attributes[:'transfer_id']
75
+ end
76
+
77
+ if attributes.key?(:'leaves')
78
+ if (value = attributes[:'leaves']).is_a?(Array)
79
+ self.leaves = value
80
+ end
81
+ end
82
+
83
+ if attributes.key?(:'threshold')
84
+ self.threshold = attributes[:'threshold']
85
+ end
86
+
87
+ if attributes.key?(:'operator_recipients')
88
+ if (value = attributes[:'operator_recipients']).is_a?(Array)
89
+ self.operator_recipients = value
90
+ end
91
+ end
92
+
93
+ if attributes.key?(:'receiver_public_key')
94
+ self.receiver_public_key = attributes[:'receiver_public_key']
95
+ end
96
+ end
97
+
98
+ # Show invalid properties with the reasons. Usually used together with valid?
99
+ # @return Array for valid properties with the reasons
100
+ def list_invalid_properties
101
+ invalid_properties = Array.new
102
+ if @transfer_id.nil?
103
+ invalid_properties.push('invalid value for "transfer_id", transfer_id cannot be nil.')
104
+ end
105
+
106
+ if @leaves.nil?
107
+ invalid_properties.push('invalid value for "leaves", leaves cannot be nil.')
108
+ end
109
+
110
+ if @threshold.nil?
111
+ invalid_properties.push('invalid value for "threshold", threshold cannot be nil.')
112
+ end
113
+
114
+ if @operator_recipients.nil?
115
+ invalid_properties.push('invalid value for "operator_recipients", operator_recipients cannot be nil.')
116
+ end
117
+
118
+ if @receiver_public_key.nil?
119
+ invalid_properties.push('invalid value for "receiver_public_key", receiver_public_key cannot be nil.')
120
+ end
121
+
122
+ invalid_properties
123
+ end
124
+
125
+ # Check to see if the all the properties in the model are valid
126
+ # @return true if the model is valid
127
+ def valid?
128
+ return false if @transfer_id.nil?
129
+ return false if @leaves.nil?
130
+ return false if @threshold.nil?
131
+ return false if @operator_recipients.nil?
132
+ return false if @receiver_public_key.nil?
133
+ true
134
+ end
135
+
136
+ # Checks equality by comparing each attribute.
137
+ # @param [Object] Object to be compared
138
+ def ==(o)
139
+ return true if self.equal?(o)
140
+ self.class == o.class &&
141
+ transfer_id == o.transfer_id &&
142
+ leaves == o.leaves &&
143
+ threshold == o.threshold &&
144
+ operator_recipients == o.operator_recipients &&
145
+ receiver_public_key == o.receiver_public_key
146
+ end
147
+
148
+ # @see the `==` method
149
+ # @param [Object] Object to be compared
150
+ def eql?(o)
151
+ self == o
152
+ end
153
+
154
+ # Calculates hash code according to all attributes.
155
+ # @return [Integer] Hash code
156
+ def hash
157
+ [transfer_id, leaves, threshold, operator_recipients, receiver_public_key].hash
158
+ end
159
+
160
+ # Builds the object from hash
161
+ # @param [Hash] attributes Model attributes in the form of hash
162
+ # @return [Object] Returns the model itself
163
+ def self.build_from_hash(attributes)
164
+ new.build_from_hash(attributes)
165
+ end
166
+
167
+ # Builds the object from hash
168
+ # @param [Hash] attributes Model attributes in the form of hash
169
+ # @return [Object] Returns the model itself
170
+ def build_from_hash(attributes)
171
+ return nil unless attributes.is_a?(Hash)
172
+ self.class.openapi_types.each_pair do |key, type|
173
+ if type =~ /\AArray<(.*)>/i
174
+ # check to ensure the input is an array given that the attribute
175
+ # is documented as an array but the input is not
176
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
177
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
178
+ end
179
+ elsif !attributes[self.class.attribute_map[key]].nil?
180
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
181
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
182
+ self.send("#{key}=", nil)
183
+ end
184
+ end
185
+
186
+ self
187
+ end
188
+
189
+ # Deserializes the data based on type
190
+ # @param string type Data type
191
+ # @param string value Value to be deserialized
192
+ # @return [Object] Deserialized data
193
+ def _deserialize(type, value)
194
+ case type.to_sym
195
+ when :DateTime
196
+ DateTime.parse(value)
197
+ when :Date
198
+ Date.parse(value)
199
+ when :String
200
+ value.to_s
201
+ when :Integer
202
+ value.to_i
203
+ when :Float
204
+ value.to_f
205
+ when :Boolean
206
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
207
+ true
208
+ else
209
+ false
210
+ end
211
+ when :Object
212
+ # generic object (usually a Hash), return directly
213
+ value
214
+ when /\AArray<(?<inner_type>.+)>\z/
215
+ inner_type = Regexp.last_match[:inner_type]
216
+ value.map { |v| _deserialize(inner_type, v) }
217
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
218
+ k_type = Regexp.last_match[:k_type]
219
+ v_type = Regexp.last_match[:v_type]
220
+ {}.tap do |hash|
221
+ value.each do |k, v|
222
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
223
+ end
224
+ end
225
+ else # model
226
+ TurnkeyClient.const_get(type).build_from_hash(value)
227
+ end
228
+ end
229
+
230
+ # Returns the string representation of the object
231
+ # @return [String] String presentation of the object
232
+ def to_s
233
+ to_hash.to_s
234
+ end
235
+
236
+ # to_body is an alias to to_hash (backward compatibility)
237
+ # @return [Hash] Returns the object in the form of hash
238
+ def to_body
239
+ to_hash
240
+ end
241
+
242
+ # Returns the object in the form of hash
243
+ # @return [Hash] Returns the object in the form of hash
244
+ def to_hash
245
+ hash = {}
246
+ self.class.attribute_map.each_pair do |attr, param|
247
+ value = self.send(attr)
248
+ if value.nil?
249
+ is_nullable = self.class.openapi_nullable.include?(attr)
250
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
251
+ end
252
+
253
+ hash[param] = _to_hash(value)
254
+ end
255
+ hash
256
+ end
257
+
258
+ # Outputs non-array value in the form of hash
259
+ # For object, use to_hash. Otherwise, just return the value
260
+ # @param [Object] value Any valid value
261
+ # @return [Hash] Returns the value in the form of hash
262
+ def _to_hash(value)
263
+ if value.is_a?(Array)
264
+ value.compact.map { |v| _to_hash(v) }
265
+ elsif value.is_a?(Hash)
266
+ {}.tap do |hash|
267
+ value.each { |k, v| hash[k] = _to_hash(v) }
268
+ end
269
+ elsif value.respond_to? :to_hash
270
+ value.to_hash
271
+ else
272
+ value
273
+ end
274
+ end end
275
+ end
@@ -0,0 +1,252 @@
1
+ =begin
2
+ #API Reference
3
+
4
+ #Review our [API Introduction](../api-introduction) to get started.
5
+
6
+ OpenAPI spec version: 1.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ =end
10
+
11
+ require 'date'
12
+
13
+ module TurnkeyClient
14
+ class TokenUsage
15
+ attr_accessor :type
16
+
17
+ # Unique identifier for the verification token
18
+ attr_accessor :token_id
19
+
20
+ attr_accessor :signup
21
+
22
+ attr_accessor :login
23
+
24
+ attr_accessor :signup_v2
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'type' => :'type',
30
+ :'token_id' => :'tokenId',
31
+ :'signup' => :'signup',
32
+ :'login' => :'login',
33
+ :'signup_v2' => :'signupV2'
34
+ }
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.openapi_types
39
+ {
40
+ :'type' => :'Object',
41
+ :'token_id' => :'Object',
42
+ :'signup' => :'Object',
43
+ :'login' => :'Object',
44
+ :'signup_v2' => :'Object'
45
+ }
46
+ end
47
+
48
+ # List of attributes with nullable: true
49
+ def self.openapi_nullable
50
+ Set.new([
51
+ ])
52
+ end
53
+
54
+ # Initializes the object
55
+ # @param [Hash] attributes Model attributes in the form of hash
56
+ def initialize(attributes = {})
57
+ if (!attributes.is_a?(Hash))
58
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TurnkeyClient::TokenUsage` initialize method"
59
+ end
60
+
61
+ # check to see if the attribute exists and convert string to symbol for hash key
62
+ attributes = attributes.each_with_object({}) { |(k, v), h|
63
+ if (!self.class.attribute_map.key?(k.to_sym))
64
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TurnkeyClient::TokenUsage`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
65
+ end
66
+ h[k.to_sym] = v
67
+ }
68
+
69
+ if attributes.key?(:'type')
70
+ self.type = attributes[:'type']
71
+ end
72
+
73
+ if attributes.key?(:'token_id')
74
+ self.token_id = attributes[:'token_id']
75
+ end
76
+
77
+ if attributes.key?(:'signup')
78
+ self.signup = attributes[:'signup']
79
+ end
80
+
81
+ if attributes.key?(:'login')
82
+ self.login = attributes[:'login']
83
+ end
84
+
85
+ if attributes.key?(:'signup_v2')
86
+ self.signup_v2 = attributes[:'signup_v2']
87
+ end
88
+ end
89
+
90
+ # Show invalid properties with the reasons. Usually used together with valid?
91
+ # @return Array for valid properties with the reasons
92
+ def list_invalid_properties
93
+ invalid_properties = Array.new
94
+ if @type.nil?
95
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
96
+ end
97
+
98
+ if @token_id.nil?
99
+ invalid_properties.push('invalid value for "token_id", token_id cannot be nil.')
100
+ end
101
+
102
+ invalid_properties
103
+ end
104
+
105
+ # Check to see if the all the properties in the model are valid
106
+ # @return true if the model is valid
107
+ def valid?
108
+ return false if @type.nil?
109
+ return false if @token_id.nil?
110
+ true
111
+ end
112
+
113
+ # Checks equality by comparing each attribute.
114
+ # @param [Object] Object to be compared
115
+ def ==(o)
116
+ return true if self.equal?(o)
117
+ self.class == o.class &&
118
+ type == o.type &&
119
+ token_id == o.token_id &&
120
+ signup == o.signup &&
121
+ login == o.login &&
122
+ signup_v2 == o.signup_v2
123
+ end
124
+
125
+ # @see the `==` method
126
+ # @param [Object] Object to be compared
127
+ def eql?(o)
128
+ self == o
129
+ end
130
+
131
+ # Calculates hash code according to all attributes.
132
+ # @return [Integer] Hash code
133
+ def hash
134
+ [type, token_id, signup, login, signup_v2].hash
135
+ end
136
+
137
+ # Builds the object from hash
138
+ # @param [Hash] attributes Model attributes in the form of hash
139
+ # @return [Object] Returns the model itself
140
+ def self.build_from_hash(attributes)
141
+ new.build_from_hash(attributes)
142
+ end
143
+
144
+ # Builds the object from hash
145
+ # @param [Hash] attributes Model attributes in the form of hash
146
+ # @return [Object] Returns the model itself
147
+ def build_from_hash(attributes)
148
+ return nil unless attributes.is_a?(Hash)
149
+ self.class.openapi_types.each_pair do |key, type|
150
+ if 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[self.class.attribute_map[key]].is_a?(Array)
154
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
155
+ end
156
+ elsif !attributes[self.class.attribute_map[key]].nil?
157
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
158
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
159
+ self.send("#{key}=", nil)
160
+ end
161
+ end
162
+
163
+ self
164
+ end
165
+
166
+ # Deserializes the data based on type
167
+ # @param string type Data type
168
+ # @param string value Value to be deserialized
169
+ # @return [Object] Deserialized data
170
+ def _deserialize(type, value)
171
+ case type.to_sym
172
+ when :DateTime
173
+ DateTime.parse(value)
174
+ when :Date
175
+ Date.parse(value)
176
+ when :String
177
+ value.to_s
178
+ when :Integer
179
+ value.to_i
180
+ when :Float
181
+ value.to_f
182
+ when :Boolean
183
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
184
+ true
185
+ else
186
+ false
187
+ end
188
+ when :Object
189
+ # generic object (usually a Hash), return directly
190
+ value
191
+ when /\AArray<(?<inner_type>.+)>\z/
192
+ inner_type = Regexp.last_match[:inner_type]
193
+ value.map { |v| _deserialize(inner_type, v) }
194
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
195
+ k_type = Regexp.last_match[:k_type]
196
+ v_type = Regexp.last_match[:v_type]
197
+ {}.tap do |hash|
198
+ value.each do |k, v|
199
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
200
+ end
201
+ end
202
+ else # model
203
+ TurnkeyClient.const_get(type).build_from_hash(value)
204
+ end
205
+ end
206
+
207
+ # Returns the string representation of the object
208
+ # @return [String] String presentation of the object
209
+ def to_s
210
+ to_hash.to_s
211
+ end
212
+
213
+ # to_body is an alias to to_hash (backward compatibility)
214
+ # @return [Hash] Returns the object in the form of hash
215
+ def to_body
216
+ to_hash
217
+ end
218
+
219
+ # Returns the object in the form of hash
220
+ # @return [Hash] Returns the object in the form of hash
221
+ def to_hash
222
+ hash = {}
223
+ self.class.attribute_map.each_pair do |attr, param|
224
+ value = self.send(attr)
225
+ if value.nil?
226
+ is_nullable = self.class.openapi_nullable.include?(attr)
227
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
228
+ end
229
+
230
+ hash[param] = _to_hash(value)
231
+ end
232
+ hash
233
+ end
234
+
235
+ # Outputs non-array value in the form of hash
236
+ # For object, use to_hash. Otherwise, just return the value
237
+ # @param [Object] value Any valid value
238
+ # @return [Hash] Returns the value in the form of hash
239
+ def _to_hash(value)
240
+ if value.is_a?(Array)
241
+ value.compact.map { |v| _to_hash(v) }
242
+ elsif value.is_a?(Hash)
243
+ {}.tap do |hash|
244
+ value.each { |k, v| hash[k] = _to_hash(v) }
245
+ end
246
+ elsif value.respond_to? :to_hash
247
+ value.to_hash
248
+ else
249
+ value
250
+ end
251
+ end end
252
+ end