image-inspector-client 1.0.3 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -2
- data/Gemfile +1 -1
- data/README.md +1 -1
- data/Rakefile +1 -1
- data/image-inspector-client.gemspec +8 -7
- data/lib/image-inspector-client.rb +9 -9
- data/lib/image-inspector-client/version.rb +2 -2
- data/test/test_client.rb +2 -1
- data/test/test_metadata.rb +2 -1
- data/test/test_openscap.rb +7 -4
- data/test/test_rest_client.rb +9 -6
- metadata +23 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 72ce115d700fd6aea872826048f485b1d8d5986d
|
4
|
+
data.tar.gz: b54b8036062a6d01b8a6b1fe37590e4ce1801559
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f746679909baefd5ec70737b70754d25626149e59eb8aadd5a381d46b3a7c841e6f0f0a7da2201953c3a0beec091862cb96a5f6bcb7544b4d818883b2a97dbf7
|
7
|
+
data.tar.gz: 55b2e9deac240d87cb2447c3245a313997be06881640d3cee516e38eb0cdde601fe1c65adbbac293f9388f9038739880559933ccf80e5605e8aa4adf20410dc0
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
data/Rakefile
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# coding: utf-8
|
2
|
+
|
2
3
|
lib = File.expand_path('../lib', __FILE__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
5
|
require 'image-inspector-client/version'
|
@@ -10,22 +11,22 @@ Gem::Specification.new do |spec|
|
|
10
11
|
spec.email = ['mtayer@redhat.com']
|
11
12
|
spec.summary = 'A client for image_inspector REST API'
|
12
13
|
spec.description = 'A client for image_inspector REST API'
|
13
|
-
spec.homepage = 'https://github.com/
|
14
|
+
spec.homepage = 'https://github.com/openshift/image-inspector-client-ruby'
|
14
15
|
spec.license = 'MIT'
|
15
16
|
|
16
17
|
spec.files = `git ls-files -z`.split("\x0")
|
17
18
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
19
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
20
|
spec.require_paths = ['lib']
|
20
|
-
spec.required_ruby_version = '>= 2.
|
21
|
+
spec.required_ruby_version = '>= 2.2.0'
|
21
22
|
|
22
23
|
spec.add_development_dependency 'bundler', '~> 1.6'
|
23
|
-
spec.add_development_dependency 'rake', '~>
|
24
|
+
spec.add_development_dependency 'rake', '~> 12.0'
|
24
25
|
spec.add_development_dependency 'minitest'
|
25
|
-
spec.add_development_dependency 'webmock'
|
26
|
-
spec.add_development_dependency 'rubocop', '
|
26
|
+
spec.add_development_dependency 'webmock', '~> 3.0.1'
|
27
|
+
spec.add_development_dependency 'rubocop', '~> 0.49.1'
|
27
28
|
|
28
29
|
spec.add_dependency 'json'
|
29
|
-
spec.add_dependency 'recursive-open-struct', '
|
30
|
-
spec.add_dependency 'rest-client'
|
30
|
+
spec.add_dependency 'recursive-open-struct', '~> 1.0'
|
31
|
+
spec.add_dependency 'rest-client', '~> 2.0'
|
31
32
|
end
|
@@ -2,7 +2,7 @@ require 'json'
|
|
2
2
|
require 'rest-client'
|
3
3
|
require 'recursive_open_struct'
|
4
4
|
|
5
|
-
# Client for image inspector: https://github.com/
|
5
|
+
# Client for image inspector: https://github.com/openshift/image-inspector
|
6
6
|
module ImageInspectorClient
|
7
7
|
# module entry point
|
8
8
|
class Client
|
@@ -19,9 +19,10 @@ module ImageInspectorClient
|
|
19
19
|
auth_options: {
|
20
20
|
username: nil,
|
21
21
|
password: nil,
|
22
|
-
bearer_token: nil
|
22
|
+
bearer_token: nil,
|
23
|
+
auth_token: nil
|
23
24
|
},
|
24
|
-
http_proxy_uri:
|
25
|
+
http_proxy_uri: nil
|
25
26
|
)
|
26
27
|
@endpoint = URI.parse("#{uri}/api/#{version}")
|
27
28
|
@auth_options = auth_options
|
@@ -74,13 +75,12 @@ module ImageInspectorClient
|
|
74
75
|
end
|
75
76
|
|
76
77
|
def http_headers
|
78
|
+
headers = {}
|
77
79
|
if @auth_options[:bearer_token]
|
78
|
-
{
|
79
|
-
Authorization: "Bearer #{@auth_options[:bearer_token]}"
|
80
|
-
}
|
81
|
-
else
|
82
|
-
{}
|
80
|
+
headers[:Authorization] = "Bearer #{@auth_options[:bearer_token]}"
|
83
81
|
end
|
82
|
+
headers[:'X-Auth-Token'] = @auth_options[:auth_token] if @auth_options[:auth_token]
|
83
|
+
headers
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
@@ -94,7 +94,7 @@ module ImageInspectorClient
|
|
94
94
|
end
|
95
95
|
|
96
96
|
def to_s
|
97
|
-
|
97
|
+
"HTTP status code #{@error_code}, #{@message}"
|
98
98
|
end
|
99
99
|
end
|
100
100
|
end
|
data/test/test_client.rb
CHANGED
@@ -7,7 +7,8 @@ class TestClient < MiniTest::Test
|
|
7
7
|
.to_return(status: 404)
|
8
8
|
|
9
9
|
assert_raises(ImageInspectorClient::InspectorClientException) do
|
10
|
-
ImageInspectorClient::Client
|
10
|
+
ImageInspectorClient::Client
|
11
|
+
.new('http://localhost:8080', 'v1')
|
11
12
|
.fetch_metadata
|
12
13
|
end
|
13
14
|
end
|
data/test/test_metadata.rb
CHANGED
@@ -8,7 +8,8 @@ class TestMetadata < MiniTest::Test
|
|
8
8
|
status: 200
|
9
9
|
)
|
10
10
|
|
11
|
-
md = ImageInspectorClient::Client
|
11
|
+
md = ImageInspectorClient::Client
|
12
|
+
.new('http://localhost:8080', 'v1')
|
12
13
|
.fetch_metadata
|
13
14
|
|
14
15
|
assert_instance_of(RecursiveOpenStruct, md)
|
data/test/test_openscap.rb
CHANGED
@@ -8,7 +8,8 @@ class TestOpenscap < MiniTest::Test
|
|
8
8
|
status: 200
|
9
9
|
)
|
10
10
|
|
11
|
-
md = ImageInspectorClient::Client
|
11
|
+
md = ImageInspectorClient::Client
|
12
|
+
.new('http://localhost:8080', 'v1')
|
12
13
|
.fetch_oscap_arf
|
13
14
|
|
14
15
|
assert_equal(File.read('test/xml/openscap.xml'), md)
|
@@ -26,7 +27,8 @@ class TestOpenscap < MiniTest::Test
|
|
26
27
|
status: 200
|
27
28
|
)
|
28
29
|
|
29
|
-
md = ImageInspectorClient::Client
|
30
|
+
md = ImageInspectorClient::Client
|
31
|
+
.new('http://localhost:8080', 'v1')
|
30
32
|
.fetch_oscap_arf
|
31
33
|
|
32
34
|
assert_equal('', md)
|
@@ -45,8 +47,9 @@ class TestOpenscap < MiniTest::Test
|
|
45
47
|
)
|
46
48
|
|
47
49
|
e = assert_raises(ImageInspectorClient::InspectorClientException) do
|
48
|
-
ImageInspectorClient::Client
|
49
|
-
|
50
|
+
ImageInspectorClient::Client
|
51
|
+
.new('http://localhost:8080', 'v1')
|
52
|
+
.fetch_oscap_arf
|
50
53
|
end
|
51
54
|
|
52
55
|
assert_equal(404, e.error_code)
|
data/test/test_rest_client.rb
CHANGED
@@ -9,8 +9,9 @@ class TestRestClient < MiniTest::Test
|
|
9
9
|
)
|
10
10
|
|
11
11
|
e = assert_raises(ImageInspectorClient::InspectorClientException) do
|
12
|
-
ImageInspectorClient::Client
|
13
|
-
|
12
|
+
ImageInspectorClient::Client
|
13
|
+
.new('http://localhost:8080', 'v1')
|
14
|
+
.fetch_metadata
|
14
15
|
end
|
15
16
|
|
16
17
|
assert_equal(404, e.error_code)
|
@@ -24,8 +25,9 @@ class TestRestClient < MiniTest::Test
|
|
24
25
|
)
|
25
26
|
|
26
27
|
e = assert_raises(ImageInspectorClient::InspectorClientException) do
|
27
|
-
ImageInspectorClient::Client
|
28
|
-
|
28
|
+
ImageInspectorClient::Client
|
29
|
+
.new('http://localhost:8080', 'v1')
|
30
|
+
.fetch_metadata
|
29
31
|
end
|
30
32
|
|
31
33
|
assert_equal(404, e.error_code)
|
@@ -39,8 +41,9 @@ class TestRestClient < MiniTest::Test
|
|
39
41
|
)
|
40
42
|
|
41
43
|
e = assert_raises(ImageInspectorClient::InspectorClientException) do
|
42
|
-
ImageInspectorClient::Client
|
43
|
-
|
44
|
+
ImageInspectorClient::Client
|
45
|
+
.new('http://localhost:8080', 'v1')
|
46
|
+
.fetch_metadata
|
44
47
|
end
|
45
48
|
|
46
49
|
assert_equal(404, e.error_code)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: image-inspector-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mooli Tayer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '12.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '12.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: minitest
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -56,30 +56,30 @@ dependencies:
|
|
56
56
|
name: webmock
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 3.0.1
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 3.0.1
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rubocop
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.
|
75
|
+
version: 0.49.1
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.
|
82
|
+
version: 0.49.1
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: json
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,30 +98,30 @@ dependencies:
|
|
98
98
|
name: recursive-open-struct
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 1.0
|
103
|
+
version: '1.0'
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 1.0
|
110
|
+
version: '1.0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: rest-client
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - "
|
115
|
+
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '0'
|
117
|
+
version: '2.0'
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - "
|
122
|
+
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: '0'
|
124
|
+
version: '2.0'
|
125
125
|
description: A client for image_inspector REST API
|
126
126
|
email:
|
127
127
|
- mtayer@redhat.com
|
@@ -146,7 +146,7 @@ files:
|
|
146
146
|
- test/test_openscap.rb
|
147
147
|
- test/test_rest_client.rb
|
148
148
|
- test/xml/openscap.xml
|
149
|
-
homepage: https://github.com/
|
149
|
+
homepage: https://github.com/openshift/image-inspector-client-ruby
|
150
150
|
licenses:
|
151
151
|
- MIT
|
152
152
|
metadata: {}
|
@@ -158,7 +158,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
158
158
|
requirements:
|
159
159
|
- - ">="
|
160
160
|
- !ruby/object:Gem::Version
|
161
|
-
version: 2.
|
161
|
+
version: 2.2.0
|
162
162
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
164
|
- - ">="
|
@@ -166,7 +166,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
166
166
|
version: '0'
|
167
167
|
requirements: []
|
168
168
|
rubyforge_project:
|
169
|
-
rubygems_version: 2.6.
|
169
|
+
rubygems_version: 2.6.13
|
170
170
|
signing_key:
|
171
171
|
specification_version: 4
|
172
172
|
summary: A client for image_inspector REST API
|