pnap_tag_api 2.0.3 → 2.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/pnap_tag_api/api/tags_api.rb +6 -6
- data/lib/pnap_tag_api/api_client.rb +17 -14
- data/lib/pnap_tag_api/api_error.rb +1 -1
- data/lib/pnap_tag_api/api_model_base.rb +88 -0
- data/lib/pnap_tag_api/configuration.rb +11 -1
- data/lib/pnap_tag_api/models/delete_result.rb +31 -78
- data/lib/pnap_tag_api/models/error.rb +21 -78
- data/lib/pnap_tag_api/models/resource_assignment.rb +21 -78
- data/lib/pnap_tag_api/models/tag.rb +41 -78
- data/lib/pnap_tag_api/models/tag_create.rb +31 -78
- data/lib/pnap_tag_api/models/tag_update.rb +31 -78
- data/lib/pnap_tag_api/version.rb +1 -2
- data/lib/pnap_tag_api.rb +2 -1
- data/pnap_tag_api.gemspec +6 -6
- data/spec/api/tags_api_spec.rb +1 -1
- data/spec/models/delete_result_spec.rb +2 -2
- data/spec/models/error_spec.rb +2 -2
- data/spec/models/resource_assignment_spec.rb +2 -2
- data/spec/models/tag_create_spec.rb +2 -2
- data/spec/models/tag_spec.rb +2 -2
- data/spec/models/tag_update_spec.rb +2 -2
- data/spec/spec_helper.rb +1 -1
- metadata +14 -9
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 40a0b32613383b3ea37f29c8a3ffe120a8a445d7b4a39e26fbe002a4d362b4fc
|
|
4
|
+
data.tar.gz: 1fea9c80460378f230ed7e481f6a19191f5a40ba2cabc5532dc1d946925c9e05
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6dc1de365bc281d01c4afce7065cdd5d66826c9e30c0823eb47f8741e7efaaf50b10d0ab0d9d0842a90498fd52a4af27c683de4c15d488796e3dd65527847eb0
|
|
7
|
+
data.tar.gz: ecebe15935bff108132e237aa7a0c012cd8eb766a6dc3a3192cd958a053fa3633d5cbffd6f254a7f29c6da70169d79b18f2e0791dc8c5e26deff33b7abf98a85
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.0.
|
|
1
|
+
2.0.5
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
The version of the OpenAPI document: 1.0
|
|
7
7
|
Contact: support@phoenixnap.com
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
|
-
|
|
9
|
+
Generator version: 7.20.0
|
|
10
10
|
|
|
11
11
|
=end
|
|
12
12
|
|
|
@@ -48,7 +48,7 @@ module TagApi
|
|
|
48
48
|
# header parameters
|
|
49
49
|
header_params = opts[:header_params] || {}
|
|
50
50
|
# HTTP header 'Accept' (if needed)
|
|
51
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
51
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
52
52
|
|
|
53
53
|
# form parameters
|
|
54
54
|
form_params = opts[:form_params] || {}
|
|
@@ -111,7 +111,7 @@ module TagApi
|
|
|
111
111
|
# header parameters
|
|
112
112
|
header_params = opts[:header_params] || {}
|
|
113
113
|
# HTTP header 'Accept' (if needed)
|
|
114
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
114
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
115
115
|
# HTTP header 'Content-Type'
|
|
116
116
|
content_type = @api_client.select_header_content_type(['application/json'])
|
|
117
117
|
if !content_type.nil?
|
|
@@ -179,7 +179,7 @@ module TagApi
|
|
|
179
179
|
# header parameters
|
|
180
180
|
header_params = opts[:header_params] || {}
|
|
181
181
|
# HTTP header 'Accept' (if needed)
|
|
182
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
182
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
183
183
|
|
|
184
184
|
# form parameters
|
|
185
185
|
form_params = opts[:form_params] || {}
|
|
@@ -242,7 +242,7 @@ module TagApi
|
|
|
242
242
|
# header parameters
|
|
243
243
|
header_params = opts[:header_params] || {}
|
|
244
244
|
# HTTP header 'Accept' (if needed)
|
|
245
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
245
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
246
246
|
|
|
247
247
|
# form parameters
|
|
248
248
|
form_params = opts[:form_params] || {}
|
|
@@ -311,7 +311,7 @@ module TagApi
|
|
|
311
311
|
# header parameters
|
|
312
312
|
header_params = opts[:header_params] || {}
|
|
313
313
|
# HTTP header 'Accept' (if needed)
|
|
314
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
314
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
315
315
|
# HTTP header 'Content-Type'
|
|
316
316
|
content_type = @api_client.select_header_content_type(['application/json'])
|
|
317
317
|
if !content_type.nil?
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
The version of the OpenAPI document: 1.0
|
|
7
7
|
Contact: support@phoenixnap.com
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
|
-
|
|
9
|
+
Generator version: 7.20.0
|
|
10
10
|
|
|
11
11
|
=end
|
|
12
12
|
|
|
@@ -52,7 +52,8 @@ module TagApi
|
|
|
52
52
|
# the data deserialized from response body (may be a Tempfile or nil), response status code and response headers.
|
|
53
53
|
def call_api(http_method, path, opts = {})
|
|
54
54
|
request = build_request(http_method, path, opts)
|
|
55
|
-
tempfile =
|
|
55
|
+
tempfile = nil
|
|
56
|
+
(download_file(request) { tempfile = _1 }) if opts[:return_type] == 'File'
|
|
56
57
|
response = request.run
|
|
57
58
|
|
|
58
59
|
if @config.debugging
|
|
@@ -191,19 +192,17 @@ module TagApi
|
|
|
191
192
|
chunk.force_encoding(encoding)
|
|
192
193
|
tempfile.write(chunk)
|
|
193
194
|
end
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
195
|
+
request.on_complete do
|
|
196
|
+
if !tempfile
|
|
197
|
+
fail ApiError.new("Failed to create the tempfile based on the HTTP response from the server: #{request.inspect}")
|
|
198
|
+
end
|
|
197
199
|
tempfile.close
|
|
198
200
|
@config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
|
|
199
201
|
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
|
|
200
202
|
"will be deleted automatically with GC. It's also recommended to delete the temp file "\
|
|
201
203
|
"explicitly with `tempfile.delete`"
|
|
202
|
-
|
|
203
|
-
fail ApiError.new("Failed to create the tempfile based on the HTTP response from the server: #{request.inspect}")
|
|
204
|
+
yield tempfile if block_given?
|
|
204
205
|
end
|
|
205
|
-
|
|
206
|
-
tempfile
|
|
207
206
|
end
|
|
208
207
|
|
|
209
208
|
# Check if the given MIME is a JSON MIME.
|
|
@@ -215,7 +214,7 @@ module TagApi
|
|
|
215
214
|
# @param [String] mime MIME
|
|
216
215
|
# @return [Boolean] True if the MIME is application/json
|
|
217
216
|
def json_mime?(mime)
|
|
218
|
-
(mime == '*/*') || !(mime =~
|
|
217
|
+
(mime == '*/*') || !(mime =~ /^Application\/.*json(?!p)(;.*)?/i).nil?
|
|
219
218
|
end
|
|
220
219
|
|
|
221
220
|
# Deserialize the response to the given return type.
|
|
@@ -282,9 +281,13 @@ module TagApi
|
|
|
282
281
|
data.each { |k, v| hash[k] = convert_to_type(v, sub_type) }
|
|
283
282
|
end
|
|
284
283
|
else
|
|
285
|
-
# models (e.g. Pet) or oneOf
|
|
284
|
+
# models (e.g. Pet) or oneOf/anyOf
|
|
286
285
|
klass = TagApi.const_get(return_type)
|
|
287
|
-
klass.respond_to?(:openapi_one_of)
|
|
286
|
+
if klass.respond_to?(:openapi_one_of) || klass.respond_to?(:openapi_any_of)
|
|
287
|
+
klass.build(data)
|
|
288
|
+
else
|
|
289
|
+
klass.build_from_hash(data)
|
|
290
|
+
end
|
|
288
291
|
end
|
|
289
292
|
end
|
|
290
293
|
|
|
@@ -294,7 +297,7 @@ module TagApi
|
|
|
294
297
|
# @param [String] filename the filename to be sanitized
|
|
295
298
|
# @return [String] the sanitized filename
|
|
296
299
|
def sanitize_filename(filename)
|
|
297
|
-
filename.
|
|
300
|
+
filename.split(/[\/\\]/).last
|
|
298
301
|
end
|
|
299
302
|
|
|
300
303
|
def build_request_url(path, opts = {})
|
|
@@ -394,4 +397,4 @@ module TagApi
|
|
|
394
397
|
end
|
|
395
398
|
end
|
|
396
399
|
end
|
|
397
|
-
end
|
|
400
|
+
end
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Tags API
|
|
3
|
+
|
|
4
|
+
#Tags are case-sensitive key-value pairs that simplify resource management. The Tag Manager API allows you to create and manage such tags to later assign them to related resources in your Bare Metal Cloud (through the respective resource apis) in order to group and categorize them.<br> <br> <span class='pnap-api-knowledge-base-link'> Knowledge base articles to help you can be found <a href='https://phoenixnap.com/kb/bmc-server-management-via-api#server-tag-manager-api' target='_blank'>here</a> </span><br> <br> <b>All URLs are relative to (https://api.phoenixnap.com/tag-manager/v1/)</b>
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0
|
|
7
|
+
Contact: support@phoenixnap.com
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.20.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
module TagApi
|
|
14
|
+
class ApiModelBase
|
|
15
|
+
# Deserializes the data based on type
|
|
16
|
+
# @param string type Data type
|
|
17
|
+
# @param string value Value to be deserialized
|
|
18
|
+
# @return [Object] Deserialized data
|
|
19
|
+
def self._deserialize(type, value)
|
|
20
|
+
case type.to_sym
|
|
21
|
+
when :Time
|
|
22
|
+
Time.parse(value)
|
|
23
|
+
when :Date
|
|
24
|
+
Date.parse(value)
|
|
25
|
+
when :String
|
|
26
|
+
value.to_s
|
|
27
|
+
when :Integer
|
|
28
|
+
value.to_i
|
|
29
|
+
when :Float
|
|
30
|
+
value.to_f
|
|
31
|
+
when :Boolean
|
|
32
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
33
|
+
true
|
|
34
|
+
else
|
|
35
|
+
false
|
|
36
|
+
end
|
|
37
|
+
when :Object
|
|
38
|
+
# generic object (usually a Hash), return directly
|
|
39
|
+
value
|
|
40
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
41
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
42
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
43
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
44
|
+
k_type = Regexp.last_match[:k_type]
|
|
45
|
+
v_type = Regexp.last_match[:v_type]
|
|
46
|
+
{}.tap do |hash|
|
|
47
|
+
value.each do |k, v|
|
|
48
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
else # model
|
|
52
|
+
# models (e.g. Pet) or oneOf
|
|
53
|
+
klass = TagApi.const_get(type)
|
|
54
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# Returns the string representation of the object
|
|
59
|
+
# @return [String] String presentation of the object
|
|
60
|
+
def to_s
|
|
61
|
+
to_hash.to_s
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
65
|
+
# @return [Hash] Returns the object in the form of hash
|
|
66
|
+
def to_body
|
|
67
|
+
to_hash
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# Outputs non-array value in the form of hash
|
|
71
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
72
|
+
# @param [Object] value Any valid value
|
|
73
|
+
# @return [Hash] Returns the value in the form of hash
|
|
74
|
+
def _to_hash(value)
|
|
75
|
+
if value.is_a?(Array)
|
|
76
|
+
value.compact.map { |v| _to_hash(v) }
|
|
77
|
+
elsif value.is_a?(Hash)
|
|
78
|
+
{}.tap do |hash|
|
|
79
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
80
|
+
end
|
|
81
|
+
elsif value.respond_to? :to_hash
|
|
82
|
+
value.to_hash
|
|
83
|
+
else
|
|
84
|
+
value
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
end
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
The version of the OpenAPI document: 1.0
|
|
7
7
|
Contact: support@phoenixnap.com
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
|
-
|
|
9
|
+
Generator version: 7.20.0
|
|
10
10
|
|
|
11
11
|
=end
|
|
12
12
|
|
|
@@ -79,6 +79,14 @@ module TagApi
|
|
|
79
79
|
# @return [true, false]
|
|
80
80
|
attr_accessor :debugging
|
|
81
81
|
|
|
82
|
+
# Set this to ignore operation servers for the API client. This is useful when you need to
|
|
83
|
+
# send requests to a different server than the one specified in the OpenAPI document.
|
|
84
|
+
# Will default to the base url defined in the spec but can be overridden by setting
|
|
85
|
+
# `scheme`, `host`, `base_path` directly.
|
|
86
|
+
# Default to false.
|
|
87
|
+
# @return [true, false]
|
|
88
|
+
attr_accessor :ignore_operation_servers
|
|
89
|
+
|
|
82
90
|
# Defines the logger used for debugging.
|
|
83
91
|
# Default to `Rails.logger` (when in Rails) or logging to STDOUT.
|
|
84
92
|
#
|
|
@@ -166,6 +174,7 @@ module TagApi
|
|
|
166
174
|
@timeout = 0
|
|
167
175
|
@params_encoding = nil
|
|
168
176
|
@debugging = false
|
|
177
|
+
@ignore_operation_servers = false
|
|
169
178
|
@inject_format = false
|
|
170
179
|
@force_ending_format = false
|
|
171
180
|
@logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
|
|
@@ -200,6 +209,7 @@ module TagApi
|
|
|
200
209
|
|
|
201
210
|
# Returns base URL for specified operation based on server settings
|
|
202
211
|
def base_url(operation = nil)
|
|
212
|
+
return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if ignore_operation_servers
|
|
203
213
|
if operation_server_settings.key?(operation) then
|
|
204
214
|
index = server_operation_index.fetch(operation, server_index)
|
|
205
215
|
server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
The version of the OpenAPI document: 1.0
|
|
7
7
|
Contact: support@phoenixnap.com
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
|
-
|
|
9
|
+
Generator version: 7.20.0
|
|
10
10
|
|
|
11
11
|
=end
|
|
12
12
|
|
|
@@ -15,7 +15,7 @@ require 'time'
|
|
|
15
15
|
|
|
16
16
|
module TagApi
|
|
17
17
|
# Result of a successful delete action.
|
|
18
|
-
class DeleteResult
|
|
18
|
+
class DeleteResult < ApiModelBase
|
|
19
19
|
# Tag deletion result message.
|
|
20
20
|
attr_accessor :result
|
|
21
21
|
|
|
@@ -30,9 +30,14 @@ module TagApi
|
|
|
30
30
|
}
|
|
31
31
|
end
|
|
32
32
|
|
|
33
|
+
# Returns attribute mapping this model knows about
|
|
34
|
+
def self.acceptable_attribute_map
|
|
35
|
+
attribute_map
|
|
36
|
+
end
|
|
37
|
+
|
|
33
38
|
# Returns all the JSON keys this model knows about
|
|
34
39
|
def self.acceptable_attributes
|
|
35
|
-
|
|
40
|
+
acceptable_attribute_map.values
|
|
36
41
|
end
|
|
37
42
|
|
|
38
43
|
# Attribute type mapping.
|
|
@@ -57,9 +62,10 @@ module TagApi
|
|
|
57
62
|
end
|
|
58
63
|
|
|
59
64
|
# check to see if the attribute exists and convert string to symbol for hash key
|
|
65
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
60
66
|
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
61
|
-
if (!
|
|
62
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `TagApi::DeleteResult`. Please check the name to make sure it's valid. List of attributes: " +
|
|
67
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
68
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `TagApi::DeleteResult`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
63
69
|
end
|
|
64
70
|
h[k.to_sym] = v
|
|
65
71
|
}
|
|
@@ -102,6 +108,26 @@ module TagApi
|
|
|
102
108
|
true
|
|
103
109
|
end
|
|
104
110
|
|
|
111
|
+
# Custom attribute writer method with validation
|
|
112
|
+
# @param [Object] result Value to be assigned
|
|
113
|
+
def result=(result)
|
|
114
|
+
if result.nil?
|
|
115
|
+
fail ArgumentError, 'result cannot be nil'
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
@result = result
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
# Custom attribute writer method with validation
|
|
122
|
+
# @param [Object] tag_id Value to be assigned
|
|
123
|
+
def tag_id=(tag_id)
|
|
124
|
+
if tag_id.nil?
|
|
125
|
+
fail ArgumentError, 'tag_id cannot be nil'
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
@tag_id = tag_id
|
|
129
|
+
end
|
|
130
|
+
|
|
105
131
|
# Checks equality by comparing each attribute.
|
|
106
132
|
# @param [Object] Object to be compared
|
|
107
133
|
def ==(o)
|
|
@@ -146,61 +172,6 @@ module TagApi
|
|
|
146
172
|
new(transformed_hash)
|
|
147
173
|
end
|
|
148
174
|
|
|
149
|
-
# Deserializes the data based on type
|
|
150
|
-
# @param string type Data type
|
|
151
|
-
# @param string value Value to be deserialized
|
|
152
|
-
# @return [Object] Deserialized data
|
|
153
|
-
def self._deserialize(type, value)
|
|
154
|
-
case type.to_sym
|
|
155
|
-
when :Time
|
|
156
|
-
Time.parse(value)
|
|
157
|
-
when :Date
|
|
158
|
-
Date.parse(value)
|
|
159
|
-
when :String
|
|
160
|
-
value.to_s
|
|
161
|
-
when :Integer
|
|
162
|
-
value.to_i
|
|
163
|
-
when :Float
|
|
164
|
-
value.to_f
|
|
165
|
-
when :Boolean
|
|
166
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
167
|
-
true
|
|
168
|
-
else
|
|
169
|
-
false
|
|
170
|
-
end
|
|
171
|
-
when :Object
|
|
172
|
-
# generic object (usually a Hash), return directly
|
|
173
|
-
value
|
|
174
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
|
175
|
-
inner_type = Regexp.last_match[:inner_type]
|
|
176
|
-
value.map { |v| _deserialize(inner_type, v) }
|
|
177
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
178
|
-
k_type = Regexp.last_match[:k_type]
|
|
179
|
-
v_type = Regexp.last_match[:v_type]
|
|
180
|
-
{}.tap do |hash|
|
|
181
|
-
value.each do |k, v|
|
|
182
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
183
|
-
end
|
|
184
|
-
end
|
|
185
|
-
else # model
|
|
186
|
-
# models (e.g. Pet) or oneOf
|
|
187
|
-
klass = TagApi.const_get(type)
|
|
188
|
-
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
189
|
-
end
|
|
190
|
-
end
|
|
191
|
-
|
|
192
|
-
# Returns the string representation of the object
|
|
193
|
-
# @return [String] String presentation of the object
|
|
194
|
-
def to_s
|
|
195
|
-
to_hash.to_s
|
|
196
|
-
end
|
|
197
|
-
|
|
198
|
-
# to_body is an alias to to_hash (backward compatibility)
|
|
199
|
-
# @return [Hash] Returns the object in the form of hash
|
|
200
|
-
def to_body
|
|
201
|
-
to_hash
|
|
202
|
-
end
|
|
203
|
-
|
|
204
175
|
# Returns the object in the form of hash
|
|
205
176
|
# @return [Hash] Returns the object in the form of hash
|
|
206
177
|
def to_hash
|
|
@@ -217,24 +188,6 @@ module TagApi
|
|
|
217
188
|
hash
|
|
218
189
|
end
|
|
219
190
|
|
|
220
|
-
# Outputs non-array value in the form of hash
|
|
221
|
-
# For object, use to_hash. Otherwise, just return the value
|
|
222
|
-
# @param [Object] value Any valid value
|
|
223
|
-
# @return [Hash] Returns the value in the form of hash
|
|
224
|
-
def _to_hash(value)
|
|
225
|
-
if value.is_a?(Array)
|
|
226
|
-
value.compact.map { |v| _to_hash(v) }
|
|
227
|
-
elsif value.is_a?(Hash)
|
|
228
|
-
{}.tap do |hash|
|
|
229
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
230
|
-
end
|
|
231
|
-
elsif value.respond_to? :to_hash
|
|
232
|
-
value.to_hash
|
|
233
|
-
else
|
|
234
|
-
value
|
|
235
|
-
end
|
|
236
|
-
end
|
|
237
|
-
|
|
238
191
|
end
|
|
239
192
|
|
|
240
193
|
end
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
The version of the OpenAPI document: 1.0
|
|
7
7
|
Contact: support@phoenixnap.com
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
|
-
|
|
9
|
+
Generator version: 7.20.0
|
|
10
10
|
|
|
11
11
|
=end
|
|
12
12
|
|
|
@@ -14,7 +14,7 @@ require 'date'
|
|
|
14
14
|
require 'time'
|
|
15
15
|
|
|
16
16
|
module TagApi
|
|
17
|
-
class Error
|
|
17
|
+
class Error < ApiModelBase
|
|
18
18
|
# The description detailing the cause of the error code.
|
|
19
19
|
attr_accessor :message
|
|
20
20
|
|
|
@@ -29,9 +29,14 @@ module TagApi
|
|
|
29
29
|
}
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
+
# Returns attribute mapping this model knows about
|
|
33
|
+
def self.acceptable_attribute_map
|
|
34
|
+
attribute_map
|
|
35
|
+
end
|
|
36
|
+
|
|
32
37
|
# Returns all the JSON keys this model knows about
|
|
33
38
|
def self.acceptable_attributes
|
|
34
|
-
|
|
39
|
+
acceptable_attribute_map.values
|
|
35
40
|
end
|
|
36
41
|
|
|
37
42
|
# Attribute type mapping.
|
|
@@ -56,9 +61,10 @@ module TagApi
|
|
|
56
61
|
end
|
|
57
62
|
|
|
58
63
|
# check to see if the attribute exists and convert string to symbol for hash key
|
|
64
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
59
65
|
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
60
|
-
if (!
|
|
61
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `TagApi::Error`. Please check the name to make sure it's valid. List of attributes: " +
|
|
66
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
67
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `TagApi::Error`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
62
68
|
end
|
|
63
69
|
h[k.to_sym] = v
|
|
64
70
|
}
|
|
@@ -96,6 +102,16 @@ module TagApi
|
|
|
96
102
|
true
|
|
97
103
|
end
|
|
98
104
|
|
|
105
|
+
# Custom attribute writer method with validation
|
|
106
|
+
# @param [Object] message Value to be assigned
|
|
107
|
+
def message=(message)
|
|
108
|
+
if message.nil?
|
|
109
|
+
fail ArgumentError, 'message cannot be nil'
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
@message = message
|
|
113
|
+
end
|
|
114
|
+
|
|
99
115
|
# Checks equality by comparing each attribute.
|
|
100
116
|
# @param [Object] Object to be compared
|
|
101
117
|
def ==(o)
|
|
@@ -140,61 +156,6 @@ module TagApi
|
|
|
140
156
|
new(transformed_hash)
|
|
141
157
|
end
|
|
142
158
|
|
|
143
|
-
# Deserializes the data based on type
|
|
144
|
-
# @param string type Data type
|
|
145
|
-
# @param string value Value to be deserialized
|
|
146
|
-
# @return [Object] Deserialized data
|
|
147
|
-
def self._deserialize(type, value)
|
|
148
|
-
case type.to_sym
|
|
149
|
-
when :Time
|
|
150
|
-
Time.parse(value)
|
|
151
|
-
when :Date
|
|
152
|
-
Date.parse(value)
|
|
153
|
-
when :String
|
|
154
|
-
value.to_s
|
|
155
|
-
when :Integer
|
|
156
|
-
value.to_i
|
|
157
|
-
when :Float
|
|
158
|
-
value.to_f
|
|
159
|
-
when :Boolean
|
|
160
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
161
|
-
true
|
|
162
|
-
else
|
|
163
|
-
false
|
|
164
|
-
end
|
|
165
|
-
when :Object
|
|
166
|
-
# generic object (usually a Hash), return directly
|
|
167
|
-
value
|
|
168
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
|
169
|
-
inner_type = Regexp.last_match[:inner_type]
|
|
170
|
-
value.map { |v| _deserialize(inner_type, v) }
|
|
171
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
172
|
-
k_type = Regexp.last_match[:k_type]
|
|
173
|
-
v_type = Regexp.last_match[:v_type]
|
|
174
|
-
{}.tap do |hash|
|
|
175
|
-
value.each do |k, v|
|
|
176
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
177
|
-
end
|
|
178
|
-
end
|
|
179
|
-
else # model
|
|
180
|
-
# models (e.g. Pet) or oneOf
|
|
181
|
-
klass = TagApi.const_get(type)
|
|
182
|
-
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
183
|
-
end
|
|
184
|
-
end
|
|
185
|
-
|
|
186
|
-
# Returns the string representation of the object
|
|
187
|
-
# @return [String] String presentation of the object
|
|
188
|
-
def to_s
|
|
189
|
-
to_hash.to_s
|
|
190
|
-
end
|
|
191
|
-
|
|
192
|
-
# to_body is an alias to to_hash (backward compatibility)
|
|
193
|
-
# @return [Hash] Returns the object in the form of hash
|
|
194
|
-
def to_body
|
|
195
|
-
to_hash
|
|
196
|
-
end
|
|
197
|
-
|
|
198
159
|
# Returns the object in the form of hash
|
|
199
160
|
# @return [Hash] Returns the object in the form of hash
|
|
200
161
|
def to_hash
|
|
@@ -211,24 +172,6 @@ module TagApi
|
|
|
211
172
|
hash
|
|
212
173
|
end
|
|
213
174
|
|
|
214
|
-
# Outputs non-array value in the form of hash
|
|
215
|
-
# For object, use to_hash. Otherwise, just return the value
|
|
216
|
-
# @param [Object] value Any valid value
|
|
217
|
-
# @return [Hash] Returns the value in the form of hash
|
|
218
|
-
def _to_hash(value)
|
|
219
|
-
if value.is_a?(Array)
|
|
220
|
-
value.compact.map { |v| _to_hash(v) }
|
|
221
|
-
elsif value.is_a?(Hash)
|
|
222
|
-
{}.tap do |hash|
|
|
223
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
224
|
-
end
|
|
225
|
-
elsif value.respond_to? :to_hash
|
|
226
|
-
value.to_hash
|
|
227
|
-
else
|
|
228
|
-
value
|
|
229
|
-
end
|
|
230
|
-
end
|
|
231
|
-
|
|
232
175
|
end
|
|
233
176
|
|
|
234
177
|
end
|