turnkey_client 0.0.13 → 0.0.14

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 (167) hide show
  1. checksums.yaml +4 -4
  2. data/lib/turnkey_client/api/activities_api.rb +66 -8
  3. data/lib/turnkey_client/api/api_keys_api.rb +14 -14
  4. data/lib/turnkey_client/api/authenticators_api.rb +16 -16
  5. data/lib/turnkey_client/api/consensus_api.rb +8 -8
  6. data/lib/turnkey_client/api/features_api.rb +8 -8
  7. data/lib/turnkey_client/api/invitations_api.rb +8 -8
  8. data/lib/turnkey_client/api/on_ramp_api.rb +77 -0
  9. data/lib/turnkey_client/api/organizations_api.rb +18 -18
  10. data/lib/turnkey_client/api/policies_api.rb +256 -24
  11. data/lib/turnkey_client/api/private_key_tags_api.rb +12 -12
  12. data/lib/turnkey_client/api/private_keys_api.rb +28 -28
  13. data/lib/turnkey_client/api/sessions_api.rb +184 -10
  14. data/lib/turnkey_client/api/signing_api.rb +12 -12
  15. data/lib/turnkey_client/api/user_auth_api.rb +20 -20
  16. data/lib/turnkey_client/api/user_recovery_api.rb +6 -6
  17. data/lib/turnkey_client/api/user_tags_api.rb +12 -12
  18. data/lib/turnkey_client/api/user_verification_api.rb +135 -0
  19. data/lib/turnkey_client/api/users_api.rb +194 -20
  20. data/lib/turnkey_client/api/wallets_api.rb +48 -48
  21. data/lib/turnkey_client/models/activity_type.rb +14 -0
  22. data/lib/turnkey_client/models/activity_v1_policy_evaluation.rb +287 -0
  23. data/lib/turnkey_client/models/address_format.rb +1 -0
  24. data/lib/turnkey_client/models/api_key.rb +1 -0
  25. data/lib/turnkey_client/models/api_key_params.rb +1 -0
  26. data/lib/turnkey_client/models/api_key_params_v2.rb +1 -0
  27. data/lib/turnkey_client/models/api_only_user_params.rb +3 -2
  28. data/lib/turnkey_client/models/create_organization_intent.rb +1 -0
  29. data/lib/turnkey_client/models/create_organization_intent_v2.rb +1 -0
  30. data/lib/turnkey_client/models/create_policy_intent_v3.rb +2 -0
  31. data/lib/turnkey_client/models/create_read_write_session_intent.rb +3 -1
  32. data/lib/turnkey_client/models/create_read_write_session_intent_v2.rb +19 -5
  33. data/lib/turnkey_client/models/create_smart_contract_interface_intent.rb +265 -0
  34. data/lib/turnkey_client/models/create_smart_contract_interface_request.rb +288 -0
  35. data/lib/turnkey_client/models/create_smart_contract_interface_result.rb +211 -0
  36. data/lib/turnkey_client/models/create_sub_organization_intent_v4.rb +2 -0
  37. data/lib/turnkey_client/models/create_sub_organization_intent_v5.rb +2 -0
  38. data/lib/turnkey_client/models/create_sub_organization_intent_v6.rb +2 -0
  39. data/lib/turnkey_client/models/create_sub_organization_intent_v7.rb +4 -0
  40. data/lib/turnkey_client/models/create_users_intent_v3.rb +213 -0
  41. data/lib/turnkey_client/models/create_users_request.rb +2 -2
  42. data/lib/turnkey_client/models/create_wallet_intent.rb +2 -1
  43. data/lib/turnkey_client/models/credential_type.rb +3 -0
  44. data/lib/turnkey_client/models/data_v1_smart_contract_interface.rb +329 -0
  45. data/lib/turnkey_client/models/delete_payment_method_intent.rb +1 -0
  46. data/lib/turnkey_client/models/delete_private_keys_intent.rb +1 -0
  47. data/lib/turnkey_client/models/delete_smart_contract_interface_intent.rb +211 -0
  48. data/lib/turnkey_client/models/delete_smart_contract_interface_request.rb +288 -0
  49. data/lib/turnkey_client/models/delete_smart_contract_interface_result.rb +211 -0
  50. data/lib/turnkey_client/models/delete_sub_organization_intent.rb +1 -0
  51. data/lib/turnkey_client/models/delete_wallets_intent.rb +1 -0
  52. data/lib/turnkey_client/models/email_auth_intent.rb +31 -5
  53. data/lib/turnkey_client/models/email_auth_intent_v2.rb +31 -5
  54. data/lib/turnkey_client/models/email_customization_params.rb +5 -0
  55. data/lib/turnkey_client/models/feature.rb +1 -0
  56. data/lib/turnkey_client/models/fiat_on_ramp_blockchain_network.rb +29 -0
  57. data/lib/turnkey_client/models/fiat_on_ramp_crypto_currency.rb +29 -0
  58. data/lib/turnkey_client/models/fiat_on_ramp_currency.rb +59 -0
  59. data/lib/turnkey_client/models/fiat_on_ramp_payment_method.rb +38 -0
  60. data/lib/turnkey_client/models/fiat_on_ramp_provider.rb +27 -0
  61. data/lib/turnkey_client/models/get_activities_request.rb +3 -3
  62. data/lib/turnkey_client/models/get_activities_response.rb +1 -1
  63. data/lib/turnkey_client/models/get_activity_request.rb +2 -2
  64. data/lib/turnkey_client/models/get_api_key_request.rb +1 -1
  65. data/lib/turnkey_client/models/get_api_keys_request.rb +3 -2
  66. data/lib/turnkey_client/models/get_authenticator_request.rb +2 -2
  67. data/lib/turnkey_client/models/get_authenticators_request.rb +2 -2
  68. data/lib/turnkey_client/models/get_oauth_providers_request.rb +3 -2
  69. data/lib/turnkey_client/models/get_oauth_providers_response.rb +1 -1
  70. data/lib/turnkey_client/models/get_organization_configs_request.rb +1 -1
  71. data/lib/turnkey_client/models/get_policies_request.rb +1 -1
  72. data/lib/turnkey_client/models/get_policies_response.rb +1 -1
  73. data/lib/turnkey_client/models/get_policy_evaluations_request.rb +226 -0
  74. data/lib/turnkey_client/models/get_policy_evaluations_response.rb +212 -0
  75. data/lib/turnkey_client/models/get_policy_request.rb +2 -2
  76. data/lib/turnkey_client/models/get_private_key_request.rb +2 -2
  77. data/lib/turnkey_client/models/get_private_keys_request.rb +1 -1
  78. data/lib/turnkey_client/models/get_private_keys_response.rb +1 -1
  79. data/lib/turnkey_client/models/get_smart_contract_interface_request.rb +226 -0
  80. data/lib/turnkey_client/models/get_smart_contract_interface_response.rb +210 -0
  81. data/lib/turnkey_client/models/get_smart_contract_interfaces_request.rb +211 -0
  82. data/lib/turnkey_client/models/get_smart_contract_interfaces_response.rb +213 -0
  83. data/lib/turnkey_client/models/get_sub_org_ids_request.rb +2 -2
  84. data/lib/turnkey_client/models/get_user_request.rb +2 -2
  85. data/lib/turnkey_client/models/get_users_request.rb +1 -1
  86. data/lib/turnkey_client/models/get_users_response.rb +1 -1
  87. data/lib/turnkey_client/models/get_verified_sub_org_ids_request.rb +2 -2
  88. data/lib/turnkey_client/models/get_wallet_account_request.rb +6 -4
  89. data/lib/turnkey_client/models/get_wallet_accounts_request.rb +3 -7
  90. data/lib/turnkey_client/models/get_wallet_accounts_response.rb +1 -1
  91. data/lib/turnkey_client/models/get_wallet_request.rb +2 -2
  92. data/lib/turnkey_client/models/get_wallets_request.rb +1 -1
  93. data/lib/turnkey_client/models/get_wallets_response.rb +1 -1
  94. data/lib/turnkey_client/models/get_whoami_request.rb +1 -1
  95. data/lib/turnkey_client/models/get_whoami_response.rb +4 -4
  96. data/lib/turnkey_client/models/init_fiat_on_ramp_intent.rb +315 -0
  97. data/lib/turnkey_client/models/init_fiat_on_ramp_request.rb +288 -0
  98. data/lib/turnkey_client/models/init_fiat_on_ramp_result.rb +226 -0
  99. data/lib/turnkey_client/models/init_otp_auth_intent.rb +28 -4
  100. data/lib/turnkey_client/models/init_otp_auth_intent_v2.rb +310 -0
  101. data/lib/turnkey_client/models/init_otp_auth_request.rb +2 -2
  102. data/lib/turnkey_client/models/init_otp_auth_result_v2.rb +211 -0
  103. data/lib/turnkey_client/models/init_otp_intent.rb +321 -0
  104. data/lib/turnkey_client/models/init_otp_request.rb +288 -0
  105. data/lib/turnkey_client/models/init_otp_result.rb +211 -0
  106. data/lib/turnkey_client/models/init_user_email_recovery_intent.rb +2 -1
  107. data/lib/turnkey_client/models/intent.rb +130 -4
  108. data/lib/turnkey_client/models/invitation_params.rb +1 -1
  109. data/lib/turnkey_client/models/list_private_key_tags_request.rb +1 -1
  110. data/lib/turnkey_client/models/list_private_key_tags_response.rb +1 -1
  111. data/lib/turnkey_client/models/list_user_tags_request.rb +1 -1
  112. data/lib/turnkey_client/models/list_user_tags_response.rb +1 -1
  113. data/lib/turnkey_client/models/oauth_intent.rb +18 -5
  114. data/lib/turnkey_client/models/oauth_login_intent.rb +248 -0
  115. data/lib/turnkey_client/models/oauth_login_request.rb +288 -0
  116. data/lib/turnkey_client/models/oauth_login_result.rb +211 -0
  117. data/lib/turnkey_client/models/otp_auth_intent.rb +10 -2
  118. data/lib/turnkey_client/models/otp_login_intent.rb +248 -0
  119. data/lib/turnkey_client/models/otp_login_request.rb +288 -0
  120. data/lib/turnkey_client/models/otp_login_result.rb +211 -0
  121. data/lib/turnkey_client/models/outcome.rb +31 -0
  122. data/lib/turnkey_client/models/payload_encoding.rb +1 -0
  123. data/lib/turnkey_client/models/policy.rb +2 -0
  124. data/lib/turnkey_client/models/private_key_params.rb +1 -1
  125. data/lib/turnkey_client/models/result.rb +121 -4
  126. data/lib/turnkey_client/models/root_user_params.rb +3 -2
  127. data/lib/turnkey_client/models/root_user_params_v2.rb +4 -3
  128. data/lib/turnkey_client/models/root_user_params_v3.rb +4 -3
  129. data/lib/turnkey_client/models/root_user_params_v4.rb +5 -3
  130. data/lib/turnkey_client/models/set_organization_feature_intent.rb +1 -0
  131. data/lib/turnkey_client/models/simple_client_extension_results.rb +2 -0
  132. data/lib/turnkey_client/models/smart_contract_interface_type.rb +27 -0
  133. data/lib/turnkey_client/models/sms_customization_params.rb +1 -0
  134. data/lib/turnkey_client/models/stamp_login_intent.rb +233 -0
  135. data/lib/turnkey_client/models/stamp_login_request.rb +288 -0
  136. data/lib/turnkey_client/models/stamp_login_result.rb +211 -0
  137. data/lib/turnkey_client/models/transaction_type.rb +1 -0
  138. data/lib/turnkey_client/models/ump_v1_policy_evaluation.rb +214 -0
  139. data/lib/turnkey_client/models/update_policy_intent.rb +4 -0
  140. data/lib/turnkey_client/models/update_policy_intent_v2.rb +264 -0
  141. data/lib/turnkey_client/models/update_policy_request.rb +2 -2
  142. data/lib/turnkey_client/models/update_policy_result_v2.rb +211 -0
  143. data/lib/turnkey_client/models/update_private_key_tag_intent.rb +1 -0
  144. data/lib/turnkey_client/models/update_user_email_intent.rb +237 -0
  145. data/lib/turnkey_client/models/update_user_email_request.rb +288 -0
  146. data/lib/turnkey_client/models/update_user_email_result.rb +211 -0
  147. data/lib/turnkey_client/models/update_user_intent.rb +4 -1
  148. data/lib/turnkey_client/models/update_user_name_intent.rb +226 -0
  149. data/lib/turnkey_client/models/update_user_name_request.rb +288 -0
  150. data/lib/turnkey_client/models/update_user_name_result.rb +211 -0
  151. data/lib/turnkey_client/models/update_user_phone_number_intent.rb +237 -0
  152. data/lib/turnkey_client/models/update_user_phone_number_request.rb +288 -0
  153. data/lib/turnkey_client/models/update_user_phone_number_result.rb +211 -0
  154. data/lib/turnkey_client/models/update_user_tag_intent.rb +1 -0
  155. data/lib/turnkey_client/models/user.rb +3 -1
  156. data/lib/turnkey_client/models/user_params.rb +4 -3
  157. data/lib/turnkey_client/models/user_params_v2.rb +4 -3
  158. data/lib/turnkey_client/models/user_params_v3.rb +301 -0
  159. data/lib/turnkey_client/models/verify_otp_intent.rb +237 -0
  160. data/lib/turnkey_client/models/verify_otp_request.rb +288 -0
  161. data/lib/turnkey_client/models/verify_otp_result.rb +211 -0
  162. data/lib/turnkey_client/models/wallet_account.rb +15 -4
  163. data/lib/turnkey_client/models/wallet_params.rb +2 -1
  164. data/lib/turnkey_client/version.rb +1 -1
  165. data/lib/turnkey_client.rb +57 -0
  166. data/turnkey_client-0.0.13.gem +0 -0
  167. metadata +60 -2
@@ -0,0 +1,265 @@
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 CreateSmartContractInterfaceIntent
15
+ # Corresponding contract address or program ID
16
+ attr_accessor :smart_contract_address
17
+
18
+ # ABI/IDL as a JSON string
19
+ attr_accessor :smart_contract_interface
20
+
21
+ attr_accessor :type
22
+
23
+ # Human-readable name for a Smart Contract Interface.
24
+ attr_accessor :label
25
+
26
+ # Notes for a Smart Contract Interface.
27
+ attr_accessor :notes
28
+
29
+ # Attribute mapping from ruby-style variable name to JSON key.
30
+ def self.attribute_map
31
+ {
32
+ :'smart_contract_address' => :'smartContractAddress',
33
+ :'smart_contract_interface' => :'smartContractInterface',
34
+ :'type' => :'type',
35
+ :'label' => :'label',
36
+ :'notes' => :'notes'
37
+ }
38
+ end
39
+
40
+ # Attribute type mapping.
41
+ def self.openapi_types
42
+ {
43
+ :'smart_contract_address' => :'Object',
44
+ :'smart_contract_interface' => :'Object',
45
+ :'type' => :'Object',
46
+ :'label' => :'Object',
47
+ :'notes' => :'Object'
48
+ }
49
+ end
50
+
51
+ # List of attributes with nullable: true
52
+ def self.openapi_nullable
53
+ Set.new([
54
+ ])
55
+ end
56
+
57
+ # Initializes the object
58
+ # @param [Hash] attributes Model attributes in the form of hash
59
+ def initialize(attributes = {})
60
+ if (!attributes.is_a?(Hash))
61
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TurnkeyClient::CreateSmartContractInterfaceIntent` initialize method"
62
+ end
63
+
64
+ # check to see if the attribute exists and convert string to symbol for hash key
65
+ attributes = attributes.each_with_object({}) { |(k, v), h|
66
+ if (!self.class.attribute_map.key?(k.to_sym))
67
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TurnkeyClient::CreateSmartContractInterfaceIntent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
68
+ end
69
+ h[k.to_sym] = v
70
+ }
71
+
72
+ if attributes.key?(:'smart_contract_address')
73
+ self.smart_contract_address = attributes[:'smart_contract_address']
74
+ end
75
+
76
+ if attributes.key?(:'smart_contract_interface')
77
+ self.smart_contract_interface = attributes[:'smart_contract_interface']
78
+ end
79
+
80
+ if attributes.key?(:'type')
81
+ self.type = attributes[:'type']
82
+ end
83
+
84
+ if attributes.key?(:'label')
85
+ self.label = attributes[:'label']
86
+ end
87
+
88
+ if attributes.key?(:'notes')
89
+ self.notes = attributes[:'notes']
90
+ end
91
+ end
92
+
93
+ # Show invalid properties with the reasons. Usually used together with valid?
94
+ # @return Array for valid properties with the reasons
95
+ def list_invalid_properties
96
+ invalid_properties = Array.new
97
+ if @smart_contract_address.nil?
98
+ invalid_properties.push('invalid value for "smart_contract_address", smart_contract_address cannot be nil.')
99
+ end
100
+
101
+ if @smart_contract_interface.nil?
102
+ invalid_properties.push('invalid value for "smart_contract_interface", smart_contract_interface cannot be nil.')
103
+ end
104
+
105
+ if @type.nil?
106
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
107
+ end
108
+
109
+ if @label.nil?
110
+ invalid_properties.push('invalid value for "label", label cannot be nil.')
111
+ end
112
+
113
+ invalid_properties
114
+ end
115
+
116
+ # Check to see if the all the properties in the model are valid
117
+ # @return true if the model is valid
118
+ def valid?
119
+ return false if @smart_contract_address.nil?
120
+ return false if @smart_contract_interface.nil?
121
+ return false if @type.nil?
122
+ return false if @label.nil?
123
+ true
124
+ end
125
+
126
+ # Checks equality by comparing each attribute.
127
+ # @param [Object] Object to be compared
128
+ def ==(o)
129
+ return true if self.equal?(o)
130
+ self.class == o.class &&
131
+ smart_contract_address == o.smart_contract_address &&
132
+ smart_contract_interface == o.smart_contract_interface &&
133
+ type == o.type &&
134
+ label == o.label &&
135
+ notes == o.notes
136
+ end
137
+
138
+ # @see the `==` method
139
+ # @param [Object] Object to be compared
140
+ def eql?(o)
141
+ self == o
142
+ end
143
+
144
+ # Calculates hash code according to all attributes.
145
+ # @return [Integer] Hash code
146
+ def hash
147
+ [smart_contract_address, smart_contract_interface, type, label, notes].hash
148
+ end
149
+
150
+ # Builds the object from hash
151
+ # @param [Hash] attributes Model attributes in the form of hash
152
+ # @return [Object] Returns the model itself
153
+ def self.build_from_hash(attributes)
154
+ new.build_from_hash(attributes)
155
+ end
156
+
157
+ # Builds the object from hash
158
+ # @param [Hash] attributes Model attributes in the form of hash
159
+ # @return [Object] Returns the model itself
160
+ def build_from_hash(attributes)
161
+ return nil unless attributes.is_a?(Hash)
162
+ self.class.openapi_types.each_pair do |key, type|
163
+ if type =~ /\AArray<(.*)>/i
164
+ # check to ensure the input is an array given that the attribute
165
+ # is documented as an array but the input is not
166
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
167
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
168
+ end
169
+ elsif !attributes[self.class.attribute_map[key]].nil?
170
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
171
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
172
+ self.send("#{key}=", nil)
173
+ end
174
+ end
175
+
176
+ self
177
+ end
178
+
179
+ # Deserializes the data based on type
180
+ # @param string type Data type
181
+ # @param string value Value to be deserialized
182
+ # @return [Object] Deserialized data
183
+ def _deserialize(type, value)
184
+ case type.to_sym
185
+ when :DateTime
186
+ DateTime.parse(value)
187
+ when :Date
188
+ Date.parse(value)
189
+ when :String
190
+ value.to_s
191
+ when :Integer
192
+ value.to_i
193
+ when :Float
194
+ value.to_f
195
+ when :Boolean
196
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
197
+ true
198
+ else
199
+ false
200
+ end
201
+ when :Object
202
+ # generic object (usually a Hash), return directly
203
+ value
204
+ when /\AArray<(?<inner_type>.+)>\z/
205
+ inner_type = Regexp.last_match[:inner_type]
206
+ value.map { |v| _deserialize(inner_type, v) }
207
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
208
+ k_type = Regexp.last_match[:k_type]
209
+ v_type = Regexp.last_match[:v_type]
210
+ {}.tap do |hash|
211
+ value.each do |k, v|
212
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
213
+ end
214
+ end
215
+ else # model
216
+ TurnkeyClient.const_get(type).build_from_hash(value)
217
+ end
218
+ end
219
+
220
+ # Returns the string representation of the object
221
+ # @return [String] String presentation of the object
222
+ def to_s
223
+ to_hash.to_s
224
+ end
225
+
226
+ # to_body is an alias to to_hash (backward compatibility)
227
+ # @return [Hash] Returns the object in the form of hash
228
+ def to_body
229
+ to_hash
230
+ end
231
+
232
+ # Returns the object in the form of hash
233
+ # @return [Hash] Returns the object in the form of hash
234
+ def to_hash
235
+ hash = {}
236
+ self.class.attribute_map.each_pair do |attr, param|
237
+ value = self.send(attr)
238
+ if value.nil?
239
+ is_nullable = self.class.openapi_nullable.include?(attr)
240
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
241
+ end
242
+
243
+ hash[param] = _to_hash(value)
244
+ end
245
+ hash
246
+ end
247
+
248
+ # Outputs non-array value in the form of hash
249
+ # For object, use to_hash. Otherwise, just return the value
250
+ # @param [Object] value Any valid value
251
+ # @return [Hash] Returns the value in the form of hash
252
+ def _to_hash(value)
253
+ if value.is_a?(Array)
254
+ value.compact.map { |v| _to_hash(v) }
255
+ elsif value.is_a?(Hash)
256
+ {}.tap do |hash|
257
+ value.each { |k, v| hash[k] = _to_hash(v) }
258
+ end
259
+ elsif value.respond_to? :to_hash
260
+ value.to_hash
261
+ else
262
+ value
263
+ end
264
+ end end
265
+ end
@@ -0,0 +1,288 @@
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 CreateSmartContractInterfaceRequest
15
+ attr_accessor :type
16
+
17
+ # Timestamp (in milliseconds) of the request, used to verify liveness of user requests.
18
+ attr_accessor :timestamp_ms
19
+
20
+ # Unique identifier for a given Organization.
21
+ attr_accessor :organization_id
22
+
23
+ attr_accessor :parameters
24
+
25
+ class EnumAttributeValidator
26
+ attr_reader :datatype
27
+ attr_reader :allowable_values
28
+
29
+ def initialize(datatype, allowable_values)
30
+ @allowable_values = allowable_values.map do |value|
31
+ case datatype.to_s
32
+ when /Integer/i
33
+ value.to_i
34
+ when /Float/i
35
+ value.to_f
36
+ else
37
+ value
38
+ end
39
+ end
40
+ end
41
+
42
+ def valid?(value)
43
+ !value || allowable_values.include?(value)
44
+ end
45
+ end
46
+
47
+ # Attribute mapping from ruby-style variable name to JSON key.
48
+ def self.attribute_map
49
+ {
50
+ :'type' => :'type',
51
+ :'timestamp_ms' => :'timestampMs',
52
+ :'organization_id' => :'organizationId',
53
+ :'parameters' => :'parameters'
54
+ }
55
+ end
56
+
57
+ # Attribute type mapping.
58
+ def self.openapi_types
59
+ {
60
+ :'type' => :'Object',
61
+ :'timestamp_ms' => :'Object',
62
+ :'organization_id' => :'Object',
63
+ :'parameters' => :'Object'
64
+ }
65
+ end
66
+
67
+ # List of attributes with nullable: true
68
+ def self.openapi_nullable
69
+ Set.new([
70
+ ])
71
+ end
72
+
73
+ # Initializes the object
74
+ # @param [Hash] attributes Model attributes in the form of hash
75
+ def initialize(attributes = {})
76
+ if (!attributes.is_a?(Hash))
77
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TurnkeyClient::CreateSmartContractInterfaceRequest` initialize method"
78
+ end
79
+
80
+ # check to see if the attribute exists and convert string to symbol for hash key
81
+ attributes = attributes.each_with_object({}) { |(k, v), h|
82
+ if (!self.class.attribute_map.key?(k.to_sym))
83
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TurnkeyClient::CreateSmartContractInterfaceRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
84
+ end
85
+ h[k.to_sym] = v
86
+ }
87
+
88
+ if attributes.key?(:'type')
89
+ self.type = attributes[:'type']
90
+ end
91
+
92
+ if attributes.key?(:'timestamp_ms')
93
+ self.timestamp_ms = attributes[:'timestamp_ms']
94
+ end
95
+
96
+ if attributes.key?(:'organization_id')
97
+ self.organization_id = attributes[:'organization_id']
98
+ end
99
+
100
+ if attributes.key?(:'parameters')
101
+ self.parameters = attributes[:'parameters']
102
+ end
103
+ end
104
+
105
+ # Show invalid properties with the reasons. Usually used together with valid?
106
+ # @return Array for valid properties with the reasons
107
+ def list_invalid_properties
108
+ invalid_properties = Array.new
109
+ if @type.nil?
110
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
111
+ end
112
+
113
+ if @timestamp_ms.nil?
114
+ invalid_properties.push('invalid value for "timestamp_ms", timestamp_ms cannot be nil.')
115
+ end
116
+
117
+ if @organization_id.nil?
118
+ invalid_properties.push('invalid value for "organization_id", organization_id cannot be nil.')
119
+ end
120
+
121
+ if @parameters.nil?
122
+ invalid_properties.push('invalid value for "parameters", parameters cannot be nil.')
123
+ end
124
+
125
+ invalid_properties
126
+ end
127
+
128
+ # Check to see if the all the properties in the model are valid
129
+ # @return true if the model is valid
130
+ def valid?
131
+ return false if @type.nil?
132
+ type_validator = EnumAttributeValidator.new('Object', ['ACTIVITY_TYPE_CREATE_SMART_CONTRACT_INTERFACE'])
133
+ return false unless type_validator.valid?(@type)
134
+ return false if @timestamp_ms.nil?
135
+ return false if @organization_id.nil?
136
+ return false if @parameters.nil?
137
+ true
138
+ end
139
+
140
+ # Custom attribute writer method checking allowed values (enum).
141
+ # @param [Object] type Object to be assigned
142
+ def type=(type)
143
+ validator = EnumAttributeValidator.new('Object', ['ACTIVITY_TYPE_CREATE_SMART_CONTRACT_INTERFACE'])
144
+ unless validator.valid?(type)
145
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
146
+ end
147
+ @type = type
148
+ end
149
+
150
+ # Checks equality by comparing each attribute.
151
+ # @param [Object] Object to be compared
152
+ def ==(o)
153
+ return true if self.equal?(o)
154
+ self.class == o.class &&
155
+ type == o.type &&
156
+ timestamp_ms == o.timestamp_ms &&
157
+ organization_id == o.organization_id &&
158
+ parameters == o.parameters
159
+ end
160
+
161
+ # @see the `==` method
162
+ # @param [Object] Object to be compared
163
+ def eql?(o)
164
+ self == o
165
+ end
166
+
167
+ # Calculates hash code according to all attributes.
168
+ # @return [Integer] Hash code
169
+ def hash
170
+ [type, timestamp_ms, organization_id, parameters].hash
171
+ end
172
+
173
+ # Builds the object from hash
174
+ # @param [Hash] attributes Model attributes in the form of hash
175
+ # @return [Object] Returns the model itself
176
+ def self.build_from_hash(attributes)
177
+ new.build_from_hash(attributes)
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 build_from_hash(attributes)
184
+ return nil unless attributes.is_a?(Hash)
185
+ self.class.openapi_types.each_pair do |key, type|
186
+ if type =~ /\AArray<(.*)>/i
187
+ # check to ensure the input is an array given that the attribute
188
+ # is documented as an array but the input is not
189
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
190
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
191
+ end
192
+ elsif !attributes[self.class.attribute_map[key]].nil?
193
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
194
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
195
+ self.send("#{key}=", nil)
196
+ end
197
+ end
198
+
199
+ self
200
+ end
201
+
202
+ # Deserializes the data based on type
203
+ # @param string type Data type
204
+ # @param string value Value to be deserialized
205
+ # @return [Object] Deserialized data
206
+ def _deserialize(type, value)
207
+ case type.to_sym
208
+ when :DateTime
209
+ DateTime.parse(value)
210
+ when :Date
211
+ Date.parse(value)
212
+ when :String
213
+ value.to_s
214
+ when :Integer
215
+ value.to_i
216
+ when :Float
217
+ value.to_f
218
+ when :Boolean
219
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
220
+ true
221
+ else
222
+ false
223
+ end
224
+ when :Object
225
+ # generic object (usually a Hash), return directly
226
+ value
227
+ when /\AArray<(?<inner_type>.+)>\z/
228
+ inner_type = Regexp.last_match[:inner_type]
229
+ value.map { |v| _deserialize(inner_type, v) }
230
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
231
+ k_type = Regexp.last_match[:k_type]
232
+ v_type = Regexp.last_match[:v_type]
233
+ {}.tap do |hash|
234
+ value.each do |k, v|
235
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
236
+ end
237
+ end
238
+ else # model
239
+ TurnkeyClient.const_get(type).build_from_hash(value)
240
+ end
241
+ end
242
+
243
+ # Returns the string representation of the object
244
+ # @return [String] String presentation of the object
245
+ def to_s
246
+ to_hash.to_s
247
+ end
248
+
249
+ # to_body is an alias to to_hash (backward compatibility)
250
+ # @return [Hash] Returns the object in the form of hash
251
+ def to_body
252
+ to_hash
253
+ end
254
+
255
+ # Returns the object in the form of hash
256
+ # @return [Hash] Returns the object in the form of hash
257
+ def to_hash
258
+ hash = {}
259
+ self.class.attribute_map.each_pair do |attr, param|
260
+ value = self.send(attr)
261
+ if value.nil?
262
+ is_nullable = self.class.openapi_nullable.include?(attr)
263
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
264
+ end
265
+
266
+ hash[param] = _to_hash(value)
267
+ end
268
+ hash
269
+ end
270
+
271
+ # Outputs non-array value in the form of hash
272
+ # For object, use to_hash. Otherwise, just return the value
273
+ # @param [Object] value Any valid value
274
+ # @return [Hash] Returns the value in the form of hash
275
+ def _to_hash(value)
276
+ if value.is_a?(Array)
277
+ value.compact.map { |v| _to_hash(v) }
278
+ elsif value.is_a?(Hash)
279
+ {}.tap do |hash|
280
+ value.each { |k, v| hash[k] = _to_hash(v) }
281
+ end
282
+ elsif value.respond_to? :to_hash
283
+ value.to_hash
284
+ else
285
+ value
286
+ end
287
+ end end
288
+ end