endoflife_date 0.10.0 → 1.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.
@@ -0,0 +1,105 @@
1
+ =begin
2
+ #endoflife.date
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)
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.4.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module EndOfLifeDateApiClient
17
+ # Whether this release cycle has active support
18
+ module CycleSupport
19
+ class << self
20
+ # List of class defined in anyOf (OpenAPI v3)
21
+ def openapi_any_of
22
+ [
23
+ :'Boolean',
24
+ :'String'
25
+ ]
26
+ end
27
+
28
+ # Builds the object
29
+ # @param [Mixed] Data to be matched against the list of anyOf items
30
+ # @return [Object] Returns the model or the data itself
31
+ def build(data)
32
+ # Go through the list of anyOf items and attempt to identify the appropriate one.
33
+ # Note:
34
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
35
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
36
+ # - TODO: scalar values are de facto behaving as if they were nullable.
37
+ # - TODO: logging when debugging is set.
38
+ openapi_any_of.each do |klass|
39
+ begin
40
+ next if klass == :AnyType # "nullable: true"
41
+ typed_data = find_and_cast_into_type(klass, data)
42
+ return typed_data if typed_data
43
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
44
+ end
45
+ end
46
+
47
+ openapi_any_of.include?(:AnyType) ? data : nil
48
+ end
49
+
50
+ private
51
+
52
+ SchemaMismatchError = Class.new(StandardError)
53
+
54
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
55
+ def find_and_cast_into_type(klass, data)
56
+ return if data.nil?
57
+
58
+ case klass.to_s
59
+ when 'Boolean'
60
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
61
+ when 'Float'
62
+ return data if data.instance_of?(Float)
63
+ when 'Integer'
64
+ return data if data.instance_of?(Integer)
65
+ when 'Time'
66
+ return Time.parse(data)
67
+ when 'Date'
68
+ return Date.parse(data)
69
+ when 'String'
70
+ return data if data.instance_of?(String)
71
+ when 'Object' # "type: object"
72
+ return data if data.instance_of?(Hash)
73
+ when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
74
+ if data.instance_of?(Array)
75
+ sub_type = Regexp.last_match[:sub_type]
76
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
77
+ end
78
+ when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
79
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
80
+ sub_type = Regexp.last_match[:sub_type]
81
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
82
+ end
83
+ else # model
84
+ const = EndOfLifeDateApiClient.const_get(klass)
85
+ if const
86
+ if const.respond_to?(:openapi_any_of) # nested anyOf model
87
+ model = const.build(data)
88
+ return model if model
89
+ else
90
+ # raise if data contains keys that are not known to the model
91
+ raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
92
+ model = const.build_from_hash(data)
93
+ return model if model
94
+ end
95
+ end
96
+ end
97
+
98
+ raise # if no match by now, raise
99
+ rescue
100
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
101
+ end
102
+ end
103
+ end
104
+
105
+ end
@@ -4,12 +4,12 @@
4
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)
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.4.0
10
10
 
11
11
  =end
12
12
 
13
13
  module EndOfLifeDateApiClient
14
- VERSION = '0.10.0'
14
+ VERSION = '1.0.0'
15
15
  end
@@ -4,9 +4,9 @@
4
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)
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.4.0
10
10
 
11
11
  =end
12
12
 
@@ -18,6 +18,11 @@ require 'endoflife_date/configuration'
18
18
 
19
19
  # Models
20
20
  require 'endoflife_date/models/cycle'
21
+ require 'endoflife_date/models/cycle_cycle'
22
+ require 'endoflife_date/models/cycle_discontinued'
23
+ require 'endoflife_date/models/cycle_eol'
24
+ require 'endoflife_date/models/cycle_lts'
25
+ require 'endoflife_date/models/cycle_support'
21
26
 
22
27
  # APIs
23
28
  require 'endoflife_date/api/default_api'
@@ -4,9 +4,9 @@
4
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)
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.4.0
10
10
 
11
11
  =end
12
12
 
@@ -36,7 +36,7 @@ describe 'DefaultApi' do
36
36
  # All Products
37
37
  # Return a list of all products. Each of these can be used for the other API endpoints.
38
38
  # @param [Hash] opts the optional parameters
39
- # @return [Object]
39
+ # @return [Array<String>]
40
40
  describe 'get_api_all_json test' do
41
41
  it 'should work' do
42
42
  # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
@@ -61,7 +61,7 @@ describe 'DefaultApi' do
61
61
  # Get EoL dates of all cycles of a given product.
62
62
  # @param product Product URL as per the canonical URL on the endofife.date website
63
63
  # @param [Hash] opts the optional parameters
64
- # @return [Object]
64
+ # @return [Array<Cycle>]
65
65
  describe 'get_api_product_json test' do
66
66
  it 'should work' do
67
67
  # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
@@ -0,0 +1,21 @@
1
+ =begin
2
+ #endoflife.date
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)
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.4.0
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+ require 'date'
16
+
17
+ # Unit tests for EndOfLifeDateApiClient::CycleCycle
18
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
+ # Please update as you see appropriate
20
+ describe EndOfLifeDateApiClient::CycleCycle do
21
+ end
@@ -0,0 +1,21 @@
1
+ =begin
2
+ #endoflife.date
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)
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.4.0
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+ require 'date'
16
+
17
+ # Unit tests for EndOfLifeDateApiClient::CycleDiscontinued
18
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
+ # Please update as you see appropriate
20
+ describe EndOfLifeDateApiClient::CycleDiscontinued do
21
+ end
@@ -0,0 +1,21 @@
1
+ =begin
2
+ #endoflife.date
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)
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.4.0
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+ require 'date'
16
+
17
+ # Unit tests for EndOfLifeDateApiClient::CycleEol
18
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
+ # Please update as you see appropriate
20
+ describe EndOfLifeDateApiClient::CycleEol do
21
+ end
@@ -0,0 +1,21 @@
1
+ =begin
2
+ #endoflife.date
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)
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.4.0
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+ require 'date'
16
+
17
+ # Unit tests for EndOfLifeDateApiClient::CycleLts
18
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
+ # Please update as you see appropriate
20
+ describe EndOfLifeDateApiClient::CycleLts do
21
+ end
@@ -4,9 +4,9 @@
4
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)
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.4.0
10
10
 
11
11
  =end
12
12
 
@@ -22,9 +22,11 @@ describe EndOfLifeDateApiClient::Cycle do
22
22
 
23
23
  describe 'test an instance of Cycle' do
24
24
  it 'should create an instance of Cycle' do
25
- expect(instance).to be_instance_of(EndOfLifeDateApiClient::Cycle)
25
+ # uncomment below to test the instance creation
26
+ #expect(instance).to be_instance_of(EndOfLifeDateApiClient::Cycle)
26
27
  end
27
28
  end
29
+
28
30
  describe 'test attribute "cycle"' do
29
31
  it 'should work' do
30
32
  # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
@@ -0,0 +1,21 @@
1
+ =begin
2
+ #endoflife.date
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)
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.4.0
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+ require 'date'
16
+
17
+ # Unit tests for EndOfLifeDateApiClient::CycleSupport
18
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
+ # Please update as you see appropriate
20
+ describe EndOfLifeDateApiClient::CycleSupport do
21
+ end
data/spec/spec_helper.rb CHANGED
@@ -4,9 +4,9 @@
4
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)
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.4.0
10
10
 
11
11
  =end
12
12
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: endoflife_date
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
- - Cliffano Subagio
7
+ - OpenAPI Clients Factory
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-19 00:00:00.000000000 Z
11
+ date: 2024-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -53,7 +53,7 @@ dependencies:
53
53
  description: Documentation for the endoflife.date API. The API is currently in Alpha.
54
54
  Additional information about the API can be found on the [endoflife.date wiki](https://github.com/endoflife-date/endoflife.date/wiki)
55
55
  email:
56
- - blah@cliffano.com
56
+ - blah+oapicf@cliffano.com
57
57
  executables: []
58
58
  extensions: []
59
59
  extra_rdoc_files: []
@@ -75,6 +75,11 @@ files:
75
75
  - bin/ruby-parse
76
76
  - bin/ruby-rewrite
77
77
  - docs/Cycle.md
78
+ - docs/CycleCycle.md
79
+ - docs/CycleDiscontinued.md
80
+ - docs/CycleEol.md
81
+ - docs/CycleLts.md
82
+ - docs/CycleSupport.md
78
83
  - docs/DefaultApi.md
79
84
  - endoflife_date.gemspec
80
85
  - git_push.sh
@@ -84,13 +89,21 @@ files:
84
89
  - lib/endoflife_date/api_error.rb
85
90
  - lib/endoflife_date/configuration.rb
86
91
  - lib/endoflife_date/models/cycle.rb
92
+ - lib/endoflife_date/models/cycle_cycle.rb
93
+ - lib/endoflife_date/models/cycle_discontinued.rb
94
+ - lib/endoflife_date/models/cycle_eol.rb
95
+ - lib/endoflife_date/models/cycle_lts.rb
96
+ - lib/endoflife_date/models/cycle_support.rb
87
97
  - lib/endoflife_date/version.rb
88
98
  - spec/api/default_api_spec.rb
89
- - spec/api_client_spec.rb
90
- - spec/configuration_spec.rb
99
+ - spec/models/cycle_cycle_spec.rb
100
+ - spec/models/cycle_discontinued_spec.rb
101
+ - spec/models/cycle_eol_spec.rb
102
+ - spec/models/cycle_lts_spec.rb
91
103
  - spec/models/cycle_spec.rb
104
+ - spec/models/cycle_support_spec.rb
92
105
  - spec/spec_helper.rb
93
- homepage: https://github.com/cliffano/endoflife.date-api-clients
106
+ homepage: https://github.com/oapicf/endoflife.date-api-clients
94
107
  licenses:
95
108
  - MIT
96
109
  metadata: {}
@@ -115,7 +128,10 @@ specification_version: 4
115
128
  summary: endoflife.date Ruby Gem
116
129
  test_files:
117
130
  - spec/api/default_api_spec.rb
118
- - spec/api_client_spec.rb
119
- - spec/configuration_spec.rb
131
+ - spec/models/cycle_discontinued_spec.rb
132
+ - spec/models/cycle_support_spec.rb
133
+ - spec/models/cycle_lts_spec.rb
120
134
  - spec/models/cycle_spec.rb
135
+ - spec/models/cycle_eol_spec.rb
136
+ - spec/models/cycle_cycle_spec.rb
121
137
  - spec/spec_helper.rb
@@ -1,228 +0,0 @@
1
- =begin
2
- #endoflife.date
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)
5
-
6
- The version of the OpenAPI document: 0.0.1
7
- Contact: blah@cliffano.com
8
- Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 7.0.0
10
-
11
- =end
12
-
13
- require 'spec_helper'
14
-
15
- describe EndOfLifeDateApiClient::ApiClient do
16
- context 'initialization' do
17
- context 'URL stuff' do
18
- context 'host' do
19
- it 'removes http from host' do
20
- EndOfLifeDateApiClient.configure { |c| c.host = 'http://example.com' }
21
- expect(EndOfLifeDateApiClient::Configuration.default.host).to eq('example.com')
22
- end
23
-
24
- it 'removes https from host' do
25
- EndOfLifeDateApiClient.configure { |c| c.host = 'https://wookiee.com' }
26
- expect(EndOfLifeDateApiClient::ApiClient.default.config.host).to eq('wookiee.com')
27
- end
28
-
29
- it 'removes trailing path from host' do
30
- EndOfLifeDateApiClient.configure { |c| c.host = 'hobo.com/v4' }
31
- expect(EndOfLifeDateApiClient::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
- EndOfLifeDateApiClient.configure { |c| c.base_path = 'v4/dog' }
38
- expect(EndOfLifeDateApiClient::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
- EndOfLifeDateApiClient.configure { |c| c.base_path = '/v4/dog' }
43
- expect(EndOfLifeDateApiClient::Configuration.default.base_path).to eq('/v4/dog')
44
- end
45
-
46
- it "ends up as a blank string if nil" do
47
- EndOfLifeDateApiClient.configure { |c| c.base_path = nil }
48
- expect(EndOfLifeDateApiClient::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) { EndOfLifeDateApiClient::Configuration.new }
56
- let(:api_client) { EndOfLifeDateApiClient::ApiClient.new(config) }
57
-
58
- it 'defaults to nil' do
59
- expect(EndOfLifeDateApiClient::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) { EndOfLifeDateApiClient::Configuration.new }
75
- let(:api_client) { EndOfLifeDateApiClient::ApiClient.new(config) }
76
-
77
- it 'defaults to 0' do
78
- expect(EndOfLifeDateApiClient::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
-
93
-
94
- describe '#deserialize' do
95
- it "handles Array<Integer>" do
96
- api_client = EndOfLifeDateApiClient::ApiClient.new
97
- headers = { 'Content-Type' => 'application/json' }
98
- response = double('response', headers: headers, body: '[12, 34]')
99
- data = api_client.deserialize(response, 'Array<Integer>')
100
- expect(data).to be_instance_of(Array)
101
- expect(data).to eq([12, 34])
102
- end
103
-
104
- it 'handles Array<Array<Integer>>' do
105
- api_client = EndOfLifeDateApiClient::ApiClient.new
106
- headers = { 'Content-Type' => 'application/json' }
107
- response = double('response', headers: headers, body: '[[12, 34], [56]]')
108
- data = api_client.deserialize(response, 'Array<Array<Integer>>')
109
- expect(data).to be_instance_of(Array)
110
- expect(data).to eq([[12, 34], [56]])
111
- end
112
-
113
- it 'handles Hash<String, String>' do
114
- api_client = EndOfLifeDateApiClient::ApiClient.new
115
- headers = { 'Content-Type' => 'application/json' }
116
- response = double('response', headers: headers, body: '{"message": "Hello"}')
117
- data = api_client.deserialize(response, 'Hash<String, String>')
118
- expect(data).to be_instance_of(Hash)
119
- expect(data).to eq(:message => 'Hello')
120
- end
121
- end
122
-
123
- describe "#object_to_hash" do
124
- it 'ignores nils and includes empty arrays' do
125
- # uncomment below to test object_to_hash for model
126
- # api_client = EndOfLifeDateApiClient::ApiClient.new
127
- # _model = EndOfLifeDateApiClient::ModelName.new
128
- # update the model attribute below
129
- # _model.id = 1
130
- # update the expected value (hash) below
131
- # expected = {id: 1, name: '', tags: []}
132
- # expect(api_client.object_to_hash(_model)).to eq(expected)
133
- end
134
- end
135
-
136
- describe '#build_collection_param' do
137
- let(:param) { ['aa', 'bb', 'cc'] }
138
- let(:api_client) { EndOfLifeDateApiClient::ApiClient.new }
139
-
140
- it 'works for csv' do
141
- expect(api_client.build_collection_param(param, :csv)).to eq('aa,bb,cc')
142
- end
143
-
144
- it 'works for ssv' do
145
- expect(api_client.build_collection_param(param, :ssv)).to eq('aa bb cc')
146
- end
147
-
148
- it 'works for tsv' do
149
- expect(api_client.build_collection_param(param, :tsv)).to eq("aa\tbb\tcc")
150
- end
151
-
152
- it 'works for pipes' do
153
- expect(api_client.build_collection_param(param, :pipes)).to eq('aa|bb|cc')
154
- end
155
-
156
- it 'works for multi' do
157
- expect(api_client.build_collection_param(param, :multi)).to eq(['aa', 'bb', 'cc'])
158
- end
159
-
160
- it 'fails for invalid collection format' do
161
- expect { api_client.build_collection_param(param, :INVALID) }.to raise_error(RuntimeError, 'unknown collection format: :INVALID')
162
- end
163
- end
164
-
165
- describe '#json_mime?' do
166
- let(:api_client) { EndOfLifeDateApiClient::ApiClient.new }
167
-
168
- it 'works' do
169
- expect(api_client.json_mime?(nil)).to eq false
170
- expect(api_client.json_mime?('')).to eq false
171
-
172
- expect(api_client.json_mime?('application/json')).to eq true
173
- expect(api_client.json_mime?('application/json; charset=UTF8')).to eq true
174
- expect(api_client.json_mime?('APPLICATION/JSON')).to eq true
175
-
176
- expect(api_client.json_mime?('application/xml')).to eq false
177
- expect(api_client.json_mime?('text/plain')).to eq false
178
- expect(api_client.json_mime?('application/jsonp')).to eq false
179
- end
180
- end
181
-
182
- describe '#select_header_accept' do
183
- let(:api_client) { EndOfLifeDateApiClient::ApiClient.new }
184
-
185
- it 'works' do
186
- expect(api_client.select_header_accept(nil)).to be_nil
187
- expect(api_client.select_header_accept([])).to be_nil
188
-
189
- expect(api_client.select_header_accept(['application/json'])).to eq('application/json')
190
- expect(api_client.select_header_accept(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
191
- expect(api_client.select_header_accept(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
192
-
193
- expect(api_client.select_header_accept(['application/xml'])).to eq('application/xml')
194
- expect(api_client.select_header_accept(['text/html', 'application/xml'])).to eq('text/html,application/xml')
195
- end
196
- end
197
-
198
- describe '#select_header_content_type' do
199
- let(:api_client) { EndOfLifeDateApiClient::ApiClient.new }
200
-
201
- it 'works' do
202
- expect(api_client.select_header_content_type(nil)).to be_nil
203
- expect(api_client.select_header_content_type([])).to be_nil
204
-
205
- expect(api_client.select_header_content_type(['application/json'])).to eq('application/json')
206
- expect(api_client.select_header_content_type(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
207
- expect(api_client.select_header_content_type(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
208
- expect(api_client.select_header_content_type(['application/xml'])).to eq('application/xml')
209
- expect(api_client.select_header_content_type(['text/plain', 'application/xml'])).to eq('text/plain')
210
- end
211
- end
212
-
213
- describe '#sanitize_filename' do
214
- let(:api_client) { EndOfLifeDateApiClient::ApiClient.new }
215
-
216
- it 'works' do
217
- expect(api_client.sanitize_filename('sun')).to eq('sun')
218
- expect(api_client.sanitize_filename('sun.gif')).to eq('sun.gif')
219
- expect(api_client.sanitize_filename('../sun.gif')).to eq('sun.gif')
220
- expect(api_client.sanitize_filename('/var/tmp/sun.gif')).to eq('sun.gif')
221
- expect(api_client.sanitize_filename('./sun.gif')).to eq('sun.gif')
222
- expect(api_client.sanitize_filename('..\sun.gif')).to eq('sun.gif')
223
- expect(api_client.sanitize_filename('\var\tmp\sun.gif')).to eq('sun.gif')
224
- expect(api_client.sanitize_filename('c:\var\tmp\sun.gif')).to eq('sun.gif')
225
- expect(api_client.sanitize_filename('.\sun.gif')).to eq('sun.gif')
226
- end
227
- end
228
- end
@@ -1,42 +0,0 @@
1
- =begin
2
- #endoflife.date
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)
5
-
6
- The version of the OpenAPI document: 0.0.1
7
- Contact: blah@cliffano.com
8
- Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 7.0.0
10
-
11
- =end
12
-
13
- require 'spec_helper'
14
-
15
- describe EndOfLifeDateApiClient::Configuration do
16
- let(:config) { EndOfLifeDateApiClient::Configuration.default }
17
-
18
- before(:each) do
19
- # uncomment below to setup host and base_path
20
- # require 'URI'
21
- # uri = URI.parse("https://endoflife.date")
22
- # EndOfLifeDateApiClient.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://endoflife.date")
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://endoflife.date")
39
- end
40
- end
41
- end
42
- end