turnkey_client 0.0.7 → 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/private_keys_api.rb +58 -0
- data/lib/turnkey_client/api/wallets_api.rb +58 -0
- data/lib/turnkey_client/models/activity_type.rb +2 -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/intent.rb +22 -4
- data/lib/turnkey_client/models/result.rb +22 -4
- data/lib/turnkey_client/version.rb +1 -1
- data/lib/turnkey_client.rb +6 -0
- data/turnkey_client-0.0.7.gem +0 -0
- metadata +9 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b6b2fb9158ef1973e1960d18d1a330e399759ce682aac326ef4def8e824078b
|
4
|
+
data.tar.gz: 62748d649e8de1e9c7a344a380ef5476c9fc0e97a9337052d5db54864126ecb8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ebcd2cf3f4f7753e16bb258d1e274a68923d5e6f299a7df2c6788a14b3a6f5f7f2302f2fef18fcd8fe0e2b1646ce11eb91aea5fe06d2ce887fbe64de486989f
|
7
|
+
data.tar.gz: ee681bf7a0c611e0130566bd5a43495f6b3d6c6aa165925bd6b5745a8e6863322d629d3a807c84fcea5fba2f3dc1cf3042aa9c0549a1e7638d8c8c8af8c4317a
|
@@ -73,6 +73,64 @@ module TurnkeyClient
|
|
73
73
|
end
|
74
74
|
return data, status_code, headers
|
75
75
|
end
|
76
|
+
# Delete organization 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 organization 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 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
|
@@ -84,6 +84,8 @@ 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
|
87
89
|
|
88
90
|
# Builds the enum from string
|
89
91
|
# @param [String] The enum value in the form of the string
|
@@ -0,0 +1,223 @@
|
|
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 DeletePrivateKeysIntent
|
15
|
+
# List of unique identifiers for private keys within an organization
|
16
|
+
attr_accessor :private_key_ids
|
17
|
+
|
18
|
+
# Optional parameter for deleting the private keys, even if any have not been previously exported. If they have been exported, this field is ignored.
|
19
|
+
attr_accessor :delete_without_export
|
20
|
+
|
21
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
22
|
+
def self.attribute_map
|
23
|
+
{
|
24
|
+
:'private_key_ids' => :'privateKeyIds',
|
25
|
+
:'delete_without_export' => :'deleteWithoutExport'
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
# Attribute type mapping.
|
30
|
+
def self.openapi_types
|
31
|
+
{
|
32
|
+
:'private_key_ids' => :'Object',
|
33
|
+
:'delete_without_export' => :'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::DeletePrivateKeysIntent` 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::DeletePrivateKeysIntent`. 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?(:'private_key_ids')
|
59
|
+
if (value = attributes[:'private_key_ids']).is_a?(Array)
|
60
|
+
self.private_key_ids = value
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
if attributes.key?(:'delete_without_export')
|
65
|
+
self.delete_without_export = attributes[:'delete_without_export']
|
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 @private_key_ids.nil?
|
74
|
+
invalid_properties.push('invalid value for "private_key_ids", private_key_ids cannot be nil.')
|
75
|
+
end
|
76
|
+
|
77
|
+
invalid_properties
|
78
|
+
end
|
79
|
+
|
80
|
+
# Check to see if the all the properties in the model are valid
|
81
|
+
# @return true if the model is valid
|
82
|
+
def valid?
|
83
|
+
return false if @private_key_ids.nil?
|
84
|
+
true
|
85
|
+
end
|
86
|
+
|
87
|
+
# Checks equality by comparing each attribute.
|
88
|
+
# @param [Object] Object to be compared
|
89
|
+
def ==(o)
|
90
|
+
return true if self.equal?(o)
|
91
|
+
self.class == o.class &&
|
92
|
+
private_key_ids == o.private_key_ids &&
|
93
|
+
delete_without_export == o.delete_without_export
|
94
|
+
end
|
95
|
+
|
96
|
+
# @see the `==` method
|
97
|
+
# @param [Object] Object to be compared
|
98
|
+
def eql?(o)
|
99
|
+
self == o
|
100
|
+
end
|
101
|
+
|
102
|
+
# Calculates hash code according to all attributes.
|
103
|
+
# @return [Integer] Hash code
|
104
|
+
def hash
|
105
|
+
[private_key_ids, delete_without_export].hash
|
106
|
+
end
|
107
|
+
|
108
|
+
# Builds the object from hash
|
109
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
110
|
+
# @return [Object] Returns the model itself
|
111
|
+
def self.build_from_hash(attributes)
|
112
|
+
new.build_from_hash(attributes)
|
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 build_from_hash(attributes)
|
119
|
+
return nil unless attributes.is_a?(Hash)
|
120
|
+
self.class.openapi_types.each_pair do |key, type|
|
121
|
+
if type =~ /\AArray<(.*)>/i
|
122
|
+
# check to ensure the input is an array given that the attribute
|
123
|
+
# is documented as an array but the input is not
|
124
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
125
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
126
|
+
end
|
127
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
128
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
129
|
+
elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
130
|
+
self.send("#{key}=", nil)
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
self
|
135
|
+
end
|
136
|
+
|
137
|
+
# Deserializes the data based on type
|
138
|
+
# @param string type Data type
|
139
|
+
# @param string value Value to be deserialized
|
140
|
+
# @return [Object] Deserialized data
|
141
|
+
def _deserialize(type, value)
|
142
|
+
case type.to_sym
|
143
|
+
when :DateTime
|
144
|
+
DateTime.parse(value)
|
145
|
+
when :Date
|
146
|
+
Date.parse(value)
|
147
|
+
when :String
|
148
|
+
value.to_s
|
149
|
+
when :Integer
|
150
|
+
value.to_i
|
151
|
+
when :Float
|
152
|
+
value.to_f
|
153
|
+
when :Boolean
|
154
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
155
|
+
true
|
156
|
+
else
|
157
|
+
false
|
158
|
+
end
|
159
|
+
when :Object
|
160
|
+
# generic object (usually a Hash), return directly
|
161
|
+
value
|
162
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
163
|
+
inner_type = Regexp.last_match[:inner_type]
|
164
|
+
value.map { |v| _deserialize(inner_type, v) }
|
165
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
166
|
+
k_type = Regexp.last_match[:k_type]
|
167
|
+
v_type = Regexp.last_match[:v_type]
|
168
|
+
{}.tap do |hash|
|
169
|
+
value.each do |k, v|
|
170
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
171
|
+
end
|
172
|
+
end
|
173
|
+
else # model
|
174
|
+
TurnkeyClient.const_get(type).build_from_hash(value)
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
# Returns the string representation of the object
|
179
|
+
# @return [String] String presentation of the object
|
180
|
+
def to_s
|
181
|
+
to_hash.to_s
|
182
|
+
end
|
183
|
+
|
184
|
+
# to_body is an alias to to_hash (backward compatibility)
|
185
|
+
# @return [Hash] Returns the object in the form of hash
|
186
|
+
def to_body
|
187
|
+
to_hash
|
188
|
+
end
|
189
|
+
|
190
|
+
# Returns the object in the form of hash
|
191
|
+
# @return [Hash] Returns the object in the form of hash
|
192
|
+
def to_hash
|
193
|
+
hash = {}
|
194
|
+
self.class.attribute_map.each_pair do |attr, param|
|
195
|
+
value = self.send(attr)
|
196
|
+
if value.nil?
|
197
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
198
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
199
|
+
end
|
200
|
+
|
201
|
+
hash[param] = _to_hash(value)
|
202
|
+
end
|
203
|
+
hash
|
204
|
+
end
|
205
|
+
|
206
|
+
# Outputs non-array value in the form of hash
|
207
|
+
# For object, use to_hash. Otherwise, just return the value
|
208
|
+
# @param [Object] value Any valid value
|
209
|
+
# @return [Hash] Returns the value in the form of hash
|
210
|
+
def _to_hash(value)
|
211
|
+
if value.is_a?(Array)
|
212
|
+
value.compact.map { |v| _to_hash(v) }
|
213
|
+
elsif value.is_a?(Hash)
|
214
|
+
{}.tap do |hash|
|
215
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
216
|
+
end
|
217
|
+
elsif value.respond_to? :to_hash
|
218
|
+
value.to_hash
|
219
|
+
else
|
220
|
+
value
|
221
|
+
end
|
222
|
+
end end
|
223
|
+
end
|
@@ -0,0 +1,288 @@
|
|
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 DeletePrivateKeysRequest
|
15
|
+
attr_accessor :type
|
16
|
+
|
17
|
+
# Timestamp (in milliseconds) of the request, used to verify liveness of user requests.
|
18
|
+
attr_accessor :timestamp_ms
|
19
|
+
|
20
|
+
# Unique identifier for a given Organization.
|
21
|
+
attr_accessor :organization_id
|
22
|
+
|
23
|
+
attr_accessor :parameters
|
24
|
+
|
25
|
+
class EnumAttributeValidator
|
26
|
+
attr_reader :datatype
|
27
|
+
attr_reader :allowable_values
|
28
|
+
|
29
|
+
def initialize(datatype, allowable_values)
|
30
|
+
@allowable_values = allowable_values.map do |value|
|
31
|
+
case datatype.to_s
|
32
|
+
when /Integer/i
|
33
|
+
value.to_i
|
34
|
+
when /Float/i
|
35
|
+
value.to_f
|
36
|
+
else
|
37
|
+
value
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def valid?(value)
|
43
|
+
!value || allowable_values.include?(value)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
48
|
+
def self.attribute_map
|
49
|
+
{
|
50
|
+
:'type' => :'type',
|
51
|
+
:'timestamp_ms' => :'timestampMs',
|
52
|
+
:'organization_id' => :'organizationId',
|
53
|
+
:'parameters' => :'parameters'
|
54
|
+
}
|
55
|
+
end
|
56
|
+
|
57
|
+
# Attribute type mapping.
|
58
|
+
def self.openapi_types
|
59
|
+
{
|
60
|
+
:'type' => :'Object',
|
61
|
+
:'timestamp_ms' => :'Object',
|
62
|
+
:'organization_id' => :'Object',
|
63
|
+
:'parameters' => :'Object'
|
64
|
+
}
|
65
|
+
end
|
66
|
+
|
67
|
+
# List of attributes with nullable: true
|
68
|
+
def self.openapi_nullable
|
69
|
+
Set.new([
|
70
|
+
])
|
71
|
+
end
|
72
|
+
|
73
|
+
# Initializes the object
|
74
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
75
|
+
def initialize(attributes = {})
|
76
|
+
if (!attributes.is_a?(Hash))
|
77
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `TurnkeyClient::DeletePrivateKeysRequest` initialize method"
|
78
|
+
end
|
79
|
+
|
80
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
81
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
82
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
83
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `TurnkeyClient::DeletePrivateKeysRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
84
|
+
end
|
85
|
+
h[k.to_sym] = v
|
86
|
+
}
|
87
|
+
|
88
|
+
if attributes.key?(:'type')
|
89
|
+
self.type = attributes[:'type']
|
90
|
+
end
|
91
|
+
|
92
|
+
if attributes.key?(:'timestamp_ms')
|
93
|
+
self.timestamp_ms = attributes[:'timestamp_ms']
|
94
|
+
end
|
95
|
+
|
96
|
+
if attributes.key?(:'organization_id')
|
97
|
+
self.organization_id = attributes[:'organization_id']
|
98
|
+
end
|
99
|
+
|
100
|
+
if attributes.key?(:'parameters')
|
101
|
+
self.parameters = attributes[:'parameters']
|
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 @type.nil?
|
110
|
+
invalid_properties.push('invalid value for "type", type cannot be nil.')
|
111
|
+
end
|
112
|
+
|
113
|
+
if @timestamp_ms.nil?
|
114
|
+
invalid_properties.push('invalid value for "timestamp_ms", timestamp_ms cannot be nil.')
|
115
|
+
end
|
116
|
+
|
117
|
+
if @organization_id.nil?
|
118
|
+
invalid_properties.push('invalid value for "organization_id", organization_id cannot be nil.')
|
119
|
+
end
|
120
|
+
|
121
|
+
if @parameters.nil?
|
122
|
+
invalid_properties.push('invalid value for "parameters", parameters 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 @type.nil?
|
132
|
+
type_validator = EnumAttributeValidator.new('Object', ['ACTIVITY_TYPE_DELETE_PRIVATE_KEYS'])
|
133
|
+
return false unless type_validator.valid?(@type)
|
134
|
+
return false if @timestamp_ms.nil?
|
135
|
+
return false if @organization_id.nil?
|
136
|
+
return false if @parameters.nil?
|
137
|
+
true
|
138
|
+
end
|
139
|
+
|
140
|
+
# Custom attribute writer method checking allowed values (enum).
|
141
|
+
# @param [Object] type Object to be assigned
|
142
|
+
def type=(type)
|
143
|
+
validator = EnumAttributeValidator.new('Object', ['ACTIVITY_TYPE_DELETE_PRIVATE_KEYS'])
|
144
|
+
unless validator.valid?(type)
|
145
|
+
fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
|
146
|
+
end
|
147
|
+
@type = type
|
148
|
+
end
|
149
|
+
|
150
|
+
# Checks equality by comparing each attribute.
|
151
|
+
# @param [Object] Object to be compared
|
152
|
+
def ==(o)
|
153
|
+
return true if self.equal?(o)
|
154
|
+
self.class == o.class &&
|
155
|
+
type == o.type &&
|
156
|
+
timestamp_ms == o.timestamp_ms &&
|
157
|
+
organization_id == o.organization_id &&
|
158
|
+
parameters == o.parameters
|
159
|
+
end
|
160
|
+
|
161
|
+
# @see the `==` method
|
162
|
+
# @param [Object] Object to be compared
|
163
|
+
def eql?(o)
|
164
|
+
self == o
|
165
|
+
end
|
166
|
+
|
167
|
+
# Calculates hash code according to all attributes.
|
168
|
+
# @return [Integer] Hash code
|
169
|
+
def hash
|
170
|
+
[type, timestamp_ms, organization_id, parameters].hash
|
171
|
+
end
|
172
|
+
|
173
|
+
# Builds the object from hash
|
174
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
175
|
+
# @return [Object] Returns the model itself
|
176
|
+
def self.build_from_hash(attributes)
|
177
|
+
new.build_from_hash(attributes)
|
178
|
+
end
|
179
|
+
|
180
|
+
# Builds the object from hash
|
181
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
182
|
+
# @return [Object] Returns the model itself
|
183
|
+
def build_from_hash(attributes)
|
184
|
+
return nil unless attributes.is_a?(Hash)
|
185
|
+
self.class.openapi_types.each_pair do |key, type|
|
186
|
+
if type =~ /\AArray<(.*)>/i
|
187
|
+
# check to ensure the input is an array given that the attribute
|
188
|
+
# is documented as an array but the input is not
|
189
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
190
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
191
|
+
end
|
192
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
193
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
194
|
+
elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
195
|
+
self.send("#{key}=", nil)
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
self
|
200
|
+
end
|
201
|
+
|
202
|
+
# Deserializes the data based on type
|
203
|
+
# @param string type Data type
|
204
|
+
# @param string value Value to be deserialized
|
205
|
+
# @return [Object] Deserialized data
|
206
|
+
def _deserialize(type, value)
|
207
|
+
case type.to_sym
|
208
|
+
when :DateTime
|
209
|
+
DateTime.parse(value)
|
210
|
+
when :Date
|
211
|
+
Date.parse(value)
|
212
|
+
when :String
|
213
|
+
value.to_s
|
214
|
+
when :Integer
|
215
|
+
value.to_i
|
216
|
+
when :Float
|
217
|
+
value.to_f
|
218
|
+
when :Boolean
|
219
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
220
|
+
true
|
221
|
+
else
|
222
|
+
false
|
223
|
+
end
|
224
|
+
when :Object
|
225
|
+
# generic object (usually a Hash), return directly
|
226
|
+
value
|
227
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
228
|
+
inner_type = Regexp.last_match[:inner_type]
|
229
|
+
value.map { |v| _deserialize(inner_type, v) }
|
230
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
231
|
+
k_type = Regexp.last_match[:k_type]
|
232
|
+
v_type = Regexp.last_match[:v_type]
|
233
|
+
{}.tap do |hash|
|
234
|
+
value.each do |k, v|
|
235
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
236
|
+
end
|
237
|
+
end
|
238
|
+
else # model
|
239
|
+
TurnkeyClient.const_get(type).build_from_hash(value)
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
# Returns the string representation of the object
|
244
|
+
# @return [String] String presentation of the object
|
245
|
+
def to_s
|
246
|
+
to_hash.to_s
|
247
|
+
end
|
248
|
+
|
249
|
+
# to_body is an alias to to_hash (backward compatibility)
|
250
|
+
# @return [Hash] Returns the object in the form of hash
|
251
|
+
def to_body
|
252
|
+
to_hash
|
253
|
+
end
|
254
|
+
|
255
|
+
# Returns the object in the form of hash
|
256
|
+
# @return [Hash] Returns the object in the form of hash
|
257
|
+
def to_hash
|
258
|
+
hash = {}
|
259
|
+
self.class.attribute_map.each_pair do |attr, param|
|
260
|
+
value = self.send(attr)
|
261
|
+
if value.nil?
|
262
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
263
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
264
|
+
end
|
265
|
+
|
266
|
+
hash[param] = _to_hash(value)
|
267
|
+
end
|
268
|
+
hash
|
269
|
+
end
|
270
|
+
|
271
|
+
# Outputs non-array value in the form of hash
|
272
|
+
# For object, use to_hash. Otherwise, just return the value
|
273
|
+
# @param [Object] value Any valid value
|
274
|
+
# @return [Hash] Returns the value in the form of hash
|
275
|
+
def _to_hash(value)
|
276
|
+
if value.is_a?(Array)
|
277
|
+
value.compact.map { |v| _to_hash(v) }
|
278
|
+
elsif value.is_a?(Hash)
|
279
|
+
{}.tap do |hash|
|
280
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
281
|
+
end
|
282
|
+
elsif value.respond_to? :to_hash
|
283
|
+
value.to_hash
|
284
|
+
else
|
285
|
+
value
|
286
|
+
end
|
287
|
+
end end
|
288
|
+
end
|