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
@@ -131,6 +131,64 @@ module TurnkeyClient
|
|
131
131
|
end
|
132
132
|
return data, status_code, headers
|
133
133
|
end
|
134
|
+
# Delete organization 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 organization 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
|
@@ -40,6 +40,8 @@ module TurnkeyClient
|
|
40
40
|
|
41
41
|
attr_accessor :updated_at
|
42
42
|
|
43
|
+
attr_accessor :failure
|
44
|
+
|
43
45
|
# Attribute mapping from ruby-style variable name to JSON key.
|
44
46
|
def self.attribute_map
|
45
47
|
{
|
@@ -54,7 +56,8 @@ module TurnkeyClient
|
|
54
56
|
:'can_approve' => :'canApprove',
|
55
57
|
:'can_reject' => :'canReject',
|
56
58
|
:'created_at' => :'createdAt',
|
57
|
-
:'updated_at' => :'updatedAt'
|
59
|
+
:'updated_at' => :'updatedAt',
|
60
|
+
:'failure' => :'failure'
|
58
61
|
}
|
59
62
|
end
|
60
63
|
|
@@ -72,7 +75,8 @@ module TurnkeyClient
|
|
72
75
|
:'can_approve' => :'Object',
|
73
76
|
:'can_reject' => :'Object',
|
74
77
|
:'created_at' => :'Object',
|
75
|
-
:'updated_at' => :'Object'
|
78
|
+
:'updated_at' => :'Object',
|
79
|
+
:'failure' => :'Object'
|
76
80
|
}
|
77
81
|
end
|
78
82
|
|
@@ -146,6 +150,10 @@ module TurnkeyClient
|
|
146
150
|
if attributes.key?(:'updated_at')
|
147
151
|
self.updated_at = attributes[:'updated_at']
|
148
152
|
end
|
153
|
+
|
154
|
+
if attributes.key?(:'failure')
|
155
|
+
self.failure = attributes[:'failure']
|
156
|
+
end
|
149
157
|
end
|
150
158
|
|
151
159
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -237,7 +245,8 @@ module TurnkeyClient
|
|
237
245
|
can_approve == o.can_approve &&
|
238
246
|
can_reject == o.can_reject &&
|
239
247
|
created_at == o.created_at &&
|
240
|
-
updated_at == o.updated_at
|
248
|
+
updated_at == o.updated_at &&
|
249
|
+
failure == o.failure
|
241
250
|
end
|
242
251
|
|
243
252
|
# @see the `==` method
|
@@ -249,7 +258,7 @@ module TurnkeyClient
|
|
249
258
|
# Calculates hash code according to all attributes.
|
250
259
|
# @return [Integer] Hash code
|
251
260
|
def hash
|
252
|
-
[id, organization_id, status, type, intent, result, votes, fingerprint, can_approve, can_reject, created_at, updated_at].hash
|
261
|
+
[id, organization_id, status, type, intent, result, votes, fingerprint, can_approve, can_reject, created_at, updated_at, failure].hash
|
253
262
|
end
|
254
263
|
|
255
264
|
# Builds the object from hash
|
@@ -73,6 +73,19 @@ module TurnkeyClient
|
|
73
73
|
IMPORT_WALLET = 'ACTIVITY_TYPE_IMPORT_WALLET'.freeze
|
74
74
|
INIT_IMPORT_PRIVATE_KEY = 'ACTIVITY_TYPE_INIT_IMPORT_PRIVATE_KEY'.freeze
|
75
75
|
IMPORT_PRIVATE_KEY = 'ACTIVITY_TYPE_IMPORT_PRIVATE_KEY'.freeze
|
76
|
+
CREATE_POLICIES = 'ACTIVITY_TYPE_CREATE_POLICIES'.freeze
|
77
|
+
SIGN_RAW_PAYLOADS = 'ACTIVITY_TYPE_SIGN_RAW_PAYLOADS'.freeze
|
78
|
+
CREATE_READ_ONLY_SESSION = 'ACTIVITY_TYPE_CREATE_READ_ONLY_SESSION'.freeze
|
79
|
+
CREATE_OAUTH_PROVIDERS = 'ACTIVITY_TYPE_CREATE_OAUTH_PROVIDERS'.freeze
|
80
|
+
DELETE_OAUTH_PROVIDERS = 'ACTIVITY_TYPE_DELETE_OAUTH_PROVIDERS'.freeze
|
81
|
+
CREATE_SUB_ORGANIZATION_V5 = 'ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V5'.freeze
|
82
|
+
OAUTH = 'ACTIVITY_TYPE_OAUTH'.freeze
|
83
|
+
CREATE_API_KEYS_V2 = 'ACTIVITY_TYPE_CREATE_API_KEYS_V2'.freeze
|
84
|
+
CREATE_READ_WRITE_SESSION = 'ACTIVITY_TYPE_CREATE_READ_WRITE_SESSION'.freeze
|
85
|
+
EMAIL_AUTH_V2 = 'ACTIVITY_TYPE_EMAIL_AUTH_V2'.freeze
|
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
|
76
89
|
|
77
90
|
# Builds the enum from string
|
78
91
|
# @param [String] The enum value in the form of the string
|
@@ -0,0 +1,200 @@
|
|
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 Any
|
15
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
16
|
+
def self.attribute_map
|
17
|
+
{
|
18
|
+
}
|
19
|
+
end
|
20
|
+
|
21
|
+
# Attribute type mapping.
|
22
|
+
def self.openapi_types
|
23
|
+
{
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
# List of attributes with nullable: true
|
28
|
+
def self.openapi_nullable
|
29
|
+
Set.new([
|
30
|
+
])
|
31
|
+
end
|
32
|
+
|
33
|
+
# Initializes the object
|
34
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
35
|
+
def initialize(attributes = {})
|
36
|
+
if (!attributes.is_a?(Hash))
|
37
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `TurnkeyClient::Any` initialize method"
|
38
|
+
end
|
39
|
+
|
40
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
41
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
42
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
43
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `TurnkeyClient::Any`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
44
|
+
end
|
45
|
+
h[k.to_sym] = v
|
46
|
+
}
|
47
|
+
|
48
|
+
# call parent's initialize
|
49
|
+
super(attributes)
|
50
|
+
end
|
51
|
+
|
52
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
53
|
+
# @return Array for valid properties with the reasons
|
54
|
+
def list_invalid_properties
|
55
|
+
invalid_properties = super
|
56
|
+
invalid_properties
|
57
|
+
end
|
58
|
+
|
59
|
+
# Check to see if the all the properties in the model are valid
|
60
|
+
# @return true if the model is valid
|
61
|
+
def valid?
|
62
|
+
true
|
63
|
+
end
|
64
|
+
|
65
|
+
# Checks equality by comparing each attribute.
|
66
|
+
# @param [Object] Object to be compared
|
67
|
+
def ==(o)
|
68
|
+
return true if self.equal?(o)
|
69
|
+
self.class == o.class && super(o)
|
70
|
+
end
|
71
|
+
|
72
|
+
# @see the `==` method
|
73
|
+
# @param [Object] Object to be compared
|
74
|
+
def eql?(o)
|
75
|
+
self == o
|
76
|
+
end
|
77
|
+
|
78
|
+
# Calculates hash code according to all attributes.
|
79
|
+
# @return [Integer] Hash code
|
80
|
+
def hash
|
81
|
+
[].hash
|
82
|
+
end
|
83
|
+
|
84
|
+
# Builds the object from hash
|
85
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
86
|
+
# @return [Object] Returns the model itself
|
87
|
+
def self.build_from_hash(attributes)
|
88
|
+
new.build_from_hash(attributes)
|
89
|
+
end
|
90
|
+
|
91
|
+
# Builds the object from hash
|
92
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
93
|
+
# @return [Object] Returns the model itself
|
94
|
+
def build_from_hash(attributes)
|
95
|
+
return nil unless attributes.is_a?(Hash)
|
96
|
+
super(attributes)
|
97
|
+
self.class.openapi_types.each_pair do |key, type|
|
98
|
+
if type =~ /\AArray<(.*)>/i
|
99
|
+
# check to ensure the input is an array given that the attribute
|
100
|
+
# is documented as an array but the input is not
|
101
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
102
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
103
|
+
end
|
104
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
105
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
106
|
+
elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
107
|
+
self.send("#{key}=", nil)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
self
|
112
|
+
end
|
113
|
+
|
114
|
+
# Deserializes the data based on type
|
115
|
+
# @param string type Data type
|
116
|
+
# @param string value Value to be deserialized
|
117
|
+
# @return [Object] Deserialized data
|
118
|
+
def _deserialize(type, value)
|
119
|
+
case type.to_sym
|
120
|
+
when :DateTime
|
121
|
+
DateTime.parse(value)
|
122
|
+
when :Date
|
123
|
+
Date.parse(value)
|
124
|
+
when :String
|
125
|
+
value.to_s
|
126
|
+
when :Integer
|
127
|
+
value.to_i
|
128
|
+
when :Float
|
129
|
+
value.to_f
|
130
|
+
when :Boolean
|
131
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
132
|
+
true
|
133
|
+
else
|
134
|
+
false
|
135
|
+
end
|
136
|
+
when :Object
|
137
|
+
# generic object (usually a Hash), return directly
|
138
|
+
value
|
139
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
140
|
+
inner_type = Regexp.last_match[:inner_type]
|
141
|
+
value.map { |v| _deserialize(inner_type, v) }
|
142
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
143
|
+
k_type = Regexp.last_match[:k_type]
|
144
|
+
v_type = Regexp.last_match[:v_type]
|
145
|
+
{}.tap do |hash|
|
146
|
+
value.each do |k, v|
|
147
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
148
|
+
end
|
149
|
+
end
|
150
|
+
else # model
|
151
|
+
TurnkeyClient.const_get(type).build_from_hash(value)
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
# Returns the string representation of the object
|
156
|
+
# @return [String] String presentation of the object
|
157
|
+
def to_s
|
158
|
+
to_hash.to_s
|
159
|
+
end
|
160
|
+
|
161
|
+
# to_body is an alias to to_hash (backward compatibility)
|
162
|
+
# @return [Hash] Returns the object in the form of hash
|
163
|
+
def to_body
|
164
|
+
to_hash
|
165
|
+
end
|
166
|
+
|
167
|
+
# Returns the object in the form of hash
|
168
|
+
# @return [Hash] Returns the object in the form of hash
|
169
|
+
def to_hash
|
170
|
+
hash = super
|
171
|
+
self.class.attribute_map.each_pair do |attr, param|
|
172
|
+
value = self.send(attr)
|
173
|
+
if value.nil?
|
174
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
175
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
176
|
+
end
|
177
|
+
|
178
|
+
hash[param] = _to_hash(value)
|
179
|
+
end
|
180
|
+
hash
|
181
|
+
end
|
182
|
+
|
183
|
+
# Outputs non-array value in the form of hash
|
184
|
+
# For object, use to_hash. Otherwise, just return the value
|
185
|
+
# @param [Object] value Any valid value
|
186
|
+
# @return [Hash] Returns the value in the form of hash
|
187
|
+
def _to_hash(value)
|
188
|
+
if value.is_a?(Array)
|
189
|
+
value.compact.map { |v| _to_hash(v) }
|
190
|
+
elsif value.is_a?(Hash)
|
191
|
+
{}.tap do |hash|
|
192
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
193
|
+
end
|
194
|
+
elsif value.respond_to? :to_hash
|
195
|
+
value.to_hash
|
196
|
+
else
|
197
|
+
value
|
198
|
+
end
|
199
|
+
end end
|
200
|
+
end
|
@@ -0,0 +1,28 @@
|
|
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 ApiKeyCurve
|
15
|
+
P256 = 'API_KEY_CURVE_P256'.freeze
|
16
|
+
SECP256_K1 = 'API_KEY_CURVE_SECP256K1'.freeze
|
17
|
+
ED25519 = 'API_KEY_CURVE_ED25519'.freeze
|
18
|
+
|
19
|
+
# Builds the enum from string
|
20
|
+
# @param [String] The enum value in the form of the string
|
21
|
+
# @return [String] The enum value
|
22
|
+
def build_from_hash(value)
|
23
|
+
constantValues = ApiKeyCurve.constants.select { |c| ApiKeyCurve::const_get(c) == value }
|
24
|
+
raise "Invalid ENUM value #{value} for class #ApiKeyCurve" if constantValues.empty?
|
25
|
+
value
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,250 @@
|
|
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 ApiKeyParamsV2
|
15
|
+
# Human-readable name for an API Key.
|
16
|
+
attr_accessor :api_key_name
|
17
|
+
|
18
|
+
# The public component of a cryptographic key pair used to sign messages and transactions.
|
19
|
+
attr_accessor :public_key
|
20
|
+
|
21
|
+
attr_accessor :curve_type
|
22
|
+
|
23
|
+
# Optional window (in seconds) indicating how long the API Key should last.
|
24
|
+
attr_accessor :expiration_seconds
|
25
|
+
|
26
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
27
|
+
def self.attribute_map
|
28
|
+
{
|
29
|
+
:'api_key_name' => :'apiKeyName',
|
30
|
+
:'public_key' => :'publicKey',
|
31
|
+
:'curve_type' => :'curveType',
|
32
|
+
:'expiration_seconds' => :'expirationSeconds'
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
# Attribute type mapping.
|
37
|
+
def self.openapi_types
|
38
|
+
{
|
39
|
+
:'api_key_name' => :'Object',
|
40
|
+
:'public_key' => :'Object',
|
41
|
+
:'curve_type' => :'Object',
|
42
|
+
:'expiration_seconds' => :'Object'
|
43
|
+
}
|
44
|
+
end
|
45
|
+
|
46
|
+
# List of attributes with nullable: true
|
47
|
+
def self.openapi_nullable
|
48
|
+
Set.new([
|
49
|
+
])
|
50
|
+
end
|
51
|
+
|
52
|
+
# Initializes the object
|
53
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
54
|
+
def initialize(attributes = {})
|
55
|
+
if (!attributes.is_a?(Hash))
|
56
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `TurnkeyClient::ApiKeyParamsV2` initialize method"
|
57
|
+
end
|
58
|
+
|
59
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
60
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
61
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
62
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `TurnkeyClient::ApiKeyParamsV2`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
63
|
+
end
|
64
|
+
h[k.to_sym] = v
|
65
|
+
}
|
66
|
+
|
67
|
+
if attributes.key?(:'api_key_name')
|
68
|
+
self.api_key_name = attributes[:'api_key_name']
|
69
|
+
end
|
70
|
+
|
71
|
+
if attributes.key?(:'public_key')
|
72
|
+
self.public_key = attributes[:'public_key']
|
73
|
+
end
|
74
|
+
|
75
|
+
if attributes.key?(:'curve_type')
|
76
|
+
self.curve_type = attributes[:'curve_type']
|
77
|
+
end
|
78
|
+
|
79
|
+
if attributes.key?(:'expiration_seconds')
|
80
|
+
self.expiration_seconds = attributes[:'expiration_seconds']
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
85
|
+
# @return Array for valid properties with the reasons
|
86
|
+
def list_invalid_properties
|
87
|
+
invalid_properties = Array.new
|
88
|
+
if @api_key_name.nil?
|
89
|
+
invalid_properties.push('invalid value for "api_key_name", api_key_name cannot be nil.')
|
90
|
+
end
|
91
|
+
|
92
|
+
if @public_key.nil?
|
93
|
+
invalid_properties.push('invalid value for "public_key", public_key cannot be nil.')
|
94
|
+
end
|
95
|
+
|
96
|
+
if @curve_type.nil?
|
97
|
+
invalid_properties.push('invalid value for "curve_type", curve_type cannot be nil.')
|
98
|
+
end
|
99
|
+
|
100
|
+
invalid_properties
|
101
|
+
end
|
102
|
+
|
103
|
+
# Check to see if the all the properties in the model are valid
|
104
|
+
# @return true if the model is valid
|
105
|
+
def valid?
|
106
|
+
return false if @api_key_name.nil?
|
107
|
+
return false if @public_key.nil?
|
108
|
+
return false if @curve_type.nil?
|
109
|
+
true
|
110
|
+
end
|
111
|
+
|
112
|
+
# Checks equality by comparing each attribute.
|
113
|
+
# @param [Object] Object to be compared
|
114
|
+
def ==(o)
|
115
|
+
return true if self.equal?(o)
|
116
|
+
self.class == o.class &&
|
117
|
+
api_key_name == o.api_key_name &&
|
118
|
+
public_key == o.public_key &&
|
119
|
+
curve_type == o.curve_type &&
|
120
|
+
expiration_seconds == o.expiration_seconds
|
121
|
+
end
|
122
|
+
|
123
|
+
# @see the `==` method
|
124
|
+
# @param [Object] Object to be compared
|
125
|
+
def eql?(o)
|
126
|
+
self == o
|
127
|
+
end
|
128
|
+
|
129
|
+
# Calculates hash code according to all attributes.
|
130
|
+
# @return [Integer] Hash code
|
131
|
+
def hash
|
132
|
+
[api_key_name, public_key, curve_type, expiration_seconds].hash
|
133
|
+
end
|
134
|
+
|
135
|
+
# Builds the object from hash
|
136
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
137
|
+
# @return [Object] Returns the model itself
|
138
|
+
def self.build_from_hash(attributes)
|
139
|
+
new.build_from_hash(attributes)
|
140
|
+
end
|
141
|
+
|
142
|
+
# Builds the object from hash
|
143
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
144
|
+
# @return [Object] Returns the model itself
|
145
|
+
def build_from_hash(attributes)
|
146
|
+
return nil unless attributes.is_a?(Hash)
|
147
|
+
self.class.openapi_types.each_pair do |key, type|
|
148
|
+
if type =~ /\AArray<(.*)>/i
|
149
|
+
# check to ensure the input is an array given that the attribute
|
150
|
+
# is documented as an array but the input is not
|
151
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
152
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
153
|
+
end
|
154
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
155
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
156
|
+
elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
157
|
+
self.send("#{key}=", nil)
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
self
|
162
|
+
end
|
163
|
+
|
164
|
+
# Deserializes the data based on type
|
165
|
+
# @param string type Data type
|
166
|
+
# @param string value Value to be deserialized
|
167
|
+
# @return [Object] Deserialized data
|
168
|
+
def _deserialize(type, value)
|
169
|
+
case type.to_sym
|
170
|
+
when :DateTime
|
171
|
+
DateTime.parse(value)
|
172
|
+
when :Date
|
173
|
+
Date.parse(value)
|
174
|
+
when :String
|
175
|
+
value.to_s
|
176
|
+
when :Integer
|
177
|
+
value.to_i
|
178
|
+
when :Float
|
179
|
+
value.to_f
|
180
|
+
when :Boolean
|
181
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
182
|
+
true
|
183
|
+
else
|
184
|
+
false
|
185
|
+
end
|
186
|
+
when :Object
|
187
|
+
# generic object (usually a Hash), return directly
|
188
|
+
value
|
189
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
190
|
+
inner_type = Regexp.last_match[:inner_type]
|
191
|
+
value.map { |v| _deserialize(inner_type, v) }
|
192
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
193
|
+
k_type = Regexp.last_match[:k_type]
|
194
|
+
v_type = Regexp.last_match[:v_type]
|
195
|
+
{}.tap do |hash|
|
196
|
+
value.each do |k, v|
|
197
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
198
|
+
end
|
199
|
+
end
|
200
|
+
else # model
|
201
|
+
TurnkeyClient.const_get(type).build_from_hash(value)
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
205
|
+
# Returns the string representation of the object
|
206
|
+
# @return [String] String presentation of the object
|
207
|
+
def to_s
|
208
|
+
to_hash.to_s
|
209
|
+
end
|
210
|
+
|
211
|
+
# to_body is an alias to to_hash (backward compatibility)
|
212
|
+
# @return [Hash] Returns the object in the form of hash
|
213
|
+
def to_body
|
214
|
+
to_hash
|
215
|
+
end
|
216
|
+
|
217
|
+
# Returns the object in the form of hash
|
218
|
+
# @return [Hash] Returns the object in the form of hash
|
219
|
+
def to_hash
|
220
|
+
hash = {}
|
221
|
+
self.class.attribute_map.each_pair do |attr, param|
|
222
|
+
value = self.send(attr)
|
223
|
+
if value.nil?
|
224
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
225
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
226
|
+
end
|
227
|
+
|
228
|
+
hash[param] = _to_hash(value)
|
229
|
+
end
|
230
|
+
hash
|
231
|
+
end
|
232
|
+
|
233
|
+
# Outputs non-array value in the form of hash
|
234
|
+
# For object, use to_hash. Otherwise, just return the value
|
235
|
+
# @param [Object] value Any valid value
|
236
|
+
# @return [Hash] Returns the value in the form of hash
|
237
|
+
def _to_hash(value)
|
238
|
+
if value.is_a?(Array)
|
239
|
+
value.compact.map { |v| _to_hash(v) }
|
240
|
+
elsif value.is_a?(Hash)
|
241
|
+
{}.tap do |hash|
|
242
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
243
|
+
end
|
244
|
+
elsif value.respond_to? :to_hash
|
245
|
+
value.to_hash
|
246
|
+
else
|
247
|
+
value
|
248
|
+
end
|
249
|
+
end end
|
250
|
+
end
|