turnkey_client 0.0.7 → 0.0.9
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/private_keys_api.rb +58 -0
- data/lib/turnkey_client/api/wallets_api.rb +58 -0
- data/lib/turnkey_client/models/activity_type.rb +4 -0
- data/lib/turnkey_client/models/address_format.rb +22 -0
- data/lib/turnkey_client/models/create_read_write_session_intent_v2.rb +241 -0
- data/lib/turnkey_client/models/create_read_write_session_request.rb +2 -2
- data/lib/turnkey_client/models/create_read_write_session_result_v2.rb +286 -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_sub_organization_intent.rb +206 -0
- data/lib/turnkey_client/models/delete_sub_organization_request.rb +288 -0
- data/lib/turnkey_client/models/delete_sub_organization_result.rb +211 -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/intent.rb +40 -4
- data/lib/turnkey_client/models/result.rb +40 -4
- data/lib/turnkey_client/models/transaction_type.rb +2 -1
- data/lib/turnkey_client/version.rb +1 -1
- data/lib/turnkey_client.rb +11 -0
- data/turnkey_client-0.0.7.gem +0 -0
- data/turnkey_client-0.0.8.gem +0 -0
- metadata +15 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8bc7a0a0e24c5d557f5852bb0faf866bfdc1fe71e25a4424b7fb0bae0e239f4
|
4
|
+
data.tar.gz: b985001c47992de3c0b6478c8204d7a88b53c5ed27537214c5aeaa229fb9ebb9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eac7b15edcd779b1d9743c943b8e4fc6effd2794caad21c9b7822bd4fbfb7ec23023595315eebcd8f93efa90b1a5997827b1f90fc8a26b43509db3bea72062b8
|
7
|
+
data.tar.gz: 3506ecd5e9ca60ca1f381b126f102000b699937c68fbe08488d2fd0db13b16aa34105831a27499c0a805afd9c149ae900885c2acc1ddb71910e9c0c171d35aa6
|
@@ -73,6 +73,64 @@ module TurnkeyClient
|
|
73
73
|
end
|
74
74
|
return data, status_code, headers
|
75
75
|
end
|
76
|
+
# Delete Sub Organization
|
77
|
+
# Deletes a sub organization
|
78
|
+
# @param body
|
79
|
+
# @param [Hash] opts the optional parameters
|
80
|
+
# @return [ActivityResponse]
|
81
|
+
def delete_sub_organization(body, opts = {})
|
82
|
+
data, _status_code, _headers = delete_sub_organization_with_http_info(body, opts)
|
83
|
+
data
|
84
|
+
end
|
85
|
+
|
86
|
+
# Delete Sub Organization
|
87
|
+
# Deletes a sub organization
|
88
|
+
# @param body
|
89
|
+
# @param [Hash] opts the optional parameters
|
90
|
+
# @return [Array<(ActivityResponse, Integer, Hash)>] ActivityResponse data, response status code and response headers
|
91
|
+
def delete_sub_organization_with_http_info(body, opts = {})
|
92
|
+
if @api_client.config.debugging
|
93
|
+
@api_client.config.logger.debug 'Calling API: OrganizationsApi.delete_sub_organization ...'
|
94
|
+
end
|
95
|
+
# verify the required parameter 'body' is set
|
96
|
+
if @api_client.config.client_side_validation && body.nil?
|
97
|
+
fail ArgumentError, "Missing the required parameter 'body' when calling OrganizationsApi.delete_sub_organization"
|
98
|
+
end
|
99
|
+
# resource path
|
100
|
+
local_var_path = '/public/v1/submit/delete_sub_organization'
|
101
|
+
|
102
|
+
# query parameters
|
103
|
+
query_params = opts[:query_params] || {}
|
104
|
+
|
105
|
+
# header parameters
|
106
|
+
header_params = opts[:header_params] || {}
|
107
|
+
# HTTP header 'Accept' (if needed)
|
108
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
109
|
+
# HTTP header 'Content-Type'
|
110
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
111
|
+
|
112
|
+
# form parameters
|
113
|
+
form_params = opts[:form_params] || {}
|
114
|
+
|
115
|
+
# http body (model)
|
116
|
+
post_body = opts[:body] || @api_client.object_to_http_body(body)
|
117
|
+
|
118
|
+
return_type = opts[:return_type] || 'ActivityResponse'
|
119
|
+
|
120
|
+
auth_names = opts[:auth_names] || ['ApiKeyAuth', 'AuthenticatorAuth']
|
121
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
122
|
+
:header_params => header_params,
|
123
|
+
:query_params => query_params,
|
124
|
+
:form_params => form_params,
|
125
|
+
:body => post_body,
|
126
|
+
:auth_names => auth_names,
|
127
|
+
:return_type => return_type)
|
128
|
+
|
129
|
+
if @api_client.config.debugging
|
130
|
+
@api_client.config.logger.debug "API called: OrganizationsApi#delete_sub_organization\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
131
|
+
end
|
132
|
+
return data, status_code, headers
|
133
|
+
end
|
76
134
|
# Get Configs
|
77
135
|
# Get quorum settings and features for an organization
|
78
136
|
# @param body
|
@@ -73,6 +73,64 @@ module TurnkeyClient
|
|
73
73
|
end
|
74
74
|
return data, status_code, headers
|
75
75
|
end
|
76
|
+
# Delete Private Keys
|
77
|
+
# Deletes private keys for an organization
|
78
|
+
# @param body
|
79
|
+
# @param [Hash] opts the optional parameters
|
80
|
+
# @return [ActivityResponse]
|
81
|
+
def delete_private_keys(body, opts = {})
|
82
|
+
data, _status_code, _headers = delete_private_keys_with_http_info(body, opts)
|
83
|
+
data
|
84
|
+
end
|
85
|
+
|
86
|
+
# Delete Private Keys
|
87
|
+
# Deletes private keys for an organization
|
88
|
+
# @param body
|
89
|
+
# @param [Hash] opts the optional parameters
|
90
|
+
# @return [Array<(ActivityResponse, Integer, Hash)>] ActivityResponse data, response status code and response headers
|
91
|
+
def delete_private_keys_with_http_info(body, opts = {})
|
92
|
+
if @api_client.config.debugging
|
93
|
+
@api_client.config.logger.debug 'Calling API: PrivateKeysApi.delete_private_keys ...'
|
94
|
+
end
|
95
|
+
# verify the required parameter 'body' is set
|
96
|
+
if @api_client.config.client_side_validation && body.nil?
|
97
|
+
fail ArgumentError, "Missing the required parameter 'body' when calling PrivateKeysApi.delete_private_keys"
|
98
|
+
end
|
99
|
+
# resource path
|
100
|
+
local_var_path = '/public/v1/submit/delete_private_keys'
|
101
|
+
|
102
|
+
# query parameters
|
103
|
+
query_params = opts[:query_params] || {}
|
104
|
+
|
105
|
+
# header parameters
|
106
|
+
header_params = opts[:header_params] || {}
|
107
|
+
# HTTP header 'Accept' (if needed)
|
108
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
109
|
+
# HTTP header 'Content-Type'
|
110
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
111
|
+
|
112
|
+
# form parameters
|
113
|
+
form_params = opts[:form_params] || {}
|
114
|
+
|
115
|
+
# http body (model)
|
116
|
+
post_body = opts[:body] || @api_client.object_to_http_body(body)
|
117
|
+
|
118
|
+
return_type = opts[:return_type] || 'ActivityResponse'
|
119
|
+
|
120
|
+
auth_names = opts[:auth_names] || ['ApiKeyAuth', 'AuthenticatorAuth']
|
121
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
122
|
+
:header_params => header_params,
|
123
|
+
:query_params => query_params,
|
124
|
+
:form_params => form_params,
|
125
|
+
:body => post_body,
|
126
|
+
:auth_names => auth_names,
|
127
|
+
:return_type => return_type)
|
128
|
+
|
129
|
+
if @api_client.config.debugging
|
130
|
+
@api_client.config.logger.debug "API called: PrivateKeysApi#delete_private_keys\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
131
|
+
end
|
132
|
+
return data, status_code, headers
|
133
|
+
end
|
76
134
|
# Export Private Key
|
77
135
|
# Exports a Private Key
|
78
136
|
# @param body
|
@@ -131,6 +131,64 @@ module TurnkeyClient
|
|
131
131
|
end
|
132
132
|
return data, status_code, headers
|
133
133
|
end
|
134
|
+
# Delete Wallets
|
135
|
+
# Deletes wallets for an organization
|
136
|
+
# @param body
|
137
|
+
# @param [Hash] opts the optional parameters
|
138
|
+
# @return [ActivityResponse]
|
139
|
+
def delete_wallets(body, opts = {})
|
140
|
+
data, _status_code, _headers = delete_wallets_with_http_info(body, opts)
|
141
|
+
data
|
142
|
+
end
|
143
|
+
|
144
|
+
# Delete Wallets
|
145
|
+
# Deletes wallets for an organization
|
146
|
+
# @param body
|
147
|
+
# @param [Hash] opts the optional parameters
|
148
|
+
# @return [Array<(ActivityResponse, Integer, Hash)>] ActivityResponse data, response status code and response headers
|
149
|
+
def delete_wallets_with_http_info(body, opts = {})
|
150
|
+
if @api_client.config.debugging
|
151
|
+
@api_client.config.logger.debug 'Calling API: WalletsApi.delete_wallets ...'
|
152
|
+
end
|
153
|
+
# verify the required parameter 'body' is set
|
154
|
+
if @api_client.config.client_side_validation && body.nil?
|
155
|
+
fail ArgumentError, "Missing the required parameter 'body' when calling WalletsApi.delete_wallets"
|
156
|
+
end
|
157
|
+
# resource path
|
158
|
+
local_var_path = '/public/v1/submit/delete_wallets'
|
159
|
+
|
160
|
+
# query parameters
|
161
|
+
query_params = opts[:query_params] || {}
|
162
|
+
|
163
|
+
# header parameters
|
164
|
+
header_params = opts[:header_params] || {}
|
165
|
+
# HTTP header 'Accept' (if needed)
|
166
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
167
|
+
# HTTP header 'Content-Type'
|
168
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
169
|
+
|
170
|
+
# form parameters
|
171
|
+
form_params = opts[:form_params] || {}
|
172
|
+
|
173
|
+
# http body (model)
|
174
|
+
post_body = opts[:body] || @api_client.object_to_http_body(body)
|
175
|
+
|
176
|
+
return_type = opts[:return_type] || 'ActivityResponse'
|
177
|
+
|
178
|
+
auth_names = opts[:auth_names] || ['ApiKeyAuth', 'AuthenticatorAuth']
|
179
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
180
|
+
:header_params => header_params,
|
181
|
+
:query_params => query_params,
|
182
|
+
:form_params => form_params,
|
183
|
+
:body => post_body,
|
184
|
+
:auth_names => auth_names,
|
185
|
+
:return_type => return_type)
|
186
|
+
|
187
|
+
if @api_client.config.debugging
|
188
|
+
@api_client.config.logger.debug "API called: WalletsApi#delete_wallets\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
189
|
+
end
|
190
|
+
return data, status_code, headers
|
191
|
+
end
|
134
192
|
# Export Wallet
|
135
193
|
# Exports a Wallet
|
136
194
|
# @param body
|
@@ -84,6 +84,10 @@ module TurnkeyClient
|
|
84
84
|
CREATE_READ_WRITE_SESSION = 'ACTIVITY_TYPE_CREATE_READ_WRITE_SESSION'.freeze
|
85
85
|
EMAIL_AUTH_V2 = 'ACTIVITY_TYPE_EMAIL_AUTH_V2'.freeze
|
86
86
|
CREATE_SUB_ORGANIZATION_V6 = 'ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V6'.freeze
|
87
|
+
DELETE_PRIVATE_KEYS = 'ACTIVITY_TYPE_DELETE_PRIVATE_KEYS'.freeze
|
88
|
+
DELETE_WALLETS = 'ACTIVITY_TYPE_DELETE_WALLETS'.freeze
|
89
|
+
CREATE_READ_WRITE_SESSION_V2 = 'ACTIVITY_TYPE_CREATE_READ_WRITE_SESSION_V2'.freeze
|
90
|
+
DELETE_SUB_ORGANIZATION = 'ACTIVITY_TYPE_DELETE_SUB_ORGANIZATION'.freeze
|
87
91
|
|
88
92
|
# Builds the enum from string
|
89
93
|
# @param [String] The enum value in the form of the string
|
@@ -18,6 +18,28 @@ module TurnkeyClient
|
|
18
18
|
SOLANA = 'ADDRESS_FORMAT_SOLANA'.freeze
|
19
19
|
COSMOS = 'ADDRESS_FORMAT_COSMOS'.freeze
|
20
20
|
TRON = 'ADDRESS_FORMAT_TRON'.freeze
|
21
|
+
SUI = 'ADDRESS_FORMAT_SUI'.freeze
|
22
|
+
APTOS = 'ADDRESS_FORMAT_APTOS'.freeze
|
23
|
+
BITCOIN_MAINNET_P2_PKH = 'ADDRESS_FORMAT_BITCOIN_MAINNET_P2PKH'.freeze
|
24
|
+
BITCOIN_MAINNET_P2_SH = 'ADDRESS_FORMAT_BITCOIN_MAINNET_P2SH'.freeze
|
25
|
+
BITCOIN_MAINNET_P2_WPKH = 'ADDRESS_FORMAT_BITCOIN_MAINNET_P2WPKH'.freeze
|
26
|
+
BITCOIN_MAINNET_P2_WSH = 'ADDRESS_FORMAT_BITCOIN_MAINNET_P2WSH'.freeze
|
27
|
+
BITCOIN_MAINNET_P2_TR = 'ADDRESS_FORMAT_BITCOIN_MAINNET_P2TR'.freeze
|
28
|
+
BITCOIN_TESTNET_P2_PKH = 'ADDRESS_FORMAT_BITCOIN_TESTNET_P2PKH'.freeze
|
29
|
+
BITCOIN_TESTNET_P2_SH = 'ADDRESS_FORMAT_BITCOIN_TESTNET_P2SH'.freeze
|
30
|
+
BITCOIN_TESTNET_P2_WPKH = 'ADDRESS_FORMAT_BITCOIN_TESTNET_P2WPKH'.freeze
|
31
|
+
BITCOIN_TESTNET_P2_WSH = 'ADDRESS_FORMAT_BITCOIN_TESTNET_P2WSH'.freeze
|
32
|
+
BITCOIN_TESTNET_P2_TR = 'ADDRESS_FORMAT_BITCOIN_TESTNET_P2TR'.freeze
|
33
|
+
BITCOIN_SIGNET_P2_PKH = 'ADDRESS_FORMAT_BITCOIN_SIGNET_P2PKH'.freeze
|
34
|
+
BITCOIN_SIGNET_P2_SH = 'ADDRESS_FORMAT_BITCOIN_SIGNET_P2SH'.freeze
|
35
|
+
BITCOIN_SIGNET_P2_WPKH = 'ADDRESS_FORMAT_BITCOIN_SIGNET_P2WPKH'.freeze
|
36
|
+
BITCOIN_SIGNET_P2_WSH = 'ADDRESS_FORMAT_BITCOIN_SIGNET_P2WSH'.freeze
|
37
|
+
BITCOIN_SIGNET_P2_TR = 'ADDRESS_FORMAT_BITCOIN_SIGNET_P2TR'.freeze
|
38
|
+
BITCOIN_REGTEST_P2_PKH = 'ADDRESS_FORMAT_BITCOIN_REGTEST_P2PKH'.freeze
|
39
|
+
BITCOIN_REGTEST_P2_SH = 'ADDRESS_FORMAT_BITCOIN_REGTEST_P2SH'.freeze
|
40
|
+
BITCOIN_REGTEST_P2_WPKH = 'ADDRESS_FORMAT_BITCOIN_REGTEST_P2WPKH'.freeze
|
41
|
+
BITCOIN_REGTEST_P2_WSH = 'ADDRESS_FORMAT_BITCOIN_REGTEST_P2WSH'.freeze
|
42
|
+
BITCOIN_REGTEST_P2_TR = 'ADDRESS_FORMAT_BITCOIN_REGTEST_P2TR'.freeze
|
21
43
|
|
22
44
|
# Builds the enum from string
|
23
45
|
# @param [String] The enum value in the form of the string
|
@@ -0,0 +1,241 @@
|
|
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 CreateReadWriteSessionIntentV2
|
15
|
+
# Client-side public key generated by the user, to which the read write session bundle (credentials) will be encrypted.
|
16
|
+
attr_accessor :target_public_key
|
17
|
+
|
18
|
+
# Unique identifier for a given User.
|
19
|
+
attr_accessor :user_id
|
20
|
+
|
21
|
+
# Optional human-readable name for an API Key. If none provided, default to Read Write Session - <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
|
+
:'target_public_key' => :'targetPublicKey',
|
31
|
+
:'user_id' => :'userId',
|
32
|
+
:'api_key_name' => :'apiKeyName',
|
33
|
+
:'expiration_seconds' => :'expirationSeconds'
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
# Attribute type mapping.
|
38
|
+
def self.openapi_types
|
39
|
+
{
|
40
|
+
:'target_public_key' => :'Object',
|
41
|
+
:'user_id' => :'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::CreateReadWriteSessionIntentV2` 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::CreateReadWriteSessionIntentV2`. 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?(:'target_public_key')
|
69
|
+
self.target_public_key = attributes[:'target_public_key']
|
70
|
+
end
|
71
|
+
|
72
|
+
if attributes.key?(:'user_id')
|
73
|
+
self.user_id = attributes[:'user_id']
|
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 @target_public_key.nil?
|
90
|
+
invalid_properties.push('invalid value for "target_public_key", target_public_key cannot be nil.')
|
91
|
+
end
|
92
|
+
|
93
|
+
invalid_properties
|
94
|
+
end
|
95
|
+
|
96
|
+
# Check to see if the all the properties in the model are valid
|
97
|
+
# @return true if the model is valid
|
98
|
+
def valid?
|
99
|
+
return false if @target_public_key.nil?
|
100
|
+
true
|
101
|
+
end
|
102
|
+
|
103
|
+
# Checks equality by comparing each attribute.
|
104
|
+
# @param [Object] Object to be compared
|
105
|
+
def ==(o)
|
106
|
+
return true if self.equal?(o)
|
107
|
+
self.class == o.class &&
|
108
|
+
target_public_key == o.target_public_key &&
|
109
|
+
user_id == o.user_id &&
|
110
|
+
api_key_name == o.api_key_name &&
|
111
|
+
expiration_seconds == o.expiration_seconds
|
112
|
+
end
|
113
|
+
|
114
|
+
# @see the `==` method
|
115
|
+
# @param [Object] Object to be compared
|
116
|
+
def eql?(o)
|
117
|
+
self == o
|
118
|
+
end
|
119
|
+
|
120
|
+
# Calculates hash code according to all attributes.
|
121
|
+
# @return [Integer] Hash code
|
122
|
+
def hash
|
123
|
+
[target_public_key, user_id, api_key_name, expiration_seconds].hash
|
124
|
+
end
|
125
|
+
|
126
|
+
# Builds the object from hash
|
127
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
128
|
+
# @return [Object] Returns the model itself
|
129
|
+
def self.build_from_hash(attributes)
|
130
|
+
new.build_from_hash(attributes)
|
131
|
+
end
|
132
|
+
|
133
|
+
# Builds the object from hash
|
134
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
135
|
+
# @return [Object] Returns the model itself
|
136
|
+
def build_from_hash(attributes)
|
137
|
+
return nil unless attributes.is_a?(Hash)
|
138
|
+
self.class.openapi_types.each_pair do |key, type|
|
139
|
+
if type =~ /\AArray<(.*)>/i
|
140
|
+
# check to ensure the input is an array given that the attribute
|
141
|
+
# is documented as an array but the input is not
|
142
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
143
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
144
|
+
end
|
145
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
146
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
147
|
+
elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
148
|
+
self.send("#{key}=", nil)
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
self
|
153
|
+
end
|
154
|
+
|
155
|
+
# Deserializes the data based on type
|
156
|
+
# @param string type Data type
|
157
|
+
# @param string value Value to be deserialized
|
158
|
+
# @return [Object] Deserialized data
|
159
|
+
def _deserialize(type, value)
|
160
|
+
case type.to_sym
|
161
|
+
when :DateTime
|
162
|
+
DateTime.parse(value)
|
163
|
+
when :Date
|
164
|
+
Date.parse(value)
|
165
|
+
when :String
|
166
|
+
value.to_s
|
167
|
+
when :Integer
|
168
|
+
value.to_i
|
169
|
+
when :Float
|
170
|
+
value.to_f
|
171
|
+
when :Boolean
|
172
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
173
|
+
true
|
174
|
+
else
|
175
|
+
false
|
176
|
+
end
|
177
|
+
when :Object
|
178
|
+
# generic object (usually a Hash), return directly
|
179
|
+
value
|
180
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
181
|
+
inner_type = Regexp.last_match[:inner_type]
|
182
|
+
value.map { |v| _deserialize(inner_type, v) }
|
183
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
184
|
+
k_type = Regexp.last_match[:k_type]
|
185
|
+
v_type = Regexp.last_match[:v_type]
|
186
|
+
{}.tap do |hash|
|
187
|
+
value.each do |k, v|
|
188
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
189
|
+
end
|
190
|
+
end
|
191
|
+
else # model
|
192
|
+
TurnkeyClient.const_get(type).build_from_hash(value)
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
# Returns the string representation of the object
|
197
|
+
# @return [String] String presentation of the object
|
198
|
+
def to_s
|
199
|
+
to_hash.to_s
|
200
|
+
end
|
201
|
+
|
202
|
+
# to_body is an alias to to_hash (backward compatibility)
|
203
|
+
# @return [Hash] Returns the object in the form of hash
|
204
|
+
def to_body
|
205
|
+
to_hash
|
206
|
+
end
|
207
|
+
|
208
|
+
# Returns the object in the form of hash
|
209
|
+
# @return [Hash] Returns the object in the form of hash
|
210
|
+
def to_hash
|
211
|
+
hash = {}
|
212
|
+
self.class.attribute_map.each_pair do |attr, param|
|
213
|
+
value = self.send(attr)
|
214
|
+
if value.nil?
|
215
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
216
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
217
|
+
end
|
218
|
+
|
219
|
+
hash[param] = _to_hash(value)
|
220
|
+
end
|
221
|
+
hash
|
222
|
+
end
|
223
|
+
|
224
|
+
# Outputs non-array value in the form of hash
|
225
|
+
# For object, use to_hash. Otherwise, just return the value
|
226
|
+
# @param [Object] value Any valid value
|
227
|
+
# @return [Hash] Returns the value in the form of hash
|
228
|
+
def _to_hash(value)
|
229
|
+
if value.is_a?(Array)
|
230
|
+
value.compact.map { |v| _to_hash(v) }
|
231
|
+
elsif value.is_a?(Hash)
|
232
|
+
{}.tap do |hash|
|
233
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
234
|
+
end
|
235
|
+
elsif value.respond_to? :to_hash
|
236
|
+
value.to_hash
|
237
|
+
else
|
238
|
+
value
|
239
|
+
end
|
240
|
+
end end
|
241
|
+
end
|
@@ -129,7 +129,7 @@ module TurnkeyClient
|
|
129
129
|
# @return true if the model is valid
|
130
130
|
def valid?
|
131
131
|
return false if @type.nil?
|
132
|
-
type_validator = EnumAttributeValidator.new('Object', ['
|
132
|
+
type_validator = EnumAttributeValidator.new('Object', ['ACTIVITY_TYPE_CREATE_READ_WRITE_SESSION_V2'])
|
133
133
|
return false unless type_validator.valid?(@type)
|
134
134
|
return false if @timestamp_ms.nil?
|
135
135
|
return false if @organization_id.nil?
|
@@ -140,7 +140,7 @@ module TurnkeyClient
|
|
140
140
|
# Custom attribute writer method checking allowed values (enum).
|
141
141
|
# @param [Object] type Object to be assigned
|
142
142
|
def type=(type)
|
143
|
-
validator = EnumAttributeValidator.new('Object', ['
|
143
|
+
validator = EnumAttributeValidator.new('Object', ['ACTIVITY_TYPE_CREATE_READ_WRITE_SESSION_V2'])
|
144
144
|
unless validator.valid?(type)
|
145
145
|
fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
|
146
146
|
end
|