pnap_tag_api 1.0.5 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ea07744c22aafb6771923bb6094f342641d4faa3f8477e80988376d0e2b82e06
4
- data.tar.gz: 9b905adb4fa2a62b96da6eca4681956c5060a30fe370212ce65399f4616067ed
3
+ metadata.gz: '012924e6400941a60779b30c1525befdb629fb7ee3f1441100f3c6cb618facd5'
4
+ data.tar.gz: 6a0f229ac00297dbce7d2f1403e205862a24c57069ecc09d475d8cce0716eaac
5
5
  SHA512:
6
- metadata.gz: 2e7bc30913833576908159a4f78322aeb693f4a4b4bbb50358eb0d1890ad376b5c729c7fa3f71ebc1c66e40501726b81d23ece3dff2d7dce53673e814aeed494
7
- data.tar.gz: 7988e3725d3cdc9975a8628b772cfb1fa1633e4836624e40d727f42c0b0c9edc1fa14c8b2727a4eedd3ba73a410e52b8f4835bcc52163fa340902a0fe02d9090
6
+ metadata.gz: 969d28560b37d9d6def34175bbed350f963c297d6542120cd189a48d52bc71f27d3710a5bc6b66d7129ef000764db0136237e27038092a9614b00865d6ca3d5f
7
+ data.tar.gz: 073d14e4125947069f738fe4fb9d0303c07f3654fdd153de376ae6613fd052681af08d5c62e7173cff68d8f900123b1d4fffc4484acc521847577205ba946b23
data/README.md CHANGED
@@ -75,6 +75,8 @@ require 'pnap_tag_api'
75
75
  TagApi.configure do |config|
76
76
  # Configure OAuth2 access token for authorization: OAuth2
77
77
  config.access_token = 'YOUR ACCESS TOKEN'
78
+ # Configure a proc to get access tokens in lieu of the static access_token configuration
79
+ config.access_token_getter = -> { 'YOUR TOKEN GETTER PROC' }
78
80
  end
79
81
 
80
82
  api_instance = TagApi::TagsApi.new
@@ -143,6 +145,7 @@ Class | Method | HTTP request | Description
143
145
  ## Documentation for Authorization
144
146
 
145
147
 
148
+ Authentication schemes defined for the API:
146
149
  ### OAuth2
147
150
 
148
151
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.5
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: 6.1.0
9
+ OpenAPI Generator version: 7.2.0
10
10
 
11
11
  =end
12
12
 
@@ -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: 6.1.0
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 TagApi
21
22
  class ApiClient
22
23
  # The Configuration object holding settings to be used in the API client.
@@ -31,6 +32,7 @@ module TagApi
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/#{ TagApi::VERSION }"
35
37
  @powered_by = "PNAP-ruby-sdk-bmc/#{ TagApi::VERSION }"
36
38
  @default_headers = {
@@ -47,9 +49,10 @@ module TagApi
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 (could be nil), response status code and response headers.
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 TagApi
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 TagApi
127
132
  end
128
133
  end
129
134
 
130
- request = Typhoeus::Request.new(url, req_opts)
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 TagApi
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 TagApi
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.on_complete do |response|
191
- if tempfile
192
- tempfile.close
193
- @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
194
- "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
195
- "will be deleted automatically with GC. It's also recommended to delete the temp file "\
196
- "explicitly with `tempfile.delete`"
197
- end
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 TagApi
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: 6.1.0
9
+ OpenAPI Generator version: 7.2.0
10
10
 
11
11
  =end
12
12
 
@@ -32,6 +32,7 @@ module TagApi
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: 6.1.0
9
+ OpenAPI Generator version: 7.2.0
10
10
 
11
11
  =end
12
12
 
@@ -62,6 +62,16 @@ module TagApi
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 TagApi
142
152
  @scheme = 'https'
143
153
  @host = 'api.phoenixnap.com'
144
154
  @base_path = '/tag-manager/v1'
145
- @server_index = 0
155
+ @server_index = nil
146
156
  @server_operation_index = {}
147
157
  @server_variables = {}
148
158
  @server_operation_variables = {}
@@ -190,10 +200,12 @@ module TagApi
190
200
 
191
201
  # Returns base URL for specified operation based on server settings
192
202
  def base_url(operation = nil)
193
- index = server_operation_index.fetch(operation, server_index)
194
- return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if index == nil
195
-
196
- server_url(index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
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 TagApi
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 TagApi
221
239
  type: 'oauth2',
222
240
  in: 'header',
223
241
  key: 'Authorization',
224
- value: "Bearer #{access_token}"
242
+ value: "Bearer #{access_token_with_refresh}"
225
243
  },
226
244
  }
227
245
  end
@@ -249,8 +267,8 @@ module TagApi
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 TagApi
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: 6.1.0
9
+ OpenAPI Generator version: 7.2.0
10
10
 
11
11
  =end
12
12
 
@@ -66,16 +66,21 @@ module TagApi
66
66
 
67
67
  if attributes.key?(:'result')
68
68
  self.result = attributes[:'result']
69
+ else
70
+ self.result = nil
69
71
  end
70
72
 
71
73
  if attributes.key?(:'tag_id')
72
74
  self.tag_id = attributes[:'tag_id']
75
+ else
76
+ self.tag_id = nil
73
77
  end
74
78
  end
75
79
 
76
80
  # Show invalid properties with the reasons. Usually used together with valid?
77
81
  # @return Array for valid properties with the reasons
78
82
  def list_invalid_properties
83
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
79
84
  invalid_properties = Array.new
80
85
  if @result.nil?
81
86
  invalid_properties.push('invalid value for "result", result cannot be nil.')
@@ -91,6 +96,7 @@ module TagApi
91
96
  # Check to see if the all the properties in the model are valid
92
97
  # @return true if the model is valid
93
98
  def valid?
99
+ warn '[DEPRECATED] the `valid?` method is obsolete'
94
100
  return false if @result.nil?
95
101
  return false if @tag_id.nil?
96
102
  true
@@ -121,37 +127,30 @@ module TagApi
121
127
  # @param [Hash] attributes Model attributes in the form of hash
122
128
  # @return [Object] Returns the model itself
123
129
  def self.build_from_hash(attributes)
124
- new.build_from_hash(attributes)
125
- end
126
-
127
- # Builds the object from hash
128
- # @param [Hash] attributes Model attributes in the form of hash
129
- # @return [Object] Returns the model itself
130
- def build_from_hash(attributes)
131
130
  return nil unless attributes.is_a?(Hash)
132
131
  attributes = attributes.transform_keys(&:to_sym)
133
- self.class.openapi_types.each_pair do |key, type|
134
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
135
- self.send("#{key}=", nil)
132
+ transformed_hash = {}
133
+ openapi_types.each_pair do |key, type|
134
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
135
+ transformed_hash["#{key}"] = nil
136
136
  elsif type =~ /\AArray<(.*)>/i
137
137
  # check to ensure the input is an array given that the attribute
138
138
  # is documented as an array but the input is not
139
- if attributes[self.class.attribute_map[key]].is_a?(Array)
140
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
139
+ if attributes[attribute_map[key]].is_a?(Array)
140
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
141
141
  end
142
- elsif !attributes[self.class.attribute_map[key]].nil?
143
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
142
+ elsif !attributes[attribute_map[key]].nil?
143
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
144
144
  end
145
145
  end
146
-
147
- self
146
+ new(transformed_hash)
148
147
  end
149
148
 
150
149
  # Deserializes the data based on type
151
150
  # @param string type Data type
152
151
  # @param string value Value to be deserialized
153
152
  # @return [Object] Deserialized data
154
- def _deserialize(type, value)
153
+ def self._deserialize(type, value)
155
154
  case type.to_sym
156
155
  when :Time
157
156
  Time.parse(value)
@@ -186,7 +185,7 @@ module TagApi
186
185
  else # model
187
186
  # models (e.g. Pet) or oneOf
188
187
  klass = TagApi.const_get(type)
189
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
188
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
190
189
  end
191
190
  end
192
191
 
@@ -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: 6.1.0
9
+ OpenAPI Generator version: 7.2.0
10
10
 
11
11
  =end
12
12
 
@@ -65,6 +65,8 @@ module TagApi
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 TagApi
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 TagApi
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 TagApi
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
- self.class.openapi_types.each_pair do |key, type|
130
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
131
- self.send("#{key}=", nil)
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[self.class.attribute_map[key]].is_a?(Array)
136
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
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[self.class.attribute_map[key]].nil?
139
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
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 TagApi
182
179
  else # model
183
180
  # models (e.g. Pet) or oneOf
184
181
  klass = TagApi.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: 6.1.0
9
+ OpenAPI Generator version: 7.2.0
10
10
 
11
11
  =end
12
12
 
@@ -66,6 +66,8 @@ module TagApi
66
66
 
67
67
  if attributes.key?(:'resource_name')
68
68
  self.resource_name = attributes[:'resource_name']
69
+ else
70
+ self.resource_name = nil
69
71
  end
70
72
 
71
73
  if attributes.key?(:'value')
@@ -76,6 +78,7 @@ module TagApi
76
78
  # Show invalid properties with the reasons. Usually used together with valid?
77
79
  # @return Array for valid properties with the reasons
78
80
  def list_invalid_properties
81
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
79
82
  invalid_properties = Array.new
80
83
  if @resource_name.nil?
81
84
  invalid_properties.push('invalid value for "resource_name", resource_name cannot be nil.')
@@ -87,6 +90,7 @@ module TagApi
87
90
  # Check to see if the all the properties in the model are valid
88
91
  # @return true if the model is valid
89
92
  def valid?
93
+ warn '[DEPRECATED] the `valid?` method is obsolete'
90
94
  return false if @resource_name.nil?
91
95
  true
92
96
  end
@@ -116,37 +120,30 @@ module TagApi
116
120
  # @param [Hash] attributes Model attributes in the form of hash
117
121
  # @return [Object] Returns the model itself
118
122
  def self.build_from_hash(attributes)
119
- new.build_from_hash(attributes)
120
- end
121
-
122
- # Builds the object from hash
123
- # @param [Hash] attributes Model attributes in the form of hash
124
- # @return [Object] Returns the model itself
125
- def build_from_hash(attributes)
126
123
  return nil unless attributes.is_a?(Hash)
127
124
  attributes = attributes.transform_keys(&:to_sym)
128
- self.class.openapi_types.each_pair do |key, type|
129
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
130
- self.send("#{key}=", nil)
125
+ transformed_hash = {}
126
+ openapi_types.each_pair do |key, type|
127
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
128
+ transformed_hash["#{key}"] = nil
131
129
  elsif type =~ /\AArray<(.*)>/i
132
130
  # check to ensure the input is an array given that the attribute
133
131
  # is documented as an array but the input is not
134
- if attributes[self.class.attribute_map[key]].is_a?(Array)
135
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
132
+ if attributes[attribute_map[key]].is_a?(Array)
133
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
136
134
  end
137
- elsif !attributes[self.class.attribute_map[key]].nil?
138
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
135
+ elsif !attributes[attribute_map[key]].nil?
136
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
139
137
  end
140
138
  end
141
-
142
- self
139
+ new(transformed_hash)
143
140
  end
144
141
 
145
142
  # Deserializes the data based on type
146
143
  # @param string type Data type
147
144
  # @param string value Value to be deserialized
148
145
  # @return [Object] Deserialized data
149
- def _deserialize(type, value)
146
+ def self._deserialize(type, value)
150
147
  case type.to_sym
151
148
  when :Time
152
149
  Time.parse(value)
@@ -181,7 +178,7 @@ module TagApi
181
178
  else # model
182
179
  # models (e.g. Pet) or oneOf
183
180
  klass = TagApi.const_get(type)
184
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
181
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
185
182
  end
186
183
  end
187
184
 
@@ -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: 6.1.0
9
+ OpenAPI Generator version: 7.2.0
10
10
 
11
11
  =end
12
12
 
@@ -113,10 +113,14 @@ module TagApi
113
113
 
114
114
  if attributes.key?(:'id')
115
115
  self.id = attributes[:'id']
116
+ else
117
+ self.id = nil
116
118
  end
117
119
 
118
120
  if attributes.key?(:'name')
119
121
  self.name = attributes[:'name']
122
+ else
123
+ self.name = nil
120
124
  end
121
125
 
122
126
  if attributes.key?(:'values')
@@ -131,6 +135,8 @@ module TagApi
131
135
 
132
136
  if attributes.key?(:'is_billing_tag')
133
137
  self.is_billing_tag = attributes[:'is_billing_tag']
138
+ else
139
+ self.is_billing_tag = nil
134
140
  end
135
141
 
136
142
  if attributes.key?(:'resource_assignments')
@@ -149,6 +155,7 @@ module TagApi
149
155
  # Show invalid properties with the reasons. Usually used together with valid?
150
156
  # @return Array for valid properties with the reasons
151
157
  def list_invalid_properties
158
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
152
159
  invalid_properties = Array.new
153
160
  if @id.nil?
154
161
  invalid_properties.push('invalid value for "id", id cannot be nil.')
@@ -168,6 +175,7 @@ module TagApi
168
175
  # Check to see if the all the properties in the model are valid
169
176
  # @return true if the model is valid
170
177
  def valid?
178
+ warn '[DEPRECATED] the `valid?` method is obsolete'
171
179
  return false if @id.nil?
172
180
  return false if @name.nil?
173
181
  return false if @is_billing_tag.nil?
@@ -216,37 +224,30 @@ module TagApi
216
224
  # @param [Hash] attributes Model attributes in the form of hash
217
225
  # @return [Object] Returns the model itself
218
226
  def self.build_from_hash(attributes)
219
- new.build_from_hash(attributes)
220
- end
221
-
222
- # Builds the object from hash
223
- # @param [Hash] attributes Model attributes in the form of hash
224
- # @return [Object] Returns the model itself
225
- def build_from_hash(attributes)
226
227
  return nil unless attributes.is_a?(Hash)
227
228
  attributes = attributes.transform_keys(&:to_sym)
228
- self.class.openapi_types.each_pair do |key, type|
229
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
230
- self.send("#{key}=", nil)
229
+ transformed_hash = {}
230
+ openapi_types.each_pair do |key, type|
231
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
232
+ transformed_hash["#{key}"] = nil
231
233
  elsif type =~ /\AArray<(.*)>/i
232
234
  # check to ensure the input is an array given that the attribute
233
235
  # is documented as an array but the input is not
234
- if attributes[self.class.attribute_map[key]].is_a?(Array)
235
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
236
+ if attributes[attribute_map[key]].is_a?(Array)
237
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
236
238
  end
237
- elsif !attributes[self.class.attribute_map[key]].nil?
238
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
239
+ elsif !attributes[attribute_map[key]].nil?
240
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
239
241
  end
240
242
  end
241
-
242
- self
243
+ new(transformed_hash)
243
244
  end
244
245
 
245
246
  # Deserializes the data based on type
246
247
  # @param string type Data type
247
248
  # @param string value Value to be deserialized
248
249
  # @return [Object] Deserialized data
249
- def _deserialize(type, value)
250
+ def self._deserialize(type, value)
250
251
  case type.to_sym
251
252
  when :Time
252
253
  Time.parse(value)
@@ -281,7 +282,7 @@ module TagApi
281
282
  else # model
282
283
  # models (e.g. Pet) or oneOf
283
284
  klass = TagApi.const_get(type)
284
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
285
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
285
286
  end
286
287
  end
287
288