pnap_ip_api 2.2.0 → 2.3.0
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/docs/IpBlock.md +1 -1
- data/docs/IpBlockCreate.md +1 -1
- data/lib/pnap_ip_api/api/ip_blocks_api.rb +7 -7
- data/lib/pnap_ip_api/api_client.rb +17 -14
- data/lib/pnap_ip_api/api_error.rb +1 -1
- data/lib/pnap_ip_api/api_model_base.rb +88 -0
- data/lib/pnap_ip_api/configuration.rb +11 -1
- data/lib/pnap_ip_api/models/delete_ip_block_result.rb +11 -78
- data/lib/pnap_ip_api/models/error.rb +21 -78
- data/lib/pnap_ip_api/models/ip_block.rb +12 -79
- data/lib/pnap_ip_api/models/ip_block_create.rb +32 -79
- data/lib/pnap_ip_api/models/ip_block_patch.rb +11 -78
- data/lib/pnap_ip_api/models/tag_assignment.rb +41 -78
- data/lib/pnap_ip_api/models/tag_assignment_request.rb +21 -78
- data/lib/pnap_ip_api/version.rb +1 -2
- data/lib/pnap_ip_api.rb +2 -1
- data/pnap_ip_api.gemspec +6 -6
- data/spec/api/ip_blocks_api_spec.rb +1 -1
- data/spec/models/delete_ip_block_result_spec.rb +2 -2
- data/spec/models/error_spec.rb +2 -2
- data/spec/models/ip_block_create_spec.rb +2 -2
- data/spec/models/ip_block_patch_spec.rb +2 -2
- data/spec/models/ip_block_spec.rb +2 -2
- data/spec/models/tag_assignment_request_spec.rb +2 -2
- data/spec/models/tag_assignment_spec.rb +2 -2
- data/spec/spec_helper.rb +1 -1
- metadata +13 -9
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2a282df791160057a83049b4a1cd1514a285eaca72f1946294f13dd1184998c0
|
|
4
|
+
data.tar.gz: 806d09deeba88be86d5190aad7b47d929a38d2cd9c2bea43e2361ec942e47742
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8ea922154718b2a4d8e9be3eeea1bed6b391dbaed3e5f27e0b06db1dc4f7db44e80f5e2034a25e1bce100b596912d3745bfc926d7c0e38ae0d833b6dea4276c9
|
|
7
|
+
data.tar.gz: 40ee9230e0509771dfe4b013976f96b821ea48f259865a3d37453c321706c41f38ee7e87b963ba4e0f7b9d148c2c28fb1af2c093d17e8115f5d8af4b08e11bc7
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.
|
|
1
|
+
2.3.0
|
data/docs/IpBlock.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
| Name | Type | Description | Notes |
|
|
6
6
|
| ---- | ---- | ----------- | ----- |
|
|
7
7
|
| **id** | **String** | IP Block identifier. | [optional] |
|
|
8
|
-
| **location** | **String** | IP Block location ID. Currently this field should be set to `PHX`, `ASH`, `SGP`, `NLD`, `CHI`
|
|
8
|
+
| **location** | **String** | IP Block location ID. Currently this field should be set to `PHX`, `ASH`, `SGP`, `NLD`, `CHI` or `SEA`. | [optional] |
|
|
9
9
|
| **cidr_block_size** | **String** | CIDR IP Block Size. Currently this field should be set to either `/31`, `/30`, `/29`, `/28`, `/27`, `/26`, `/25`, `/24`, `/23` or `/22`. | [optional] |
|
|
10
10
|
| **cidr** | **String** | The IP Block in CIDR notation. | [optional] |
|
|
11
11
|
| **ip_version** | **String** | The IP Version of the block. | [optional] |
|
data/docs/IpBlockCreate.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
| Name | Type | Description | Notes |
|
|
6
6
|
| ---- | ---- | ----------- | ----- |
|
|
7
|
-
| **location** | **String** | IP Block location ID. Currently this field should be set to `PHX`, `ASH`, `SGP`, `NLD`, `CHI`
|
|
7
|
+
| **location** | **String** | IP Block location ID. Currently this field should be set to `PHX`, `ASH`, `SGP`, `NLD`, `CHI` or `SEA`. | |
|
|
8
8
|
| **cidr_block_size** | **String** | CIDR IP Block Size. V4 supported sizes: [`/31`, `/30`, `/29` or `/28`]. V6 supported sizes: [`/64`]. For a larger Block Size contact support. | |
|
|
9
9
|
| **ip_version** | **String** | IP Version. This field should be set to `V4` or `V6` | [optional][default to 'V4'] |
|
|
10
10
|
| **description** | **String** | The description of the IP Block. | [optional] |
|
|
@@ -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 IpApi
|
|
|
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 IpApi
|
|
|
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
|
|
|
116
116
|
# form parameters
|
|
117
117
|
form_params = opts[:form_params] || {}
|
|
@@ -174,7 +174,7 @@ module IpApi
|
|
|
174
174
|
# header parameters
|
|
175
175
|
header_params = opts[:header_params] || {}
|
|
176
176
|
# HTTP header 'Accept' (if needed)
|
|
177
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
177
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
178
178
|
|
|
179
179
|
# form parameters
|
|
180
180
|
form_params = opts[:form_params] || {}
|
|
@@ -243,7 +243,7 @@ module IpApi
|
|
|
243
243
|
# header parameters
|
|
244
244
|
header_params = opts[:header_params] || {}
|
|
245
245
|
# HTTP header 'Accept' (if needed)
|
|
246
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
246
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
247
247
|
# HTTP header 'Content-Type'
|
|
248
248
|
content_type = @api_client.select_header_content_type(['application/json'])
|
|
249
249
|
if !content_type.nil?
|
|
@@ -317,7 +317,7 @@ module IpApi
|
|
|
317
317
|
# header parameters
|
|
318
318
|
header_params = opts[:header_params] || {}
|
|
319
319
|
# HTTP header 'Accept' (if needed)
|
|
320
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
320
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
321
321
|
# HTTP header 'Content-Type'
|
|
322
322
|
content_type = @api_client.select_header_content_type(['application/json'])
|
|
323
323
|
if !content_type.nil?
|
|
@@ -385,7 +385,7 @@ module IpApi
|
|
|
385
385
|
# header parameters
|
|
386
386
|
header_params = opts[:header_params] || {}
|
|
387
387
|
# HTTP header 'Accept' (if needed)
|
|
388
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
388
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
389
389
|
# HTTP header 'Content-Type'
|
|
390
390
|
content_type = @api_client.select_header_content_type(['application/json'])
|
|
391
391
|
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 IpApi
|
|
|
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 IpApi
|
|
|
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 IpApi
|
|
|
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 IpApi
|
|
|
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 = IpApi.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 IpApi
|
|
|
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 IpApi
|
|
|
394
397
|
end
|
|
395
398
|
end
|
|
396
399
|
end
|
|
397
|
-
end
|
|
400
|
+
end
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#IP Addresses API
|
|
3
|
+
|
|
4
|
+
#Public IP blocks are a set of contiguous IPs that allow you to access your servers or networks from the internet. Use the IP Addresses API to request and delete IP blocks.<br> <br> <span class='pnap-api-knowledge-base-link'> Knowledge base articles to help you can be found <a href='https://phoenixnap.com/kb/public-ip-management#bmc-public-ip-allocations-api' target='_blank'>here</a> </span><br> <br> <b>All URLs are relative to (https://api.phoenixnap.com/ips/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 IpApi
|
|
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 = IpApi.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 IpApi
|
|
|
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 IpApi
|
|
|
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 IpApi
|
|
|
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 IpApi
|
|
17
17
|
# Result of a successful delete action.
|
|
18
|
-
class DeleteIpBlockResult
|
|
18
|
+
class DeleteIpBlockResult < ApiModelBase
|
|
19
19
|
# IP Block has been deleted.
|
|
20
20
|
attr_accessor :result
|
|
21
21
|
|
|
@@ -30,9 +30,14 @@ module IpApi
|
|
|
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 IpApi
|
|
|
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 `IpApi::DeleteIpBlockResult`. 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 `IpApi::DeleteIpBlockResult`. 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
|
}
|
|
@@ -132,61 +138,6 @@ module IpApi
|
|
|
132
138
|
new(transformed_hash)
|
|
133
139
|
end
|
|
134
140
|
|
|
135
|
-
# Deserializes the data based on type
|
|
136
|
-
# @param string type Data type
|
|
137
|
-
# @param string value Value to be deserialized
|
|
138
|
-
# @return [Object] Deserialized data
|
|
139
|
-
def self._deserialize(type, value)
|
|
140
|
-
case type.to_sym
|
|
141
|
-
when :Time
|
|
142
|
-
Time.parse(value)
|
|
143
|
-
when :Date
|
|
144
|
-
Date.parse(value)
|
|
145
|
-
when :String
|
|
146
|
-
value.to_s
|
|
147
|
-
when :Integer
|
|
148
|
-
value.to_i
|
|
149
|
-
when :Float
|
|
150
|
-
value.to_f
|
|
151
|
-
when :Boolean
|
|
152
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
153
|
-
true
|
|
154
|
-
else
|
|
155
|
-
false
|
|
156
|
-
end
|
|
157
|
-
when :Object
|
|
158
|
-
# generic object (usually a Hash), return directly
|
|
159
|
-
value
|
|
160
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
|
161
|
-
inner_type = Regexp.last_match[:inner_type]
|
|
162
|
-
value.map { |v| _deserialize(inner_type, v) }
|
|
163
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
164
|
-
k_type = Regexp.last_match[:k_type]
|
|
165
|
-
v_type = Regexp.last_match[:v_type]
|
|
166
|
-
{}.tap do |hash|
|
|
167
|
-
value.each do |k, v|
|
|
168
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
169
|
-
end
|
|
170
|
-
end
|
|
171
|
-
else # model
|
|
172
|
-
# models (e.g. Pet) or oneOf
|
|
173
|
-
klass = IpApi.const_get(type)
|
|
174
|
-
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.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
141
|
# Returns the object in the form of hash
|
|
191
142
|
# @return [Hash] Returns the object in the form of hash
|
|
192
143
|
def to_hash
|
|
@@ -203,24 +154,6 @@ module IpApi
|
|
|
203
154
|
hash
|
|
204
155
|
end
|
|
205
156
|
|
|
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
|
|
223
|
-
|
|
224
157
|
end
|
|
225
158
|
|
|
226
159
|
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 IpApi
|
|
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 IpApi
|
|
|
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 IpApi
|
|
|
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 `IpApi::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 `IpApi::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 IpApi
|
|
|
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 IpApi
|
|
|
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 = IpApi.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 IpApi
|
|
|
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
|