image-inspector-client 1.0.3 → 2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a4a6c042421c36dc77cbdf06b8ac27fed24fae08
4
- data.tar.gz: 4a902b2d59cafde219c5c1e4d8b66a73a37553b7
3
+ metadata.gz: 72ce115d700fd6aea872826048f485b1d8d5986d
4
+ data.tar.gz: b54b8036062a6d01b8a6b1fe37590e4ce1801559
5
5
  SHA512:
6
- metadata.gz: 12ff422fbadf19288d00bda3be488f967519a43784d649b3c515fc6e8ef38a7208f865f9af958de9d12678c6114c32dc0376906cab49ac27a68603673ce59c75
7
- data.tar.gz: 337932fe6766926c5ffdee79e1d12c3d60aa5e661ce9ce615b3bf614e0cf6174e2658496bfc228db143ffe8fd334a261e3b200ec55303b9ab80e26d8c0a79fc0
6
+ metadata.gz: f746679909baefd5ec70737b70754d25626149e59eb8aadd5a381d46b3a7c841e6f0f0a7da2201953c3a0beec091862cb96a5f6bcb7544b4d818883b2a97dbf7
7
+ data.tar.gz: 55b2e9deac240d87cb2447c3245a313997be06881640d3cee516e38eb0cdde601fe1c65adbbac293f9388f9038739880559933ccf80e5605e8aa4adf20410dc0
@@ -1,7 +1,8 @@
1
1
  language: ruby
2
2
  rvm:
3
- - "2.0"
4
- - "2.1"
5
3
  - "2.2"
4
+ - "2.3"
5
+ - "2.4"
6
+ - "2.5"
6
7
  sudo: false
7
8
  cache: bundler
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- # Specify your gem's dependencies in kubeclient.gemspec
3
+ # Specify your gem's dependencies in image-inspector-client.gemspec
4
4
  gemspec
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # image-inspector-client
2
- a ruby client for [image-inspector](https://github.com/simon3z/image-inspector)
2
+ a ruby client for [image-inspector](https://github.com/openshift/image-inspector)
3
3
 
4
4
  ## installing gem
5
5
  gem install image-inspector-client
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'bundler/gem_tasks'
2
2
  require 'rake/testtask'
3
3
  require 'rubocop/rake_task'
4
4
 
5
- task default: [:test, :rubocop]
5
+ task default: %i[test rubocop]
6
6
 
7
7
  Rake::TestTask.new do |t|
8
8
  t.libs << 'test'
@@ -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/moolitayer/image-inspector-client'
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.0.0'
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', '~> 10.0'
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', '= 0.30.0'
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', '= 1.0.0'
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/simon3z/image-inspector
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: nil
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
- 'HTTP status code ' + @error_code.to_s + ', ' + @message
97
+ "HTTP status code #{@error_code}, #{@message}"
98
98
  end
99
99
  end
100
100
  end
@@ -1,4 +1,4 @@
1
- # Client for image inspector: https://github.com/simon3z/image-inspector
1
+ # Client for image inspector: https://github.com/openshift/image-inspector
2
2
  module ImageInspectorClient
3
- VERSION = '1.0.3'
3
+ VERSION = '2.0.0'.freeze
4
4
  end
@@ -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.new('http://localhost:8080', 'v1')
10
+ ImageInspectorClient::Client
11
+ .new('http://localhost:8080', 'v1')
11
12
  .fetch_metadata
12
13
  end
13
14
  end
@@ -8,7 +8,8 @@ class TestMetadata < MiniTest::Test
8
8
  status: 200
9
9
  )
10
10
 
11
- md = ImageInspectorClient::Client.new('http://localhost:8080', 'v1')
11
+ md = ImageInspectorClient::Client
12
+ .new('http://localhost:8080', 'v1')
12
13
  .fetch_metadata
13
14
 
14
15
  assert_instance_of(RecursiveOpenStruct, md)
@@ -8,7 +8,8 @@ class TestOpenscap < MiniTest::Test
8
8
  status: 200
9
9
  )
10
10
 
11
- md = ImageInspectorClient::Client.new('http://localhost:8080', 'v1')
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.new('http://localhost:8080', 'v1')
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.new('http://localhost:8080', 'v1')
49
- .fetch_oscap_arf
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)
@@ -9,8 +9,9 @@ class TestRestClient < MiniTest::Test
9
9
  )
10
10
 
11
11
  e = assert_raises(ImageInspectorClient::InspectorClientException) do
12
- ImageInspectorClient::Client.new('http://localhost:8080', 'v1')
13
- .fetch_metadata
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.new('http://localhost:8080', 'v1')
28
- .fetch_metadata
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.new('http://localhost:8080', 'v1')
43
- .fetch_metadata
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: 1.0.3
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: 2016-07-13 00:00:00.000000000 Z
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: '10.0'
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: '10.0'
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: '0'
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: '0'
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.30.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.30.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.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.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/moolitayer/image-inspector-client
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.0.0
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.3
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