endoflife_date 0.10.0 → 1.1.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.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +53 -31
  3. data/README.md +14 -8
  4. data/bin/byebug +1 -12
  5. data/bin/coderay +1 -12
  6. data/bin/htmldiff +1 -12
  7. data/bin/ldiff +1 -12
  8. data/bin/pry +1 -12
  9. data/bin/racc +1 -12
  10. data/bin/rake +1 -12
  11. data/bin/rspec +1 -12
  12. data/bin/rubocop +1 -12
  13. data/bin/ruby-parse +1 -12
  14. data/bin/ruby-rewrite +1 -12
  15. data/docs/Cycle.md +8 -8
  16. data/docs/CycleCycle.md +15 -0
  17. data/docs/CycleDiscontinued.md +15 -0
  18. data/docs/CycleEol.md +15 -0
  19. data/docs/CycleLts.md +15 -0
  20. data/docs/CycleSupport.md +15 -0
  21. data/docs/DefaultApi.md +15 -15
  22. data/endoflife_date.gemspec +8 -7
  23. data/git_push.sh +1 -1
  24. data/lib/endoflife_date/api/default_api.rb +20 -20
  25. data/lib/endoflife_date/api_client.rb +25 -24
  26. data/lib/endoflife_date/api_error.rb +3 -3
  27. data/lib/endoflife_date/api_model_base.rb +88 -0
  28. data/lib/endoflife_date/configuration.rb +16 -5
  29. data/lib/endoflife_date/models/cycle.rb +41 -175
  30. data/lib/endoflife_date/models/cycle_cycle.rb +104 -0
  31. data/lib/endoflife_date/models/cycle_discontinued.rb +104 -0
  32. data/lib/endoflife_date/models/cycle_eol.rb +104 -0
  33. data/lib/endoflife_date/models/cycle_lts.rb +104 -0
  34. data/lib/endoflife_date/models/cycle_support.rb +104 -0
  35. data/lib/endoflife_date/version.rb +4 -4
  36. data/lib/endoflife_date.rb +9 -3
  37. data/spec/api/default_api_spec.rb +9 -9
  38. data/spec/models/cycle_cycle_spec.rb +21 -0
  39. data/spec/models/cycle_discontinued_spec.rb +21 -0
  40. data/spec/models/cycle_eol_spec.rb +21 -0
  41. data/spec/models/cycle_lts_spec.rb +21 -0
  42. data/spec/models/cycle_spec.rb +7 -5
  43. data/spec/models/cycle_support_spec.rb +21 -0
  44. data/spec/spec_helper.rb +3 -3
  45. metadata +32 -16
  46. data/bin/bundle +0 -109
  47. data/spec/api_client_spec.rb +0 -228
  48. data/spec/configuration_spec.rb +0 -42
data/docs/DefaultApi.md CHANGED
@@ -11,7 +11,7 @@ All URIs are relative to *https://endoflife.date*
11
11
 
12
12
  ## get_api_all_json
13
13
 
14
- > Object get_api_all_json
14
+ > Array<String> get_api_all_json
15
15
 
16
16
  All Products
17
17
 
@@ -38,7 +38,7 @@ end
38
38
 
39
39
  This returns an Array which contains the response data, status code and headers.
40
40
 
41
- > <Array(Object, Integer, Hash)> get_api_all_json_with_http_info
41
+ > <Array(Array&lt;String&gt;, Integer, Hash)> get_api_all_json_with_http_info
42
42
 
43
43
  ```ruby
44
44
  begin
@@ -46,7 +46,7 @@ begin
46
46
  data, status_code, headers = api_instance.get_api_all_json_with_http_info
47
47
  p status_code # => 2xx
48
48
  p headers # => { ... }
49
- p data # => Object
49
+ p data # => Array&lt;String&gt;
50
50
  rescue EndOfLifeDateApiClient::ApiError => e
51
51
  puts "Error when calling DefaultApi->get_api_all_json_with_http_info: #{e}"
52
52
  end
@@ -58,7 +58,7 @@ This endpoint does not need any parameter.
58
58
 
59
59
  ### Return type
60
60
 
61
- **Object**
61
+ **Array&lt;String&gt;**
62
62
 
63
63
  ### Authorization
64
64
 
@@ -76,7 +76,7 @@ No authorization required
76
76
 
77
77
  Single cycle details
78
78
 
79
- Gets details of a single cycle
79
+ Gets details of a single cycle.
80
80
 
81
81
  ### Examples
82
82
 
@@ -85,8 +85,8 @@ require 'time'
85
85
  require 'endoflife_date'
86
86
 
87
87
  api_instance = EndOfLifeDateApiClient::DefaultApi.new
88
- product = TODO # Object | Product URL as per the canonical URL on the endofife.date website
89
- cycle = TODO # Object | Release Cycle for which the details must be fetched
88
+ product = 'product_example' # String | Product URL as per the canonical URL on the endofife.date website.
89
+ cycle = 'cycle_example' # String | Release Cycle for which the details must be fetched. Any slash character in the cycle name will be replaced with dashes. For example FreeBSD's releng/14.0 becomes releng-14.0.
90
90
 
91
91
  begin
92
92
  # Single cycle details
@@ -119,8 +119,8 @@ end
119
119
 
120
120
  | Name | Type | Description | Notes |
121
121
  | ---- | ---- | ----------- | ----- |
122
- | **product** | [**Object**](.md) | Product URL as per the canonical URL on the endofife.date website | |
123
- | **cycle** | [**Object**](.md) | Release Cycle for which the details must be fetched | |
122
+ | **product** | **String** | Product URL as per the canonical URL on the endofife.date website. | |
123
+ | **cycle** | **String** | Release Cycle for which the details must be fetched. Any slash character in the cycle name will be replaced with dashes. For example FreeBSD&#39;s releng/14.0 becomes releng-14.0. | |
124
124
 
125
125
  ### Return type
126
126
 
@@ -138,7 +138,7 @@ No authorization required
138
138
 
139
139
  ## get_api_product_json
140
140
 
141
- > Object get_api_product_json(product)
141
+ > <Array<Cycle>> get_api_product_json(product)
142
142
 
143
143
  Get All Details
144
144
 
@@ -151,7 +151,7 @@ require 'time'
151
151
  require 'endoflife_date'
152
152
 
153
153
  api_instance = EndOfLifeDateApiClient::DefaultApi.new
154
- product = TODO # Object | Product URL as per the canonical URL on the endofife.date website
154
+ product = 'product_example' # String | Product URL as per the canonical URL on the endofife.date website.
155
155
 
156
156
  begin
157
157
  # Get All Details
@@ -166,7 +166,7 @@ end
166
166
 
167
167
  This returns an Array which contains the response data, status code and headers.
168
168
 
169
- > <Array(Object, Integer, Hash)> get_api_product_json_with_http_info(product)
169
+ > <Array(<Array<Cycle>>, Integer, Hash)> get_api_product_json_with_http_info(product)
170
170
 
171
171
  ```ruby
172
172
  begin
@@ -174,7 +174,7 @@ begin
174
174
  data, status_code, headers = api_instance.get_api_product_json_with_http_info(product)
175
175
  p status_code # => 2xx
176
176
  p headers # => { ... }
177
- p data # => Object
177
+ p data # => <Array<Cycle>>
178
178
  rescue EndOfLifeDateApiClient::ApiError => e
179
179
  puts "Error when calling DefaultApi->get_api_product_json_with_http_info: #{e}"
180
180
  end
@@ -184,11 +184,11 @@ end
184
184
 
185
185
  | Name | Type | Description | Notes |
186
186
  | ---- | ---- | ----------- | ----- |
187
- | **product** | [**Object**](.md) | Product URL as per the canonical URL on the endofife.date website | |
187
+ | **product** | **String** | Product URL as per the canonical URL on the endofife.date website. | |
188
188
 
189
189
  ### Return type
190
190
 
191
- **Object**
191
+ [**Array&lt;Cycle&gt;**](Cycle.md)
192
192
 
193
193
  ### Authorization
194
194
 
@@ -3,12 +3,12 @@
3
3
  =begin
4
4
  #endoflife.date
5
5
 
6
- #Documentation for the endoflife.date API. The API is currently in Alpha. Additional information about the API can be found on the [endoflife.date wiki](https://github.com/endoflife-date/endoflife.date/wiki)
6
+ #The endoflife.date v0 API is currently deprecated, please [use the endoflife.date v1 API](https://endoflife.date/docs/api/v1/).
7
7
 
8
8
  The version of the OpenAPI document: 0.0.1
9
- Contact: blah@cliffano.com
9
+ Contact: blah+oapicf@cliffano.com
10
10
  Generated by: https://openapi-generator.tech
11
- OpenAPI Generator version: 7.0.0
11
+ Generator version: 7.17.0
12
12
 
13
13
  =end
14
14
 
@@ -19,13 +19,14 @@ Gem::Specification.new do |s|
19
19
  s.name = "endoflife_date"
20
20
  s.version = EndOfLifeDateApiClient::VERSION
21
21
  s.platform = Gem::Platform::RUBY
22
- s.authors = ["Cliffano Subagio"]
23
- s.email = ["blah@cliffano.com"]
24
- s.homepage = "https://github.com/cliffano/endoflife.date-api-clients"
22
+ s.authors = ["OpenAPI Clients Factory"]
23
+ s.email = ["blah+oapicf@cliffano.com"]
24
+ s.homepage = "https://github.com/oapicf/endoflife.date-api-clients"
25
25
  s.summary = "endoflife.date Ruby Gem"
26
- s.description = "Documentation for the endoflife.date API. The API is currently in Alpha. Additional information about the API can be found on the [endoflife.date wiki](https://github.com/endoflife-date/endoflife.date/wiki)"
26
+ s.description = "The endoflife.date v0 API is currently deprecated, please [use the endoflife.date v1 API](https://endoflife.date/docs/api/v1/)."
27
27
  s.license = "MIT"
28
28
  s.required_ruby_version = ">= 2.0"
29
+ s.metadata = {}
29
30
 
30
31
  s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
31
32
 
data/git_push.sh CHANGED
@@ -14,7 +14,7 @@ if [ "$git_host" = "" ]; then
14
14
  fi
15
15
 
16
16
  if [ "$git_user_id" = "" ]; then
17
- git_user_id="cliffano"
17
+ git_user_id="oapicf"
18
18
  echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
19
19
  fi
20
20
 
@@ -1,12 +1,12 @@
1
1
  =begin
2
2
  #endoflife.date
3
3
 
4
- #Documentation for the endoflife.date API. The API is currently in Alpha. Additional information about the API can be found on the [endoflife.date wiki](https://github.com/endoflife-date/endoflife.date/wiki)
4
+ #The endoflife.date v0 API is currently deprecated, please [use the endoflife.date v1 API](https://endoflife.date/docs/api/v1/).
5
5
 
6
6
  The version of the OpenAPI document: 0.0.1
7
- Contact: blah@cliffano.com
7
+ Contact: blah+oapicf@cliffano.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 7.0.0
9
+ Generator version: 7.17.0
10
10
 
11
11
  =end
12
12
 
@@ -22,7 +22,7 @@ module EndOfLifeDateApiClient
22
22
  # All Products
23
23
  # Return a list of all products. Each of these can be used for the other API endpoints.
24
24
  # @param [Hash] opts the optional parameters
25
- # @return [Object]
25
+ # @return [Array<String>]
26
26
  def get_api_all_json(opts = {})
27
27
  data, _status_code, _headers = get_api_all_json_with_http_info(opts)
28
28
  data
@@ -31,7 +31,7 @@ module EndOfLifeDateApiClient
31
31
  # All Products
32
32
  # Return a list of all products. Each of these can be used for the other API endpoints.
33
33
  # @param [Hash] opts the optional parameters
34
- # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
34
+ # @return [Array<(Array<String>, Integer, Hash)>] Array<String> data, response status code and response headers
35
35
  def get_api_all_json_with_http_info(opts = {})
36
36
  if @api_client.config.debugging
37
37
  @api_client.config.logger.debug 'Calling API: DefaultApi.get_api_all_json ...'
@@ -45,7 +45,7 @@ module EndOfLifeDateApiClient
45
45
  # header parameters
46
46
  header_params = opts[:header_params] || {}
47
47
  # HTTP header 'Accept' (if needed)
48
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
48
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
49
49
 
50
50
  # form parameters
51
51
  form_params = opts[:form_params] || {}
@@ -54,7 +54,7 @@ module EndOfLifeDateApiClient
54
54
  post_body = opts[:debug_body]
55
55
 
56
56
  # return_type
57
- return_type = opts[:debug_return_type] || 'Object'
57
+ return_type = opts[:debug_return_type] || 'Array<String>'
58
58
 
59
59
  # auth_names
60
60
  auth_names = opts[:debug_auth_names] || []
@@ -77,9 +77,9 @@ module EndOfLifeDateApiClient
77
77
  end
78
78
 
79
79
  # Single cycle details
80
- # Gets details of a single cycle
81
- # @param product [Object] Product URL as per the canonical URL on the endofife.date website
82
- # @param cycle [Object] Release Cycle for which the details must be fetched
80
+ # Gets details of a single cycle.
81
+ # @param product [String] Product URL as per the canonical URL on the endofife.date website.
82
+ # @param cycle [String] Release Cycle for which the details must be fetched. Any slash character in the cycle name will be replaced with dashes. For example FreeBSD&#39;s releng/14.0 becomes releng-14.0.
83
83
  # @param [Hash] opts the optional parameters
84
84
  # @return [Cycle]
85
85
  def get_api_product_cycle_json(product, cycle, opts = {})
@@ -88,9 +88,9 @@ module EndOfLifeDateApiClient
88
88
  end
89
89
 
90
90
  # Single cycle details
91
- # Gets details of a single cycle
92
- # @param product [Object] Product URL as per the canonical URL on the endofife.date website
93
- # @param cycle [Object] Release Cycle for which the details must be fetched
91
+ # Gets details of a single cycle.
92
+ # @param product [String] Product URL as per the canonical URL on the endofife.date website.
93
+ # @param cycle [String] Release Cycle for which the details must be fetched. Any slash character in the cycle name will be replaced with dashes. For example FreeBSD&#39;s releng/14.0 becomes releng-14.0.
94
94
  # @param [Hash] opts the optional parameters
95
95
  # @return [Array<(Cycle, Integer, Hash)>] Cycle data, response status code and response headers
96
96
  def get_api_product_cycle_json_with_http_info(product, cycle, opts = {})
@@ -114,7 +114,7 @@ module EndOfLifeDateApiClient
114
114
  # header parameters
115
115
  header_params = opts[:header_params] || {}
116
116
  # HTTP header 'Accept' (if needed)
117
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
117
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
118
118
 
119
119
  # form parameters
120
120
  form_params = opts[:form_params] || {}
@@ -147,9 +147,9 @@ module EndOfLifeDateApiClient
147
147
 
148
148
  # Get All Details
149
149
  # Get EoL dates of all cycles of a given product.
150
- # @param product [Object] Product URL as per the canonical URL on the endofife.date website
150
+ # @param product [String] Product URL as per the canonical URL on the endofife.date website.
151
151
  # @param [Hash] opts the optional parameters
152
- # @return [Object]
152
+ # @return [Array<Cycle>]
153
153
  def get_api_product_json(product, opts = {})
154
154
  data, _status_code, _headers = get_api_product_json_with_http_info(product, opts)
155
155
  data
@@ -157,9 +157,9 @@ module EndOfLifeDateApiClient
157
157
 
158
158
  # Get All Details
159
159
  # Get EoL dates of all cycles of a given product.
160
- # @param product [Object] Product URL as per the canonical URL on the endofife.date website
160
+ # @param product [String] Product URL as per the canonical URL on the endofife.date website.
161
161
  # @param [Hash] opts the optional parameters
162
- # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
162
+ # @return [Array<(Array<Cycle>, Integer, Hash)>] Array<Cycle> data, response status code and response headers
163
163
  def get_api_product_json_with_http_info(product, opts = {})
164
164
  if @api_client.config.debugging
165
165
  @api_client.config.logger.debug 'Calling API: DefaultApi.get_api_product_json ...'
@@ -177,7 +177,7 @@ module EndOfLifeDateApiClient
177
177
  # header parameters
178
178
  header_params = opts[:header_params] || {}
179
179
  # HTTP header 'Accept' (if needed)
180
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
180
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
181
181
 
182
182
  # form parameters
183
183
  form_params = opts[:form_params] || {}
@@ -186,7 +186,7 @@ module EndOfLifeDateApiClient
186
186
  post_body = opts[:debug_body]
187
187
 
188
188
  # return_type
189
- return_type = opts[:debug_return_type] || 'Object'
189
+ return_type = opts[:debug_return_type] || 'Array<Cycle>'
190
190
 
191
191
  # auth_names
192
192
  auth_names = opts[:debug_auth_names] || []
@@ -1,12 +1,12 @@
1
1
  =begin
2
2
  #endoflife.date
3
3
 
4
- #Documentation for the endoflife.date API. The API is currently in Alpha. Additional information about the API can be found on the [endoflife.date wiki](https://github.com/endoflife-date/endoflife.date/wiki)
4
+ #The endoflife.date v0 API is currently deprecated, please [use the endoflife.date v1 API](https://endoflife.date/docs/api/v1/).
5
5
 
6
6
  The version of the OpenAPI document: 0.0.1
7
- Contact: blah@cliffano.com
7
+ Contact: blah+oapicf@cliffano.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 7.0.0
9
+ Generator version: 7.17.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 EndOfLifeDateApiClient
21
22
  class ApiClient
22
23
  # The Configuration object holding settings to be used in the API client.
@@ -45,9 +46,11 @@ module EndOfLifeDateApiClient
45
46
  # Call an API with given options.
46
47
  #
47
48
  # @return [Array<(Object, Integer, Hash)>] an array of 3 elements:
48
- # the data deserialized from response body (could be nil), response status code and response headers.
49
+ # the data deserialized from response body (may be a Tempfile or nil), response status code and response headers.
49
50
  def call_api(http_method, path, opts = {})
50
51
  request = build_request(http_method, path, opts)
52
+ tempfile = nil
53
+ (download_file(request) { tempfile = _1 }) if opts[:return_type] == 'File'
51
54
  response = request.run
52
55
 
53
56
  if @config.debugging
@@ -69,7 +72,9 @@ module EndOfLifeDateApiClient
69
72
  end
70
73
  end
71
74
 
72
- if opts[:return_type]
75
+ if opts[:return_type] == 'File'
76
+ data = tempfile
77
+ elsif opts[:return_type]
73
78
  data = deserialize(response, opts[:return_type])
74
79
  else
75
80
  data = nil
@@ -124,9 +129,7 @@ module EndOfLifeDateApiClient
124
129
  end
125
130
  end
126
131
 
127
- request = Typhoeus::Request.new(url, req_opts)
128
- download_file(request) if opts[:return_type] == 'File'
129
- request
132
+ Typhoeus::Request.new(url, req_opts)
130
133
  end
131
134
 
132
135
  # Builds the HTTP request body
@@ -164,6 +167,8 @@ module EndOfLifeDateApiClient
164
167
  # process can use.
165
168
  #
166
169
  # @see Configuration#temp_folder_path
170
+ #
171
+ # @return [Tempfile] the tempfile generated
167
172
  def download_file(request)
168
173
  tempfile = nil
169
174
  encoding = nil
@@ -178,20 +183,21 @@ module EndOfLifeDateApiClient
178
183
  prefix = prefix + '-' unless prefix.end_with?('-')
179
184
  encoding = response.body.encoding
180
185
  tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
181
- @tempfile = tempfile
182
186
  end
183
187
  request.on_body do |chunk|
184
188
  chunk.force_encoding(encoding)
185
189
  tempfile.write(chunk)
186
190
  end
187
- request.on_complete do |response|
188
- if tempfile
189
- tempfile.close
190
- @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
191
- "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
192
- "will be deleted automatically with GC. It's also recommended to delete the temp file "\
193
- "explicitly with `tempfile.delete`"
191
+ request.on_complete do
192
+ if !tempfile
193
+ fail ApiError.new("Failed to create the tempfile based on the HTTP response from the server: #{request.inspect}")
194
194
  end
195
+ tempfile.close
196
+ @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
197
+ "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
198
+ "will be deleted automatically with GC. It's also recommended to delete the temp file "\
199
+ "explicitly with `tempfile.delete`"
200
+ yield tempfile if block_given?
195
201
  end
196
202
  end
197
203
 
@@ -204,7 +210,7 @@ module EndOfLifeDateApiClient
204
210
  # @param [String] mime MIME
205
211
  # @return [Boolean] True if the MIME is application/json
206
212
  def json_mime?(mime)
207
- (mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil?
213
+ (mime == '*/*') || !(mime =~ /^Application\/.*json(?!p)(;.*)?/i).nil?
208
214
  end
209
215
 
210
216
  # Deserialize the response to the given return type.
@@ -213,15 +219,10 @@ module EndOfLifeDateApiClient
213
219
  # @param [String] return_type some examples: "User", "Array<User>", "Hash<String, Integer>"
214
220
  def deserialize(response, return_type)
215
221
  body = response.body
216
-
217
- # handle file downloading - return the File instance processed in request callbacks
218
- # note that response body is empty when the file is written in chunks in request on_body callback
219
- return @tempfile if return_type == 'File'
220
-
221
222
  return nil if body.nil? || body.empty?
222
223
 
223
224
  # return response body directly for String return type
224
- return body if return_type == 'String'
225
+ return body.to_s if return_type == 'String'
225
226
 
226
227
  # ensuring a default content type
227
228
  content_type = response.headers['Content-Type'] || 'application/json'
@@ -288,7 +289,7 @@ module EndOfLifeDateApiClient
288
289
  # @param [String] filename the filename to be sanitized
289
290
  # @return [String] the sanitized filename
290
291
  def sanitize_filename(filename)
291
- filename.gsub(/.*[\/\\]/, '')
292
+ filename.split(/[\/\\]/).last
292
293
  end
293
294
 
294
295
  def build_request_url(path, opts = {})
@@ -1,12 +1,12 @@
1
1
  =begin
2
2
  #endoflife.date
3
3
 
4
- #Documentation for the endoflife.date API. The API is currently in Alpha. Additional information about the API can be found on the [endoflife.date wiki](https://github.com/endoflife-date/endoflife.date/wiki)
4
+ #The endoflife.date v0 API is currently deprecated, please [use the endoflife.date v1 API](https://endoflife.date/docs/api/v1/).
5
5
 
6
6
  The version of the OpenAPI document: 0.0.1
7
- Contact: blah@cliffano.com
7
+ Contact: blah+oapicf@cliffano.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 7.0.0
9
+ Generator version: 7.17.0
10
10
 
11
11
  =end
12
12
 
@@ -0,0 +1,88 @@
1
+ =begin
2
+ #endoflife.date
3
+
4
+ #The endoflife.date v0 API is currently deprecated, please [use the endoflife.date v1 API](https://endoflife.date/docs/api/v1/).
5
+
6
+ The version of the OpenAPI document: 0.0.1
7
+ Contact: blah+oapicf@cliffano.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.17.0
10
+
11
+ =end
12
+
13
+ module EndOfLifeDateApiClient
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 = EndOfLifeDateApiClient.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
@@ -1,12 +1,12 @@
1
1
  =begin
2
2
  #endoflife.date
3
3
 
4
- #Documentation for the endoflife.date API. The API is currently in Alpha. Additional information about the API can be found on the [endoflife.date wiki](https://github.com/endoflife-date/endoflife.date/wiki)
4
+ #The endoflife.date v0 API is currently deprecated, please [use the endoflife.date v1 API](https://endoflife.date/docs/api/v1/).
5
5
 
6
6
  The version of the OpenAPI document: 0.0.1
7
- Contact: blah@cliffano.com
7
+ Contact: blah+oapicf@cliffano.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 7.0.0
9
+ Generator version: 7.17.0
10
10
 
11
11
  =end
12
12
 
@@ -79,6 +79,14 @@ module EndOfLifeDateApiClient
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 EndOfLifeDateApiClient
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 EndOfLifeDateApiClient
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])
@@ -222,8 +232,8 @@ module EndOfLifeDateApiClient
222
232
 
223
233
  # Gets access_token using access_token_getter or uses the static access_token
224
234
  def access_token_with_refresh
225
- return access_token if access_token_getter.nil?
226
- access_token_getter.call
235
+ return access_token if access_token_getter.nil?
236
+ access_token_getter.call
227
237
  end
228
238
 
229
239
  # Gets Basic Auth token string
@@ -286,5 +296,6 @@ module EndOfLifeDateApiClient
286
296
  url
287
297
  end
288
298
 
299
+
289
300
  end
290
301
  end