pnap_audit_api 1.0.6 → 2.0.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/README.md +3 -0
- data/VERSION +1 -1
- data/lib/pnap_audit_api/api/events_api.rb +1 -1
- data/lib/pnap_audit_api/api_client.rb +24 -21
- data/lib/pnap_audit_api/api_error.rb +2 -1
- data/lib/pnap_audit_api/configuration.rb +28 -9
- data/lib/pnap_audit_api/models/error.rb +16 -19
- data/lib/pnap_audit_api/models/event.rb +18 -19
- data/lib/pnap_audit_api/models/user_info.rb +18 -19
- data/lib/pnap_audit_api/version.rb +1 -1
- data/lib/pnap_audit_api.rb +1 -1
- data/pnap_audit_api.gemspec +2 -2
- data/spec/api/events_api_spec.rb +2 -2
- data/spec/models/error_spec.rb +6 -4
- data/spec/models/event_spec.rb +7 -5
- data/spec/models/user_info_spec.rb +7 -5
- data/spec/spec_helper.rb +1 -1
- metadata +3 -27
- data/docs/ApiAction.md +0 -26
- data/docs/ApiActionAllOf.md +0 -20
- data/docs/Headers.md +0 -18
- data/docs/Request.md +0 -22
- data/docs/Response.md +0 -20
- data/lib/pnap_audit_api/models/api_action.rb +0 -284
- data/lib/pnap_audit_api/models/api_action_all_of.rb +0 -237
- data/lib/pnap_audit_api/models/headers.rb +0 -225
- data/lib/pnap_audit_api/models/request.rb +0 -288
- data/lib/pnap_audit_api/models/response.rb +0 -235
- data/spec/api_client_spec.rb +0 -226
- data/spec/configuration_spec.rb +0 -42
- data/spec/models/api_action_all_of_spec.rb +0 -40
- data/spec/models/api_action_spec.rb +0 -58
- data/spec/models/headers_spec.rb +0 -34
- data/spec/models/request_spec.rb +0 -50
- data/spec/models/response_spec.rb +0 -40
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b41ee3b3f24e885b88200d14ec54e72471a0793284997f08e9b65bd11315ec4
|
4
|
+
data.tar.gz: 0db3cbc55acf3cb2b7bc6d64f535a90e99e5c7df0aa286e5815ba8026e51ce1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98142f8c6ac06eb8d9f647e8b425067c94fc9778f10e3d4b65421e9c2009a1932aecb7b4867c03d23f701a8e91afa95ad29ad0eb4a54d3e8b62cb7eaba90f66f
|
7
|
+
data.tar.gz: cfe7467df845edad4587028b28d9d7cdd80b31098216ae5a27ae7a672d7258506ff90ed16fc69bdff06fff478fc920825e949906d36b97b204f6ca464e2e30f0
|
data/README.md
CHANGED
@@ -73,6 +73,8 @@ require 'pnap_audit_api'
|
|
73
73
|
AuditApi.configure do |config|
|
74
74
|
# Configure OAuth2 access token for authorization: OAuth2
|
75
75
|
config.access_token = 'YOUR ACCESS TOKEN'
|
76
|
+
# Configure a proc to get access tokens in lieu of the static access_token configuration
|
77
|
+
config.access_token_getter = -> { 'YOUR TOKEN GETTER PROC' }
|
76
78
|
end
|
77
79
|
|
78
80
|
api_instance = AuditApi::EventsApi.new
|
@@ -140,6 +142,7 @@ Class | Method | HTTP request | Description
|
|
140
142
|
## Documentation for Authorization
|
141
143
|
|
142
144
|
|
145
|
+
Authentication schemes defined for the API:
|
143
146
|
### OAuth2
|
144
147
|
|
145
148
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
2.0.0
|
@@ -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
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 7.2.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -17,6 +17,7 @@ require 'tempfile'
|
|
17
17
|
require 'time'
|
18
18
|
require 'typhoeus'
|
19
19
|
|
20
|
+
|
20
21
|
module AuditApi
|
21
22
|
class ApiClient
|
22
23
|
# The Configuration object holding settings to be used in the API client.
|
@@ -31,6 +32,7 @@ module AuditApi
|
|
31
32
|
# @option config [Configuration] Configuration for initializing the object, default to Configuration.default
|
32
33
|
def initialize(config = Configuration.default)
|
33
34
|
@config = config
|
35
|
+
@config.params_encoding = :multi
|
34
36
|
@user_agent = "PNAP-ruby-sdk-bmc/#{ AuditApi::VERSION }"
|
35
37
|
@powered_by = "PNAP-ruby-sdk-bmc/#{ AuditApi::VERSION }"
|
36
38
|
@default_headers = {
|
@@ -47,9 +49,10 @@ module AuditApi
|
|
47
49
|
# Call an API with given options.
|
48
50
|
#
|
49
51
|
# @return [Array<(Object, Integer, Hash)>] an array of 3 elements:
|
50
|
-
# the data deserialized from response body (
|
52
|
+
# the data deserialized from response body (may be a Tempfile or nil), response status code and response headers.
|
51
53
|
def call_api(http_method, path, opts = {})
|
52
54
|
request = build_request(http_method, path, opts)
|
55
|
+
tempfile = download_file(request) if opts[:return_type] == 'File'
|
53
56
|
response = request.run
|
54
57
|
|
55
58
|
if @config.debugging
|
@@ -71,7 +74,9 @@ module AuditApi
|
|
71
74
|
end
|
72
75
|
end
|
73
76
|
|
74
|
-
if opts[:return_type]
|
77
|
+
if opts[:return_type] == 'File'
|
78
|
+
data = tempfile
|
79
|
+
elsif opts[:return_type]
|
75
80
|
data = deserialize(response, opts[:return_type])
|
76
81
|
else
|
77
82
|
data = nil
|
@@ -127,9 +132,7 @@ module AuditApi
|
|
127
132
|
end
|
128
133
|
end
|
129
134
|
|
130
|
-
|
131
|
-
download_file(request) if opts[:return_type] == 'File'
|
132
|
-
request
|
135
|
+
Typhoeus::Request.new(url, req_opts)
|
133
136
|
end
|
134
137
|
|
135
138
|
# Builds the HTTP request body
|
@@ -167,6 +170,8 @@ module AuditApi
|
|
167
170
|
# process can use.
|
168
171
|
#
|
169
172
|
# @see Configuration#temp_folder_path
|
173
|
+
#
|
174
|
+
# @return [Tempfile] the tempfile generated
|
170
175
|
def download_file(request)
|
171
176
|
tempfile = nil
|
172
177
|
encoding = nil
|
@@ -181,21 +186,24 @@ module AuditApi
|
|
181
186
|
prefix = prefix + '-' unless prefix.end_with?('-')
|
182
187
|
encoding = response.body.encoding
|
183
188
|
tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
|
184
|
-
@tempfile = tempfile
|
185
189
|
end
|
186
190
|
request.on_body do |chunk|
|
187
191
|
chunk.force_encoding(encoding)
|
188
192
|
tempfile.write(chunk)
|
189
193
|
end
|
190
|
-
request
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
194
|
+
# run the request to ensure the tempfile is created successfully before returning it
|
195
|
+
request.run
|
196
|
+
if tempfile
|
197
|
+
tempfile.close
|
198
|
+
@config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
|
199
|
+
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
|
200
|
+
"will be deleted automatically with GC. It's also recommended to delete the temp file "\
|
201
|
+
"explicitly with `tempfile.delete`"
|
202
|
+
else
|
203
|
+
fail ApiError.new("Failed to create the tempfile based on the HTTP response from the server: #{request.inspect}")
|
198
204
|
end
|
205
|
+
|
206
|
+
tempfile
|
199
207
|
end
|
200
208
|
|
201
209
|
# Check if the given MIME is a JSON MIME.
|
@@ -216,15 +224,10 @@ module AuditApi
|
|
216
224
|
# @param [String] return_type some examples: "User", "Array<User>", "Hash<String, Integer>"
|
217
225
|
def deserialize(response, return_type)
|
218
226
|
body = response.body
|
219
|
-
|
220
|
-
# handle file downloading - return the File instance processed in request callbacks
|
221
|
-
# note that response body is empty when the file is written in chunks in request on_body callback
|
222
|
-
return @tempfile if return_type == 'File'
|
223
|
-
|
224
227
|
return nil if body.nil? || body.empty?
|
225
228
|
|
226
229
|
# return response body directly for String return type
|
227
|
-
return body if return_type == 'String'
|
230
|
+
return body.to_s if return_type == 'String'
|
228
231
|
|
229
232
|
# ensuring a default content type
|
230
233
|
content_type = response.headers['Content-Type'] || 'application/json'
|
@@ -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
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 7.2.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -32,6 +32,7 @@ module AuditApi
|
|
32
32
|
end
|
33
33
|
else
|
34
34
|
super arg
|
35
|
+
@message = arg
|
35
36
|
end
|
36
37
|
end
|
37
38
|
|
@@ -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
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 7.2.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -62,6 +62,16 @@ module AuditApi
|
|
62
62
|
# Defines the access token (Bearer) used with OAuth2.
|
63
63
|
attr_accessor :access_token
|
64
64
|
|
65
|
+
# Defines a Proc used to fetch or refresh access tokens (Bearer) used with OAuth2.
|
66
|
+
# Overrides the access_token if set
|
67
|
+
# @return [Proc]
|
68
|
+
attr_accessor :access_token_getter
|
69
|
+
|
70
|
+
# Set this to return data as binary instead of downloading a temp file. When enabled (set to true)
|
71
|
+
# HTTP responses with return type `File` will be returned as a stream of binary data.
|
72
|
+
# Default to false.
|
73
|
+
attr_accessor :return_binary_data
|
74
|
+
|
65
75
|
# Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
|
66
76
|
# details will be logged with `logger.debug` (see the `logger` attribute).
|
67
77
|
# Default to false.
|
@@ -142,7 +152,7 @@ module AuditApi
|
|
142
152
|
@scheme = 'https'
|
143
153
|
@host = 'api.phoenixnap.com'
|
144
154
|
@base_path = '/audit/v1'
|
145
|
-
@server_index =
|
155
|
+
@server_index = nil
|
146
156
|
@server_operation_index = {}
|
147
157
|
@server_variables = {}
|
148
158
|
@server_operation_variables = {}
|
@@ -190,10 +200,12 @@ module AuditApi
|
|
190
200
|
|
191
201
|
# Returns base URL for specified operation based on server settings
|
192
202
|
def base_url(operation = nil)
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
203
|
+
if operation_server_settings.key?(operation) then
|
204
|
+
index = server_operation_index.fetch(operation, server_index)
|
205
|
+
server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
|
206
|
+
else
|
207
|
+
server_index.nil? ? "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') : server_url(server_index, server_variables, nil)
|
208
|
+
end
|
197
209
|
end
|
198
210
|
|
199
211
|
# Gets API key (with prefix if set).
|
@@ -208,6 +220,12 @@ module AuditApi
|
|
208
220
|
end
|
209
221
|
end
|
210
222
|
|
223
|
+
# Gets access_token using access_token_getter or uses the static access_token
|
224
|
+
def access_token_with_refresh
|
225
|
+
return access_token if access_token_getter.nil?
|
226
|
+
access_token_getter.call
|
227
|
+
end
|
228
|
+
|
211
229
|
# Gets Basic Auth token string
|
212
230
|
def basic_auth_token
|
213
231
|
'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n")
|
@@ -221,7 +239,7 @@ module AuditApi
|
|
221
239
|
type: 'oauth2',
|
222
240
|
in: 'header',
|
223
241
|
key: 'Authorization',
|
224
|
-
value: "Bearer #{
|
242
|
+
value: "Bearer #{access_token_with_refresh}"
|
225
243
|
},
|
226
244
|
}
|
227
245
|
end
|
@@ -249,8 +267,8 @@ module AuditApi
|
|
249
267
|
servers = server_settings if servers == nil
|
250
268
|
|
251
269
|
# check array index out of bound
|
252
|
-
if (index < 0 || index >= servers.size)
|
253
|
-
fail ArgumentError, "Invalid index #{index} when selecting the server. Must be less than #{servers.size}"
|
270
|
+
if (index.nil? || index < 0 || index >= servers.size)
|
271
|
+
fail ArgumentError, "Invalid index #{index} when selecting the server. Must not be nil and must be less than #{servers.size}"
|
254
272
|
end
|
255
273
|
|
256
274
|
server = servers[index]
|
@@ -275,5 +293,6 @@ module AuditApi
|
|
275
293
|
url
|
276
294
|
end
|
277
295
|
|
296
|
+
|
278
297
|
end
|
279
298
|
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
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 7.2.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -65,6 +65,8 @@ module AuditApi
|
|
65
65
|
|
66
66
|
if attributes.key?(:'message')
|
67
67
|
self.message = attributes[:'message']
|
68
|
+
else
|
69
|
+
self.message = nil
|
68
70
|
end
|
69
71
|
|
70
72
|
if attributes.key?(:'validation_errors')
|
@@ -77,6 +79,7 @@ module AuditApi
|
|
77
79
|
# Show invalid properties with the reasons. Usually used together with valid?
|
78
80
|
# @return Array for valid properties with the reasons
|
79
81
|
def list_invalid_properties
|
82
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
80
83
|
invalid_properties = Array.new
|
81
84
|
if @message.nil?
|
82
85
|
invalid_properties.push('invalid value for "message", message cannot be nil.')
|
@@ -88,6 +91,7 @@ module AuditApi
|
|
88
91
|
# Check to see if the all the properties in the model are valid
|
89
92
|
# @return true if the model is valid
|
90
93
|
def valid?
|
94
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
91
95
|
return false if @message.nil?
|
92
96
|
true
|
93
97
|
end
|
@@ -117,37 +121,30 @@ module AuditApi
|
|
117
121
|
# @param [Hash] attributes Model attributes in the form of hash
|
118
122
|
# @return [Object] Returns the model itself
|
119
123
|
def self.build_from_hash(attributes)
|
120
|
-
new.build_from_hash(attributes)
|
121
|
-
end
|
122
|
-
|
123
|
-
# Builds the object from hash
|
124
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
125
|
-
# @return [Object] Returns the model itself
|
126
|
-
def build_from_hash(attributes)
|
127
124
|
return nil unless attributes.is_a?(Hash)
|
128
125
|
attributes = attributes.transform_keys(&:to_sym)
|
129
|
-
|
130
|
-
|
131
|
-
|
126
|
+
transformed_hash = {}
|
127
|
+
openapi_types.each_pair do |key, type|
|
128
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
129
|
+
transformed_hash["#{key}"] = nil
|
132
130
|
elsif type =~ /\AArray<(.*)>/i
|
133
131
|
# check to ensure the input is an array given that the attribute
|
134
132
|
# is documented as an array but the input is not
|
135
|
-
if attributes[
|
136
|
-
|
133
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
134
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
137
135
|
end
|
138
|
-
elsif !attributes[
|
139
|
-
|
136
|
+
elsif !attributes[attribute_map[key]].nil?
|
137
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
140
138
|
end
|
141
139
|
end
|
142
|
-
|
143
|
-
self
|
140
|
+
new(transformed_hash)
|
144
141
|
end
|
145
142
|
|
146
143
|
# Deserializes the data based on type
|
147
144
|
# @param string type Data type
|
148
145
|
# @param string value Value to be deserialized
|
149
146
|
# @return [Object] Deserialized data
|
150
|
-
def _deserialize(type, value)
|
147
|
+
def self._deserialize(type, value)
|
151
148
|
case type.to_sym
|
152
149
|
when :Time
|
153
150
|
Time.parse(value)
|
@@ -182,7 +179,7 @@ module AuditApi
|
|
182
179
|
else # model
|
183
180
|
# models (e.g. Pet) or oneOf
|
184
181
|
klass = AuditApi.const_get(type)
|
185
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
182
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
186
183
|
end
|
187
184
|
end
|
188
185
|
|
@@ -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
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 7.2.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -74,16 +74,21 @@ module AuditApi
|
|
74
74
|
|
75
75
|
if attributes.key?(:'timestamp')
|
76
76
|
self.timestamp = attributes[:'timestamp']
|
77
|
+
else
|
78
|
+
self.timestamp = nil
|
77
79
|
end
|
78
80
|
|
79
81
|
if attributes.key?(:'user_info')
|
80
82
|
self.user_info = attributes[:'user_info']
|
83
|
+
else
|
84
|
+
self.user_info = nil
|
81
85
|
end
|
82
86
|
end
|
83
87
|
|
84
88
|
# Show invalid properties with the reasons. Usually used together with valid?
|
85
89
|
# @return Array for valid properties with the reasons
|
86
90
|
def list_invalid_properties
|
91
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
87
92
|
invalid_properties = Array.new
|
88
93
|
if @timestamp.nil?
|
89
94
|
invalid_properties.push('invalid value for "timestamp", timestamp cannot be nil.')
|
@@ -99,6 +104,7 @@ module AuditApi
|
|
99
104
|
# Check to see if the all the properties in the model are valid
|
100
105
|
# @return true if the model is valid
|
101
106
|
def valid?
|
107
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
102
108
|
return false if @timestamp.nil?
|
103
109
|
return false if @user_info.nil?
|
104
110
|
true
|
@@ -130,37 +136,30 @@ module AuditApi
|
|
130
136
|
# @param [Hash] attributes Model attributes in the form of hash
|
131
137
|
# @return [Object] Returns the model itself
|
132
138
|
def self.build_from_hash(attributes)
|
133
|
-
new.build_from_hash(attributes)
|
134
|
-
end
|
135
|
-
|
136
|
-
# Builds the object from hash
|
137
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
138
|
-
# @return [Object] Returns the model itself
|
139
|
-
def build_from_hash(attributes)
|
140
139
|
return nil unless attributes.is_a?(Hash)
|
141
140
|
attributes = attributes.transform_keys(&:to_sym)
|
142
|
-
|
143
|
-
|
144
|
-
|
141
|
+
transformed_hash = {}
|
142
|
+
openapi_types.each_pair do |key, type|
|
143
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
144
|
+
transformed_hash["#{key}"] = nil
|
145
145
|
elsif type =~ /\AArray<(.*)>/i
|
146
146
|
# check to ensure the input is an array given that the attribute
|
147
147
|
# is documented as an array but the input is not
|
148
|
-
if attributes[
|
149
|
-
|
148
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
149
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
150
150
|
end
|
151
|
-
elsif !attributes[
|
152
|
-
|
151
|
+
elsif !attributes[attribute_map[key]].nil?
|
152
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
153
153
|
end
|
154
154
|
end
|
155
|
-
|
156
|
-
self
|
155
|
+
new(transformed_hash)
|
157
156
|
end
|
158
157
|
|
159
158
|
# Deserializes the data based on type
|
160
159
|
# @param string type Data type
|
161
160
|
# @param string value Value to be deserialized
|
162
161
|
# @return [Object] Deserialized data
|
163
|
-
def _deserialize(type, value)
|
162
|
+
def self._deserialize(type, value)
|
164
163
|
case type.to_sym
|
165
164
|
when :Time
|
166
165
|
Time.parse(value)
|
@@ -195,7 +194,7 @@ module AuditApi
|
|
195
194
|
else # model
|
196
195
|
# models (e.g. Pet) or oneOf
|
197
196
|
klass = AuditApi.const_get(type)
|
198
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
197
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
199
198
|
end
|
200
199
|
end
|
201
200
|
|
@@ -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
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 7.2.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -71,6 +71,8 @@ module AuditApi
|
|
71
71
|
|
72
72
|
if attributes.key?(:'account_id')
|
73
73
|
self.account_id = attributes[:'account_id']
|
74
|
+
else
|
75
|
+
self.account_id = nil
|
74
76
|
end
|
75
77
|
|
76
78
|
if attributes.key?(:'client_id')
|
@@ -79,12 +81,15 @@ module AuditApi
|
|
79
81
|
|
80
82
|
if attributes.key?(:'username')
|
81
83
|
self.username = attributes[:'username']
|
84
|
+
else
|
85
|
+
self.username = nil
|
82
86
|
end
|
83
87
|
end
|
84
88
|
|
85
89
|
# Show invalid properties with the reasons. Usually used together with valid?
|
86
90
|
# @return Array for valid properties with the reasons
|
87
91
|
def list_invalid_properties
|
92
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
88
93
|
invalid_properties = Array.new
|
89
94
|
if @account_id.nil?
|
90
95
|
invalid_properties.push('invalid value for "account_id", account_id cannot be nil.')
|
@@ -100,6 +105,7 @@ module AuditApi
|
|
100
105
|
# Check to see if the all the properties in the model are valid
|
101
106
|
# @return true if the model is valid
|
102
107
|
def valid?
|
108
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
103
109
|
return false if @account_id.nil?
|
104
110
|
return false if @username.nil?
|
105
111
|
true
|
@@ -131,37 +137,30 @@ module AuditApi
|
|
131
137
|
# @param [Hash] attributes Model attributes in the form of hash
|
132
138
|
# @return [Object] Returns the model itself
|
133
139
|
def self.build_from_hash(attributes)
|
134
|
-
new.build_from_hash(attributes)
|
135
|
-
end
|
136
|
-
|
137
|
-
# Builds the object from hash
|
138
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
139
|
-
# @return [Object] Returns the model itself
|
140
|
-
def build_from_hash(attributes)
|
141
140
|
return nil unless attributes.is_a?(Hash)
|
142
141
|
attributes = attributes.transform_keys(&:to_sym)
|
143
|
-
|
144
|
-
|
145
|
-
|
142
|
+
transformed_hash = {}
|
143
|
+
openapi_types.each_pair do |key, type|
|
144
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
145
|
+
transformed_hash["#{key}"] = nil
|
146
146
|
elsif type =~ /\AArray<(.*)>/i
|
147
147
|
# check to ensure the input is an array given that the attribute
|
148
148
|
# is documented as an array but the input is not
|
149
|
-
if attributes[
|
150
|
-
|
149
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
150
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
151
151
|
end
|
152
|
-
elsif !attributes[
|
153
|
-
|
152
|
+
elsif !attributes[attribute_map[key]].nil?
|
153
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
154
154
|
end
|
155
155
|
end
|
156
|
-
|
157
|
-
self
|
156
|
+
new(transformed_hash)
|
158
157
|
end
|
159
158
|
|
160
159
|
# Deserializes the data based on type
|
161
160
|
# @param string type Data type
|
162
161
|
# @param string value Value to be deserialized
|
163
162
|
# @return [Object] Deserialized data
|
164
|
-
def _deserialize(type, value)
|
163
|
+
def self._deserialize(type, value)
|
165
164
|
case type.to_sym
|
166
165
|
when :Time
|
167
166
|
Time.parse(value)
|
@@ -196,7 +195,7 @@ module AuditApi
|
|
196
195
|
else # model
|
197
196
|
# models (e.g. Pet) or oneOf
|
198
197
|
klass = AuditApi.const_get(type)
|
199
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
198
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
200
199
|
end
|
201
200
|
end
|
202
201
|
|
data/lib/pnap_audit_api.rb
CHANGED
data/pnap_audit_api.gemspec
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
The version of the OpenAPI document: 1.0
|
9
9
|
Contact: support@phoenixnap.com
|
10
10
|
Generated by: https://openapi-generator.tech
|
11
|
-
OpenAPI Generator version:
|
11
|
+
OpenAPI Generator version: 7.2.0
|
12
12
|
|
13
13
|
=end
|
14
14
|
|
@@ -25,7 +25,7 @@ Gem::Specification.new do |s|
|
|
25
25
|
s.summary = "Audit Log API Ruby Gem"
|
26
26
|
s.description = "Audit Log API Ruby Gem"
|
27
27
|
s.license = "MPL-2.0"
|
28
|
-
s.required_ruby_version = ">= 2.
|
28
|
+
s.required_ruby_version = ">= 2.7"
|
29
29
|
s.metadata = { "source_code_uri" => "https://github.com/phoenixnap/ruby-sdk-bmc" }
|
30
30
|
|
31
31
|
s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
|
data/spec/api/events_api_spec.rb
CHANGED
@@ -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
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 7.2.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -46,7 +46,7 @@ describe 'EventsApi' do
|
|
46
46
|
# @return [Array<Event>]
|
47
47
|
describe 'events_get test' do
|
48
48
|
it 'should work' do
|
49
|
-
# assertion here. ref: https://
|
49
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
data/spec/models/error_spec.rb
CHANGED
@@ -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
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 7.2.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -22,18 +22,20 @@ describe AuditApi::Error do
|
|
22
22
|
|
23
23
|
describe 'test an instance of Error' do
|
24
24
|
it 'should create an instance of Error' do
|
25
|
-
|
25
|
+
# uncomment below to test the instance creation
|
26
|
+
#expect(instance).to be_instance_of(AuditApi::Error)
|
26
27
|
end
|
27
28
|
end
|
29
|
+
|
28
30
|
describe 'test attribute "message"' do
|
29
31
|
it 'should work' do
|
30
|
-
# assertion here. ref: https://
|
32
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
31
33
|
end
|
32
34
|
end
|
33
35
|
|
34
36
|
describe 'test attribute "validation_errors"' do
|
35
37
|
it 'should work' do
|
36
|
-
# assertion here. ref: https://
|
38
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
37
39
|
end
|
38
40
|
end
|
39
41
|
|