turnkey_client 0.0.4 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/turnkey_client/api/organizations_api.rb +58 -0
- data/lib/turnkey_client/api/policies_api.rb +58 -0
- data/lib/turnkey_client/api/private_keys_api.rb +58 -0
- data/lib/turnkey_client/api/sessions_api.rb +116 -0
- data/lib/turnkey_client/api/signing_api.rb +58 -0
- data/lib/turnkey_client/api/users_api.rb +232 -0
- data/lib/turnkey_client/api/wallets_api.rb +58 -0
- data/lib/turnkey_client/models/activity.rb +13 -4
- data/lib/turnkey_client/models/activity_type.rb +13 -0
- data/lib/turnkey_client/models/any.rb +200 -0
- data/lib/turnkey_client/models/api_key_curve.rb +28 -0
- data/lib/turnkey_client/models/api_key_params_v2.rb +250 -0
- data/lib/turnkey_client/models/config.rb +216 -0
- data/lib/turnkey_client/models/create_api_keys_intent_v2.rb +228 -0
- data/lib/turnkey_client/models/create_api_keys_request.rb +2 -2
- data/lib/turnkey_client/models/create_oauth_providers_intent.rb +228 -0
- data/lib/turnkey_client/models/create_oauth_providers_request.rb +288 -0
- data/lib/turnkey_client/models/create_oauth_providers_result.rb +213 -0
- data/lib/turnkey_client/models/create_policies_intent.rb +213 -0
- data/lib/turnkey_client/models/create_policies_request.rb +288 -0
- data/lib/turnkey_client/models/create_policies_result.rb +213 -0
- data/lib/turnkey_client/models/create_read_only_session_intent.rb +196 -0
- data/lib/turnkey_client/models/create_read_only_session_request.rb +288 -0
- data/lib/turnkey_client/models/create_read_only_session_result.rb +286 -0
- data/lib/turnkey_client/models/create_read_write_session_intent.rb +246 -0
- data/lib/turnkey_client/models/create_read_write_session_request.rb +288 -0
- data/lib/turnkey_client/models/create_read_write_session_result.rb +286 -0
- data/lib/turnkey_client/models/create_sub_organization_intent_v5.rb +272 -0
- data/lib/turnkey_client/models/create_sub_organization_intent_v6.rb +272 -0
- data/lib/turnkey_client/models/create_sub_organization_request.rb +2 -2
- data/lib/turnkey_client/models/create_sub_organization_result_v5.rb +230 -0
- data/lib/turnkey_client/models/create_sub_organization_result_v6.rb +230 -0
- data/lib/turnkey_client/models/credential_type.rb +3 -0
- data/lib/turnkey_client/models/delete_oauth_providers_intent.rb +228 -0
- data/lib/turnkey_client/models/delete_oauth_providers_request.rb +288 -0
- data/lib/turnkey_client/models/delete_oauth_providers_result.rb +213 -0
- data/lib/turnkey_client/models/delete_private_keys_intent.rb +223 -0
- data/lib/turnkey_client/models/delete_private_keys_request.rb +288 -0
- data/lib/turnkey_client/models/delete_private_keys_result.rb +213 -0
- data/lib/turnkey_client/models/delete_wallets_intent.rb +223 -0
- data/lib/turnkey_client/models/delete_wallets_request.rb +288 -0
- data/lib/turnkey_client/models/delete_wallets_result.rb +213 -0
- data/lib/turnkey_client/models/email_auth_intent.rb +14 -4
- data/lib/turnkey_client/models/email_auth_intent_v2.rb +265 -0
- data/lib/turnkey_client/models/email_auth_request.rb +2 -2
- data/lib/turnkey_client/models/email_customization_params.rb +1 -1
- data/lib/turnkey_client/models/external_data_v1_quorum.rb +228 -0
- data/lib/turnkey_client/models/get_oauth_providers_request.rb +221 -0
- data/lib/turnkey_client/models/get_oauth_providers_response.rb +213 -0
- data/lib/turnkey_client/models/get_organization_configs_request.rb +211 -0
- data/lib/turnkey_client/models/get_organization_configs_response.rb +210 -0
- data/lib/turnkey_client/models/get_sub_org_ids_request.rb +1 -1
- data/lib/turnkey_client/models/intent.rb +121 -9
- data/lib/turnkey_client/models/oauth_intent.rb +246 -0
- data/lib/turnkey_client/models/oauth_provider.rb +299 -0
- data/lib/turnkey_client/models/oauth_provider_params.rb +226 -0
- data/lib/turnkey_client/models/oauth_request.rb +288 -0
- data/lib/turnkey_client/models/oauth_result.rb +241 -0
- data/lib/turnkey_client/models/result.rb +103 -4
- data/lib/turnkey_client/models/root_user_params_v2.rb +272 -0
- data/lib/turnkey_client/models/root_user_params_v3.rb +272 -0
- data/lib/turnkey_client/models/sign_raw_payloads_intent.rb +256 -0
- data/lib/turnkey_client/models/sign_raw_payloads_request.rb +288 -0
- data/lib/turnkey_client/models/sign_raw_payloads_result.rb +207 -0
- data/lib/turnkey_client/models/status.rb +225 -0
- data/lib/turnkey_client/models/user.rb +18 -1
- data/lib/turnkey_client/models/wallet_account.rb +4 -19
- data/lib/turnkey_client/version.rb +1 -1
- data/lib/turnkey_client.rb +47 -0
- data/turnkey_client-0.0.4.gem +0 -0
- data/turnkey_client-0.0.7.gem +0 -0
- metadata +51 -2
@@ -0,0 +1,230 @@
|
|
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 CreateSubOrganizationResultV6
|
15
|
+
attr_accessor :sub_organization_id
|
16
|
+
|
17
|
+
attr_accessor :wallet
|
18
|
+
|
19
|
+
attr_accessor :root_user_ids
|
20
|
+
|
21
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
22
|
+
def self.attribute_map
|
23
|
+
{
|
24
|
+
:'sub_organization_id' => :'subOrganizationId',
|
25
|
+
:'wallet' => :'wallet',
|
26
|
+
:'root_user_ids' => :'rootUserIds'
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
# Attribute type mapping.
|
31
|
+
def self.openapi_types
|
32
|
+
{
|
33
|
+
:'sub_organization_id' => :'Object',
|
34
|
+
:'wallet' => :'Object',
|
35
|
+
:'root_user_ids' => :'Object'
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
# List of attributes with nullable: true
|
40
|
+
def self.openapi_nullable
|
41
|
+
Set.new([
|
42
|
+
])
|
43
|
+
end
|
44
|
+
|
45
|
+
# Initializes the object
|
46
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
47
|
+
def initialize(attributes = {})
|
48
|
+
if (!attributes.is_a?(Hash))
|
49
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `TurnkeyClient::CreateSubOrganizationResultV6` initialize method"
|
50
|
+
end
|
51
|
+
|
52
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
53
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
54
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
55
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `TurnkeyClient::CreateSubOrganizationResultV6`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
56
|
+
end
|
57
|
+
h[k.to_sym] = v
|
58
|
+
}
|
59
|
+
|
60
|
+
if attributes.key?(:'sub_organization_id')
|
61
|
+
self.sub_organization_id = attributes[:'sub_organization_id']
|
62
|
+
end
|
63
|
+
|
64
|
+
if attributes.key?(:'wallet')
|
65
|
+
self.wallet = attributes[:'wallet']
|
66
|
+
end
|
67
|
+
|
68
|
+
if attributes.key?(:'root_user_ids')
|
69
|
+
if (value = attributes[:'root_user_ids']).is_a?(Array)
|
70
|
+
self.root_user_ids = value
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
76
|
+
# @return Array for valid properties with the reasons
|
77
|
+
def list_invalid_properties
|
78
|
+
invalid_properties = Array.new
|
79
|
+
if @sub_organization_id.nil?
|
80
|
+
invalid_properties.push('invalid value for "sub_organization_id", sub_organization_id cannot be nil.')
|
81
|
+
end
|
82
|
+
|
83
|
+
invalid_properties
|
84
|
+
end
|
85
|
+
|
86
|
+
# Check to see if the all the properties in the model are valid
|
87
|
+
# @return true if the model is valid
|
88
|
+
def valid?
|
89
|
+
return false if @sub_organization_id.nil?
|
90
|
+
true
|
91
|
+
end
|
92
|
+
|
93
|
+
# Checks equality by comparing each attribute.
|
94
|
+
# @param [Object] Object to be compared
|
95
|
+
def ==(o)
|
96
|
+
return true if self.equal?(o)
|
97
|
+
self.class == o.class &&
|
98
|
+
sub_organization_id == o.sub_organization_id &&
|
99
|
+
wallet == o.wallet &&
|
100
|
+
root_user_ids == o.root_user_ids
|
101
|
+
end
|
102
|
+
|
103
|
+
# @see the `==` method
|
104
|
+
# @param [Object] Object to be compared
|
105
|
+
def eql?(o)
|
106
|
+
self == o
|
107
|
+
end
|
108
|
+
|
109
|
+
# Calculates hash code according to all attributes.
|
110
|
+
# @return [Integer] Hash code
|
111
|
+
def hash
|
112
|
+
[sub_organization_id, wallet, root_user_ids].hash
|
113
|
+
end
|
114
|
+
|
115
|
+
# Builds the object from hash
|
116
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
117
|
+
# @return [Object] Returns the model itself
|
118
|
+
def self.build_from_hash(attributes)
|
119
|
+
new.build_from_hash(attributes)
|
120
|
+
end
|
121
|
+
|
122
|
+
# Builds the object from hash
|
123
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
124
|
+
# @return [Object] Returns the model itself
|
125
|
+
def build_from_hash(attributes)
|
126
|
+
return nil unless attributes.is_a?(Hash)
|
127
|
+
self.class.openapi_types.each_pair do |key, type|
|
128
|
+
if type =~ /\AArray<(.*)>/i
|
129
|
+
# check to ensure the input is an array given that the attribute
|
130
|
+
# is documented as an array but the input is not
|
131
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
132
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
133
|
+
end
|
134
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
135
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
136
|
+
elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
137
|
+
self.send("#{key}=", nil)
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
self
|
142
|
+
end
|
143
|
+
|
144
|
+
# Deserializes the data based on type
|
145
|
+
# @param string type Data type
|
146
|
+
# @param string value Value to be deserialized
|
147
|
+
# @return [Object] Deserialized data
|
148
|
+
def _deserialize(type, value)
|
149
|
+
case type.to_sym
|
150
|
+
when :DateTime
|
151
|
+
DateTime.parse(value)
|
152
|
+
when :Date
|
153
|
+
Date.parse(value)
|
154
|
+
when :String
|
155
|
+
value.to_s
|
156
|
+
when :Integer
|
157
|
+
value.to_i
|
158
|
+
when :Float
|
159
|
+
value.to_f
|
160
|
+
when :Boolean
|
161
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
162
|
+
true
|
163
|
+
else
|
164
|
+
false
|
165
|
+
end
|
166
|
+
when :Object
|
167
|
+
# generic object (usually a Hash), return directly
|
168
|
+
value
|
169
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
170
|
+
inner_type = Regexp.last_match[:inner_type]
|
171
|
+
value.map { |v| _deserialize(inner_type, v) }
|
172
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
173
|
+
k_type = Regexp.last_match[:k_type]
|
174
|
+
v_type = Regexp.last_match[:v_type]
|
175
|
+
{}.tap do |hash|
|
176
|
+
value.each do |k, v|
|
177
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
178
|
+
end
|
179
|
+
end
|
180
|
+
else # model
|
181
|
+
TurnkeyClient.const_get(type).build_from_hash(value)
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
# Returns the string representation of the object
|
186
|
+
# @return [String] String presentation of the object
|
187
|
+
def to_s
|
188
|
+
to_hash.to_s
|
189
|
+
end
|
190
|
+
|
191
|
+
# to_body is an alias to to_hash (backward compatibility)
|
192
|
+
# @return [Hash] Returns the object in the form of hash
|
193
|
+
def to_body
|
194
|
+
to_hash
|
195
|
+
end
|
196
|
+
|
197
|
+
# Returns the object in the form of hash
|
198
|
+
# @return [Hash] Returns the object in the form of hash
|
199
|
+
def to_hash
|
200
|
+
hash = {}
|
201
|
+
self.class.attribute_map.each_pair do |attr, param|
|
202
|
+
value = self.send(attr)
|
203
|
+
if value.nil?
|
204
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
205
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
206
|
+
end
|
207
|
+
|
208
|
+
hash[param] = _to_hash(value)
|
209
|
+
end
|
210
|
+
hash
|
211
|
+
end
|
212
|
+
|
213
|
+
# Outputs non-array value in the form of hash
|
214
|
+
# For object, use to_hash. Otherwise, just return the value
|
215
|
+
# @param [Object] value Any valid value
|
216
|
+
# @return [Hash] Returns the value in the form of hash
|
217
|
+
def _to_hash(value)
|
218
|
+
if value.is_a?(Array)
|
219
|
+
value.compact.map { |v| _to_hash(v) }
|
220
|
+
elsif value.is_a?(Hash)
|
221
|
+
{}.tap do |hash|
|
222
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
223
|
+
end
|
224
|
+
elsif value.respond_to? :to_hash
|
225
|
+
value.to_hash
|
226
|
+
else
|
227
|
+
value
|
228
|
+
end
|
229
|
+
end end
|
230
|
+
end
|
@@ -15,6 +15,9 @@ module TurnkeyClient
|
|
15
15
|
WEBAUTHN_AUTHENTICATOR = 'CREDENTIAL_TYPE_WEBAUTHN_AUTHENTICATOR'.freeze
|
16
16
|
API_KEY_P256 = 'CREDENTIAL_TYPE_API_KEY_P256'.freeze
|
17
17
|
RECOVER_USER_KEY_P256 = 'CREDENTIAL_TYPE_RECOVER_USER_KEY_P256'.freeze
|
18
|
+
API_KEY_SECP256_K1 = 'CREDENTIAL_TYPE_API_KEY_SECP256K1'.freeze
|
19
|
+
EMAIL_AUTH_KEY_P256 = 'CREDENTIAL_TYPE_EMAIL_AUTH_KEY_P256'.freeze
|
20
|
+
API_KEY_ED25519 = 'CREDENTIAL_TYPE_API_KEY_ED25519'.freeze
|
18
21
|
|
19
22
|
# Builds the enum from string
|
20
23
|
# @param [String] The enum value in the form of the string
|
@@ -0,0 +1,228 @@
|
|
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 DeleteOauthProvidersIntent
|
15
|
+
# The ID of the User to remove an Oauth provider from
|
16
|
+
attr_accessor :user_id
|
17
|
+
|
18
|
+
# Unique identifier for a given Provider.
|
19
|
+
attr_accessor :provider_ids
|
20
|
+
|
21
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
22
|
+
def self.attribute_map
|
23
|
+
{
|
24
|
+
:'user_id' => :'userId',
|
25
|
+
:'provider_ids' => :'providerIds'
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
# Attribute type mapping.
|
30
|
+
def self.openapi_types
|
31
|
+
{
|
32
|
+
:'user_id' => :'Object',
|
33
|
+
:'provider_ids' => :'Object'
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
# List of attributes with nullable: true
|
38
|
+
def self.openapi_nullable
|
39
|
+
Set.new([
|
40
|
+
])
|
41
|
+
end
|
42
|
+
|
43
|
+
# Initializes the object
|
44
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
45
|
+
def initialize(attributes = {})
|
46
|
+
if (!attributes.is_a?(Hash))
|
47
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `TurnkeyClient::DeleteOauthProvidersIntent` initialize method"
|
48
|
+
end
|
49
|
+
|
50
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
51
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
52
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
53
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `TurnkeyClient::DeleteOauthProvidersIntent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
54
|
+
end
|
55
|
+
h[k.to_sym] = v
|
56
|
+
}
|
57
|
+
|
58
|
+
if attributes.key?(:'user_id')
|
59
|
+
self.user_id = attributes[:'user_id']
|
60
|
+
end
|
61
|
+
|
62
|
+
if attributes.key?(:'provider_ids')
|
63
|
+
if (value = attributes[:'provider_ids']).is_a?(Array)
|
64
|
+
self.provider_ids = value
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
70
|
+
# @return Array for valid properties with the reasons
|
71
|
+
def list_invalid_properties
|
72
|
+
invalid_properties = Array.new
|
73
|
+
if @user_id.nil?
|
74
|
+
invalid_properties.push('invalid value for "user_id", user_id cannot be nil.')
|
75
|
+
end
|
76
|
+
|
77
|
+
if @provider_ids.nil?
|
78
|
+
invalid_properties.push('invalid value for "provider_ids", provider_ids cannot be nil.')
|
79
|
+
end
|
80
|
+
|
81
|
+
invalid_properties
|
82
|
+
end
|
83
|
+
|
84
|
+
# Check to see if the all the properties in the model are valid
|
85
|
+
# @return true if the model is valid
|
86
|
+
def valid?
|
87
|
+
return false if @user_id.nil?
|
88
|
+
return false if @provider_ids.nil?
|
89
|
+
true
|
90
|
+
end
|
91
|
+
|
92
|
+
# Checks equality by comparing each attribute.
|
93
|
+
# @param [Object] Object to be compared
|
94
|
+
def ==(o)
|
95
|
+
return true if self.equal?(o)
|
96
|
+
self.class == o.class &&
|
97
|
+
user_id == o.user_id &&
|
98
|
+
provider_ids == o.provider_ids
|
99
|
+
end
|
100
|
+
|
101
|
+
# @see the `==` method
|
102
|
+
# @param [Object] Object to be compared
|
103
|
+
def eql?(o)
|
104
|
+
self == o
|
105
|
+
end
|
106
|
+
|
107
|
+
# Calculates hash code according to all attributes.
|
108
|
+
# @return [Integer] Hash code
|
109
|
+
def hash
|
110
|
+
[user_id, provider_ids].hash
|
111
|
+
end
|
112
|
+
|
113
|
+
# Builds the object from hash
|
114
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
115
|
+
# @return [Object] Returns the model itself
|
116
|
+
def self.build_from_hash(attributes)
|
117
|
+
new.build_from_hash(attributes)
|
118
|
+
end
|
119
|
+
|
120
|
+
# Builds the object from hash
|
121
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
122
|
+
# @return [Object] Returns the model itself
|
123
|
+
def build_from_hash(attributes)
|
124
|
+
return nil unless attributes.is_a?(Hash)
|
125
|
+
self.class.openapi_types.each_pair do |key, type|
|
126
|
+
if type =~ /\AArray<(.*)>/i
|
127
|
+
# check to ensure the input is an array given that the attribute
|
128
|
+
# is documented as an array but the input is not
|
129
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
130
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
131
|
+
end
|
132
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
133
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
134
|
+
elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
135
|
+
self.send("#{key}=", nil)
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
self
|
140
|
+
end
|
141
|
+
|
142
|
+
# Deserializes the data based on type
|
143
|
+
# @param string type Data type
|
144
|
+
# @param string value Value to be deserialized
|
145
|
+
# @return [Object] Deserialized data
|
146
|
+
def _deserialize(type, value)
|
147
|
+
case type.to_sym
|
148
|
+
when :DateTime
|
149
|
+
DateTime.parse(value)
|
150
|
+
when :Date
|
151
|
+
Date.parse(value)
|
152
|
+
when :String
|
153
|
+
value.to_s
|
154
|
+
when :Integer
|
155
|
+
value.to_i
|
156
|
+
when :Float
|
157
|
+
value.to_f
|
158
|
+
when :Boolean
|
159
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
160
|
+
true
|
161
|
+
else
|
162
|
+
false
|
163
|
+
end
|
164
|
+
when :Object
|
165
|
+
# generic object (usually a Hash), return directly
|
166
|
+
value
|
167
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
168
|
+
inner_type = Regexp.last_match[:inner_type]
|
169
|
+
value.map { |v| _deserialize(inner_type, v) }
|
170
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
171
|
+
k_type = Regexp.last_match[:k_type]
|
172
|
+
v_type = Regexp.last_match[:v_type]
|
173
|
+
{}.tap do |hash|
|
174
|
+
value.each do |k, v|
|
175
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
176
|
+
end
|
177
|
+
end
|
178
|
+
else # model
|
179
|
+
TurnkeyClient.const_get(type).build_from_hash(value)
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
# Returns the string representation of the object
|
184
|
+
# @return [String] String presentation of the object
|
185
|
+
def to_s
|
186
|
+
to_hash.to_s
|
187
|
+
end
|
188
|
+
|
189
|
+
# to_body is an alias to to_hash (backward compatibility)
|
190
|
+
# @return [Hash] Returns the object in the form of hash
|
191
|
+
def to_body
|
192
|
+
to_hash
|
193
|
+
end
|
194
|
+
|
195
|
+
# Returns the object in the form of hash
|
196
|
+
# @return [Hash] Returns the object in the form of hash
|
197
|
+
def to_hash
|
198
|
+
hash = {}
|
199
|
+
self.class.attribute_map.each_pair do |attr, param|
|
200
|
+
value = self.send(attr)
|
201
|
+
if value.nil?
|
202
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
203
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
204
|
+
end
|
205
|
+
|
206
|
+
hash[param] = _to_hash(value)
|
207
|
+
end
|
208
|
+
hash
|
209
|
+
end
|
210
|
+
|
211
|
+
# Outputs non-array value in the form of hash
|
212
|
+
# For object, use to_hash. Otherwise, just return the value
|
213
|
+
# @param [Object] value Any valid value
|
214
|
+
# @return [Hash] Returns the value in the form of hash
|
215
|
+
def _to_hash(value)
|
216
|
+
if value.is_a?(Array)
|
217
|
+
value.compact.map { |v| _to_hash(v) }
|
218
|
+
elsif value.is_a?(Hash)
|
219
|
+
{}.tap do |hash|
|
220
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
221
|
+
end
|
222
|
+
elsif value.respond_to? :to_hash
|
223
|
+
value.to_hash
|
224
|
+
else
|
225
|
+
value
|
226
|
+
end
|
227
|
+
end end
|
228
|
+
end
|