turnkey_client 0.0.14 → 0.0.15

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 (57) hide show
  1. checksums.yaml +4 -4
  2. data/lib/turnkey_client/api/app_proof_api.rb +77 -0
  3. data/lib/turnkey_client/api/boot_proof_api.rb +135 -0
  4. data/lib/turnkey_client/api/default_api.rb +77 -0
  5. data/lib/turnkey_client/api/user_auth_api.rb +290 -0
  6. data/lib/turnkey_client/models/activity.rb +13 -1
  7. data/lib/turnkey_client/models/activity_type.rb +7 -0
  8. data/lib/turnkey_client/models/app_proof.rb +255 -0
  9. data/lib/turnkey_client/models/boot_proof.rb +315 -0
  10. data/lib/turnkey_client/models/boot_proof_response.rb +210 -0
  11. data/lib/turnkey_client/models/common_v1_policy_evaluation.rb +214 -0
  12. data/lib/turnkey_client/models/create_oauth2_credential_intent.rb +240 -0
  13. data/lib/turnkey_client/models/create_oauth2_credential_request.rb +288 -0
  14. data/lib/turnkey_client/models/create_oauth2_credential_result.rb +211 -0
  15. data/lib/turnkey_client/models/create_sub_organization_intent_v7.rb +16 -5
  16. data/lib/turnkey_client/models/delete_oauth2_credential_intent.rb +211 -0
  17. data/lib/turnkey_client/models/delete_oauth2_credential_request.rb +288 -0
  18. data/lib/turnkey_client/models/delete_oauth2_credential_result.rb +211 -0
  19. data/lib/turnkey_client/models/disable_auth_proxy_intent.rb +196 -0
  20. data/lib/turnkey_client/models/disable_auth_proxy_result.rb +196 -0
  21. data/lib/turnkey_client/models/enable_auth_proxy_intent.rb +196 -0
  22. data/lib/turnkey_client/models/enable_auth_proxy_result.rb +211 -0
  23. data/lib/turnkey_client/models/feature_name.rb +1 -0
  24. data/lib/turnkey_client/models/get_app_proofs_request.rb +226 -0
  25. data/lib/turnkey_client/models/get_app_proofs_response.rb +212 -0
  26. data/lib/turnkey_client/models/get_boot_proof_request.rb +226 -0
  27. data/lib/turnkey_client/models/get_latest_boot_proof_request.rb +226 -0
  28. data/lib/turnkey_client/models/get_oauth2_credential_request.rb +226 -0
  29. data/lib/turnkey_client/models/get_oauth2_credential_response.rb +210 -0
  30. data/lib/turnkey_client/models/get_wallet_accounts_request.rb +12 -1
  31. data/lib/turnkey_client/models/init_fiat_on_ramp_intent.rb +16 -5
  32. data/lib/turnkey_client/models/init_fiat_on_ramp_result.rb +14 -4
  33. data/lib/turnkey_client/models/intent.rb +67 -4
  34. data/lib/turnkey_client/models/list_oauth2_credentials_request.rb +211 -0
  35. data/lib/turnkey_client/models/list_oauth2_credentials_response.rb +212 -0
  36. data/lib/turnkey_client/models/oauth2_authenticate_intent.rb +278 -0
  37. data/lib/turnkey_client/models/oauth2_authenticate_request.rb +288 -0
  38. data/lib/turnkey_client/models/oauth2_authenticate_result.rb +211 -0
  39. data/lib/turnkey_client/models/oauth2_credential.rb +298 -0
  40. data/lib/turnkey_client/models/oauth2_provider.rb +27 -0
  41. data/lib/turnkey_client/models/otp_login_intent.rb +16 -5
  42. data/lib/turnkey_client/models/payload_encoding.rb +1 -0
  43. data/lib/turnkey_client/models/result.rb +67 -4
  44. data/lib/turnkey_client/models/signature_scheme.rb +26 -0
  45. data/lib/turnkey_client/models/smart_contract_interface.rb +329 -0
  46. data/lib/turnkey_client/models/update_auth_proxy_config_intent.rb +346 -0
  47. data/lib/turnkey_client/models/update_auth_proxy_config_result.rb +206 -0
  48. data/lib/turnkey_client/models/update_oauth2_credential_intent.rb +255 -0
  49. data/lib/turnkey_client/models/update_oauth2_credential_request.rb +288 -0
  50. data/lib/turnkey_client/models/update_oauth2_credential_result.rb +211 -0
  51. data/lib/turnkey_client/models/verify_otp_intent.rb +16 -5
  52. data/lib/turnkey_client/models/wallet_account.rb +14 -5
  53. data/lib/turnkey_client/models/wallet_kit_settings_params.rb +230 -0
  54. data/lib/turnkey_client/version.rb +1 -1
  55. data/lib/turnkey_client.rb +38 -2
  56. data/turnkey_client-0.0.14.gem +0 -0
  57. metadata +41 -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 ListOauth2CredentialsRequest
15
+ # Unique identifier for a given Organization.
16
+ attr_accessor :organization_id
17
+
18
+ # Attribute mapping from ruby-style variable name to JSON key.
19
+ def self.attribute_map
20
+ {
21
+ :'organization_id' => :'organizationId'
22
+ }
23
+ end
24
+
25
+ # Attribute type mapping.
26
+ def self.openapi_types
27
+ {
28
+ :'organization_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::ListOauth2CredentialsRequest` 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::ListOauth2CredentialsRequest`. 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?(:'organization_id')
54
+ self.organization_id = attributes[:'organization_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 @organization_id.nil?
63
+ invalid_properties.push('invalid value for "organization_id", organization_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 @organization_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
+ organization_id == o.organization_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
+ [organization_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
@@ -0,0 +1,212 @@
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 ListOauth2CredentialsResponse
15
+ attr_accessor :oauth2_credentials
16
+
17
+ # Attribute mapping from ruby-style variable name to JSON key.
18
+ def self.attribute_map
19
+ {
20
+ :'oauth2_credentials' => :'oauth2Credentials'
21
+ }
22
+ end
23
+
24
+ # Attribute type mapping.
25
+ def self.openapi_types
26
+ {
27
+ :'oauth2_credentials' => :'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::ListOauth2CredentialsResponse` 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::ListOauth2CredentialsResponse`. 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?(:'oauth2_credentials')
53
+ if (value = attributes[:'oauth2_credentials']).is_a?(Array)
54
+ self.oauth2_credentials = value
55
+ end
56
+ end
57
+ end
58
+
59
+ # Show invalid properties with the reasons. Usually used together with valid?
60
+ # @return Array for valid properties with the reasons
61
+ def list_invalid_properties
62
+ invalid_properties = Array.new
63
+ if @oauth2_credentials.nil?
64
+ invalid_properties.push('invalid value for "oauth2_credentials", oauth2_credentials cannot be nil.')
65
+ end
66
+
67
+ invalid_properties
68
+ end
69
+
70
+ # Check to see if the all the properties in the model are valid
71
+ # @return true if the model is valid
72
+ def valid?
73
+ return false if @oauth2_credentials.nil?
74
+ true
75
+ end
76
+
77
+ # Checks equality by comparing each attribute.
78
+ # @param [Object] Object to be compared
79
+ def ==(o)
80
+ return true if self.equal?(o)
81
+ self.class == o.class &&
82
+ oauth2_credentials == o.oauth2_credentials
83
+ end
84
+
85
+ # @see the `==` method
86
+ # @param [Object] Object to be compared
87
+ def eql?(o)
88
+ self == o
89
+ end
90
+
91
+ # Calculates hash code according to all attributes.
92
+ # @return [Integer] Hash code
93
+ def hash
94
+ [oauth2_credentials].hash
95
+ end
96
+
97
+ # Builds the object from hash
98
+ # @param [Hash] attributes Model attributes in the form of hash
99
+ # @return [Object] Returns the model itself
100
+ def self.build_from_hash(attributes)
101
+ new.build_from_hash(attributes)
102
+ end
103
+
104
+ # Builds the object from hash
105
+ # @param [Hash] attributes Model attributes in the form of hash
106
+ # @return [Object] Returns the model itself
107
+ def build_from_hash(attributes)
108
+ return nil unless attributes.is_a?(Hash)
109
+ self.class.openapi_types.each_pair do |key, type|
110
+ if type =~ /\AArray<(.*)>/i
111
+ # check to ensure the input is an array given that the attribute
112
+ # is documented as an array but the input is not
113
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
114
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
115
+ end
116
+ elsif !attributes[self.class.attribute_map[key]].nil?
117
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
118
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
119
+ self.send("#{key}=", nil)
120
+ end
121
+ end
122
+
123
+ self
124
+ end
125
+
126
+ # Deserializes the data based on type
127
+ # @param string type Data type
128
+ # @param string value Value to be deserialized
129
+ # @return [Object] Deserialized data
130
+ def _deserialize(type, value)
131
+ case type.to_sym
132
+ when :DateTime
133
+ DateTime.parse(value)
134
+ when :Date
135
+ Date.parse(value)
136
+ when :String
137
+ value.to_s
138
+ when :Integer
139
+ value.to_i
140
+ when :Float
141
+ value.to_f
142
+ when :Boolean
143
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
144
+ true
145
+ else
146
+ false
147
+ end
148
+ when :Object
149
+ # generic object (usually a Hash), return directly
150
+ value
151
+ when /\AArray<(?<inner_type>.+)>\z/
152
+ inner_type = Regexp.last_match[:inner_type]
153
+ value.map { |v| _deserialize(inner_type, v) }
154
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
155
+ k_type = Regexp.last_match[:k_type]
156
+ v_type = Regexp.last_match[:v_type]
157
+ {}.tap do |hash|
158
+ value.each do |k, v|
159
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
160
+ end
161
+ end
162
+ else # model
163
+ TurnkeyClient.const_get(type).build_from_hash(value)
164
+ end
165
+ end
166
+
167
+ # Returns the string representation of the object
168
+ # @return [String] String presentation of the object
169
+ def to_s
170
+ to_hash.to_s
171
+ end
172
+
173
+ # to_body is an alias to to_hash (backward compatibility)
174
+ # @return [Hash] Returns the object in the form of hash
175
+ def to_body
176
+ to_hash
177
+ end
178
+
179
+ # Returns the object in the form of hash
180
+ # @return [Hash] Returns the object in the form of hash
181
+ def to_hash
182
+ hash = {}
183
+ self.class.attribute_map.each_pair do |attr, param|
184
+ value = self.send(attr)
185
+ if value.nil?
186
+ is_nullable = self.class.openapi_nullable.include?(attr)
187
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
188
+ end
189
+
190
+ hash[param] = _to_hash(value)
191
+ end
192
+ hash
193
+ end
194
+
195
+ # Outputs non-array value in the form of hash
196
+ # For object, use to_hash. Otherwise, just return the value
197
+ # @param [Object] value Any valid value
198
+ # @return [Hash] Returns the value in the form of hash
199
+ def _to_hash(value)
200
+ if value.is_a?(Array)
201
+ value.compact.map { |v| _to_hash(v) }
202
+ elsif value.is_a?(Hash)
203
+ {}.tap do |hash|
204
+ value.each { |k, v| hash[k] = _to_hash(v) }
205
+ end
206
+ elsif value.respond_to? :to_hash
207
+ value.to_hash
208
+ else
209
+ value
210
+ end
211
+ end end
212
+ end
@@ -0,0 +1,278 @@
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 Oauth2AuthenticateIntent
15
+ # The OAuth 2.0 credential id whose client_id and client_secret will be used in the OAuth 2.0 flow
16
+ attr_accessor :oauth2_credential_id
17
+
18
+ # The auth_code provided by the OAuth 2.0 provider to the end user to be exchanged for a Bearer token in the OAuth 2.0 flow
19
+ attr_accessor :auth_code
20
+
21
+ # The URI the user is redirected to after they have authenticated with the OAuth 2.0 provider
22
+ attr_accessor :redirect_uri
23
+
24
+ # The code verifier used by OAuth 2.0 PKCE providers
25
+ attr_accessor :code_verifier
26
+
27
+ # An optional nonce used by the client to prevent replay/substitution of an ID token
28
+ attr_accessor :nonce
29
+
30
+ # An optional P256 public key to which, if provided, the bearer token will be encrypted and returned via the `encrypted_bearer_token` claim of the OIDC Token
31
+ attr_accessor :bearer_token_target_public_key
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'oauth2_credential_id' => :'oauth2CredentialId',
37
+ :'auth_code' => :'authCode',
38
+ :'redirect_uri' => :'redirectUri',
39
+ :'code_verifier' => :'codeVerifier',
40
+ :'nonce' => :'nonce',
41
+ :'bearer_token_target_public_key' => :'bearerTokenTargetPublicKey'
42
+ }
43
+ end
44
+
45
+ # Attribute type mapping.
46
+ def self.openapi_types
47
+ {
48
+ :'oauth2_credential_id' => :'Object',
49
+ :'auth_code' => :'Object',
50
+ :'redirect_uri' => :'Object',
51
+ :'code_verifier' => :'Object',
52
+ :'nonce' => :'Object',
53
+ :'bearer_token_target_public_key' => :'Object'
54
+ }
55
+ end
56
+
57
+ # List of attributes with nullable: true
58
+ def self.openapi_nullable
59
+ Set.new([
60
+ :'nonce',
61
+ :'bearer_token_target_public_key'
62
+ ])
63
+ end
64
+
65
+ # Initializes the object
66
+ # @param [Hash] attributes Model attributes in the form of hash
67
+ def initialize(attributes = {})
68
+ if (!attributes.is_a?(Hash))
69
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TurnkeyClient::Oauth2AuthenticateIntent` initialize method"
70
+ end
71
+
72
+ # check to see if the attribute exists and convert string to symbol for hash key
73
+ attributes = attributes.each_with_object({}) { |(k, v), h|
74
+ if (!self.class.attribute_map.key?(k.to_sym))
75
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TurnkeyClient::Oauth2AuthenticateIntent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
76
+ end
77
+ h[k.to_sym] = v
78
+ }
79
+
80
+ if attributes.key?(:'oauth2_credential_id')
81
+ self.oauth2_credential_id = attributes[:'oauth2_credential_id']
82
+ end
83
+
84
+ if attributes.key?(:'auth_code')
85
+ self.auth_code = attributes[:'auth_code']
86
+ end
87
+
88
+ if attributes.key?(:'redirect_uri')
89
+ self.redirect_uri = attributes[:'redirect_uri']
90
+ end
91
+
92
+ if attributes.key?(:'code_verifier')
93
+ self.code_verifier = attributes[:'code_verifier']
94
+ end
95
+
96
+ if attributes.key?(:'nonce')
97
+ self.nonce = attributes[:'nonce']
98
+ end
99
+
100
+ if attributes.key?(:'bearer_token_target_public_key')
101
+ self.bearer_token_target_public_key = attributes[:'bearer_token_target_public_key']
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 @oauth2_credential_id.nil?
110
+ invalid_properties.push('invalid value for "oauth2_credential_id", oauth2_credential_id cannot be nil.')
111
+ end
112
+
113
+ if @auth_code.nil?
114
+ invalid_properties.push('invalid value for "auth_code", auth_code cannot be nil.')
115
+ end
116
+
117
+ if @redirect_uri.nil?
118
+ invalid_properties.push('invalid value for "redirect_uri", redirect_uri cannot be nil.')
119
+ end
120
+
121
+ if @code_verifier.nil?
122
+ invalid_properties.push('invalid value for "code_verifier", code_verifier 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 @oauth2_credential_id.nil?
132
+ return false if @auth_code.nil?
133
+ return false if @redirect_uri.nil?
134
+ return false if @code_verifier.nil?
135
+ true
136
+ end
137
+
138
+ # Checks equality by comparing each attribute.
139
+ # @param [Object] Object to be compared
140
+ def ==(o)
141
+ return true if self.equal?(o)
142
+ self.class == o.class &&
143
+ oauth2_credential_id == o.oauth2_credential_id &&
144
+ auth_code == o.auth_code &&
145
+ redirect_uri == o.redirect_uri &&
146
+ code_verifier == o.code_verifier &&
147
+ nonce == o.nonce &&
148
+ bearer_token_target_public_key == o.bearer_token_target_public_key
149
+ end
150
+
151
+ # @see the `==` method
152
+ # @param [Object] Object to be compared
153
+ def eql?(o)
154
+ self == o
155
+ end
156
+
157
+ # Calculates hash code according to all attributes.
158
+ # @return [Integer] Hash code
159
+ def hash
160
+ [oauth2_credential_id, auth_code, redirect_uri, code_verifier, nonce, bearer_token_target_public_key].hash
161
+ end
162
+
163
+ # Builds the object from hash
164
+ # @param [Hash] attributes Model attributes in the form of hash
165
+ # @return [Object] Returns the model itself
166
+ def self.build_from_hash(attributes)
167
+ new.build_from_hash(attributes)
168
+ end
169
+
170
+ # Builds the object from hash
171
+ # @param [Hash] attributes Model attributes in the form of hash
172
+ # @return [Object] Returns the model itself
173
+ def build_from_hash(attributes)
174
+ return nil unless attributes.is_a?(Hash)
175
+ self.class.openapi_types.each_pair do |key, type|
176
+ if type =~ /\AArray<(.*)>/i
177
+ # check to ensure the input is an array given that the attribute
178
+ # is documented as an array but the input is not
179
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
180
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
181
+ end
182
+ elsif !attributes[self.class.attribute_map[key]].nil?
183
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
184
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
185
+ self.send("#{key}=", nil)
186
+ end
187
+ end
188
+
189
+ self
190
+ end
191
+
192
+ # Deserializes the data based on type
193
+ # @param string type Data type
194
+ # @param string value Value to be deserialized
195
+ # @return [Object] Deserialized data
196
+ def _deserialize(type, value)
197
+ case type.to_sym
198
+ when :DateTime
199
+ DateTime.parse(value)
200
+ when :Date
201
+ Date.parse(value)
202
+ when :String
203
+ value.to_s
204
+ when :Integer
205
+ value.to_i
206
+ when :Float
207
+ value.to_f
208
+ when :Boolean
209
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
210
+ true
211
+ else
212
+ false
213
+ end
214
+ when :Object
215
+ # generic object (usually a Hash), return directly
216
+ value
217
+ when /\AArray<(?<inner_type>.+)>\z/
218
+ inner_type = Regexp.last_match[:inner_type]
219
+ value.map { |v| _deserialize(inner_type, v) }
220
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
221
+ k_type = Regexp.last_match[:k_type]
222
+ v_type = Regexp.last_match[:v_type]
223
+ {}.tap do |hash|
224
+ value.each do |k, v|
225
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
226
+ end
227
+ end
228
+ else # model
229
+ TurnkeyClient.const_get(type).build_from_hash(value)
230
+ end
231
+ end
232
+
233
+ # Returns the string representation of the object
234
+ # @return [String] String presentation of the object
235
+ def to_s
236
+ to_hash.to_s
237
+ end
238
+
239
+ # to_body is an alias to to_hash (backward compatibility)
240
+ # @return [Hash] Returns the object in the form of hash
241
+ def to_body
242
+ to_hash
243
+ end
244
+
245
+ # Returns the object in the form of hash
246
+ # @return [Hash] Returns the object in the form of hash
247
+ def to_hash
248
+ hash = {}
249
+ self.class.attribute_map.each_pair do |attr, param|
250
+ value = self.send(attr)
251
+ if value.nil?
252
+ is_nullable = self.class.openapi_nullable.include?(attr)
253
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
254
+ end
255
+
256
+ hash[param] = _to_hash(value)
257
+ end
258
+ hash
259
+ end
260
+
261
+ # Outputs non-array value in the form of hash
262
+ # For object, use to_hash. Otherwise, just return the value
263
+ # @param [Object] value Any valid value
264
+ # @return [Hash] Returns the value in the form of hash
265
+ def _to_hash(value)
266
+ if value.is_a?(Array)
267
+ value.compact.map { |v| _to_hash(v) }
268
+ elsif value.is_a?(Hash)
269
+ {}.tap do |hash|
270
+ value.each { |k, v| hash[k] = _to_hash(v) }
271
+ end
272
+ elsif value.respond_to? :to_hash
273
+ value.to_hash
274
+ else
275
+ value
276
+ end
277
+ end end
278
+ end