manageiq-api-client 0.3.6 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7959ef2327119a429ceb67092ac91aa3cfb6ab3b6a8bf2c9e5970ae7c5176a38
4
- data.tar.gz: 568656db7b57a43afa20ad31cc0a33c40d827bb01d9fdf4995b228f9f8cfa648
3
+ metadata.gz: 2cf72edce682a6dd72ea4e953b17db64d99cd5c32c9d768f1d41bf8c4b09b888
4
+ data.tar.gz: 1b2df1d7796fa18e4d20c00355b6505566dac1bd5454ca70b71ed80204832ec7
5
5
  SHA512:
6
- metadata.gz: c93aa6aca1516067ef20a00f80bfff4cccbff80c90aa25e14dbeec75419e848b009a3390c30db6479dec7b3053ef09705c351af75edf4771aa85f73b3140bc62
7
- data.tar.gz: 820ea3dbfa71b2df6fccb95837bea789596439f9d5560c429bc818bc2e3ff4d8e5e3ef19700f117ec90c12bf73e24b23ee7827ec98a11f218a0463b8a104455a
6
+ metadata.gz: 9591e051844cf72bcd26df553c0e4c745b7a430111cdbc3c5e5ef3e0aa25a3b78d3a9479b3821f8a1e9d1055c3256f2b8bd9c352ed34656a35cb0c58e4a60e94
7
+ data.tar.gz: ae40d2fefa9a9dcd234b0f158c2dd2dec3440c0c2ddf72143bb176eb221736c14b153aa10093e801e4210e36b648071c95f2b30bd71d8d1e6a1eec4c1a9f7f4c
@@ -22,15 +22,16 @@ 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@v2
25
+ - uses: actions/checkout@v4
26
26
  - name: Set up Ruby
27
27
  uses: ruby/setup-ruby@v1
28
28
  with:
29
29
  ruby-version: ${{ matrix.ruby-version }}
30
30
  bundler-cache: true
31
+ timeout-minutes: 30
31
32
  - name: Run tests
32
33
  run: bundle exec rake
33
34
  - name: Report code coverage
34
35
  if: ${{ github.ref == 'refs/heads/master' && matrix.ruby-version == '3.0' && matrix.rails-version == '6.1' }}
35
36
  continue-on-error: true
36
- uses: paambaati/codeclimate-action@v3.0.0
37
+ uses: paambaati/codeclimate-action@v5
data/CHANGELOG.md CHANGED
@@ -6,6 +6,14 @@ 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
+
13
+ ## [0.3.7] - 2023-05-19
14
+ ### Changed
15
+ - Loosen faraday to 1.x. [[#108]](https://github.com/ManageIQ/manageiq-api-client/pull/108)
16
+
9
17
  ## [0.3.6] - 2022-05-30
10
18
  ### Changed
11
19
  - Added support to ActiveSupport 6.1 [[#100]](https://github.com/ManageIQ/manageiq-api-client/pull/100)
@@ -57,7 +65,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
57
65
  - Add CHANGELOG.md
58
66
  - Update README with simple instructions reflecting the query interface.
59
67
 
60
- [Unreleased]: https://github.com/ManageIQ/manageiq-api-client/compare/v0.3.6...HEAD
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
70
+ [0.3.7]: https://github.com/ManageIQ/manageiq-api-client/compare/v0.3.6...v0.3.7
61
71
  [0.3.6]: https://github.com/ManageIQ/manageiq-api-client/compare/v0.3.5...v0.3.6
62
72
  [0.3.5]: https://github.com/ManageIQ/manageiq-api-client/compare/v0.3.4...v0.3.5
63
73
  [0.3.4]: https://github.com/ManageIQ/manageiq-api-client/compare/v0.3.3...v0.3.4
@@ -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 = [:@password].freeze
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?
@@ -1,7 +1,7 @@
1
1
  module ManageIQ
2
2
  module API
3
3
  class Client
4
- VERSION = "0.3.6".freeze
4
+ VERSION = "0.4.0".freeze
5
5
  end
6
6
  end
7
7
  end
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
24
24
  spec.require_paths = ["lib"]
25
25
 
26
26
  spec.add_dependency "activesupport", ">= 5.0", "< 7.0"
27
- spec.add_dependency "faraday", "~> 1.0.0"
27
+ spec.add_dependency "faraday", "~> 1.0"
28
28
  spec.add_dependency "faraday_middleware", "~> 1.0"
29
29
  spec.add_dependency "json", "~> 2.3"
30
30
  spec.add_dependency "more_core_extensions"
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.3.6
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: 2022-04-29 00:00:00.000000000 Z
12
+ date: 2023-10-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -37,14 +37,14 @@ dependencies:
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.0.0
40
+ version: '1.0'
41
41
  type: :runtime
42
42
  prerelease: false
43
43
  version_requirements: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.0.0
47
+ version: '1.0'
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: faraday_middleware
50
50
  requirement: !ruby/object:Gem::Requirement
@@ -252,7 +252,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
252
252
  - !ruby/object:Gem::Version
253
253
  version: '0'
254
254
  requirements: []
255
- rubygems_version: 3.3.5
255
+ rubygems_version: 3.2.33
256
256
  signing_key:
257
257
  specification_version: 4
258
258
  summary: ManageIQ API Client