turnkey_client 0.0.8 → 0.0.12

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 (47) hide show
  1. checksums.yaml +4 -4
  2. data/lib/turnkey_client/api/features_api.rb +4 -4
  3. data/lib/turnkey_client/api/organizations_api.rb +118 -2
  4. data/lib/turnkey_client/api/private_keys_api.rb +2 -2
  5. data/lib/turnkey_client/api/user_auth_api.rb +348 -0
  6. data/lib/turnkey_client/api/users_api.rb +0 -232
  7. data/lib/turnkey_client/api/wallets_api.rb +60 -2
  8. data/lib/turnkey_client/models/activity_type.rb +6 -0
  9. data/lib/turnkey_client/models/address_format.rb +29 -0
  10. data/lib/turnkey_client/models/create_read_write_session_intent_v2.rb +241 -0
  11. data/lib/turnkey_client/models/create_read_write_session_request.rb +2 -2
  12. data/lib/turnkey_client/models/create_read_write_session_result_v2.rb +286 -0
  13. data/lib/turnkey_client/models/create_sub_organization_intent_v7.rb +292 -0
  14. data/lib/turnkey_client/models/create_sub_organization_request.rb +2 -2
  15. data/lib/turnkey_client/models/create_sub_organization_result_v7.rb +230 -0
  16. data/lib/turnkey_client/models/credential_type.rb +1 -0
  17. data/lib/turnkey_client/models/delete_sub_organization_intent.rb +206 -0
  18. data/lib/turnkey_client/models/delete_sub_organization_request.rb +288 -0
  19. data/lib/turnkey_client/models/delete_sub_organization_result.rb +211 -0
  20. data/lib/turnkey_client/models/email_auth_intent.rb +14 -4
  21. data/lib/turnkey_client/models/email_auth_intent_v2.rb +14 -4
  22. data/lib/turnkey_client/models/feature_name.rb +2 -0
  23. data/lib/turnkey_client/models/get_sub_org_ids_request.rb +1 -1
  24. data/lib/turnkey_client/models/get_verified_sub_org_ids_request.rb +240 -0
  25. data/lib/turnkey_client/models/get_verified_sub_org_ids_response.rb +213 -0
  26. data/lib/turnkey_client/models/init_otp_auth_intent.rb +264 -0
  27. data/lib/turnkey_client/models/init_otp_auth_request.rb +288 -0
  28. data/lib/turnkey_client/models/init_otp_auth_result.rb +211 -0
  29. data/lib/turnkey_client/models/intent.rb +58 -4
  30. data/lib/turnkey_client/models/otp_auth_intent.rb +266 -0
  31. data/lib/turnkey_client/models/otp_auth_request.rb +288 -0
  32. data/lib/turnkey_client/models/otp_auth_result.rb +231 -0
  33. data/lib/turnkey_client/models/result.rb +58 -4
  34. data/lib/turnkey_client/models/root_user_params_v4.rb +282 -0
  35. data/lib/turnkey_client/models/sms_customization_params.rb +206 -0
  36. data/lib/turnkey_client/models/transaction_type.rb +2 -1
  37. data/lib/turnkey_client/models/update_user_intent.rb +14 -4
  38. data/lib/turnkey_client/models/update_wallet_intent.rb +221 -0
  39. data/lib/turnkey_client/models/update_wallet_request.rb +288 -0
  40. data/lib/turnkey_client/models/update_wallet_result.rb +211 -0
  41. data/lib/turnkey_client/models/user.rb +11 -1
  42. data/lib/turnkey_client/models/wallet_account.rb +16 -1
  43. data/lib/turnkey_client/version.rb +1 -1
  44. data/lib/turnkey_client.rb +20 -0
  45. data/turnkey_client-0.0.8.gem +0 -0
  46. data/turnkey_client-0.0.9.gem +0 -0
  47. metadata +24 -2
@@ -0,0 +1,211 @@
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 InitOtpAuthResult
15
+ # Unique identifier for an OTP authentication
16
+ attr_accessor :otp_id
17
+
18
+ # Attribute mapping from ruby-style variable name to JSON key.
19
+ def self.attribute_map
20
+ {
21
+ :'otp_id' => :'otpId'
22
+ }
23
+ end
24
+
25
+ # Attribute type mapping.
26
+ def self.openapi_types
27
+ {
28
+ :'otp_id' => :'Object'
29
+ }
30
+ end
31
+
32
+ # List of attributes with nullable: true
33
+ def self.openapi_nullable
34
+ Set.new([
35
+ ])
36
+ end
37
+
38
+ # Initializes the object
39
+ # @param [Hash] attributes Model attributes in the form of hash
40
+ def initialize(attributes = {})
41
+ if (!attributes.is_a?(Hash))
42
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TurnkeyClient::InitOtpAuthResult` initialize method"
43
+ end
44
+
45
+ # check to see if the attribute exists and convert string to symbol for hash key
46
+ attributes = attributes.each_with_object({}) { |(k, v), h|
47
+ if (!self.class.attribute_map.key?(k.to_sym))
48
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TurnkeyClient::InitOtpAuthResult`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
49
+ end
50
+ h[k.to_sym] = v
51
+ }
52
+
53
+ if attributes.key?(:'otp_id')
54
+ self.otp_id = attributes[:'otp_id']
55
+ end
56
+ end
57
+
58
+ # Show invalid properties with the reasons. Usually used together with valid?
59
+ # @return Array for valid properties with the reasons
60
+ def list_invalid_properties
61
+ invalid_properties = Array.new
62
+ if @otp_id.nil?
63
+ invalid_properties.push('invalid value for "otp_id", otp_id cannot be nil.')
64
+ end
65
+
66
+ invalid_properties
67
+ end
68
+
69
+ # Check to see if the all the properties in the model are valid
70
+ # @return true if the model is valid
71
+ def valid?
72
+ return false if @otp_id.nil?
73
+ true
74
+ end
75
+
76
+ # Checks equality by comparing each attribute.
77
+ # @param [Object] Object to be compared
78
+ def ==(o)
79
+ return true if self.equal?(o)
80
+ self.class == o.class &&
81
+ otp_id == o.otp_id
82
+ end
83
+
84
+ # @see the `==` method
85
+ # @param [Object] Object to be compared
86
+ def eql?(o)
87
+ self == o
88
+ end
89
+
90
+ # Calculates hash code according to all attributes.
91
+ # @return [Integer] Hash code
92
+ def hash
93
+ [otp_id].hash
94
+ end
95
+
96
+ # Builds the object from hash
97
+ # @param [Hash] attributes Model attributes in the form of hash
98
+ # @return [Object] Returns the model itself
99
+ def self.build_from_hash(attributes)
100
+ new.build_from_hash(attributes)
101
+ end
102
+
103
+ # Builds the object from hash
104
+ # @param [Hash] attributes Model attributes in the form of hash
105
+ # @return [Object] Returns the model itself
106
+ def build_from_hash(attributes)
107
+ return nil unless attributes.is_a?(Hash)
108
+ self.class.openapi_types.each_pair do |key, type|
109
+ if type =~ /\AArray<(.*)>/i
110
+ # check to ensure the input is an array given that the attribute
111
+ # is documented as an array but the input is not
112
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
113
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
114
+ end
115
+ elsif !attributes[self.class.attribute_map[key]].nil?
116
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
117
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
118
+ self.send("#{key}=", nil)
119
+ end
120
+ end
121
+
122
+ self
123
+ end
124
+
125
+ # Deserializes the data based on type
126
+ # @param string type Data type
127
+ # @param string value Value to be deserialized
128
+ # @return [Object] Deserialized data
129
+ def _deserialize(type, value)
130
+ case type.to_sym
131
+ when :DateTime
132
+ DateTime.parse(value)
133
+ when :Date
134
+ Date.parse(value)
135
+ when :String
136
+ value.to_s
137
+ when :Integer
138
+ value.to_i
139
+ when :Float
140
+ value.to_f
141
+ when :Boolean
142
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
143
+ true
144
+ else
145
+ false
146
+ end
147
+ when :Object
148
+ # generic object (usually a Hash), return directly
149
+ value
150
+ when /\AArray<(?<inner_type>.+)>\z/
151
+ inner_type = Regexp.last_match[:inner_type]
152
+ value.map { |v| _deserialize(inner_type, v) }
153
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
154
+ k_type = Regexp.last_match[:k_type]
155
+ v_type = Regexp.last_match[:v_type]
156
+ {}.tap do |hash|
157
+ value.each do |k, v|
158
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
159
+ end
160
+ end
161
+ else # model
162
+ TurnkeyClient.const_get(type).build_from_hash(value)
163
+ end
164
+ end
165
+
166
+ # Returns the string representation of the object
167
+ # @return [String] String presentation of the object
168
+ def to_s
169
+ to_hash.to_s
170
+ end
171
+
172
+ # to_body is an alias to to_hash (backward compatibility)
173
+ # @return [Hash] Returns the object in the form of hash
174
+ def to_body
175
+ to_hash
176
+ end
177
+
178
+ # Returns the object in the form of hash
179
+ # @return [Hash] Returns the object in the form of hash
180
+ def to_hash
181
+ hash = {}
182
+ self.class.attribute_map.each_pair do |attr, param|
183
+ value = self.send(attr)
184
+ if value.nil?
185
+ is_nullable = self.class.openapi_nullable.include?(attr)
186
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
187
+ end
188
+
189
+ hash[param] = _to_hash(value)
190
+ end
191
+ hash
192
+ end
193
+
194
+ # Outputs non-array value in the form of hash
195
+ # For object, use to_hash. Otherwise, just return the value
196
+ # @param [Object] value Any valid value
197
+ # @return [Hash] Returns the value in the form of hash
198
+ def _to_hash(value)
199
+ if value.is_a?(Array)
200
+ value.compact.map { |v| _to_hash(v) }
201
+ elsif value.is_a?(Hash)
202
+ {}.tap do |hash|
203
+ value.each { |k, v| hash[k] = _to_hash(v) }
204
+ end
205
+ elsif value.respond_to? :to_hash
206
+ value.to_hash
207
+ else
208
+ value
209
+ end
210
+ end end
211
+ end
@@ -160,6 +160,18 @@ module TurnkeyClient
160
160
 
161
161
  attr_accessor :delete_wallets_intent
162
162
 
163
+ attr_accessor :create_read_write_session_intent_v2
164
+
165
+ attr_accessor :delete_sub_organization_intent
166
+
167
+ attr_accessor :init_otp_auth_intent
168
+
169
+ attr_accessor :otp_auth_intent
170
+
171
+ attr_accessor :create_sub_organization_intent_v7
172
+
173
+ attr_accessor :update_wallet_intent
174
+
163
175
  # Attribute mapping from ruby-style variable name to JSON key.
164
176
  def self.attribute_map
165
177
  {
@@ -236,7 +248,13 @@ module TurnkeyClient
236
248
  :'email_auth_intent_v2' => :'emailAuthIntentV2',
237
249
  :'create_sub_organization_intent_v6' => :'createSubOrganizationIntentV6',
238
250
  :'delete_private_keys_intent' => :'deletePrivateKeysIntent',
239
- :'delete_wallets_intent' => :'deleteWalletsIntent'
251
+ :'delete_wallets_intent' => :'deleteWalletsIntent',
252
+ :'create_read_write_session_intent_v2' => :'createReadWriteSessionIntentV2',
253
+ :'delete_sub_organization_intent' => :'deleteSubOrganizationIntent',
254
+ :'init_otp_auth_intent' => :'initOtpAuthIntent',
255
+ :'otp_auth_intent' => :'otpAuthIntent',
256
+ :'create_sub_organization_intent_v7' => :'createSubOrganizationIntentV7',
257
+ :'update_wallet_intent' => :'updateWalletIntent'
240
258
  }
241
259
  end
242
260
 
@@ -316,7 +334,13 @@ module TurnkeyClient
316
334
  :'email_auth_intent_v2' => :'Object',
317
335
  :'create_sub_organization_intent_v6' => :'Object',
318
336
  :'delete_private_keys_intent' => :'Object',
319
- :'delete_wallets_intent' => :'Object'
337
+ :'delete_wallets_intent' => :'Object',
338
+ :'create_read_write_session_intent_v2' => :'Object',
339
+ :'delete_sub_organization_intent' => :'Object',
340
+ :'init_otp_auth_intent' => :'Object',
341
+ :'otp_auth_intent' => :'Object',
342
+ :'create_sub_organization_intent_v7' => :'Object',
343
+ :'update_wallet_intent' => :'Object'
320
344
  }
321
345
  end
322
346
 
@@ -636,6 +660,30 @@ module TurnkeyClient
636
660
  if attributes.key?(:'delete_wallets_intent')
637
661
  self.delete_wallets_intent = attributes[:'delete_wallets_intent']
638
662
  end
663
+
664
+ if attributes.key?(:'create_read_write_session_intent_v2')
665
+ self.create_read_write_session_intent_v2 = attributes[:'create_read_write_session_intent_v2']
666
+ end
667
+
668
+ if attributes.key?(:'delete_sub_organization_intent')
669
+ self.delete_sub_organization_intent = attributes[:'delete_sub_organization_intent']
670
+ end
671
+
672
+ if attributes.key?(:'init_otp_auth_intent')
673
+ self.init_otp_auth_intent = attributes[:'init_otp_auth_intent']
674
+ end
675
+
676
+ if attributes.key?(:'otp_auth_intent')
677
+ self.otp_auth_intent = attributes[:'otp_auth_intent']
678
+ end
679
+
680
+ if attributes.key?(:'create_sub_organization_intent_v7')
681
+ self.create_sub_organization_intent_v7 = attributes[:'create_sub_organization_intent_v7']
682
+ end
683
+
684
+ if attributes.key?(:'update_wallet_intent')
685
+ self.update_wallet_intent = attributes[:'update_wallet_intent']
686
+ end
639
687
  end
640
688
 
641
689
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -729,7 +777,13 @@ module TurnkeyClient
729
777
  email_auth_intent_v2 == o.email_auth_intent_v2 &&
730
778
  create_sub_organization_intent_v6 == o.create_sub_organization_intent_v6 &&
731
779
  delete_private_keys_intent == o.delete_private_keys_intent &&
732
- delete_wallets_intent == o.delete_wallets_intent
780
+ delete_wallets_intent == o.delete_wallets_intent &&
781
+ create_read_write_session_intent_v2 == o.create_read_write_session_intent_v2 &&
782
+ delete_sub_organization_intent == o.delete_sub_organization_intent &&
783
+ init_otp_auth_intent == o.init_otp_auth_intent &&
784
+ otp_auth_intent == o.otp_auth_intent &&
785
+ create_sub_organization_intent_v7 == o.create_sub_organization_intent_v7 &&
786
+ update_wallet_intent == o.update_wallet_intent
733
787
  end
734
788
 
735
789
  # @see the `==` method
@@ -741,7 +795,7 @@ module TurnkeyClient
741
795
  # Calculates hash code according to all attributes.
742
796
  # @return [Integer] Hash code
743
797
  def hash
744
- [create_organization_intent, create_authenticators_intent, create_users_intent, create_private_keys_intent, sign_raw_payload_intent, create_invitations_intent, accept_invitation_intent, create_policy_intent, disable_private_key_intent, delete_users_intent, delete_authenticators_intent, delete_invitation_intent, delete_organization_intent, delete_policy_intent, create_user_tag_intent, delete_user_tags_intent, sign_transaction_intent, create_api_keys_intent, delete_api_keys_intent, approve_activity_intent, reject_activity_intent, create_private_key_tag_intent, delete_private_key_tags_intent, create_policy_intent_v2, set_payment_method_intent, activate_billing_tier_intent, delete_payment_method_intent, create_policy_intent_v3, create_api_only_users_intent, update_root_quorum_intent, update_user_tag_intent, update_private_key_tag_intent, create_authenticators_intent_v2, accept_invitation_intent_v2, create_organization_intent_v2, create_users_intent_v2, create_sub_organization_intent, create_sub_organization_intent_v2, update_allowed_origins_intent, create_private_keys_intent_v2, update_user_intent, update_policy_intent, set_payment_method_intent_v2, create_sub_organization_intent_v3, create_wallet_intent, create_wallet_accounts_intent, init_user_email_recovery_intent, recover_user_intent, set_organization_feature_intent, remove_organization_feature_intent, sign_raw_payload_intent_v2, sign_transaction_intent_v2, export_private_key_intent, export_wallet_intent, create_sub_organization_intent_v4, email_auth_intent, export_wallet_account_intent, init_import_wallet_intent, import_wallet_intent, init_import_private_key_intent, import_private_key_intent, create_policies_intent, sign_raw_payloads_intent, create_read_only_session_intent, create_oauth_providers_intent, delete_oauth_providers_intent, create_sub_organization_intent_v5, oauth_intent, create_api_keys_intent_v2, create_read_write_session_intent, email_auth_intent_v2, create_sub_organization_intent_v6, delete_private_keys_intent, delete_wallets_intent].hash
798
+ [create_organization_intent, create_authenticators_intent, create_users_intent, create_private_keys_intent, sign_raw_payload_intent, create_invitations_intent, accept_invitation_intent, create_policy_intent, disable_private_key_intent, delete_users_intent, delete_authenticators_intent, delete_invitation_intent, delete_organization_intent, delete_policy_intent, create_user_tag_intent, delete_user_tags_intent, sign_transaction_intent, create_api_keys_intent, delete_api_keys_intent, approve_activity_intent, reject_activity_intent, create_private_key_tag_intent, delete_private_key_tags_intent, create_policy_intent_v2, set_payment_method_intent, activate_billing_tier_intent, delete_payment_method_intent, create_policy_intent_v3, create_api_only_users_intent, update_root_quorum_intent, update_user_tag_intent, update_private_key_tag_intent, create_authenticators_intent_v2, accept_invitation_intent_v2, create_organization_intent_v2, create_users_intent_v2, create_sub_organization_intent, create_sub_organization_intent_v2, update_allowed_origins_intent, create_private_keys_intent_v2, update_user_intent, update_policy_intent, set_payment_method_intent_v2, create_sub_organization_intent_v3, create_wallet_intent, create_wallet_accounts_intent, init_user_email_recovery_intent, recover_user_intent, set_organization_feature_intent, remove_organization_feature_intent, sign_raw_payload_intent_v2, sign_transaction_intent_v2, export_private_key_intent, export_wallet_intent, create_sub_organization_intent_v4, email_auth_intent, export_wallet_account_intent, init_import_wallet_intent, import_wallet_intent, init_import_private_key_intent, import_private_key_intent, create_policies_intent, sign_raw_payloads_intent, create_read_only_session_intent, create_oauth_providers_intent, delete_oauth_providers_intent, create_sub_organization_intent_v5, oauth_intent, create_api_keys_intent_v2, create_read_write_session_intent, email_auth_intent_v2, create_sub_organization_intent_v6, delete_private_keys_intent, delete_wallets_intent, create_read_write_session_intent_v2, delete_sub_organization_intent, init_otp_auth_intent, otp_auth_intent, create_sub_organization_intent_v7, update_wallet_intent].hash
745
799
  end
746
800
 
747
801
  # Builds the object from hash
@@ -0,0 +1,266 @@
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 OtpAuthIntent
15
+ # ID representing the result of an init OTP activity.
16
+ attr_accessor :otp_id
17
+
18
+ # 6 digit OTP code sent out to a user's contact (email or SMS)
19
+ attr_accessor :otp_code
20
+
21
+ # Client-side public key generated by the user, to which the OTP bundle (credentials) will be encrypted.
22
+ attr_accessor :target_public_key
23
+
24
+ # Optional human-readable name for an API Key. If none provided, default to OTP Auth - <Timestamp>
25
+ attr_accessor :api_key_name
26
+
27
+ # Expiration window (in seconds) indicating how long the API key is valid. If not provided, a default of 15 minutes will be used.
28
+ attr_accessor :expiration_seconds
29
+
30
+ # Invalidate all other previously generated OTP Auth API keys
31
+ attr_accessor :invalidate_existing
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'otp_id' => :'otpId',
37
+ :'otp_code' => :'otpCode',
38
+ :'target_public_key' => :'targetPublicKey',
39
+ :'api_key_name' => :'apiKeyName',
40
+ :'expiration_seconds' => :'expirationSeconds',
41
+ :'invalidate_existing' => :'invalidateExisting'
42
+ }
43
+ end
44
+
45
+ # Attribute type mapping.
46
+ def self.openapi_types
47
+ {
48
+ :'otp_id' => :'Object',
49
+ :'otp_code' => :'Object',
50
+ :'target_public_key' => :'Object',
51
+ :'api_key_name' => :'Object',
52
+ :'expiration_seconds' => :'Object',
53
+ :'invalidate_existing' => :'Object'
54
+ }
55
+ end
56
+
57
+ # List of attributes with nullable: true
58
+ def self.openapi_nullable
59
+ Set.new([
60
+ ])
61
+ end
62
+
63
+ # Initializes the object
64
+ # @param [Hash] attributes Model attributes in the form of hash
65
+ def initialize(attributes = {})
66
+ if (!attributes.is_a?(Hash))
67
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TurnkeyClient::OtpAuthIntent` initialize method"
68
+ end
69
+
70
+ # check to see if the attribute exists and convert string to symbol for hash key
71
+ attributes = attributes.each_with_object({}) { |(k, v), h|
72
+ if (!self.class.attribute_map.key?(k.to_sym))
73
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TurnkeyClient::OtpAuthIntent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
74
+ end
75
+ h[k.to_sym] = v
76
+ }
77
+
78
+ if attributes.key?(:'otp_id')
79
+ self.otp_id = attributes[:'otp_id']
80
+ end
81
+
82
+ if attributes.key?(:'otp_code')
83
+ self.otp_code = attributes[:'otp_code']
84
+ end
85
+
86
+ if attributes.key?(:'target_public_key')
87
+ self.target_public_key = attributes[:'target_public_key']
88
+ end
89
+
90
+ if attributes.key?(:'api_key_name')
91
+ self.api_key_name = attributes[:'api_key_name']
92
+ end
93
+
94
+ if attributes.key?(:'expiration_seconds')
95
+ self.expiration_seconds = attributes[:'expiration_seconds']
96
+ end
97
+
98
+ if attributes.key?(:'invalidate_existing')
99
+ self.invalidate_existing = attributes[:'invalidate_existing']
100
+ end
101
+ end
102
+
103
+ # Show invalid properties with the reasons. Usually used together with valid?
104
+ # @return Array for valid properties with the reasons
105
+ def list_invalid_properties
106
+ invalid_properties = Array.new
107
+ if @otp_id.nil?
108
+ invalid_properties.push('invalid value for "otp_id", otp_id cannot be nil.')
109
+ end
110
+
111
+ if @otp_code.nil?
112
+ invalid_properties.push('invalid value for "otp_code", otp_code cannot be nil.')
113
+ end
114
+
115
+ invalid_properties
116
+ end
117
+
118
+ # Check to see if the all the properties in the model are valid
119
+ # @return true if the model is valid
120
+ def valid?
121
+ return false if @otp_id.nil?
122
+ return false if @otp_code.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
+ otp_id == o.otp_id &&
132
+ otp_code == o.otp_code &&
133
+ target_public_key == o.target_public_key &&
134
+ api_key_name == o.api_key_name &&
135
+ expiration_seconds == o.expiration_seconds &&
136
+ invalidate_existing == o.invalidate_existing
137
+ end
138
+
139
+ # @see the `==` method
140
+ # @param [Object] Object to be compared
141
+ def eql?(o)
142
+ self == o
143
+ end
144
+
145
+ # Calculates hash code according to all attributes.
146
+ # @return [Integer] Hash code
147
+ def hash
148
+ [otp_id, otp_code, target_public_key, api_key_name, expiration_seconds, invalidate_existing].hash
149
+ end
150
+
151
+ # Builds the object from hash
152
+ # @param [Hash] attributes Model attributes in the form of hash
153
+ # @return [Object] Returns the model itself
154
+ def self.build_from_hash(attributes)
155
+ new.build_from_hash(attributes)
156
+ end
157
+
158
+ # Builds the object from hash
159
+ # @param [Hash] attributes Model attributes in the form of hash
160
+ # @return [Object] Returns the model itself
161
+ def build_from_hash(attributes)
162
+ return nil unless attributes.is_a?(Hash)
163
+ self.class.openapi_types.each_pair do |key, type|
164
+ if type =~ /\AArray<(.*)>/i
165
+ # check to ensure the input is an array given that the attribute
166
+ # is documented as an array but the input is not
167
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
168
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
169
+ end
170
+ elsif !attributes[self.class.attribute_map[key]].nil?
171
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
172
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
173
+ self.send("#{key}=", nil)
174
+ end
175
+ end
176
+
177
+ self
178
+ end
179
+
180
+ # Deserializes the data based on type
181
+ # @param string type Data type
182
+ # @param string value Value to be deserialized
183
+ # @return [Object] Deserialized data
184
+ def _deserialize(type, value)
185
+ case type.to_sym
186
+ when :DateTime
187
+ DateTime.parse(value)
188
+ when :Date
189
+ Date.parse(value)
190
+ when :String
191
+ value.to_s
192
+ when :Integer
193
+ value.to_i
194
+ when :Float
195
+ value.to_f
196
+ when :Boolean
197
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
198
+ true
199
+ else
200
+ false
201
+ end
202
+ when :Object
203
+ # generic object (usually a Hash), return directly
204
+ value
205
+ when /\AArray<(?<inner_type>.+)>\z/
206
+ inner_type = Regexp.last_match[:inner_type]
207
+ value.map { |v| _deserialize(inner_type, v) }
208
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
209
+ k_type = Regexp.last_match[:k_type]
210
+ v_type = Regexp.last_match[:v_type]
211
+ {}.tap do |hash|
212
+ value.each do |k, v|
213
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
214
+ end
215
+ end
216
+ else # model
217
+ TurnkeyClient.const_get(type).build_from_hash(value)
218
+ end
219
+ end
220
+
221
+ # Returns the string representation of the object
222
+ # @return [String] String presentation of the object
223
+ def to_s
224
+ to_hash.to_s
225
+ end
226
+
227
+ # to_body is an alias to to_hash (backward compatibility)
228
+ # @return [Hash] Returns the object in the form of hash
229
+ def to_body
230
+ to_hash
231
+ end
232
+
233
+ # Returns the object in the form of hash
234
+ # @return [Hash] Returns the object in the form of hash
235
+ def to_hash
236
+ hash = {}
237
+ self.class.attribute_map.each_pair do |attr, param|
238
+ value = self.send(attr)
239
+ if value.nil?
240
+ is_nullable = self.class.openapi_nullable.include?(attr)
241
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
242
+ end
243
+
244
+ hash[param] = _to_hash(value)
245
+ end
246
+ hash
247
+ end
248
+
249
+ # Outputs non-array value in the form of hash
250
+ # For object, use to_hash. Otherwise, just return the value
251
+ # @param [Object] value Any valid value
252
+ # @return [Hash] Returns the value in the form of hash
253
+ def _to_hash(value)
254
+ if value.is_a?(Array)
255
+ value.compact.map { |v| _to_hash(v) }
256
+ elsif value.is_a?(Hash)
257
+ {}.tap do |hash|
258
+ value.each { |k, v| hash[k] = _to_hash(v) }
259
+ end
260
+ elsif value.respond_to? :to_hash
261
+ value.to_hash
262
+ else
263
+ value
264
+ end
265
+ end end
266
+ end