pnap_location_api 2.0.3 → 3.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: 42d84a98f0ff7b0230c8d4527fb1c8280883b07b383923ee74d99949b8cea686
4
- data.tar.gz: 64567adae6a53e3a771dd3b54a65ea919aca3160c2e45835c19b166efeb5a9da
3
+ metadata.gz: e21ebf1872cbf4070fcc99982c94a852765e2183420387a3eaf35a8b04ecaf65
4
+ data.tar.gz: e3287708c3921dafa9cd5649d0bb85490618d81f2b2d754658124852cfc5136f
5
5
  SHA512:
6
- metadata.gz: a388acf9c267fb489d78307ea3d8db1250aa5bb7e387da82665da8f4d73f82c2a48aeaa0ffea1b62c76ef53bc3cf4ceddc15d8a59176c2688fa926ae4fb0c362
7
- data.tar.gz: eaa17d1eee9e13450669b95cc6fe07e068baafa89f2edbfeb15b6743829135012bec34c00c48c876d80682e075c343b5c35c96ebcee86f30926145752bb47b63
6
+ metadata.gz: 8213fc2ac1146ac82cff2ef2eaa55087c874a5c1fb326e30f6c5eb6f74b35d408d402c04b25a4e96945717e5854b0c0b7a16a0d54b582394e3c907213093f192
7
+ data.tar.gz: 154916548667fa2f300ac64b11c90dae605b51a3abecb0161954ddc86618979159938254d4e50f117dfb58fb4ff72c07e9e922b474c4a07ecaa5de76cac12d97
data/README.md CHANGED
@@ -63,7 +63,7 @@ require 'pnap_location_api'
63
63
 
64
64
  api_instance = LocationApi::LocationsApi.new
65
65
  opts = {
66
- location: LocationApi::LocationEnum::PHX, # LocationEnum | Location of interest
66
+ location: LocationApi::ProductLocationEnum::PHX, # ProductLocationEnum | Location of interest
67
67
  product_category: LocationApi::ProductCategoryEnum::SERVER # ProductCategoryEnum | Product category of interest
68
68
  }
69
69
 
@@ -105,9 +105,9 @@ Class | Method | HTTP request | Description
105
105
 
106
106
  - [LocationApi::Error](docs/Error.md)
107
107
  - [LocationApi::Location](docs/Location.md)
108
- - [LocationApi::LocationEnum](docs/LocationEnum.md)
109
108
  - [LocationApi::ProductCategory](docs/ProductCategory.md)
110
109
  - [LocationApi::ProductCategoryEnum](docs/ProductCategoryEnum.md)
110
+ - [LocationApi::ProductLocationEnum](docs/ProductLocationEnum.md)
111
111
 
112
112
 
113
113
  ## Documentation for Authorization
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.3
1
+ 3.0.0
data/docs/Location.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  | Name | Type | Description | Notes |
6
6
  | ---- | ---- | ----------- | ----- |
7
- | **location** | [**LocationEnum**](LocationEnum.md) | | |
7
+ | **location** | [**ProductLocationEnum**](ProductLocationEnum.md) | | |
8
8
  | **location_description** | **String** | | [optional] |
9
9
  | **product_categories** | [**Array<ProductCategory>**](ProductCategory.md) | | [optional] |
10
10
 
data/docs/LocationsApi.md CHANGED
@@ -23,7 +23,7 @@ require 'pnap_location_api'
23
23
 
24
24
  api_instance = LocationApi::LocationsApi.new
25
25
  opts = {
26
- location: LocationApi::LocationEnum::PHX, # LocationEnum | Location of interest
26
+ location: LocationApi::ProductLocationEnum::PHX, # ProductLocationEnum | Location of interest
27
27
  product_category: LocationApi::ProductCategoryEnum::SERVER # ProductCategoryEnum | Product category of interest
28
28
  }
29
29
 
@@ -58,7 +58,7 @@ end
58
58
 
59
59
  | Name | Type | Description | Notes |
60
60
  | ---- | ---- | ----------- | ----- |
61
- | **location** | [**LocationEnum**](.md) | Location of interest | [optional] |
61
+ | **location** | [**ProductLocationEnum**](.md) | Location of interest | [optional] |
62
62
  | **product_category** | [**ProductCategoryEnum**](.md) | Product category of interest | [optional] |
63
63
 
64
64
  ### Return type
@@ -1,4 +1,4 @@
1
- # LocationApi::LocationEnum
1
+ # LocationApi::ProductLocationEnum
2
2
 
3
3
  ## Properties
4
4
 
@@ -10,6 +10,6 @@
10
10
  ```ruby
11
11
  require 'pnap_location_api'
12
12
 
13
- instance = LocationApi::LocationEnum.new()
13
+ instance = LocationApi::ProductLocationEnum.new()
14
14
  ```
15
15
 
@@ -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: 7.2.0
9
+ Generator version: 7.20.0
10
10
 
11
11
  =end
12
12
 
@@ -22,7 +22,7 @@ module LocationApi
22
22
  # Get All Locations
23
23
  # Retrieve the locations info.
24
24
  # @param [Hash] opts the optional parameters
25
- # @option opts [LocationEnum] :location Location of interest
25
+ # @option opts [ProductLocationEnum] :location Location of interest
26
26
  # @option opts [ProductCategoryEnum] :product_category Product category of interest
27
27
  # @return [Array<Location>]
28
28
  def get_locations(opts = {})
@@ -33,7 +33,7 @@ module LocationApi
33
33
  # Get All Locations
34
34
  # Retrieve the locations info.
35
35
  # @param [Hash] opts the optional parameters
36
- # @option opts [LocationEnum] :location Location of interest
36
+ # @option opts [ProductLocationEnum] :location Location of interest
37
37
  # @option opts [ProductCategoryEnum] :product_category Product category of interest
38
38
  # @return [Array<(Array<Location>, Integer, Hash)>] Array<Location> data, response status code and response headers
39
39
  def get_locations_with_http_info(opts = {})
@@ -51,7 +51,7 @@ module LocationApi
51
51
  # header parameters
52
52
  header_params = opts[:header_params] || {}
53
53
  # HTTP header 'Accept' (if needed)
54
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
54
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
55
55
 
56
56
  # form parameters
57
57
  form_params = opts[:form_params] || {}
@@ -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: 7.2.0
9
+ Generator version: 7.20.0
10
10
 
11
11
  =end
12
12
 
@@ -52,7 +52,8 @@ module LocationApi
52
52
  # the data deserialized from response body (may be a Tempfile or nil), response status code and response headers.
53
53
  def call_api(http_method, path, opts = {})
54
54
  request = build_request(http_method, path, opts)
55
- tempfile = download_file(request) if opts[:return_type] == 'File'
55
+ tempfile = nil
56
+ (download_file(request) { tempfile = _1 }) if opts[:return_type] == 'File'
56
57
  response = request.run
57
58
 
58
59
  if @config.debugging
@@ -190,19 +191,17 @@ module LocationApi
190
191
  chunk.force_encoding(encoding)
191
192
  tempfile.write(chunk)
192
193
  end
193
- # run the request to ensure the tempfile is created successfully before returning it
194
- request.run
195
- if tempfile
194
+ request.on_complete do
195
+ if !tempfile
196
+ fail ApiError.new("Failed to create the tempfile based on the HTTP response from the server: #{request.inspect}")
197
+ end
196
198
  tempfile.close
197
199
  @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
198
200
  "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
199
201
  "will be deleted automatically with GC. It's also recommended to delete the temp file "\
200
202
  "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}")
203
+ yield tempfile if block_given?
203
204
  end
204
-
205
- tempfile
206
205
  end
207
206
 
208
207
  # Check if the given MIME is a JSON MIME.
@@ -214,7 +213,7 @@ module LocationApi
214
213
  # @param [String] mime MIME
215
214
  # @return [Boolean] True if the MIME is application/json
216
215
  def json_mime?(mime)
217
- (mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil?
216
+ (mime == '*/*') || !(mime =~ /^Application\/.*json(?!p)(;.*)?/i).nil?
218
217
  end
219
218
 
220
219
  # Deserialize the response to the given return type.
@@ -281,9 +280,13 @@ module LocationApi
281
280
  data.each { |k, v| hash[k] = convert_to_type(v, sub_type) }
282
281
  end
283
282
  else
284
- # models (e.g. Pet) or oneOf
283
+ # models (e.g. Pet) or oneOf/anyOf
285
284
  klass = LocationApi.const_get(return_type)
286
- klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data)
285
+ if klass.respond_to?(:openapi_one_of) || klass.respond_to?(:openapi_any_of)
286
+ klass.build(data)
287
+ else
288
+ klass.build_from_hash(data)
289
+ end
287
290
  end
288
291
  end
289
292
 
@@ -293,7 +296,7 @@ module LocationApi
293
296
  # @param [String] filename the filename to be sanitized
294
297
  # @return [String] the sanitized filename
295
298
  def sanitize_filename(filename)
296
- filename.gsub(/.*[\/\\]/, '')
299
+ filename.split(/[\/\\]/).last
297
300
  end
298
301
 
299
302
  def build_request_url(path, opts = {})
@@ -393,4 +396,4 @@ module LocationApi
393
396
  end
394
397
  end
395
398
  end
396
- end
399
+ 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: 7.2.0
9
+ Generator version: 7.20.0
10
10
 
11
11
  =end
12
12
 
@@ -0,0 +1,88 @@
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
+ Generator version: 7.20.0
10
+
11
+ =end
12
+
13
+ module LocationApi
14
+ class ApiModelBase
15
+ # Deserializes the data based on type
16
+ # @param string type Data type
17
+ # @param string value Value to be deserialized
18
+ # @return [Object] Deserialized data
19
+ def self._deserialize(type, value)
20
+ case type.to_sym
21
+ when :Time
22
+ Time.parse(value)
23
+ when :Date
24
+ Date.parse(value)
25
+ when :String
26
+ value.to_s
27
+ when :Integer
28
+ value.to_i
29
+ when :Float
30
+ value.to_f
31
+ when :Boolean
32
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
33
+ true
34
+ else
35
+ false
36
+ end
37
+ when :Object
38
+ # generic object (usually a Hash), return directly
39
+ value
40
+ when /\AArray<(?<inner_type>.+)>\z/
41
+ inner_type = Regexp.last_match[:inner_type]
42
+ value.map { |v| _deserialize(inner_type, v) }
43
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
44
+ k_type = Regexp.last_match[:k_type]
45
+ v_type = Regexp.last_match[:v_type]
46
+ {}.tap do |hash|
47
+ value.each do |k, v|
48
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
49
+ end
50
+ end
51
+ else # model
52
+ # models (e.g. Pet) or oneOf
53
+ klass = LocationApi.const_get(type)
54
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
55
+ end
56
+ end
57
+
58
+ # Returns the string representation of the object
59
+ # @return [String] String presentation of the object
60
+ def to_s
61
+ to_hash.to_s
62
+ end
63
+
64
+ # to_body is an alias to to_hash (backward compatibility)
65
+ # @return [Hash] Returns the object in the form of hash
66
+ def to_body
67
+ to_hash
68
+ end
69
+
70
+ # Outputs non-array value in the form of hash
71
+ # For object, use to_hash. Otherwise, just return the value
72
+ # @param [Object] value Any valid value
73
+ # @return [Hash] Returns the value in the form of hash
74
+ def _to_hash(value)
75
+ if value.is_a?(Array)
76
+ value.compact.map { |v| _to_hash(v) }
77
+ elsif value.is_a?(Hash)
78
+ {}.tap do |hash|
79
+ value.each { |k, v| hash[k] = _to_hash(v) }
80
+ end
81
+ elsif value.respond_to? :to_hash
82
+ value.to_hash
83
+ else
84
+ value
85
+ end
86
+ end
87
+ end
88
+ end
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 1.0
7
7
  Contact: support@phoenixnap.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 7.2.0
9
+ Generator version: 7.20.0
10
10
 
11
11
  =end
12
12
 
@@ -79,6 +79,14 @@ module LocationApi
79
79
  # @return [true, false]
80
80
  attr_accessor :debugging
81
81
 
82
+ # Set this to ignore operation servers for the API client. This is useful when you need to
83
+ # send requests to a different server than the one specified in the OpenAPI document.
84
+ # Will default to the base url defined in the spec but can be overridden by setting
85
+ # `scheme`, `host`, `base_path` directly.
86
+ # Default to false.
87
+ # @return [true, false]
88
+ attr_accessor :ignore_operation_servers
89
+
82
90
  # Defines the logger used for debugging.
83
91
  # Default to `Rails.logger` (when in Rails) or logging to STDOUT.
84
92
  #
@@ -166,6 +174,7 @@ module LocationApi
166
174
  @timeout = 0
167
175
  @params_encoding = nil
168
176
  @debugging = false
177
+ @ignore_operation_servers = false
169
178
  @inject_format = false
170
179
  @force_ending_format = false
171
180
  @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
@@ -200,6 +209,7 @@ module LocationApi
200
209
 
201
210
  # Returns base URL for specified operation based on server settings
202
211
  def base_url(operation = nil)
212
+ return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if ignore_operation_servers
203
213
  if operation_server_settings.key?(operation) then
204
214
  index = server_operation_index.fetch(operation, server_index)
205
215
  server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 1.0
7
7
  Contact: support@phoenixnap.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 7.2.0
9
+ Generator version: 7.20.0
10
10
 
11
11
  =end
12
12
 
@@ -14,7 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module LocationApi
17
- class Error
17
+ class Error < ApiModelBase
18
18
  # The description detailing the cause of the error code.
19
19
  attr_accessor :message
20
20
 
@@ -29,9 +29,14 @@ module LocationApi
29
29
  }
30
30
  end
31
31
 
32
+ # Returns attribute mapping this model knows about
33
+ def self.acceptable_attribute_map
34
+ attribute_map
35
+ end
36
+
32
37
  # Returns all the JSON keys this model knows about
33
38
  def self.acceptable_attributes
34
- attribute_map.values
39
+ acceptable_attribute_map.values
35
40
  end
36
41
 
37
42
  # Attribute type mapping.
@@ -56,9 +61,10 @@ module LocationApi
56
61
  end
57
62
 
58
63
  # check to see if the attribute exists and convert string to symbol for hash key
64
+ acceptable_attribute_map = self.class.acceptable_attribute_map
59
65
  attributes = attributes.each_with_object({}) { |(k, v), h|
60
- if (!self.class.attribute_map.key?(k.to_sym))
61
- fail ArgumentError, "`#{k}` is not a valid attribute in `LocationApi::Error`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
66
+ if (!acceptable_attribute_map.key?(k.to_sym))
67
+ fail ArgumentError, "`#{k}` is not a valid attribute in `LocationApi::Error`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
62
68
  end
63
69
  h[k.to_sym] = v
64
70
  }
@@ -96,6 +102,16 @@ module LocationApi
96
102
  true
97
103
  end
98
104
 
105
+ # Custom attribute writer method with validation
106
+ # @param [Object] message Value to be assigned
107
+ def message=(message)
108
+ if message.nil?
109
+ fail ArgumentError, 'message cannot be nil'
110
+ end
111
+
112
+ @message = message
113
+ end
114
+
99
115
  # Checks equality by comparing each attribute.
100
116
  # @param [Object] Object to be compared
101
117
  def ==(o)
@@ -140,61 +156,6 @@ module LocationApi
140
156
  new(transformed_hash)
141
157
  end
142
158
 
143
- # Deserializes the data based on type
144
- # @param string type Data type
145
- # @param string value Value to be deserialized
146
- # @return [Object] Deserialized data
147
- def self._deserialize(type, value)
148
- case type.to_sym
149
- when :Time
150
- Time.parse(value)
151
- when :Date
152
- Date.parse(value)
153
- when :String
154
- value.to_s
155
- when :Integer
156
- value.to_i
157
- when :Float
158
- value.to_f
159
- when :Boolean
160
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
161
- true
162
- else
163
- false
164
- end
165
- when :Object
166
- # generic object (usually a Hash), return directly
167
- value
168
- when /\AArray<(?<inner_type>.+)>\z/
169
- inner_type = Regexp.last_match[:inner_type]
170
- value.map { |v| _deserialize(inner_type, v) }
171
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
172
- k_type = Regexp.last_match[:k_type]
173
- v_type = Regexp.last_match[:v_type]
174
- {}.tap do |hash|
175
- value.each do |k, v|
176
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
177
- end
178
- end
179
- else # model
180
- # models (e.g. Pet) or oneOf
181
- klass = LocationApi.const_get(type)
182
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
183
- end
184
- end
185
-
186
- # Returns the string representation of the object
187
- # @return [String] String presentation of the object
188
- def to_s
189
- to_hash.to_s
190
- end
191
-
192
- # to_body is an alias to to_hash (backward compatibility)
193
- # @return [Hash] Returns the object in the form of hash
194
- def to_body
195
- to_hash
196
- end
197
-
198
159
  # Returns the object in the form of hash
199
160
  # @return [Hash] Returns the object in the form of hash
200
161
  def to_hash
@@ -211,24 +172,6 @@ module LocationApi
211
172
  hash
212
173
  end
213
174
 
214
- # Outputs non-array value in the form of hash
215
- # For object, use to_hash. Otherwise, just return the value
216
- # @param [Object] value Any valid value
217
- # @return [Hash] Returns the value in the form of hash
218
- def _to_hash(value)
219
- if value.is_a?(Array)
220
- value.compact.map { |v| _to_hash(v) }
221
- elsif value.is_a?(Hash)
222
- {}.tap do |hash|
223
- value.each { |k, v| hash[k] = _to_hash(v) }
224
- end
225
- elsif value.respond_to? :to_hash
226
- value.to_hash
227
- else
228
- value
229
- end
230
- end
231
-
232
175
  end
233
176
 
234
177
  end
@@ -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: 7.2.0
9
+ Generator version: 7.20.0
10
10
 
11
11
  =end
12
12
 
@@ -15,7 +15,7 @@ require 'time'
15
15
 
16
16
  module LocationApi
17
17
  # Location resource
18
- class Location
18
+ class Location < ApiModelBase
19
19
  attr_accessor :location
20
20
 
21
21
  attr_accessor :location_description
@@ -53,15 +53,20 @@ module LocationApi
53
53
  }
54
54
  end
55
55
 
56
+ # Returns attribute mapping this model knows about
57
+ def self.acceptable_attribute_map
58
+ attribute_map
59
+ end
60
+
56
61
  # Returns all the JSON keys this model knows about
57
62
  def self.acceptable_attributes
58
- attribute_map.values
63
+ acceptable_attribute_map.values
59
64
  end
60
65
 
61
66
  # Attribute type mapping.
62
67
  def self.openapi_types
63
68
  {
64
- :'location' => :'LocationEnum',
69
+ :'location' => :'ProductLocationEnum',
65
70
  :'location_description' => :'String',
66
71
  :'product_categories' => :'Array<ProductCategory>'
67
72
  }
@@ -81,9 +86,10 @@ module LocationApi
81
86
  end
82
87
 
83
88
  # check to see if the attribute exists and convert string to symbol for hash key
89
+ acceptable_attribute_map = self.class.acceptable_attribute_map
84
90
  attributes = attributes.each_with_object({}) { |(k, v), h|
85
- if (!self.class.attribute_map.key?(k.to_sym))
86
- fail ArgumentError, "`#{k}` is not a valid attribute in `LocationApi::Location`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
91
+ if (!acceptable_attribute_map.key?(k.to_sym))
92
+ fail ArgumentError, "`#{k}` is not a valid attribute in `LocationApi::Location`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
87
93
  end
88
94
  h[k.to_sym] = v
89
95
  }
@@ -125,6 +131,16 @@ module LocationApi
125
131
  true
126
132
  end
127
133
 
134
+ # Custom attribute writer method with validation
135
+ # @param [Object] location Value to be assigned
136
+ def location=(location)
137
+ if location.nil?
138
+ fail ArgumentError, 'location cannot be nil'
139
+ end
140
+
141
+ @location = location
142
+ end
143
+
128
144
  # Checks equality by comparing each attribute.
129
145
  # @param [Object] Object to be compared
130
146
  def ==(o)
@@ -170,61 +186,6 @@ module LocationApi
170
186
  new(transformed_hash)
171
187
  end
172
188
 
173
- # Deserializes the data based on type
174
- # @param string type Data type
175
- # @param string value Value to be deserialized
176
- # @return [Object] Deserialized data
177
- def self._deserialize(type, value)
178
- case type.to_sym
179
- when :Time
180
- Time.parse(value)
181
- when :Date
182
- Date.parse(value)
183
- when :String
184
- value.to_s
185
- when :Integer
186
- value.to_i
187
- when :Float
188
- value.to_f
189
- when :Boolean
190
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
191
- true
192
- else
193
- false
194
- end
195
- when :Object
196
- # generic object (usually a Hash), return directly
197
- value
198
- when /\AArray<(?<inner_type>.+)>\z/
199
- inner_type = Regexp.last_match[:inner_type]
200
- value.map { |v| _deserialize(inner_type, v) }
201
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
202
- k_type = Regexp.last_match[:k_type]
203
- v_type = Regexp.last_match[:v_type]
204
- {}.tap do |hash|
205
- value.each do |k, v|
206
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
207
- end
208
- end
209
- else # model
210
- # models (e.g. Pet) or oneOf
211
- klass = LocationApi.const_get(type)
212
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
213
- end
214
- end
215
-
216
- # Returns the string representation of the object
217
- # @return [String] String presentation of the object
218
- def to_s
219
- to_hash.to_s
220
- end
221
-
222
- # to_body is an alias to to_hash (backward compatibility)
223
- # @return [Hash] Returns the object in the form of hash
224
- def to_body
225
- to_hash
226
- end
227
-
228
189
  # Returns the object in the form of hash
229
190
  # @return [Hash] Returns the object in the form of hash
230
191
  def to_hash
@@ -241,24 +202,6 @@ module LocationApi
241
202
  hash
242
203
  end
243
204
 
244
- # Outputs non-array value in the form of hash
245
- # For object, use to_hash. Otherwise, just return the value
246
- # @param [Object] value Any valid value
247
- # @return [Hash] Returns the value in the form of hash
248
- def _to_hash(value)
249
- if value.is_a?(Array)
250
- value.compact.map { |v| _to_hash(v) }
251
- elsif value.is_a?(Hash)
252
- {}.tap do |hash|
253
- value.each { |k, v| hash[k] = _to_hash(v) }
254
- end
255
- elsif value.respond_to? :to_hash
256
- value.to_hash
257
- else
258
- value
259
- end
260
- end
261
-
262
205
  end
263
206
 
264
207
  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: 7.2.0
9
+ Generator version: 7.20.0
10
10
 
11
11
  =end
12
12
 
@@ -14,7 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module LocationApi
17
- class ProductCategory
17
+ class ProductCategory < ApiModelBase
18
18
  attr_accessor :product_category
19
19
 
20
20
  attr_accessor :product_category_description
@@ -49,9 +49,14 @@ module LocationApi
49
49
  }
50
50
  end
51
51
 
52
+ # Returns attribute mapping this model knows about
53
+ def self.acceptable_attribute_map
54
+ attribute_map
55
+ end
56
+
52
57
  # Returns all the JSON keys this model knows about
53
58
  def self.acceptable_attributes
54
- attribute_map.values
59
+ acceptable_attribute_map.values
55
60
  end
56
61
 
57
62
  # Attribute type mapping.
@@ -76,9 +81,10 @@ module LocationApi
76
81
  end
77
82
 
78
83
  # check to see if the attribute exists and convert string to symbol for hash key
84
+ acceptable_attribute_map = self.class.acceptable_attribute_map
79
85
  attributes = attributes.each_with_object({}) { |(k, v), h|
80
- if (!self.class.attribute_map.key?(k.to_sym))
81
- fail ArgumentError, "`#{k}` is not a valid attribute in `LocationApi::ProductCategory`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
86
+ if (!acceptable_attribute_map.key?(k.to_sym))
87
+ fail ArgumentError, "`#{k}` is not a valid attribute in `LocationApi::ProductCategory`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
82
88
  end
83
89
  h[k.to_sym] = v
84
90
  }
@@ -114,6 +120,16 @@ module LocationApi
114
120
  true
115
121
  end
116
122
 
123
+ # Custom attribute writer method with validation
124
+ # @param [Object] product_category Value to be assigned
125
+ def product_category=(product_category)
126
+ if product_category.nil?
127
+ fail ArgumentError, 'product_category cannot be nil'
128
+ end
129
+
130
+ @product_category = product_category
131
+ end
132
+
117
133
  # Checks equality by comparing each attribute.
118
134
  # @param [Object] Object to be compared
119
135
  def ==(o)
@@ -158,61 +174,6 @@ module LocationApi
158
174
  new(transformed_hash)
159
175
  end
160
176
 
161
- # Deserializes the data based on type
162
- # @param string type Data type
163
- # @param string value Value to be deserialized
164
- # @return [Object] Deserialized data
165
- def self._deserialize(type, value)
166
- case type.to_sym
167
- when :Time
168
- Time.parse(value)
169
- when :Date
170
- Date.parse(value)
171
- when :String
172
- value.to_s
173
- when :Integer
174
- value.to_i
175
- when :Float
176
- value.to_f
177
- when :Boolean
178
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
179
- true
180
- else
181
- false
182
- end
183
- when :Object
184
- # generic object (usually a Hash), return directly
185
- value
186
- when /\AArray<(?<inner_type>.+)>\z/
187
- inner_type = Regexp.last_match[:inner_type]
188
- value.map { |v| _deserialize(inner_type, v) }
189
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
190
- k_type = Regexp.last_match[:k_type]
191
- v_type = Regexp.last_match[:v_type]
192
- {}.tap do |hash|
193
- value.each do |k, v|
194
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
195
- end
196
- end
197
- else # model
198
- # models (e.g. Pet) or oneOf
199
- klass = LocationApi.const_get(type)
200
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
201
- end
202
- end
203
-
204
- # Returns the string representation of the object
205
- # @return [String] String presentation of the object
206
- def to_s
207
- to_hash.to_s
208
- end
209
-
210
- # to_body is an alias to to_hash (backward compatibility)
211
- # @return [Hash] Returns the object in the form of hash
212
- def to_body
213
- to_hash
214
- end
215
-
216
177
  # Returns the object in the form of hash
217
178
  # @return [Hash] Returns the object in the form of hash
218
179
  def to_hash
@@ -229,24 +190,6 @@ module LocationApi
229
190
  hash
230
191
  end
231
192
 
232
- # Outputs non-array value in the form of hash
233
- # For object, use to_hash. Otherwise, just return the value
234
- # @param [Object] value Any valid value
235
- # @return [Hash] Returns the value in the form of hash
236
- def _to_hash(value)
237
- if value.is_a?(Array)
238
- value.compact.map { |v| _to_hash(v) }
239
- elsif value.is_a?(Hash)
240
- {}.tap do |hash|
241
- value.each { |k, v| hash[k] = _to_hash(v) }
242
- end
243
- elsif value.respond_to? :to_hash
244
- value.to_hash
245
- else
246
- value
247
- end
248
- end
249
-
250
193
  end
251
194
 
252
195
  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: 7.2.0
9
+ Generator version: 7.20.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: 7.2.0
9
+ Generator version: 7.20.0
10
10
 
11
11
  =end
12
12
 
@@ -14,17 +14,16 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module LocationApi
17
- class LocationEnum
17
+ class ProductLocationEnum
18
18
  PHX = "PHX".freeze
19
19
  ASH = "ASH".freeze
20
20
  NLD = "NLD".freeze
21
21
  SGP = "SGP".freeze
22
22
  CHI = "CHI".freeze
23
23
  SEA = "SEA".freeze
24
- AUS = "AUS".freeze
25
24
 
26
25
  def self.all_vars
27
- @all_vars ||= [PHX, ASH, NLD, SGP, CHI, SEA, AUS].freeze
26
+ @all_vars ||= [PHX, ASH, NLD, SGP, CHI, SEA].freeze
28
27
  end
29
28
 
30
29
  # Builds the enum from string
@@ -38,8 +37,8 @@ module LocationApi
38
37
  # @param [String] The enum value in the form of the string
39
38
  # @return [String] The enum value
40
39
  def build_from_hash(value)
41
- return value if LocationEnum.all_vars.include?(value)
42
- raise "Invalid ENUM value #{value} for class #LocationEnum"
40
+ return value if ProductLocationEnum.all_vars.include?(value)
41
+ raise "Invalid ENUM value #{value} for class #ProductLocationEnum"
43
42
  end
44
43
  end
45
44
  end
@@ -6,8 +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: 7.2.0
10
-
9
+ Generator version: 7.20.0
11
10
  =end
12
11
 
13
12
  def get_version()
@@ -6,22 +6,23 @@
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: 7.2.0
9
+ Generator version: 7.20.0
10
10
 
11
11
  =end
12
12
 
13
13
  # Common files
14
14
  require 'pnap_location_api/api_client'
15
15
  require 'pnap_location_api/api_error'
16
+ require 'pnap_location_api/api_model_base'
16
17
  require 'pnap_location_api/version'
17
18
  require 'pnap_location_api/configuration'
18
19
 
19
20
  # Models
20
21
  require 'pnap_location_api/models/error'
21
22
  require 'pnap_location_api/models/location'
22
- require 'pnap_location_api/models/location_enum'
23
23
  require 'pnap_location_api/models/product_category'
24
24
  require 'pnap_location_api/models/product_category_enum'
25
+ require 'pnap_location_api/models/product_location_enum'
25
26
 
26
27
  # APIs
27
28
  require 'pnap_location_api/api/locations_api'
@@ -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: 7.2.0
11
+ Generator version: 7.20.0
12
12
 
13
13
  =end
14
14
 
@@ -19,14 +19,14 @@ Gem::Specification.new do |s|
19
19
  s.name = "pnap_location_api"
20
20
  s.version = LocationApi::VERSION
21
21
  s.platform = Gem::Platform::RUBY
22
- s.authors = ["PhoenixNAP"]
22
+ s.authors = ["OpenAPI-Generator"]
23
23
  s.email = ["support@phoenixnap.com"]
24
- s.homepage = "https://phoenixnap.com/bare-metal-cloud"
24
+ s.homepage = "https://openapi-generator.tech"
25
25
  s.summary = "Locations API Ruby Gem"
26
- s.description = "Locations API Ruby Gem"
26
+ s.description = "No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)"
27
27
  s.license = "MPL-2.0"
28
28
  s.required_ruby_version = ">= 2.7"
29
- s.metadata = { "source_code_uri" => "https://github.com/phoenixnap/ruby-sdk-bmc" }
29
+ s.metadata = {}
30
30
 
31
31
  s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
32
32
 
@@ -36,4 +36,4 @@ Gem::Specification.new do |s|
36
36
  s.test_files = `find spec/*`.split("\n")
37
37
  s.executables = []
38
38
  s.require_paths = ["lib"]
39
- end
39
+ 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: 7.2.0
9
+ Generator version: 7.20.0
10
10
 
11
11
  =end
12
12
 
@@ -36,7 +36,7 @@ describe 'LocationsApi' do
36
36
  # Get All Locations
37
37
  # Retrieve the locations info.
38
38
  # @param [Hash] opts the optional parameters
39
- # @option opts [LocationEnum] :location Location of interest
39
+ # @option opts [ProductLocationEnum] :location Location of interest
40
40
  # @option opts [ProductCategoryEnum] :product_category Product category of interest
41
41
  # @return [Array<Location>]
42
42
  describe 'get_locations test' do
@@ -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: 7.2.0
9
+ Generator version: 7.20.0
10
10
 
11
11
  =end
12
12
 
@@ -18,7 +18,7 @@ require 'date'
18
18
  # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
19
  # Please update as you see appropriate
20
20
  describe LocationApi::Error do
21
- let(:instance) { LocationApi::Error.new }
21
+ #let(:instance) { LocationApi::Error.new }
22
22
 
23
23
  describe 'test an instance of Error' do
24
24
  it 'should create an instance of Error' do
@@ -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: 7.2.0
9
+ Generator version: 7.20.0
10
10
 
11
11
  =end
12
12
 
@@ -18,7 +18,7 @@ require 'date'
18
18
  # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
19
  # Please update as you see appropriate
20
20
  describe LocationApi::Location do
21
- let(:instance) { LocationApi::Location.new }
21
+ #let(:instance) { LocationApi::Location.new }
22
22
 
23
23
  describe 'test an instance of Location' do
24
24
  it 'should create an instance of Location' do
@@ -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: 7.2.0
9
+ Generator version: 7.20.0
10
10
 
11
11
  =end
12
12
 
@@ -18,7 +18,7 @@ require 'date'
18
18
  # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
19
  # Please update as you see appropriate
20
20
  describe LocationApi::ProductCategoryEnum do
21
- let(:instance) { LocationApi::ProductCategoryEnum.new }
21
+ #let(:instance) { LocationApi::ProductCategoryEnum.new }
22
22
 
23
23
  describe 'test an instance of ProductCategoryEnum' do
24
24
  it 'should create an instance of ProductCategoryEnum' do
@@ -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: 7.2.0
9
+ Generator version: 7.20.0
10
10
 
11
11
  =end
12
12
 
@@ -18,7 +18,7 @@ require 'date'
18
18
  # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
19
  # Please update as you see appropriate
20
20
  describe LocationApi::ProductCategory do
21
- let(:instance) { LocationApi::ProductCategory.new }
21
+ #let(:instance) { LocationApi::ProductCategory.new }
22
22
 
23
23
  describe 'test an instance of ProductCategory' do
24
24
  it 'should create an instance of ProductCategory' do
@@ -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: 7.2.0
9
+ Generator version: 7.20.0
10
10
 
11
11
  =end
12
12
 
@@ -14,16 +14,16 @@ require 'spec_helper'
14
14
  require 'json'
15
15
  require 'date'
16
16
 
17
- # Unit tests for LocationApi::LocationEnum
17
+ # Unit tests for LocationApi::ProductLocationEnum
18
18
  # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
19
  # Please update as you see appropriate
20
- describe LocationApi::LocationEnum do
21
- let(:instance) { LocationApi::LocationEnum.new }
20
+ describe LocationApi::ProductLocationEnum do
21
+ #let(:instance) { LocationApi::ProductLocationEnum.new }
22
22
 
23
- describe 'test an instance of LocationEnum' do
24
- it 'should create an instance of LocationEnum' do
23
+ describe 'test an instance of ProductLocationEnum' do
24
+ it 'should create an instance of ProductLocationEnum' do
25
25
  # uncomment below to test the instance creation
26
- #expect(instance).to be_instance_of(LocationApi::LocationEnum)
26
+ #expect(instance).to be_instance_of(LocationApi::ProductLocationEnum)
27
27
  end
28
28
  end
29
29
 
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: 7.2.0
9
+ Generator version: 7.20.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: 2.0.3
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
- - PhoenixNAP
7
+ - OpenAPI-Generator
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-03-12 00:00:00.000000000 Z
11
+ date: 2026-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -50,7 +50,7 @@ dependencies:
50
50
  - - ">="
51
51
  - !ruby/object:Gem::Version
52
52
  version: 3.6.0
53
- description: Locations API Ruby Gem
53
+ description: No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
54
54
  email:
55
55
  - support@phoenixnap.com
56
56
  executables: []
@@ -63,34 +63,34 @@ files:
63
63
  - VERSION
64
64
  - docs/Error.md
65
65
  - docs/Location.md
66
- - docs/LocationEnum.md
67
66
  - docs/LocationsApi.md
68
67
  - docs/ProductCategory.md
69
68
  - docs/ProductCategoryEnum.md
69
+ - docs/ProductLocationEnum.md
70
70
  - lib/pnap_location_api.rb
71
71
  - lib/pnap_location_api/api/locations_api.rb
72
72
  - lib/pnap_location_api/api_client.rb
73
73
  - lib/pnap_location_api/api_error.rb
74
+ - lib/pnap_location_api/api_model_base.rb
74
75
  - lib/pnap_location_api/configuration.rb
75
76
  - lib/pnap_location_api/models/error.rb
76
77
  - lib/pnap_location_api/models/location.rb
77
- - lib/pnap_location_api/models/location_enum.rb
78
78
  - lib/pnap_location_api/models/product_category.rb
79
79
  - lib/pnap_location_api/models/product_category_enum.rb
80
+ - lib/pnap_location_api/models/product_location_enum.rb
80
81
  - lib/pnap_location_api/version.rb
81
82
  - pnap_location_api.gemspec
82
83
  - spec/api/locations_api_spec.rb
83
84
  - spec/models/error_spec.rb
84
- - spec/models/location_enum_spec.rb
85
85
  - spec/models/location_spec.rb
86
86
  - spec/models/product_category_enum_spec.rb
87
87
  - spec/models/product_category_spec.rb
88
+ - spec/models/product_location_enum_spec.rb
88
89
  - spec/spec_helper.rb
89
- homepage: https://phoenixnap.com/bare-metal-cloud
90
+ homepage: https://openapi-generator.tech
90
91
  licenses:
91
92
  - MPL-2.0
92
- metadata:
93
- source_code_uri: https://github.com/phoenixnap/ruby-sdk-bmc
93
+ metadata: {}
94
94
  post_install_message:
95
95
  rdoc_options: []
96
96
  require_paths:
@@ -112,9 +112,9 @@ specification_version: 4
112
112
  summary: Locations API Ruby Gem
113
113
  test_files:
114
114
  - spec/api/locations_api_spec.rb
115
- - spec/models/error_spec.rb
116
115
  - spec/models/product_category_spec.rb
117
- - spec/models/location_enum_spec.rb
116
+ - spec/models/error_spec.rb
117
+ - spec/models/product_location_enum_spec.rb
118
118
  - spec/models/location_spec.rb
119
119
  - spec/models/product_category_enum_spec.rb
120
120
  - spec/spec_helper.rb