turnkey_client 0.0.4 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/lib/turnkey_client/api/organizations_api.rb +58 -0
  3. data/lib/turnkey_client/api/policies_api.rb +58 -0
  4. data/lib/turnkey_client/api/sessions_api.rb +116 -0
  5. data/lib/turnkey_client/api/signing_api.rb +58 -0
  6. data/lib/turnkey_client/api/users_api.rb +232 -0
  7. data/lib/turnkey_client/models/activity.rb +13 -4
  8. data/lib/turnkey_client/models/activity_type.rb +11 -0
  9. data/lib/turnkey_client/models/any.rb +200 -0
  10. data/lib/turnkey_client/models/api_key_curve.rb +28 -0
  11. data/lib/turnkey_client/models/api_key_params_v2.rb +250 -0
  12. data/lib/turnkey_client/models/config.rb +216 -0
  13. data/lib/turnkey_client/models/create_api_keys_intent_v2.rb +228 -0
  14. data/lib/turnkey_client/models/create_api_keys_request.rb +2 -2
  15. data/lib/turnkey_client/models/create_oauth_providers_intent.rb +228 -0
  16. data/lib/turnkey_client/models/create_oauth_providers_request.rb +288 -0
  17. data/lib/turnkey_client/models/create_oauth_providers_result.rb +213 -0
  18. data/lib/turnkey_client/models/create_policies_intent.rb +213 -0
  19. data/lib/turnkey_client/models/create_policies_request.rb +288 -0
  20. data/lib/turnkey_client/models/create_policies_result.rb +213 -0
  21. data/lib/turnkey_client/models/create_read_only_session_intent.rb +196 -0
  22. data/lib/turnkey_client/models/create_read_only_session_request.rb +288 -0
  23. data/lib/turnkey_client/models/create_read_only_session_result.rb +286 -0
  24. data/lib/turnkey_client/models/create_read_write_session_intent.rb +246 -0
  25. data/lib/turnkey_client/models/create_read_write_session_request.rb +288 -0
  26. data/lib/turnkey_client/models/create_read_write_session_result.rb +286 -0
  27. data/lib/turnkey_client/models/create_sub_organization_intent_v5.rb +272 -0
  28. data/lib/turnkey_client/models/create_sub_organization_intent_v6.rb +272 -0
  29. data/lib/turnkey_client/models/create_sub_organization_request.rb +2 -2
  30. data/lib/turnkey_client/models/create_sub_organization_result_v5.rb +230 -0
  31. data/lib/turnkey_client/models/create_sub_organization_result_v6.rb +230 -0
  32. data/lib/turnkey_client/models/credential_type.rb +3 -0
  33. data/lib/turnkey_client/models/delete_oauth_providers_intent.rb +228 -0
  34. data/lib/turnkey_client/models/delete_oauth_providers_request.rb +288 -0
  35. data/lib/turnkey_client/models/delete_oauth_providers_result.rb +213 -0
  36. data/lib/turnkey_client/models/email_auth_intent.rb +14 -4
  37. data/lib/turnkey_client/models/email_auth_intent_v2.rb +265 -0
  38. data/lib/turnkey_client/models/email_auth_request.rb +2 -2
  39. data/lib/turnkey_client/models/email_customization_params.rb +1 -1
  40. data/lib/turnkey_client/models/external_data_v1_quorum.rb +228 -0
  41. data/lib/turnkey_client/models/get_oauth_providers_request.rb +221 -0
  42. data/lib/turnkey_client/models/get_oauth_providers_response.rb +213 -0
  43. data/lib/turnkey_client/models/get_organization_configs_request.rb +211 -0
  44. data/lib/turnkey_client/models/get_organization_configs_response.rb +210 -0
  45. data/lib/turnkey_client/models/get_sub_org_ids_request.rb +1 -1
  46. data/lib/turnkey_client/models/intent.rb +103 -9
  47. data/lib/turnkey_client/models/oauth_intent.rb +246 -0
  48. data/lib/turnkey_client/models/oauth_provider.rb +299 -0
  49. data/lib/turnkey_client/models/oauth_provider_params.rb +226 -0
  50. data/lib/turnkey_client/models/oauth_request.rb +288 -0
  51. data/lib/turnkey_client/models/oauth_result.rb +241 -0
  52. data/lib/turnkey_client/models/result.rb +85 -4
  53. data/lib/turnkey_client/models/root_user_params_v2.rb +272 -0
  54. data/lib/turnkey_client/models/root_user_params_v3.rb +272 -0
  55. data/lib/turnkey_client/models/sign_raw_payloads_intent.rb +256 -0
  56. data/lib/turnkey_client/models/sign_raw_payloads_request.rb +288 -0
  57. data/lib/turnkey_client/models/sign_raw_payloads_result.rb +207 -0
  58. data/lib/turnkey_client/models/status.rb +225 -0
  59. data/lib/turnkey_client/models/user.rb +18 -1
  60. data/lib/turnkey_client/models/wallet_account.rb +4 -19
  61. data/lib/turnkey_client/version.rb +1 -1
  62. data/lib/turnkey_client.rb +41 -0
  63. data/turnkey_client-0.0.4.gem +0 -0
  64. metadata +44 -2
@@ -0,0 +1,210 @@
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 GetOrganizationConfigsResponse
15
+ attr_accessor :configs
16
+
17
+ # Attribute mapping from ruby-style variable name to JSON key.
18
+ def self.attribute_map
19
+ {
20
+ :'configs' => :'configs'
21
+ }
22
+ end
23
+
24
+ # Attribute type mapping.
25
+ def self.openapi_types
26
+ {
27
+ :'configs' => :'Object'
28
+ }
29
+ end
30
+
31
+ # List of attributes with nullable: true
32
+ def self.openapi_nullable
33
+ Set.new([
34
+ ])
35
+ end
36
+
37
+ # Initializes the object
38
+ # @param [Hash] attributes Model attributes in the form of hash
39
+ def initialize(attributes = {})
40
+ if (!attributes.is_a?(Hash))
41
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TurnkeyClient::GetOrganizationConfigsResponse` initialize method"
42
+ end
43
+
44
+ # check to see if the attribute exists and convert string to symbol for hash key
45
+ attributes = attributes.each_with_object({}) { |(k, v), h|
46
+ if (!self.class.attribute_map.key?(k.to_sym))
47
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TurnkeyClient::GetOrganizationConfigsResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
48
+ end
49
+ h[k.to_sym] = v
50
+ }
51
+
52
+ if attributes.key?(:'configs')
53
+ self.configs = attributes[:'configs']
54
+ end
55
+ end
56
+
57
+ # Show invalid properties with the reasons. Usually used together with valid?
58
+ # @return Array for valid properties with the reasons
59
+ def list_invalid_properties
60
+ invalid_properties = Array.new
61
+ if @configs.nil?
62
+ invalid_properties.push('invalid value for "configs", configs cannot be nil.')
63
+ end
64
+
65
+ invalid_properties
66
+ end
67
+
68
+ # Check to see if the all the properties in the model are valid
69
+ # @return true if the model is valid
70
+ def valid?
71
+ return false if @configs.nil?
72
+ true
73
+ end
74
+
75
+ # Checks equality by comparing each attribute.
76
+ # @param [Object] Object to be compared
77
+ def ==(o)
78
+ return true if self.equal?(o)
79
+ self.class == o.class &&
80
+ configs == o.configs
81
+ end
82
+
83
+ # @see the `==` method
84
+ # @param [Object] Object to be compared
85
+ def eql?(o)
86
+ self == o
87
+ end
88
+
89
+ # Calculates hash code according to all attributes.
90
+ # @return [Integer] Hash code
91
+ def hash
92
+ [configs].hash
93
+ end
94
+
95
+ # Builds the object from hash
96
+ # @param [Hash] attributes Model attributes in the form of hash
97
+ # @return [Object] Returns the model itself
98
+ def self.build_from_hash(attributes)
99
+ new.build_from_hash(attributes)
100
+ end
101
+
102
+ # Builds the object from hash
103
+ # @param [Hash] attributes Model attributes in the form of hash
104
+ # @return [Object] Returns the model itself
105
+ def build_from_hash(attributes)
106
+ return nil unless attributes.is_a?(Hash)
107
+ self.class.openapi_types.each_pair do |key, type|
108
+ if type =~ /\AArray<(.*)>/i
109
+ # check to ensure the input is an array given that the attribute
110
+ # is documented as an array but the input is not
111
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
112
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
113
+ end
114
+ elsif !attributes[self.class.attribute_map[key]].nil?
115
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
116
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
117
+ self.send("#{key}=", nil)
118
+ end
119
+ end
120
+
121
+ self
122
+ end
123
+
124
+ # Deserializes the data based on type
125
+ # @param string type Data type
126
+ # @param string value Value to be deserialized
127
+ # @return [Object] Deserialized data
128
+ def _deserialize(type, value)
129
+ case type.to_sym
130
+ when :DateTime
131
+ DateTime.parse(value)
132
+ when :Date
133
+ Date.parse(value)
134
+ when :String
135
+ value.to_s
136
+ when :Integer
137
+ value.to_i
138
+ when :Float
139
+ value.to_f
140
+ when :Boolean
141
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
142
+ true
143
+ else
144
+ false
145
+ end
146
+ when :Object
147
+ # generic object (usually a Hash), return directly
148
+ value
149
+ when /\AArray<(?<inner_type>.+)>\z/
150
+ inner_type = Regexp.last_match[:inner_type]
151
+ value.map { |v| _deserialize(inner_type, v) }
152
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
153
+ k_type = Regexp.last_match[:k_type]
154
+ v_type = Regexp.last_match[:v_type]
155
+ {}.tap do |hash|
156
+ value.each do |k, v|
157
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
158
+ end
159
+ end
160
+ else # model
161
+ TurnkeyClient.const_get(type).build_from_hash(value)
162
+ end
163
+ end
164
+
165
+ # Returns the string representation of the object
166
+ # @return [String] String presentation of the object
167
+ def to_s
168
+ to_hash.to_s
169
+ end
170
+
171
+ # to_body is an alias to to_hash (backward compatibility)
172
+ # @return [Hash] Returns the object in the form of hash
173
+ def to_body
174
+ to_hash
175
+ end
176
+
177
+ # Returns the object in the form of hash
178
+ # @return [Hash] Returns the object in the form of hash
179
+ def to_hash
180
+ hash = {}
181
+ self.class.attribute_map.each_pair do |attr, param|
182
+ value = self.send(attr)
183
+ if value.nil?
184
+ is_nullable = self.class.openapi_nullable.include?(attr)
185
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
186
+ end
187
+
188
+ hash[param] = _to_hash(value)
189
+ end
190
+ hash
191
+ end
192
+
193
+ # Outputs non-array value in the form of hash
194
+ # For object, use to_hash. Otherwise, just return the value
195
+ # @param [Object] value Any valid value
196
+ # @return [Hash] Returns the value in the form of hash
197
+ def _to_hash(value)
198
+ if value.is_a?(Array)
199
+ value.compact.map { |v| _to_hash(v) }
200
+ elsif value.is_a?(Hash)
201
+ {}.tap do |hash|
202
+ value.each { |k, v| hash[k] = _to_hash(v) }
203
+ end
204
+ elsif value.respond_to? :to_hash
205
+ value.to_hash
206
+ else
207
+ value
208
+ end
209
+ end end
210
+ end
@@ -15,7 +15,7 @@ module TurnkeyClient
15
15
  # Unique identifier for the parent Organization. This is used to find sub-organizations within it.
16
16
  attr_accessor :organization_id
17
17
 
18
- # Specifies the type of filter to apply, i.e 'CREDENTIAL_ID', 'NAME', 'USERNAME', 'EMAIL' or 'PUBLIC_KEY'
18
+ # Specifies the type of filter to apply, i.e 'CREDENTIAL_ID', 'NAME', 'USERNAME', 'EMAIL', 'OIDC_TOKEN' or 'PUBLIC_KEY'
19
19
  attr_accessor :filter_type
20
20
 
21
21
  # The value of the filter to apply for the specified type. For example, a specific email or name string.
@@ -134,6 +134,28 @@ module TurnkeyClient
134
134
 
135
135
  attr_accessor :import_private_key_intent
136
136
 
137
+ attr_accessor :create_policies_intent
138
+
139
+ attr_accessor :sign_raw_payloads_intent
140
+
141
+ attr_accessor :create_read_only_session_intent
142
+
143
+ attr_accessor :create_oauth_providers_intent
144
+
145
+ attr_accessor :delete_oauth_providers_intent
146
+
147
+ attr_accessor :create_sub_organization_intent_v5
148
+
149
+ attr_accessor :oauth_intent
150
+
151
+ attr_accessor :create_api_keys_intent_v2
152
+
153
+ attr_accessor :create_read_write_session_intent
154
+
155
+ attr_accessor :email_auth_intent_v2
156
+
157
+ attr_accessor :create_sub_organization_intent_v6
158
+
137
159
  # Attribute mapping from ruby-style variable name to JSON key.
138
160
  def self.attribute_map
139
161
  {
@@ -197,7 +219,18 @@ module TurnkeyClient
197
219
  :'init_import_wallet_intent' => :'initImportWalletIntent',
198
220
  :'import_wallet_intent' => :'importWalletIntent',
199
221
  :'init_import_private_key_intent' => :'initImportPrivateKeyIntent',
200
- :'import_private_key_intent' => :'importPrivateKeyIntent'
222
+ :'import_private_key_intent' => :'importPrivateKeyIntent',
223
+ :'create_policies_intent' => :'createPoliciesIntent',
224
+ :'sign_raw_payloads_intent' => :'signRawPayloadsIntent',
225
+ :'create_read_only_session_intent' => :'createReadOnlySessionIntent',
226
+ :'create_oauth_providers_intent' => :'createOauthProvidersIntent',
227
+ :'delete_oauth_providers_intent' => :'deleteOauthProvidersIntent',
228
+ :'create_sub_organization_intent_v5' => :'createSubOrganizationIntentV5',
229
+ :'oauth_intent' => :'oauthIntent',
230
+ :'create_api_keys_intent_v2' => :'createApiKeysIntentV2',
231
+ :'create_read_write_session_intent' => :'createReadWriteSessionIntent',
232
+ :'email_auth_intent_v2' => :'emailAuthIntentV2',
233
+ :'create_sub_organization_intent_v6' => :'createSubOrganizationIntentV6'
201
234
  }
202
235
  end
203
236
 
@@ -264,7 +297,18 @@ module TurnkeyClient
264
297
  :'init_import_wallet_intent' => :'Object',
265
298
  :'import_wallet_intent' => :'Object',
266
299
  :'init_import_private_key_intent' => :'Object',
267
- :'import_private_key_intent' => :'Object'
300
+ :'import_private_key_intent' => :'Object',
301
+ :'create_policies_intent' => :'Object',
302
+ :'sign_raw_payloads_intent' => :'Object',
303
+ :'create_read_only_session_intent' => :'Object',
304
+ :'create_oauth_providers_intent' => :'Object',
305
+ :'delete_oauth_providers_intent' => :'Object',
306
+ :'create_sub_organization_intent_v5' => :'Object',
307
+ :'oauth_intent' => :'Object',
308
+ :'create_api_keys_intent_v2' => :'Object',
309
+ :'create_read_write_session_intent' => :'Object',
310
+ :'email_auth_intent_v2' => :'Object',
311
+ :'create_sub_organization_intent_v6' => :'Object'
268
312
  }
269
313
  end
270
314
 
@@ -532,23 +576,62 @@ module TurnkeyClient
532
576
  if attributes.key?(:'import_private_key_intent')
533
577
  self.import_private_key_intent = attributes[:'import_private_key_intent']
534
578
  end
579
+
580
+ if attributes.key?(:'create_policies_intent')
581
+ self.create_policies_intent = attributes[:'create_policies_intent']
582
+ end
583
+
584
+ if attributes.key?(:'sign_raw_payloads_intent')
585
+ self.sign_raw_payloads_intent = attributes[:'sign_raw_payloads_intent']
586
+ end
587
+
588
+ if attributes.key?(:'create_read_only_session_intent')
589
+ self.create_read_only_session_intent = attributes[:'create_read_only_session_intent']
590
+ end
591
+
592
+ if attributes.key?(:'create_oauth_providers_intent')
593
+ self.create_oauth_providers_intent = attributes[:'create_oauth_providers_intent']
594
+ end
595
+
596
+ if attributes.key?(:'delete_oauth_providers_intent')
597
+ self.delete_oauth_providers_intent = attributes[:'delete_oauth_providers_intent']
598
+ end
599
+
600
+ if attributes.key?(:'create_sub_organization_intent_v5')
601
+ self.create_sub_organization_intent_v5 = attributes[:'create_sub_organization_intent_v5']
602
+ end
603
+
604
+ if attributes.key?(:'oauth_intent')
605
+ self.oauth_intent = attributes[:'oauth_intent']
606
+ end
607
+
608
+ if attributes.key?(:'create_api_keys_intent_v2')
609
+ self.create_api_keys_intent_v2 = attributes[:'create_api_keys_intent_v2']
610
+ end
611
+
612
+ if attributes.key?(:'create_read_write_session_intent')
613
+ self.create_read_write_session_intent = attributes[:'create_read_write_session_intent']
614
+ end
615
+
616
+ if attributes.key?(:'email_auth_intent_v2')
617
+ self.email_auth_intent_v2 = attributes[:'email_auth_intent_v2']
618
+ end
619
+
620
+ if attributes.key?(:'create_sub_organization_intent_v6')
621
+ self.create_sub_organization_intent_v6 = attributes[:'create_sub_organization_intent_v6']
622
+ end
535
623
  end
536
624
 
537
625
  # Show invalid properties with the reasons. Usually used together with valid?
538
626
  # @return Array for valid properties with the reasons
539
627
  def list_invalid_properties
540
628
  invalid_properties = Array.new
541
- if @create_organization_intent.nil?
542
- invalid_properties.push('invalid value for "create_organization_intent", create_organization_intent cannot be nil.')
543
- end
544
-
545
629
  invalid_properties
546
630
  end
547
631
 
548
632
  # Check to see if the all the properties in the model are valid
549
633
  # @return true if the model is valid
550
634
  def valid?
551
- return false if @create_organization_intent.nil?
552
635
  true
553
636
  end
554
637
 
@@ -617,7 +700,18 @@ module TurnkeyClient
617
700
  init_import_wallet_intent == o.init_import_wallet_intent &&
618
701
  import_wallet_intent == o.import_wallet_intent &&
619
702
  init_import_private_key_intent == o.init_import_private_key_intent &&
620
- import_private_key_intent == o.import_private_key_intent
703
+ import_private_key_intent == o.import_private_key_intent &&
704
+ create_policies_intent == o.create_policies_intent &&
705
+ sign_raw_payloads_intent == o.sign_raw_payloads_intent &&
706
+ create_read_only_session_intent == o.create_read_only_session_intent &&
707
+ create_oauth_providers_intent == o.create_oauth_providers_intent &&
708
+ delete_oauth_providers_intent == o.delete_oauth_providers_intent &&
709
+ create_sub_organization_intent_v5 == o.create_sub_organization_intent_v5 &&
710
+ oauth_intent == o.oauth_intent &&
711
+ create_api_keys_intent_v2 == o.create_api_keys_intent_v2 &&
712
+ create_read_write_session_intent == o.create_read_write_session_intent &&
713
+ email_auth_intent_v2 == o.email_auth_intent_v2 &&
714
+ create_sub_organization_intent_v6 == o.create_sub_organization_intent_v6
621
715
  end
622
716
 
623
717
  # @see the `==` method
@@ -629,7 +723,7 @@ module TurnkeyClient
629
723
  # Calculates hash code according to all attributes.
630
724
  # @return [Integer] Hash code
631
725
  def hash
632
- [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].hash
726
+ [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].hash
633
727
  end
634
728
 
635
729
  # Builds the object from hash
@@ -0,0 +1,246 @@
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 OauthIntent
15
+ # Base64 encoded OIDC token
16
+ attr_accessor :oidc_token
17
+
18
+ # Client-side public key generated by the user, to which the oauth bundle (credentials) will be encrypted.
19
+ attr_accessor :target_public_key
20
+
21
+ # Optional human-readable name for an API Key. If none provided, default to Oauth - <Timestamp>
22
+ attr_accessor :api_key_name
23
+
24
+ # Expiration window (in seconds) indicating how long the API key is valid. If not provided, a default of 15 minutes will be used.
25
+ attr_accessor :expiration_seconds
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'oidc_token' => :'oidcToken',
31
+ :'target_public_key' => :'targetPublicKey',
32
+ :'api_key_name' => :'apiKeyName',
33
+ :'expiration_seconds' => :'expirationSeconds'
34
+ }
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.openapi_types
39
+ {
40
+ :'oidc_token' => :'Object',
41
+ :'target_public_key' => :'Object',
42
+ :'api_key_name' => :'Object',
43
+ :'expiration_seconds' => :'Object'
44
+ }
45
+ end
46
+
47
+ # List of attributes with nullable: true
48
+ def self.openapi_nullable
49
+ Set.new([
50
+ ])
51
+ end
52
+
53
+ # Initializes the object
54
+ # @param [Hash] attributes Model attributes in the form of hash
55
+ def initialize(attributes = {})
56
+ if (!attributes.is_a?(Hash))
57
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TurnkeyClient::OauthIntent` initialize method"
58
+ end
59
+
60
+ # check to see if the attribute exists and convert string to symbol for hash key
61
+ attributes = attributes.each_with_object({}) { |(k, v), h|
62
+ if (!self.class.attribute_map.key?(k.to_sym))
63
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TurnkeyClient::OauthIntent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
64
+ end
65
+ h[k.to_sym] = v
66
+ }
67
+
68
+ if attributes.key?(:'oidc_token')
69
+ self.oidc_token = attributes[:'oidc_token']
70
+ end
71
+
72
+ if attributes.key?(:'target_public_key')
73
+ self.target_public_key = attributes[:'target_public_key']
74
+ end
75
+
76
+ if attributes.key?(:'api_key_name')
77
+ self.api_key_name = attributes[:'api_key_name']
78
+ end
79
+
80
+ if attributes.key?(:'expiration_seconds')
81
+ self.expiration_seconds = attributes[:'expiration_seconds']
82
+ end
83
+ end
84
+
85
+ # Show invalid properties with the reasons. Usually used together with valid?
86
+ # @return Array for valid properties with the reasons
87
+ def list_invalid_properties
88
+ invalid_properties = Array.new
89
+ if @oidc_token.nil?
90
+ invalid_properties.push('invalid value for "oidc_token", oidc_token cannot be nil.')
91
+ end
92
+
93
+ if @target_public_key.nil?
94
+ invalid_properties.push('invalid value for "target_public_key", target_public_key cannot be nil.')
95
+ end
96
+
97
+ invalid_properties
98
+ end
99
+
100
+ # Check to see if the all the properties in the model are valid
101
+ # @return true if the model is valid
102
+ def valid?
103
+ return false if @oidc_token.nil?
104
+ return false if @target_public_key.nil?
105
+ true
106
+ end
107
+
108
+ # Checks equality by comparing each attribute.
109
+ # @param [Object] Object to be compared
110
+ def ==(o)
111
+ return true if self.equal?(o)
112
+ self.class == o.class &&
113
+ oidc_token == o.oidc_token &&
114
+ target_public_key == o.target_public_key &&
115
+ api_key_name == o.api_key_name &&
116
+ expiration_seconds == o.expiration_seconds
117
+ end
118
+
119
+ # @see the `==` method
120
+ # @param [Object] Object to be compared
121
+ def eql?(o)
122
+ self == o
123
+ end
124
+
125
+ # Calculates hash code according to all attributes.
126
+ # @return [Integer] Hash code
127
+ def hash
128
+ [oidc_token, target_public_key, api_key_name, expiration_seconds].hash
129
+ end
130
+
131
+ # Builds the object from hash
132
+ # @param [Hash] attributes Model attributes in the form of hash
133
+ # @return [Object] Returns the model itself
134
+ def self.build_from_hash(attributes)
135
+ new.build_from_hash(attributes)
136
+ end
137
+
138
+ # Builds the object from hash
139
+ # @param [Hash] attributes Model attributes in the form of hash
140
+ # @return [Object] Returns the model itself
141
+ def build_from_hash(attributes)
142
+ return nil unless attributes.is_a?(Hash)
143
+ self.class.openapi_types.each_pair do |key, type|
144
+ if type =~ /\AArray<(.*)>/i
145
+ # check to ensure the input is an array given that the attribute
146
+ # is documented as an array but the input is not
147
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
148
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
149
+ end
150
+ elsif !attributes[self.class.attribute_map[key]].nil?
151
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
152
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
153
+ self.send("#{key}=", nil)
154
+ end
155
+ end
156
+
157
+ self
158
+ end
159
+
160
+ # Deserializes the data based on type
161
+ # @param string type Data type
162
+ # @param string value Value to be deserialized
163
+ # @return [Object] Deserialized data
164
+ def _deserialize(type, value)
165
+ case type.to_sym
166
+ when :DateTime
167
+ DateTime.parse(value)
168
+ when :Date
169
+ Date.parse(value)
170
+ when :String
171
+ value.to_s
172
+ when :Integer
173
+ value.to_i
174
+ when :Float
175
+ value.to_f
176
+ when :Boolean
177
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
178
+ true
179
+ else
180
+ false
181
+ end
182
+ when :Object
183
+ # generic object (usually a Hash), return directly
184
+ value
185
+ when /\AArray<(?<inner_type>.+)>\z/
186
+ inner_type = Regexp.last_match[:inner_type]
187
+ value.map { |v| _deserialize(inner_type, v) }
188
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
189
+ k_type = Regexp.last_match[:k_type]
190
+ v_type = Regexp.last_match[:v_type]
191
+ {}.tap do |hash|
192
+ value.each do |k, v|
193
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
194
+ end
195
+ end
196
+ else # model
197
+ TurnkeyClient.const_get(type).build_from_hash(value)
198
+ end
199
+ end
200
+
201
+ # Returns the string representation of the object
202
+ # @return [String] String presentation of the object
203
+ def to_s
204
+ to_hash.to_s
205
+ end
206
+
207
+ # to_body is an alias to to_hash (backward compatibility)
208
+ # @return [Hash] Returns the object in the form of hash
209
+ def to_body
210
+ to_hash
211
+ end
212
+
213
+ # Returns the object in the form of hash
214
+ # @return [Hash] Returns the object in the form of hash
215
+ def to_hash
216
+ hash = {}
217
+ self.class.attribute_map.each_pair do |attr, param|
218
+ value = self.send(attr)
219
+ if value.nil?
220
+ is_nullable = self.class.openapi_nullable.include?(attr)
221
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
222
+ end
223
+
224
+ hash[param] = _to_hash(value)
225
+ end
226
+ hash
227
+ end
228
+
229
+ # Outputs non-array value in the form of hash
230
+ # For object, use to_hash. Otherwise, just return the value
231
+ # @param [Object] value Any valid value
232
+ # @return [Hash] Returns the value in the form of hash
233
+ def _to_hash(value)
234
+ if value.is_a?(Array)
235
+ value.compact.map { |v| _to_hash(v) }
236
+ elsif value.is_a?(Hash)
237
+ {}.tap do |hash|
238
+ value.each { |k, v| hash[k] = _to_hash(v) }
239
+ end
240
+ elsif value.respond_to? :to_hash
241
+ value.to_hash
242
+ else
243
+ value
244
+ end
245
+ end end
246
+ end