pnap_location_api 1.0.0 → 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: ab7be44e474a0ef90f27d40ffd6c315fb7d2c092168bc7fd9fb0c466dad109b2
4
- data.tar.gz: bf01c02c183f80d47d1e72a2203c10e75a4b5009a220e39b8d0a7050b1dafbd5
3
+ metadata.gz: '0595e6b6f3142edebc7e74d829d95c753ec98aca9e9e06fbee9228126f3498dc'
4
+ data.tar.gz: 4370714669cbabc356e78d2821c8b8d7201f382f76964f9cb75e2e54b2d2c08b
5
5
  SHA512:
6
- metadata.gz: 52e5bb9b67dd0ff803e0e8c919a80812b36f7fef87d8dc9a0e04792cba701493e54d54b532b4f24317a685232514fc91cbbb5eed54ad80841c84817c0f31c981
7
- data.tar.gz: 4d451141a1025e8af54cfad191871aa5107ca6628bd9436279f7b3ff9338589892d157d4a6fd87ae68f9b7f8968197c31506519b6da9a4677cf9f3b263c880cd
6
+ metadata.gz: 46297aec02f5b5798446f9b56ceae13523c85dc4ec80845d2f40837988cb124a3626e8c0765f81f7e5f7a313972a57390751c95c38d7bfb80f3341a9362055ed
7
+ data.tar.gz: 9db51a10dbcc79d5e21464f3608911589f83d157c1d4ef8e16848a15abdac854709abb03a775d852f4333ca3e27f8d324b5879d5e706282f8bdaf6a5c71b00ec
data/README.md CHANGED
@@ -112,5 +112,5 @@ Class | Method | HTTP request | Description
112
112
 
113
113
  ## Documentation for Authorization
114
114
 
115
- All endpoints do not require authorization.
115
+ Endpoints do not require authorization.
116
116
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
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 LocationApi
21
22
  class ApiClient
22
23
  # The Configuration object holding settings to be used in the API client.
@@ -31,6 +32,7 @@ module LocationApi
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/#{ LocationApi::VERSION }"
35
37
  @powered_by = "PNAP-ruby-sdk-bmc/#{ LocationApi::VERSION }"
36
38
  @default_headers = {
@@ -47,9 +49,10 @@ module LocationApi
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 LocationApi
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
@@ -126,9 +131,7 @@ module LocationApi
126
131
  end
127
132
  end
128
133
 
129
- request = Typhoeus::Request.new(url, req_opts)
130
- download_file(request) if opts[:return_type] == 'File'
131
- request
134
+ Typhoeus::Request.new(url, req_opts)
132
135
  end
133
136
 
134
137
  # Builds the HTTP request body
@@ -166,6 +169,8 @@ module LocationApi
166
169
  # process can use.
167
170
  #
168
171
  # @see Configuration#temp_folder_path
172
+ #
173
+ # @return [Tempfile] the tempfile generated
169
174
  def download_file(request)
170
175
  tempfile = nil
171
176
  encoding = nil
@@ -180,21 +185,24 @@ module LocationApi
180
185
  prefix = prefix + '-' unless prefix.end_with?('-')
181
186
  encoding = response.body.encoding
182
187
  tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
183
- @tempfile = tempfile
184
188
  end
185
189
  request.on_body do |chunk|
186
190
  chunk.force_encoding(encoding)
187
191
  tempfile.write(chunk)
188
192
  end
189
- request.on_complete do |response|
190
- if tempfile
191
- tempfile.close
192
- @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
193
- "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
194
- "will be deleted automatically with GC. It's also recommended to delete the temp file "\
195
- "explicitly with `tempfile.delete`"
196
- end
193
+ # run the request to ensure the tempfile is created successfully before returning it
194
+ request.run
195
+ if tempfile
196
+ tempfile.close
197
+ @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
198
+ "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
199
+ "will be deleted automatically with GC. It's also recommended to delete the temp file "\
200
+ "explicitly with `tempfile.delete`"
201
+ else
202
+ fail ApiError.new("Failed to create the tempfile based on the HTTP response from the server: #{request.inspect}")
197
203
  end
204
+
205
+ tempfile
198
206
  end
199
207
 
200
208
  # Check if the given MIME is a JSON MIME.
@@ -215,15 +223,10 @@ module LocationApi
215
223
  # @param [String] return_type some examples: "User", "Array<User>", "Hash<String, Integer>"
216
224
  def deserialize(response, return_type)
217
225
  body = response.body
218
-
219
- # handle file downloading - return the File instance processed in request callbacks
220
- # note that response body is empty when the file is written in chunks in request on_body callback
221
- return @tempfile if return_type == 'File'
222
-
223
226
  return nil if body.nil? || body.empty?
224
227
 
225
228
  # return response body directly for String return type
226
- return body if return_type == 'String'
229
+ return body.to_s if return_type == 'String'
227
230
 
228
231
  # ensuring a default content type
229
232
  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 LocationApi
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 LocationApi
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 LocationApi
142
152
  @scheme = 'https'
143
153
  @host = 'api.phoenixnap.com'
144
154
  @base_path = '/location-api/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 LocationApi
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 LocationApi
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")
@@ -242,8 +260,8 @@ module LocationApi
242
260
  servers = server_settings if servers == nil
243
261
 
244
262
  # check array index out of bound
245
- if (index < 0 || index >= servers.size)
246
- fail ArgumentError, "Invalid index #{index} when selecting the server. Must be less than #{servers.size}"
263
+ if (index.nil? || index < 0 || index >= servers.size)
264
+ fail ArgumentError, "Invalid index #{index} when selecting the server. Must not be nil and must be less than #{servers.size}"
247
265
  end
248
266
 
249
267
  server = servers[index]
@@ -268,5 +286,6 @@ module LocationApi
268
286
  url
269
287
  end
270
288
 
289
+
271
290
  end
272
291
  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
 
@@ -65,6 +65,8 @@ module LocationApi
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 LocationApi
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 LocationApi
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 LocationApi
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 LocationApi
182
179
  else # model
183
180
  # models (e.g. Pet) or oneOf
184
181
  klass = LocationApi.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
 
@@ -22,6 +22,28 @@ module LocationApi
22
22
 
23
23
  attr_accessor :product_categories
24
24
 
25
+ class EnumAttributeValidator
26
+ attr_reader :datatype
27
+ attr_reader :allowable_values
28
+
29
+ def initialize(datatype, allowable_values)
30
+ @allowable_values = allowable_values.map do |value|
31
+ case datatype.to_s
32
+ when /Integer/i
33
+ value.to_i
34
+ when /Float/i
35
+ value.to_f
36
+ else
37
+ value
38
+ end
39
+ end
40
+ end
41
+
42
+ def valid?(value)
43
+ !value || allowable_values.include?(value)
44
+ end
45
+ end
46
+
25
47
  # Attribute mapping from ruby-style variable name to JSON key.
26
48
  def self.attribute_map
27
49
  {
@@ -68,6 +90,8 @@ module LocationApi
68
90
 
69
91
  if attributes.key?(:'location')
70
92
  self.location = attributes[:'location']
93
+ else
94
+ self.location = nil
71
95
  end
72
96
 
73
97
  if attributes.key?(:'location_description')
@@ -84,6 +108,7 @@ module LocationApi
84
108
  # Show invalid properties with the reasons. Usually used together with valid?
85
109
  # @return Array for valid properties with the reasons
86
110
  def list_invalid_properties
111
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
87
112
  invalid_properties = Array.new
88
113
  if @location.nil?
89
114
  invalid_properties.push('invalid value for "location", location cannot be nil.')
@@ -95,6 +120,7 @@ module LocationApi
95
120
  # Check to see if the all the properties in the model are valid
96
121
  # @return true if the model is valid
97
122
  def valid?
123
+ warn '[DEPRECATED] the `valid?` method is obsolete'
98
124
  return false if @location.nil?
99
125
  true
100
126
  end
@@ -125,37 +151,30 @@ module LocationApi
125
151
  # @param [Hash] attributes Model attributes in the form of hash
126
152
  # @return [Object] Returns the model itself
127
153
  def self.build_from_hash(attributes)
128
- new.build_from_hash(attributes)
129
- end
130
-
131
- # Builds the object from hash
132
- # @param [Hash] attributes Model attributes in the form of hash
133
- # @return [Object] Returns the model itself
134
- def build_from_hash(attributes)
135
154
  return nil unless attributes.is_a?(Hash)
136
155
  attributes = attributes.transform_keys(&:to_sym)
137
- self.class.openapi_types.each_pair do |key, type|
138
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
139
- self.send("#{key}=", nil)
156
+ transformed_hash = {}
157
+ openapi_types.each_pair do |key, type|
158
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
159
+ transformed_hash["#{key}"] = nil
140
160
  elsif type =~ /\AArray<(.*)>/i
141
161
  # check to ensure the input is an array given that the attribute
142
162
  # is documented as an array but the input is not
143
- if attributes[self.class.attribute_map[key]].is_a?(Array)
144
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
163
+ if attributes[attribute_map[key]].is_a?(Array)
164
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
145
165
  end
146
- elsif !attributes[self.class.attribute_map[key]].nil?
147
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
166
+ elsif !attributes[attribute_map[key]].nil?
167
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
148
168
  end
149
169
  end
150
-
151
- self
170
+ new(transformed_hash)
152
171
  end
153
172
 
154
173
  # Deserializes the data based on type
155
174
  # @param string type Data type
156
175
  # @param string value Value to be deserialized
157
176
  # @return [Object] Deserialized data
158
- def _deserialize(type, value)
177
+ def self._deserialize(type, value)
159
178
  case type.to_sym
160
179
  when :Time
161
180
  Time.parse(value)
@@ -190,7 +209,7 @@ module LocationApi
190
209
  else # model
191
210
  # models (e.g. Pet) or oneOf
192
211
  klass = LocationApi.const_get(type)
193
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
212
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
194
213
  end
195
214
  end
196
215
 
@@ -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
 
@@ -23,6 +23,10 @@ module LocationApi
23
23
  SEA = "SEA".freeze
24
24
  AUS = "AUS".freeze
25
25
 
26
+ def self.all_vars
27
+ @all_vars ||= [PHX, ASH, NLD, SGP, CHI, SEA, AUS].freeze
28
+ end
29
+
26
30
  # Builds the enum from string
27
31
  # @param [String] The enum value in the form of the string
28
32
  # @return [String] The enum value
@@ -34,9 +38,8 @@ module LocationApi
34
38
  # @param [String] The enum value in the form of the string
35
39
  # @return [String] The enum value
36
40
  def build_from_hash(value)
37
- constantValues = LocationEnum.constants.select { |c| LocationEnum::const_get(c) == value }
38
- raise "Invalid ENUM value #{value} for class #LocationEnum" if constantValues.empty?
39
- value
41
+ return value if LocationEnum.all_vars.include?(value)
42
+ raise "Invalid ENUM value #{value} for class #LocationEnum"
40
43
  end
41
44
  end
42
45
  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
 
@@ -19,6 +19,28 @@ module LocationApi
19
19
 
20
20
  attr_accessor :product_category_description
21
21
 
22
+ class EnumAttributeValidator
23
+ attr_reader :datatype
24
+ attr_reader :allowable_values
25
+
26
+ def initialize(datatype, allowable_values)
27
+ @allowable_values = allowable_values.map do |value|
28
+ case datatype.to_s
29
+ when /Integer/i
30
+ value.to_i
31
+ when /Float/i
32
+ value.to_f
33
+ else
34
+ value
35
+ end
36
+ end
37
+ end
38
+
39
+ def valid?(value)
40
+ !value || allowable_values.include?(value)
41
+ end
42
+ end
43
+
22
44
  # Attribute mapping from ruby-style variable name to JSON key.
23
45
  def self.attribute_map
24
46
  {
@@ -63,6 +85,8 @@ module LocationApi
63
85
 
64
86
  if attributes.key?(:'product_category')
65
87
  self.product_category = attributes[:'product_category']
88
+ else
89
+ self.product_category = nil
66
90
  end
67
91
 
68
92
  if attributes.key?(:'product_category_description')
@@ -73,6 +97,7 @@ module LocationApi
73
97
  # Show invalid properties with the reasons. Usually used together with valid?
74
98
  # @return Array for valid properties with the reasons
75
99
  def list_invalid_properties
100
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
76
101
  invalid_properties = Array.new
77
102
  if @product_category.nil?
78
103
  invalid_properties.push('invalid value for "product_category", product_category cannot be nil.')
@@ -84,6 +109,7 @@ module LocationApi
84
109
  # Check to see if the all the properties in the model are valid
85
110
  # @return true if the model is valid
86
111
  def valid?
112
+ warn '[DEPRECATED] the `valid?` method is obsolete'
87
113
  return false if @product_category.nil?
88
114
  true
89
115
  end
@@ -113,37 +139,30 @@ module LocationApi
113
139
  # @param [Hash] attributes Model attributes in the form of hash
114
140
  # @return [Object] Returns the model itself
115
141
  def self.build_from_hash(attributes)
116
- new.build_from_hash(attributes)
117
- end
118
-
119
- # Builds the object from hash
120
- # @param [Hash] attributes Model attributes in the form of hash
121
- # @return [Object] Returns the model itself
122
- def build_from_hash(attributes)
123
142
  return nil unless attributes.is_a?(Hash)
124
143
  attributes = attributes.transform_keys(&:to_sym)
125
- self.class.openapi_types.each_pair do |key, type|
126
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
127
- self.send("#{key}=", nil)
144
+ transformed_hash = {}
145
+ openapi_types.each_pair do |key, type|
146
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
147
+ transformed_hash["#{key}"] = nil
128
148
  elsif type =~ /\AArray<(.*)>/i
129
149
  # check to ensure the input is an array given that the attribute
130
150
  # is documented as an array but the input is not
131
- if attributes[self.class.attribute_map[key]].is_a?(Array)
132
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
151
+ if attributes[attribute_map[key]].is_a?(Array)
152
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
133
153
  end
134
- elsif !attributes[self.class.attribute_map[key]].nil?
135
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
154
+ elsif !attributes[attribute_map[key]].nil?
155
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
136
156
  end
137
157
  end
138
-
139
- self
158
+ new(transformed_hash)
140
159
  end
141
160
 
142
161
  # Deserializes the data based on type
143
162
  # @param string type Data type
144
163
  # @param string value Value to be deserialized
145
164
  # @return [Object] Deserialized data
146
- def _deserialize(type, value)
165
+ def self._deserialize(type, value)
147
166
  case type.to_sym
148
167
  when :Time
149
168
  Time.parse(value)
@@ -178,7 +197,7 @@ module LocationApi
178
197
  else # model
179
198
  # models (e.g. Pet) or oneOf
180
199
  klass = LocationApi.const_get(type)
181
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
200
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
182
201
  end
183
202
  end
184
203
 
@@ -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
 
@@ -21,6 +21,10 @@ module LocationApi
21
21
  PUBLIC_IP = "PUBLIC_IP".freeze
22
22
  STORAGE = "STORAGE".freeze
23
23
 
24
+ def self.all_vars
25
+ @all_vars ||= [SERVER, BANDWIDTH, OPERATING_SYSTEM, PUBLIC_IP, STORAGE].freeze
26
+ end
27
+
24
28
  # Builds the enum from string
25
29
  # @param [String] The enum value in the form of the string
26
30
  # @return [String] The enum value
@@ -32,9 +36,8 @@ module LocationApi
32
36
  # @param [String] The enum value in the form of the string
33
37
  # @return [String] The enum value
34
38
  def build_from_hash(value)
35
- constantValues = ProductCategoryEnum.constants.select { |c| ProductCategoryEnum::const_get(c) == value }
36
- raise "Invalid ENUM value #{value} for class #ProductCategoryEnum" if constantValues.empty?
37
- value
39
+ return value if ProductCategoryEnum.all_vars.include?(value)
40
+ raise "Invalid ENUM value #{value} for class #ProductCategoryEnum"
38
41
  end
39
42
  end
40
43
  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
 
@@ -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
 
@@ -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: 6.1.0
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 = "Locations API Ruby Gem"
26
26
  s.description = "Locations API Ruby Gem"
27
27
  s.license = "MPL-2.0"
28
- s.required_ruby_version = ">= 2.4"
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'
@@ -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
 
@@ -41,7 +41,7 @@ describe 'LocationsApi' do
41
41
  # @return [Array<Location>]
42
42
  describe 'get_locations test' do
43
43
  it 'should work' do
44
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
44
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
45
45
  end
46
46
  end
47
47
 
@@ -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
 
@@ -22,18 +22,20 @@ describe LocationApi::Error do
22
22
 
23
23
  describe 'test an instance of Error' do
24
24
  it 'should create an instance of Error' do
25
- expect(instance).to be_instance_of(LocationApi::Error)
25
+ # uncomment below to test the instance creation
26
+ #expect(instance).to be_instance_of(LocationApi::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://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
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://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
38
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
37
39
  end
38
40
  end
39
41
 
@@ -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
 
@@ -22,7 +22,9 @@ describe LocationApi::LocationEnum do
22
22
 
23
23
  describe 'test an instance of LocationEnum' do
24
24
  it 'should create an instance of LocationEnum' do
25
- expect(instance).to be_instance_of(LocationApi::LocationEnum)
25
+ # uncomment below to test the instance creation
26
+ #expect(instance).to be_instance_of(LocationApi::LocationEnum)
26
27
  end
27
28
  end
29
+
28
30
  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
 
@@ -22,24 +22,26 @@ describe LocationApi::Location do
22
22
 
23
23
  describe 'test an instance of Location' do
24
24
  it 'should create an instance of Location' do
25
- expect(instance).to be_instance_of(LocationApi::Location)
25
+ # uncomment below to test the instance creation
26
+ #expect(instance).to be_instance_of(LocationApi::Location)
26
27
  end
27
28
  end
29
+
28
30
  describe 'test attribute "location"' do
29
31
  it 'should work' do
30
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
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 "location_description"' do
35
37
  it 'should work' do
36
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
38
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
37
39
  end
38
40
  end
39
41
 
40
42
  describe 'test attribute "product_categories"' do
41
43
  it 'should work' do
42
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
44
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
43
45
  end
44
46
  end
45
47
 
@@ -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
 
@@ -22,7 +22,9 @@ describe LocationApi::ProductCategoryEnum do
22
22
 
23
23
  describe 'test an instance of ProductCategoryEnum' do
24
24
  it 'should create an instance of ProductCategoryEnum' do
25
- expect(instance).to be_instance_of(LocationApi::ProductCategoryEnum)
25
+ # uncomment below to test the instance creation
26
+ #expect(instance).to be_instance_of(LocationApi::ProductCategoryEnum)
26
27
  end
27
28
  end
29
+
28
30
  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
 
@@ -22,18 +22,20 @@ describe LocationApi::ProductCategory do
22
22
 
23
23
  describe 'test an instance of ProductCategory' do
24
24
  it 'should create an instance of ProductCategory' do
25
- expect(instance).to be_instance_of(LocationApi::ProductCategory)
25
+ # uncomment below to test the instance creation
26
+ #expect(instance).to be_instance_of(LocationApi::ProductCategory)
26
27
  end
27
28
  end
29
+
28
30
  describe 'test attribute "product_category"' do
29
31
  it 'should work' do
30
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
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 "product_category_description"' do
35
37
  it 'should work' do
36
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
38
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
37
39
  end
38
40
  end
39
41
 
data/spec/spec_helper.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: 6.1.0
9
+ OpenAPI Generator version: 7.2.0
10
10
 
11
11
  =end
12
12
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pnap_location_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - PhoenixNAP
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-20 00:00:00.000000000 Z
11
+ date: 2024-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -80,8 +80,6 @@ files:
80
80
  - lib/pnap_location_api/version.rb
81
81
  - pnap_location_api.gemspec
82
82
  - spec/api/locations_api_spec.rb
83
- - spec/api_client_spec.rb
84
- - spec/configuration_spec.rb
85
83
  - spec/models/error_spec.rb
86
84
  - spec/models/location_enum_spec.rb
87
85
  - spec/models/location_spec.rb
@@ -101,7 +99,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
101
99
  requirements:
102
100
  - - ">="
103
101
  - !ruby/object:Gem::Version
104
- version: '2.4'
102
+ version: '2.7'
105
103
  required_rubygems_version: !ruby/object:Gem::Requirement
106
104
  requirements:
107
105
  - - ">="
@@ -114,11 +112,9 @@ specification_version: 4
114
112
  summary: Locations API Ruby Gem
115
113
  test_files:
116
114
  - spec/api/locations_api_spec.rb
117
- - spec/api_client_spec.rb
118
- - spec/configuration_spec.rb
119
115
  - spec/models/location_enum_spec.rb
120
- - spec/models/product_category_enum_spec.rb
121
- - spec/models/location_spec.rb
122
116
  - spec/models/error_spec.rb
123
117
  - spec/models/product_category_spec.rb
118
+ - spec/models/location_spec.rb
119
+ - spec/models/product_category_enum_spec.rb
124
120
  - spec/spec_helper.rb
@@ -1,226 +0,0 @@
1
- =begin
2
- #Locations API
3
-
4
- #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
-
6
- The version of the OpenAPI document: 1.0
7
- Contact: support@phoenixnap.com
8
- Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 6.1.0
10
-
11
- =end
12
-
13
- require 'spec_helper'
14
-
15
- describe LocationApi::ApiClient do
16
- context 'initialization' do
17
- context 'URL stuff' do
18
- context 'host' do
19
- it 'removes http from host' do
20
- LocationApi.configure { |c| c.host = 'http://example.com' }
21
- expect(LocationApi::Configuration.default.host).to eq('example.com')
22
- end
23
-
24
- it 'removes https from host' do
25
- LocationApi.configure { |c| c.host = 'https://wookiee.com' }
26
- expect(LocationApi::ApiClient.default.config.host).to eq('wookiee.com')
27
- end
28
-
29
- it 'removes trailing path from host' do
30
- LocationApi.configure { |c| c.host = 'hobo.com/v4' }
31
- expect(LocationApi::Configuration.default.host).to eq('hobo.com')
32
- end
33
- end
34
-
35
- context 'base_path' do
36
- it "prepends a slash to base_path" do
37
- LocationApi.configure { |c| c.base_path = 'v4/dog' }
38
- expect(LocationApi::Configuration.default.base_path).to eq('/v4/dog')
39
- end
40
-
41
- it "doesn't prepend a slash if one is already there" do
42
- LocationApi.configure { |c| c.base_path = '/v4/dog' }
43
- expect(LocationApi::Configuration.default.base_path).to eq('/v4/dog')
44
- end
45
-
46
- it "ends up as a blank string if nil" do
47
- LocationApi.configure { |c| c.base_path = nil }
48
- expect(LocationApi::Configuration.default.base_path).to eq('')
49
- end
50
- end
51
- end
52
- end
53
-
54
- describe 'params_encoding in #build_request' do
55
- let(:config) { LocationApi::Configuration.new }
56
- let(:api_client) { LocationApi::ApiClient.new(config) }
57
-
58
- it 'defaults to nil' do
59
- expect(LocationApi::Configuration.default.params_encoding).to eq(nil)
60
- expect(config.params_encoding).to eq(nil)
61
-
62
- request = api_client.build_request(:get, '/test')
63
- expect(request.options[:params_encoding]).to eq(nil)
64
- end
65
-
66
- it 'can be customized' do
67
- config.params_encoding = :multi
68
- request = api_client.build_request(:get, '/test')
69
- expect(request.options[:params_encoding]).to eq(:multi)
70
- end
71
- end
72
-
73
- describe 'timeout in #build_request' do
74
- let(:config) { LocationApi::Configuration.new }
75
- let(:api_client) { LocationApi::ApiClient.new(config) }
76
-
77
- it 'defaults to 0' do
78
- expect(LocationApi::Configuration.default.timeout).to eq(0)
79
- expect(config.timeout).to eq(0)
80
-
81
- request = api_client.build_request(:get, '/test')
82
- expect(request.options[:timeout]).to eq(0)
83
- end
84
-
85
- it 'can be customized' do
86
- config.timeout = 100
87
- request = api_client.build_request(:get, '/test')
88
- expect(request.options[:timeout]).to eq(100)
89
- end
90
- end
91
-
92
- describe '#deserialize' do
93
- it "handles Array<Integer>" do
94
- api_client = LocationApi::ApiClient.new
95
- headers = { 'Content-Type' => 'application/json' }
96
- response = double('response', headers: headers, body: '[12, 34]')
97
- data = api_client.deserialize(response, 'Array<Integer>')
98
- expect(data).to be_instance_of(Array)
99
- expect(data).to eq([12, 34])
100
- end
101
-
102
- it 'handles Array<Array<Integer>>' do
103
- api_client = LocationApi::ApiClient.new
104
- headers = { 'Content-Type' => 'application/json' }
105
- response = double('response', headers: headers, body: '[[12, 34], [56]]')
106
- data = api_client.deserialize(response, 'Array<Array<Integer>>')
107
- expect(data).to be_instance_of(Array)
108
- expect(data).to eq([[12, 34], [56]])
109
- end
110
-
111
- it 'handles Hash<String, String>' do
112
- api_client = LocationApi::ApiClient.new
113
- headers = { 'Content-Type' => 'application/json' }
114
- response = double('response', headers: headers, body: '{"message": "Hello"}')
115
- data = api_client.deserialize(response, 'Hash<String, String>')
116
- expect(data).to be_instance_of(Hash)
117
- expect(data).to eq(:message => 'Hello')
118
- end
119
- end
120
-
121
- describe "#object_to_hash" do
122
- it 'ignores nils and includes empty arrays' do
123
- # uncomment below to test object_to_hash for model
124
- # api_client = LocationApi::ApiClient.new
125
- # _model = LocationApi::ModelName.new
126
- # update the model attribute below
127
- # _model.id = 1
128
- # update the expected value (hash) below
129
- # expected = {id: 1, name: '', tags: []}
130
- # expect(api_client.object_to_hash(_model)).to eq(expected)
131
- end
132
- end
133
-
134
- describe '#build_collection_param' do
135
- let(:param) { ['aa', 'bb', 'cc'] }
136
- let(:api_client) { LocationApi::ApiClient.new }
137
-
138
- it 'works for csv' do
139
- expect(api_client.build_collection_param(param, :csv)).to eq('aa,bb,cc')
140
- end
141
-
142
- it 'works for ssv' do
143
- expect(api_client.build_collection_param(param, :ssv)).to eq('aa bb cc')
144
- end
145
-
146
- it 'works for tsv' do
147
- expect(api_client.build_collection_param(param, :tsv)).to eq("aa\tbb\tcc")
148
- end
149
-
150
- it 'works for pipes' do
151
- expect(api_client.build_collection_param(param, :pipes)).to eq('aa|bb|cc')
152
- end
153
-
154
- it 'works for multi' do
155
- expect(api_client.build_collection_param(param, :multi)).to eq(['aa', 'bb', 'cc'])
156
- end
157
-
158
- it 'fails for invalid collection format' do
159
- expect { api_client.build_collection_param(param, :INVALID) }.to raise_error(RuntimeError, 'unknown collection format: :INVALID')
160
- end
161
- end
162
-
163
- describe '#json_mime?' do
164
- let(:api_client) { LocationApi::ApiClient.new }
165
-
166
- it 'works' do
167
- expect(api_client.json_mime?(nil)).to eq false
168
- expect(api_client.json_mime?('')).to eq false
169
-
170
- expect(api_client.json_mime?('application/json')).to eq true
171
- expect(api_client.json_mime?('application/json; charset=UTF8')).to eq true
172
- expect(api_client.json_mime?('APPLICATION/JSON')).to eq true
173
-
174
- expect(api_client.json_mime?('application/xml')).to eq false
175
- expect(api_client.json_mime?('text/plain')).to eq false
176
- expect(api_client.json_mime?('application/jsonp')).to eq false
177
- end
178
- end
179
-
180
- describe '#select_header_accept' do
181
- let(:api_client) { LocationApi::ApiClient.new }
182
-
183
- it 'works' do
184
- expect(api_client.select_header_accept(nil)).to be_nil
185
- expect(api_client.select_header_accept([])).to be_nil
186
-
187
- expect(api_client.select_header_accept(['application/json'])).to eq('application/json')
188
- expect(api_client.select_header_accept(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
189
- expect(api_client.select_header_accept(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
190
-
191
- expect(api_client.select_header_accept(['application/xml'])).to eq('application/xml')
192
- expect(api_client.select_header_accept(['text/html', 'application/xml'])).to eq('text/html,application/xml')
193
- end
194
- end
195
-
196
- describe '#select_header_content_type' do
197
- let(:api_client) { LocationApi::ApiClient.new }
198
-
199
- it 'works' do
200
- expect(api_client.select_header_content_type(nil)).to be_nil
201
- expect(api_client.select_header_content_type([])).to be_nil
202
-
203
- expect(api_client.select_header_content_type(['application/json'])).to eq('application/json')
204
- expect(api_client.select_header_content_type(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
205
- expect(api_client.select_header_content_type(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
206
- expect(api_client.select_header_content_type(['application/xml'])).to eq('application/xml')
207
- expect(api_client.select_header_content_type(['text/plain', 'application/xml'])).to eq('text/plain')
208
- end
209
- end
210
-
211
- describe '#sanitize_filename' do
212
- let(:api_client) { LocationApi::ApiClient.new }
213
-
214
- it 'works' do
215
- expect(api_client.sanitize_filename('sun')).to eq('sun')
216
- expect(api_client.sanitize_filename('sun.gif')).to eq('sun.gif')
217
- expect(api_client.sanitize_filename('../sun.gif')).to eq('sun.gif')
218
- expect(api_client.sanitize_filename('/var/tmp/sun.gif')).to eq('sun.gif')
219
- expect(api_client.sanitize_filename('./sun.gif')).to eq('sun.gif')
220
- expect(api_client.sanitize_filename('..\sun.gif')).to eq('sun.gif')
221
- expect(api_client.sanitize_filename('\var\tmp\sun.gif')).to eq('sun.gif')
222
- expect(api_client.sanitize_filename('c:\var\tmp\sun.gif')).to eq('sun.gif')
223
- expect(api_client.sanitize_filename('.\sun.gif')).to eq('sun.gif')
224
- end
225
- end
226
- end
@@ -1,42 +0,0 @@
1
- =begin
2
- #Locations API
3
-
4
- #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
-
6
- The version of the OpenAPI document: 1.0
7
- Contact: support@phoenixnap.com
8
- Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 6.1.0
10
-
11
- =end
12
-
13
- require 'spec_helper'
14
-
15
- describe LocationApi::Configuration do
16
- let(:config) { LocationApi::Configuration.default }
17
-
18
- before(:each) do
19
- # uncomment below to setup host and base_path
20
- # require 'URI'
21
- # uri = URI.parse("https://api.phoenixnap.com/location-api/v1")
22
- # LocationApi.configure do |c|
23
- # c.host = uri.host
24
- # c.base_path = uri.path
25
- # end
26
- end
27
-
28
- describe '#base_url' do
29
- it 'should have the default value' do
30
- # uncomment below to test default value of the base path
31
- # expect(config.base_url).to eq("https://api.phoenixnap.com/location-api/v1")
32
- end
33
-
34
- it 'should remove trailing slashes' do
35
- [nil, '', '/', '//'].each do |base_path|
36
- config.base_path = base_path
37
- # uncomment below to test trailing slashes
38
- # expect(config.base_url).to eq("https://api.phoenixnap.com/location-api/v1")
39
- end
40
- end
41
- end
42
- end