turnkey_client 0.0.15 → 0.0.18

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 (171) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +39 -0
  3. data/.rspec +2 -0
  4. data/.swagger-codegen/VERSION +1 -0
  5. data/.swagger-codegen-ignore +23 -0
  6. data/lib/turnkey_client/api/app_proof_api.rb +4 -4
  7. data/lib/turnkey_client/api/broadcasting_api.rb +251 -0
  8. data/lib/turnkey_client/api/on_ramp_api.rb +290 -0
  9. data/lib/turnkey_client/api/policies_api.rb +58 -0
  10. data/lib/turnkey_client/api/send_transactions_api.rb +77 -0
  11. data/lib/turnkey_client/api/wallets_api.rb +174 -0
  12. data/lib/turnkey_client/models/activity.rb +1 -1
  13. data/lib/turnkey_client/models/activity_type.rb +16 -0
  14. data/lib/turnkey_client/models/approve_activity_request.rb +14 -4
  15. data/lib/turnkey_client/models/asset_balance.rb +255 -0
  16. data/lib/turnkey_client/models/asset_balance_display.rb +216 -0
  17. data/lib/turnkey_client/models/asset_metadata.rb +246 -0
  18. data/lib/turnkey_client/models/client_signature.rb +255 -0
  19. data/lib/turnkey_client/models/client_signature_scheme.rb +26 -0
  20. data/lib/turnkey_client/models/create_api_keys_request.rb +14 -4
  21. data/lib/turnkey_client/models/create_authenticators_request.rb +14 -4
  22. data/lib/turnkey_client/models/create_fiat_on_ramp_credential_intent.rb +272 -0
  23. data/lib/turnkey_client/models/create_fiat_on_ramp_credential_request.rb +298 -0
  24. data/lib/turnkey_client/models/create_fiat_on_ramp_credential_result.rb +211 -0
  25. data/lib/turnkey_client/models/create_invitations_request.rb +14 -4
  26. data/lib/turnkey_client/models/create_oauth2_credential_request.rb +14 -4
  27. data/lib/turnkey_client/models/create_oauth_providers_request.rb +14 -4
  28. data/lib/turnkey_client/models/create_policies_request.rb +14 -4
  29. data/lib/turnkey_client/models/create_policy_intent_v3.rb +6 -0
  30. data/lib/turnkey_client/models/create_policy_request.rb +14 -4
  31. data/lib/turnkey_client/models/create_private_key_tag_request.rb +14 -4
  32. data/lib/turnkey_client/models/create_private_keys_request.rb +14 -4
  33. data/lib/turnkey_client/models/create_read_only_session_request.rb +14 -4
  34. data/lib/turnkey_client/models/create_read_write_session_request.rb +14 -4
  35. data/lib/turnkey_client/models/create_smart_contract_interface_intent.rb +1 -1
  36. data/lib/turnkey_client/models/create_smart_contract_interface_request.rb +14 -4
  37. data/lib/turnkey_client/models/create_sub_organization_intent_v7.rb +14 -5
  38. data/lib/turnkey_client/models/create_sub_organization_request.rb +14 -4
  39. data/lib/turnkey_client/models/create_tvc_app_intent.rb +277 -0
  40. data/lib/turnkey_client/models/create_tvc_app_result.rb +258 -0
  41. data/lib/turnkey_client/models/create_tvc_deployment_intent.rb +368 -0
  42. data/lib/turnkey_client/models/create_tvc_deployment_result.rb +226 -0
  43. data/lib/turnkey_client/models/create_tvc_manifest_approvals_intent.rb +228 -0
  44. data/lib/turnkey_client/models/create_tvc_manifest_approvals_result.rb +213 -0
  45. data/lib/turnkey_client/models/create_user_tag_request.rb +14 -4
  46. data/lib/turnkey_client/models/create_users_request.rb +14 -4
  47. data/lib/turnkey_client/models/create_wallet_accounts_intent.rb +15 -4
  48. data/lib/turnkey_client/models/create_wallet_accounts_request.rb +14 -4
  49. data/lib/turnkey_client/models/create_wallet_request.rb +14 -4
  50. data/lib/turnkey_client/models/curve.rb +1 -0
  51. data/lib/turnkey_client/models/custom_revert_error.rb +218 -0
  52. data/lib/turnkey_client/models/data_v1_signature_scheme.rb +26 -0
  53. data/lib/turnkey_client/models/delete_api_keys_request.rb +14 -4
  54. data/lib/turnkey_client/models/delete_authenticators_request.rb +14 -4
  55. data/lib/turnkey_client/models/delete_fiat_on_ramp_credential_intent.rb +211 -0
  56. data/lib/turnkey_client/models/delete_fiat_on_ramp_credential_request.rb +298 -0
  57. data/lib/turnkey_client/models/delete_fiat_on_ramp_credential_result.rb +211 -0
  58. data/lib/turnkey_client/models/delete_invitation_request.rb +14 -4
  59. data/lib/turnkey_client/models/delete_oauth2_credential_request.rb +14 -4
  60. data/lib/turnkey_client/models/delete_oauth_providers_request.rb +14 -4
  61. data/lib/turnkey_client/models/delete_policies_intent.rb +213 -0
  62. data/lib/turnkey_client/models/delete_policies_request.rb +298 -0
  63. data/lib/turnkey_client/models/delete_policies_result.rb +213 -0
  64. data/lib/turnkey_client/models/delete_policy_request.rb +14 -4
  65. data/lib/turnkey_client/models/delete_private_key_tags_request.rb +14 -4
  66. data/lib/turnkey_client/models/delete_private_keys_request.rb +14 -4
  67. data/lib/turnkey_client/models/delete_smart_contract_interface_request.rb +14 -4
  68. data/lib/turnkey_client/models/delete_sub_organization_request.rb +14 -4
  69. data/lib/turnkey_client/models/delete_user_tags_request.rb +14 -4
  70. data/lib/turnkey_client/models/delete_users_request.rb +14 -4
  71. data/lib/turnkey_client/models/delete_wallet_accounts_intent.rb +224 -0
  72. data/lib/turnkey_client/models/delete_wallet_accounts_request.rb +298 -0
  73. data/lib/turnkey_client/models/delete_wallet_accounts_result.rb +213 -0
  74. data/lib/turnkey_client/models/delete_wallets_request.rb +14 -4
  75. data/lib/turnkey_client/models/email_auth_customization_params.rb +255 -0
  76. data/lib/turnkey_client/models/email_auth_intent_v3.rb +306 -0
  77. data/lib/turnkey_client/models/email_auth_request.rb +16 -6
  78. data/lib/turnkey_client/models/email_customization_params_v2.rb +240 -0
  79. data/lib/turnkey_client/models/eth_send_raw_transaction_intent.rb +260 -0
  80. data/lib/turnkey_client/models/eth_send_raw_transaction_result.rb +211 -0
  81. data/lib/turnkey_client/models/eth_send_transaction_intent.rb +363 -0
  82. data/lib/turnkey_client/models/eth_send_transaction_request.rb +298 -0
  83. data/lib/turnkey_client/models/eth_send_transaction_result.rb +211 -0
  84. data/lib/turnkey_client/models/eth_send_transaction_status.rb +207 -0
  85. data/lib/turnkey_client/models/export_private_key_request.rb +14 -4
  86. data/lib/turnkey_client/models/export_wallet_account_request.rb +14 -4
  87. data/lib/turnkey_client/models/export_wallet_request.rb +14 -4
  88. data/lib/turnkey_client/models/fiat_on_ramp_credential.rb +330 -0
  89. data/lib/turnkey_client/models/get_gas_usage_request.rb +211 -0
  90. data/lib/turnkey_client/models/get_gas_usage_response.rb +241 -0
  91. data/lib/turnkey_client/models/get_nonces_request.rb +295 -0
  92. data/lib/turnkey_client/models/get_nonces_response.rb +218 -0
  93. data/lib/turnkey_client/models/get_on_ramp_transaction_status_request.rb +237 -0
  94. data/lib/turnkey_client/models/get_on_ramp_transaction_status_response.rb +211 -0
  95. data/lib/turnkey_client/models/get_send_transaction_status_request.rb +226 -0
  96. data/lib/turnkey_client/models/get_send_transaction_status_response.rb +240 -0
  97. data/lib/turnkey_client/models/get_wallet_address_balances_request.rb +275 -0
  98. data/lib/turnkey_client/models/get_wallet_address_balances_response.rb +208 -0
  99. data/lib/turnkey_client/models/import_private_key_request.rb +14 -4
  100. data/lib/turnkey_client/models/import_wallet_request.rb +14 -4
  101. data/lib/turnkey_client/models/init_fiat_on_ramp_request.rb +14 -4
  102. data/lib/turnkey_client/models/init_import_private_key_request.rb +14 -4
  103. data/lib/turnkey_client/models/init_import_wallet_request.rb +14 -4
  104. data/lib/turnkey_client/models/init_otp_auth_intent_v3.rb +336 -0
  105. data/lib/turnkey_client/models/init_otp_auth_request.rb +16 -6
  106. data/lib/turnkey_client/models/init_otp_intent_v2.rb +336 -0
  107. data/lib/turnkey_client/models/init_otp_request.rb +16 -6
  108. data/lib/turnkey_client/models/init_user_email_recovery_intent.rb +37 -4
  109. data/lib/turnkey_client/models/init_user_email_recovery_intent_v2.rb +284 -0
  110. data/lib/turnkey_client/models/init_user_email_recovery_request.rb +16 -6
  111. data/lib/turnkey_client/models/intent.rb +148 -4
  112. data/lib/turnkey_client/models/list_fiat_on_ramp_credentials_request.rb +211 -0
  113. data/lib/turnkey_client/models/list_fiat_on_ramp_credentials_response.rb +212 -0
  114. data/lib/turnkey_client/models/list_supported_assets_request.rb +260 -0
  115. data/lib/turnkey_client/models/list_supported_assets_response.rb +208 -0
  116. data/lib/turnkey_client/models/native_revert_error.rb +229 -0
  117. data/lib/turnkey_client/models/oauth2_authenticate_request.rb +14 -4
  118. data/lib/turnkey_client/models/oauth_login_request.rb +14 -4
  119. data/lib/turnkey_client/models/oauth_request.rb +14 -4
  120. data/lib/turnkey_client/models/otp_auth_request.rb +14 -4
  121. data/lib/turnkey_client/models/otp_login_intent.rb +0 -2
  122. data/lib/turnkey_client/models/otp_login_request.rb +14 -4
  123. data/lib/turnkey_client/models/recover_user_request.rb +14 -4
  124. data/lib/turnkey_client/models/reject_activity_request.rb +14 -4
  125. data/lib/turnkey_client/models/remove_organization_feature_request.rb +14 -4
  126. data/lib/turnkey_client/models/result.rb +112 -4
  127. data/lib/turnkey_client/models/revert_chain_entry.rb +253 -0
  128. data/lib/turnkey_client/models/set_organization_feature_request.rb +14 -4
  129. data/lib/turnkey_client/models/sign_raw_payload_request.rb +14 -4
  130. data/lib/turnkey_client/models/sign_raw_payloads_request.rb +14 -4
  131. data/lib/turnkey_client/models/sign_transaction_request.rb +14 -4
  132. data/lib/turnkey_client/models/sol_send_transaction_intent.rb +297 -0
  133. data/lib/turnkey_client/models/sol_send_transaction_request.rb +298 -0
  134. data/lib/turnkey_client/models/sol_send_transaction_result.rb +211 -0
  135. data/lib/turnkey_client/models/stamp_login_request.rb +14 -4
  136. data/lib/turnkey_client/models/transaction_type.rb +2 -0
  137. data/lib/turnkey_client/models/tvc_manifest_approval.rb +226 -0
  138. data/lib/turnkey_client/models/tvc_operator_params.rb +226 -0
  139. data/lib/turnkey_client/models/tvc_operator_set_params.rb +250 -0
  140. data/lib/turnkey_client/models/tx_error.rb +218 -0
  141. data/lib/turnkey_client/models/unknown_revert_error.rb +218 -0
  142. data/lib/turnkey_client/models/update_auth_proxy_config_intent.rb +27 -5
  143. data/lib/turnkey_client/models/update_fiat_on_ramp_credential_intent.rb +277 -0
  144. data/lib/turnkey_client/models/update_fiat_on_ramp_credential_request.rb +298 -0
  145. data/lib/turnkey_client/models/update_fiat_on_ramp_credential_result.rb +211 -0
  146. data/lib/turnkey_client/models/update_oauth2_credential_request.rb +14 -4
  147. data/lib/turnkey_client/models/update_policy_request.rb +14 -4
  148. data/lib/turnkey_client/models/update_private_key_tag_request.rb +14 -4
  149. data/lib/turnkey_client/models/update_root_quorum_request.rb +14 -4
  150. data/lib/turnkey_client/models/update_user_email_request.rb +14 -4
  151. data/lib/turnkey_client/models/update_user_name_request.rb +14 -4
  152. data/lib/turnkey_client/models/update_user_phone_number_request.rb +14 -4
  153. data/lib/turnkey_client/models/update_user_request.rb +14 -4
  154. data/lib/turnkey_client/models/update_user_tag_request.rb +14 -4
  155. data/lib/turnkey_client/models/update_wallet_request.rb +14 -4
  156. data/lib/turnkey_client/models/upsert_gas_usage_config_intent.rb +252 -0
  157. data/lib/turnkey_client/models/upsert_gas_usage_config_result.rb +211 -0
  158. data/lib/turnkey_client/models/verify_otp_request.rb +14 -4
  159. data/lib/turnkey_client/version.rb +1 -1
  160. data/lib/turnkey_client.rb +70 -2
  161. data/turnkey_client.gemspec +1 -1
  162. metadata +76 -12
  163. data/turnkey_client-0.0.12.gem +0 -0
  164. data/turnkey_client-0.0.13.gem +0 -0
  165. data/turnkey_client-0.0.14.gem +0 -0
  166. data/turnkey_client-0.0.2.gem +0 -0
  167. data/turnkey_client-0.0.3.gem +0 -0
  168. data/turnkey_client-0.0.4.gem +0 -0
  169. data/turnkey_client-0.0.7.gem +0 -0
  170. data/turnkey_client-0.0.8.gem +0 -0
  171. data/turnkey_client-0.0.9.gem +0 -0
@@ -0,0 +1,241 @@
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 GetGasUsageResponse
15
+ # The window duration (in minutes) for the organization or sub-organization.
16
+ attr_accessor :window_duration_minutes
17
+
18
+ # The window limit (in USD) for the organization or sub-organization.
19
+ attr_accessor :window_limit_usd
20
+
21
+ # The total gas usage (in USD) of all sponsored transactions processed over the last `window_duration_minutes`
22
+ attr_accessor :usage_usd
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'window_duration_minutes' => :'windowDurationMinutes',
28
+ :'window_limit_usd' => :'windowLimitUsd',
29
+ :'usage_usd' => :'usageUsd'
30
+ }
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.openapi_types
35
+ {
36
+ :'window_duration_minutes' => :'Object',
37
+ :'window_limit_usd' => :'Object',
38
+ :'usage_usd' => :'Object'
39
+ }
40
+ end
41
+
42
+ # List of attributes with nullable: true
43
+ def self.openapi_nullable
44
+ Set.new([
45
+ ])
46
+ end
47
+
48
+ # Initializes the object
49
+ # @param [Hash] attributes Model attributes in the form of hash
50
+ def initialize(attributes = {})
51
+ if (!attributes.is_a?(Hash))
52
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TurnkeyClient::GetGasUsageResponse` initialize method"
53
+ end
54
+
55
+ # check to see if the attribute exists and convert string to symbol for hash key
56
+ attributes = attributes.each_with_object({}) { |(k, v), h|
57
+ if (!self.class.attribute_map.key?(k.to_sym))
58
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TurnkeyClient::GetGasUsageResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
59
+ end
60
+ h[k.to_sym] = v
61
+ }
62
+
63
+ if attributes.key?(:'window_duration_minutes')
64
+ self.window_duration_minutes = attributes[:'window_duration_minutes']
65
+ end
66
+
67
+ if attributes.key?(:'window_limit_usd')
68
+ self.window_limit_usd = attributes[:'window_limit_usd']
69
+ end
70
+
71
+ if attributes.key?(:'usage_usd')
72
+ self.usage_usd = attributes[:'usage_usd']
73
+ end
74
+ end
75
+
76
+ # Show invalid properties with the reasons. Usually used together with valid?
77
+ # @return Array for valid properties with the reasons
78
+ def list_invalid_properties
79
+ invalid_properties = Array.new
80
+ if @window_duration_minutes.nil?
81
+ invalid_properties.push('invalid value for "window_duration_minutes", window_duration_minutes cannot be nil.')
82
+ end
83
+
84
+ if @window_limit_usd.nil?
85
+ invalid_properties.push('invalid value for "window_limit_usd", window_limit_usd cannot be nil.')
86
+ end
87
+
88
+ if @usage_usd.nil?
89
+ invalid_properties.push('invalid value for "usage_usd", usage_usd cannot be nil.')
90
+ end
91
+
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
+ return false if @window_duration_minutes.nil?
99
+ return false if @window_limit_usd.nil?
100
+ return false if @usage_usd.nil?
101
+ true
102
+ end
103
+
104
+ # Checks equality by comparing each attribute.
105
+ # @param [Object] Object to be compared
106
+ def ==(o)
107
+ return true if self.equal?(o)
108
+ self.class == o.class &&
109
+ window_duration_minutes == o.window_duration_minutes &&
110
+ window_limit_usd == o.window_limit_usd &&
111
+ usage_usd == o.usage_usd
112
+ end
113
+
114
+ # @see the `==` method
115
+ # @param [Object] Object to be compared
116
+ def eql?(o)
117
+ self == o
118
+ end
119
+
120
+ # Calculates hash code according to all attributes.
121
+ # @return [Integer] Hash code
122
+ def hash
123
+ [window_duration_minutes, window_limit_usd, usage_usd].hash
124
+ end
125
+
126
+ # Builds the object from hash
127
+ # @param [Hash] attributes Model attributes in the form of hash
128
+ # @return [Object] Returns the model itself
129
+ def self.build_from_hash(attributes)
130
+ new.build_from_hash(attributes)
131
+ end
132
+
133
+ # Builds the object from hash
134
+ # @param [Hash] attributes Model attributes in the form of hash
135
+ # @return [Object] Returns the model itself
136
+ def build_from_hash(attributes)
137
+ return nil unless attributes.is_a?(Hash)
138
+ self.class.openapi_types.each_pair do |key, type|
139
+ if type =~ /\AArray<(.*)>/i
140
+ # check to ensure the input is an array given that the attribute
141
+ # is documented as an array but the input is not
142
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
143
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
144
+ end
145
+ elsif !attributes[self.class.attribute_map[key]].nil?
146
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
147
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
148
+ self.send("#{key}=", nil)
149
+ end
150
+ end
151
+
152
+ self
153
+ end
154
+
155
+ # Deserializes the data based on type
156
+ # @param string type Data type
157
+ # @param string value Value to be deserialized
158
+ # @return [Object] Deserialized data
159
+ def _deserialize(type, value)
160
+ case type.to_sym
161
+ when :DateTime
162
+ DateTime.parse(value)
163
+ when :Date
164
+ Date.parse(value)
165
+ when :String
166
+ value.to_s
167
+ when :Integer
168
+ value.to_i
169
+ when :Float
170
+ value.to_f
171
+ when :Boolean
172
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
173
+ true
174
+ else
175
+ false
176
+ end
177
+ when :Object
178
+ # generic object (usually a Hash), return directly
179
+ value
180
+ when /\AArray<(?<inner_type>.+)>\z/
181
+ inner_type = Regexp.last_match[:inner_type]
182
+ value.map { |v| _deserialize(inner_type, v) }
183
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
184
+ k_type = Regexp.last_match[:k_type]
185
+ v_type = Regexp.last_match[:v_type]
186
+ {}.tap do |hash|
187
+ value.each do |k, v|
188
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
189
+ end
190
+ end
191
+ else # model
192
+ TurnkeyClient.const_get(type).build_from_hash(value)
193
+ end
194
+ end
195
+
196
+ # Returns the string representation of the object
197
+ # @return [String] String presentation of the object
198
+ def to_s
199
+ to_hash.to_s
200
+ end
201
+
202
+ # to_body is an alias to to_hash (backward compatibility)
203
+ # @return [Hash] Returns the object in the form of hash
204
+ def to_body
205
+ to_hash
206
+ end
207
+
208
+ # Returns the object in the form of hash
209
+ # @return [Hash] Returns the object in the form of hash
210
+ def to_hash
211
+ hash = {}
212
+ self.class.attribute_map.each_pair do |attr, param|
213
+ value = self.send(attr)
214
+ if value.nil?
215
+ is_nullable = self.class.openapi_nullable.include?(attr)
216
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
217
+ end
218
+
219
+ hash[param] = _to_hash(value)
220
+ end
221
+ hash
222
+ end
223
+
224
+ # Outputs non-array value in the form of hash
225
+ # For object, use to_hash. Otherwise, just return the value
226
+ # @param [Object] value Any valid value
227
+ # @return [Hash] Returns the value in the form of hash
228
+ def _to_hash(value)
229
+ if value.is_a?(Array)
230
+ value.compact.map { |v| _to_hash(v) }
231
+ elsif value.is_a?(Hash)
232
+ {}.tap do |hash|
233
+ value.each { |k, v| hash[k] = _to_hash(v) }
234
+ end
235
+ elsif value.respond_to? :to_hash
236
+ value.to_hash
237
+ else
238
+ value
239
+ end
240
+ end end
241
+ end
@@ -0,0 +1,295 @@
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 GetNoncesRequest
15
+ # Unique identifier for a given Organization.
16
+ attr_accessor :organization_id
17
+
18
+ # The Ethereum address to query nonces for.
19
+ attr_accessor :address
20
+
21
+ # CAIP-2 chain ID (e.g., 'eip155:1' for Ethereum mainnet).
22
+ attr_accessor :caip2
23
+
24
+ # Whether to fetch the standard on-chain nonce.
25
+ attr_accessor :nonce
26
+
27
+ # Whether to fetch the gas station nonce used for sponsored transactions.
28
+ attr_accessor :gas_station_nonce
29
+
30
+ class EnumAttributeValidator
31
+ attr_reader :datatype
32
+ attr_reader :allowable_values
33
+
34
+ def initialize(datatype, allowable_values)
35
+ @allowable_values = allowable_values.map do |value|
36
+ case datatype.to_s
37
+ when /Integer/i
38
+ value.to_i
39
+ when /Float/i
40
+ value.to_f
41
+ else
42
+ value
43
+ end
44
+ end
45
+ end
46
+
47
+ def valid?(value)
48
+ !value || allowable_values.include?(value)
49
+ end
50
+ end
51
+
52
+ # Attribute mapping from ruby-style variable name to JSON key.
53
+ def self.attribute_map
54
+ {
55
+ :'organization_id' => :'organizationId',
56
+ :'address' => :'address',
57
+ :'caip2' => :'caip2',
58
+ :'nonce' => :'nonce',
59
+ :'gas_station_nonce' => :'gasStationNonce'
60
+ }
61
+ end
62
+
63
+ # Attribute type mapping.
64
+ def self.openapi_types
65
+ {
66
+ :'organization_id' => :'Object',
67
+ :'address' => :'Object',
68
+ :'caip2' => :'Object',
69
+ :'nonce' => :'Object',
70
+ :'gas_station_nonce' => :'Object'
71
+ }
72
+ end
73
+
74
+ # List of attributes with nullable: true
75
+ def self.openapi_nullable
76
+ Set.new([
77
+ ])
78
+ end
79
+
80
+ # Initializes the object
81
+ # @param [Hash] attributes Model attributes in the form of hash
82
+ def initialize(attributes = {})
83
+ if (!attributes.is_a?(Hash))
84
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TurnkeyClient::GetNoncesRequest` initialize method"
85
+ end
86
+
87
+ # check to see if the attribute exists and convert string to symbol for hash key
88
+ attributes = attributes.each_with_object({}) { |(k, v), h|
89
+ if (!self.class.attribute_map.key?(k.to_sym))
90
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TurnkeyClient::GetNoncesRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
91
+ end
92
+ h[k.to_sym] = v
93
+ }
94
+
95
+ if attributes.key?(:'organization_id')
96
+ self.organization_id = attributes[:'organization_id']
97
+ end
98
+
99
+ if attributes.key?(:'address')
100
+ self.address = attributes[:'address']
101
+ end
102
+
103
+ if attributes.key?(:'caip2')
104
+ self.caip2 = attributes[:'caip2']
105
+ end
106
+
107
+ if attributes.key?(:'nonce')
108
+ self.nonce = attributes[:'nonce']
109
+ end
110
+
111
+ if attributes.key?(:'gas_station_nonce')
112
+ self.gas_station_nonce = attributes[:'gas_station_nonce']
113
+ end
114
+ end
115
+
116
+ # Show invalid properties with the reasons. Usually used together with valid?
117
+ # @return Array for valid properties with the reasons
118
+ def list_invalid_properties
119
+ invalid_properties = Array.new
120
+ if @organization_id.nil?
121
+ invalid_properties.push('invalid value for "organization_id", organization_id cannot be nil.')
122
+ end
123
+
124
+ if @address.nil?
125
+ invalid_properties.push('invalid value for "address", address cannot be nil.')
126
+ end
127
+
128
+ if @caip2.nil?
129
+ invalid_properties.push('invalid value for "caip2", caip2 cannot be nil.')
130
+ end
131
+
132
+ invalid_properties
133
+ end
134
+
135
+ # Check to see if the all the properties in the model are valid
136
+ # @return true if the model is valid
137
+ def valid?
138
+ return false if @organization_id.nil?
139
+ return false if @address.nil?
140
+ return false if @caip2.nil?
141
+ caip2_validator = EnumAttributeValidator.new('Object', ['eip155:1', 'eip155:11155111', 'eip155:8453', 'eip155:84532', 'eip155:137', 'eip155:80002'])
142
+ return false unless caip2_validator.valid?(@caip2)
143
+ true
144
+ end
145
+
146
+ # Custom attribute writer method checking allowed values (enum).
147
+ # @param [Object] caip2 Object to be assigned
148
+ def caip2=(caip2)
149
+ validator = EnumAttributeValidator.new('Object', ['eip155:1', 'eip155:11155111', 'eip155:8453', 'eip155:84532', 'eip155:137', 'eip155:80002'])
150
+ unless validator.valid?(caip2)
151
+ fail ArgumentError, "invalid value for \"caip2\", must be one of #{validator.allowable_values}."
152
+ end
153
+ @caip2 = caip2
154
+ end
155
+
156
+ # Checks equality by comparing each attribute.
157
+ # @param [Object] Object to be compared
158
+ def ==(o)
159
+ return true if self.equal?(o)
160
+ self.class == o.class &&
161
+ organization_id == o.organization_id &&
162
+ address == o.address &&
163
+ caip2 == o.caip2 &&
164
+ nonce == o.nonce &&
165
+ gas_station_nonce == o.gas_station_nonce
166
+ end
167
+
168
+ # @see the `==` method
169
+ # @param [Object] Object to be compared
170
+ def eql?(o)
171
+ self == o
172
+ end
173
+
174
+ # Calculates hash code according to all attributes.
175
+ # @return [Integer] Hash code
176
+ def hash
177
+ [organization_id, address, caip2, nonce, gas_station_nonce].hash
178
+ end
179
+
180
+ # Builds the object from hash
181
+ # @param [Hash] attributes Model attributes in the form of hash
182
+ # @return [Object] Returns the model itself
183
+ def self.build_from_hash(attributes)
184
+ new.build_from_hash(attributes)
185
+ end
186
+
187
+ # Builds the object from hash
188
+ # @param [Hash] attributes Model attributes in the form of hash
189
+ # @return [Object] Returns the model itself
190
+ def build_from_hash(attributes)
191
+ return nil unless attributes.is_a?(Hash)
192
+ self.class.openapi_types.each_pair do |key, type|
193
+ if type =~ /\AArray<(.*)>/i
194
+ # check to ensure the input is an array given that the attribute
195
+ # is documented as an array but the input is not
196
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
197
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
198
+ end
199
+ elsif !attributes[self.class.attribute_map[key]].nil?
200
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
201
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
202
+ self.send("#{key}=", nil)
203
+ end
204
+ end
205
+
206
+ self
207
+ end
208
+
209
+ # Deserializes the data based on type
210
+ # @param string type Data type
211
+ # @param string value Value to be deserialized
212
+ # @return [Object] Deserialized data
213
+ def _deserialize(type, value)
214
+ case type.to_sym
215
+ when :DateTime
216
+ DateTime.parse(value)
217
+ when :Date
218
+ Date.parse(value)
219
+ when :String
220
+ value.to_s
221
+ when :Integer
222
+ value.to_i
223
+ when :Float
224
+ value.to_f
225
+ when :Boolean
226
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
227
+ true
228
+ else
229
+ false
230
+ end
231
+ when :Object
232
+ # generic object (usually a Hash), return directly
233
+ value
234
+ when /\AArray<(?<inner_type>.+)>\z/
235
+ inner_type = Regexp.last_match[:inner_type]
236
+ value.map { |v| _deserialize(inner_type, v) }
237
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
238
+ k_type = Regexp.last_match[:k_type]
239
+ v_type = Regexp.last_match[:v_type]
240
+ {}.tap do |hash|
241
+ value.each do |k, v|
242
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
243
+ end
244
+ end
245
+ else # model
246
+ TurnkeyClient.const_get(type).build_from_hash(value)
247
+ end
248
+ end
249
+
250
+ # Returns the string representation of the object
251
+ # @return [String] String presentation of the object
252
+ def to_s
253
+ to_hash.to_s
254
+ end
255
+
256
+ # to_body is an alias to to_hash (backward compatibility)
257
+ # @return [Hash] Returns the object in the form of hash
258
+ def to_body
259
+ to_hash
260
+ end
261
+
262
+ # Returns the object in the form of hash
263
+ # @return [Hash] Returns the object in the form of hash
264
+ def to_hash
265
+ hash = {}
266
+ self.class.attribute_map.each_pair do |attr, param|
267
+ value = self.send(attr)
268
+ if value.nil?
269
+ is_nullable = self.class.openapi_nullable.include?(attr)
270
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
271
+ end
272
+
273
+ hash[param] = _to_hash(value)
274
+ end
275
+ hash
276
+ end
277
+
278
+ # Outputs non-array value in the form of hash
279
+ # For object, use to_hash. Otherwise, just return the value
280
+ # @param [Object] value Any valid value
281
+ # @return [Hash] Returns the value in the form of hash
282
+ def _to_hash(value)
283
+ if value.is_a?(Array)
284
+ value.compact.map { |v| _to_hash(v) }
285
+ elsif value.is_a?(Hash)
286
+ {}.tap do |hash|
287
+ value.each { |k, v| hash[k] = _to_hash(v) }
288
+ end
289
+ elsif value.respond_to? :to_hash
290
+ value.to_hash
291
+ else
292
+ value
293
+ end
294
+ end end
295
+ end