manageiq-api-client 0.3.7 → 0.4.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2cf72edce682a6dd72ea4e953b17db64d99cd5c32c9d768f1d41bf8c4b09b888
|
4
|
+
data.tar.gz: 1b2df1d7796fa18e4d20c00355b6505566dac1bd5454ca70b71ed80204832ec7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9591e051844cf72bcd26df553c0e4c745b7a430111cdbc3c5e5ef3e0aa25a3b78d3a9479b3821f8a1e9d1055c3256f2b8bd9c352ed34656a35cb0c58e4a60e94
|
7
|
+
data.tar.gz: ae40d2fefa9a9dcd234b0f158c2dd2dec3440c0c2ddf72143bb176eb221736c14b153aa10093e801e4210e36b648071c95f2b30bd71d8d1e6a1eec4c1a9f7f4c
|
data/.github/workflows/ci.yaml
CHANGED
@@ -22,7 +22,7 @@ jobs:
|
|
22
22
|
TEST_RAILS_VERSION: ${{ matrix.rails-version }}
|
23
23
|
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
|
24
24
|
steps:
|
25
|
-
- uses: actions/checkout@
|
25
|
+
- uses: actions/checkout@v4
|
26
26
|
- name: Set up Ruby
|
27
27
|
uses: ruby/setup-ruby@v1
|
28
28
|
with:
|
@@ -34,4 +34,4 @@ jobs:
|
|
34
34
|
- name: Report code coverage
|
35
35
|
if: ${{ github.ref == 'refs/heads/master' && matrix.ruby-version == '3.0' && matrix.rails-version == '6.1' }}
|
36
36
|
continue-on-error: true
|
37
|
-
uses: paambaati/codeclimate-action@
|
37
|
+
uses: paambaati/codeclimate-action@v5
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
## [0.4.0] - 2023-10-16
|
10
|
+
### Added
|
11
|
+
- Add Bearer token support [[#113]](https://github.com/ManageIQ/manageiq-api-client/pull/113)
|
12
|
+
|
9
13
|
## [0.3.7] - 2023-05-19
|
10
14
|
### Changed
|
11
15
|
- Loosen faraday to 1.x. [[#108]](https://github.com/ManageIQ/manageiq-api-client/pull/108)
|
@@ -61,7 +65,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
61
65
|
- Add CHANGELOG.md
|
62
66
|
- Update README with simple instructions reflecting the query interface.
|
63
67
|
|
64
|
-
[Unreleased]: https://github.com/ManageIQ/manageiq-api-client/compare/v0.
|
68
|
+
[Unreleased]: https://github.com/ManageIQ/manageiq-api-client/compare/v0.4.0...HEAD
|
69
|
+
[0.4.0]: https://github.com/ManageIQ/manageiq-api-client/compare/v0.3.7...v0.4.0
|
65
70
|
[0.3.7]: https://github.com/ManageIQ/manageiq-api-client/compare/v0.3.6...v0.3.7
|
66
71
|
[0.3.6]: https://github.com/ManageIQ/manageiq-api-client/compare/v0.3.5...v0.3.6
|
67
72
|
[0.3.5]: https://github.com/ManageIQ/manageiq-api-client/compare/v0.3.4...v0.3.5
|
@@ -6,6 +6,7 @@ module ManageIQ
|
|
6
6
|
attr_reader :password
|
7
7
|
attr_reader :token
|
8
8
|
attr_reader :miqtoken
|
9
|
+
attr_reader :bearer_token
|
9
10
|
attr_reader :group
|
10
11
|
|
11
12
|
DEFAULTS = {
|
@@ -13,26 +14,26 @@ module ManageIQ
|
|
13
14
|
:password => "smartvm"
|
14
15
|
}.freeze
|
15
16
|
|
16
|
-
CUSTOM_INSPECT_EXCLUSIONS = [
|
17
|
+
CUSTOM_INSPECT_EXCLUSIONS = %i[@password @token @miqtoken @bearer_token].freeze
|
17
18
|
include CustomInspectMixin
|
18
19
|
|
19
20
|
def initialize(options = {})
|
20
21
|
@user, @password = fetch_credentials(options)
|
21
|
-
@token, @miqtoken, @group = options.values_at(:token, :miqtoken, :group)
|
22
|
+
@token, @miqtoken, @bearer_token, @group = options.values_at(:token, :miqtoken, :bearer_token, :group)
|
22
23
|
|
23
|
-
unless token || miqtoken
|
24
|
+
unless token || miqtoken || bearer_token
|
24
25
|
raise "Must specify both a user and a password" if user.blank? || password.blank?
|
25
26
|
end
|
26
27
|
end
|
27
28
|
|
28
29
|
def self.auth_options_specified?(options)
|
29
|
-
options.slice(:user, :password, :token, :miqtoken, :group).present?
|
30
|
+
options.slice(:user, :password, :token, :miqtoken, :bearer_token, :group).present?
|
30
31
|
end
|
31
32
|
|
32
33
|
private
|
33
34
|
|
34
35
|
def fetch_credentials(options)
|
35
|
-
if options.slice(:user, :password, :token, :miqtoken).blank?
|
36
|
+
if options.slice(:user, :password, :token, :miqtoken, :bearer_token).blank?
|
36
37
|
[DEFAULTS[:user], DEFAULTS[:password]]
|
37
38
|
else
|
38
39
|
[options[:user], options[:password]]
|
@@ -76,7 +76,7 @@ module ManageIQ
|
|
76
76
|
faraday.response(:logger, client.logger)
|
77
77
|
faraday.use FaradayMiddleware::FollowRedirects, :limit => 3, :standards_compliant => true
|
78
78
|
faraday.adapter(Faraday.default_adapter) # make requests with Net::HTTP
|
79
|
-
if authentication.token.blank? && authentication.miqtoken.blank?
|
79
|
+
if authentication.token.blank? && authentication.miqtoken.blank? && authentication.bearer_token.blank?
|
80
80
|
faraday.basic_auth(authentication.user, authentication.password)
|
81
81
|
end
|
82
82
|
end
|
@@ -90,6 +90,7 @@ module ManageIQ
|
|
90
90
|
@response = handle.run_request(method.to_sym, api_path(path), nil, nil) do |request|
|
91
91
|
request.headers[:content_type] = CONTENT_TYPE
|
92
92
|
request.headers[:accept] = CONTENT_TYPE
|
93
|
+
request.headers[:authorization] = "Bearer #{authentication.bearer_token}" unless authentication.bearer_token.blank?
|
93
94
|
request.headers['X-MIQ-Group'] = authentication.group unless authentication.group.blank?
|
94
95
|
request.headers['X-Auth-Token'] = authentication.token unless authentication.token.blank?
|
95
96
|
request.headers['X-MIQ-Token'] = authentication.miqtoken unless authentication.miqtoken.blank?
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: manageiq-api-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alberto Bellotti
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-
|
12
|
+
date: 2023-10-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|