ncore 2.2.1 → 2.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +19 -0
- data/lib/ncore/client.rb +9 -10
- data/lib/ncore/configuration.rb +23 -2
- data/lib/ncore/exceptions.rb +1 -0
- data/lib/ncore/version.rb +1 -1
- data/ncore.gemspec +1 -1
- metadata +8 -9
- data/lib/ncore/ssl/ca-certificates.crt +0 -4027
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7794c341283c6e1ff3f7014e9f706d882c168b4eca9b8573caae51d88ce6fcf3
|
4
|
+
data.tar.gz: d12dcc65c24b2774ec2f23d769b1f1b0e6caecf477f88d059f671b4ef4f4c8bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 179fafbde6fd33667de8935e14594b950d8183e597d7612eead1cc6582407070f22529aa66c1df47fd8dd2427ec6a229021dcb739f9bd111a24038875b6aa935
|
7
|
+
data.tar.gz: d8d1c0f29e207a057eaa6ff93bdd3b532c6888ed5c19c7057f8fb3c27ee0548f6e411cea0d1dfa728456a0aa562ffadc278466443dc5ab05da2d76bb2ea0147a
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,22 @@
|
|
1
|
+
#### 2.3.2
|
2
|
+
|
3
|
+
- Allow ActiveSupport 7.0
|
4
|
+
|
5
|
+
#### 2.3.1
|
6
|
+
|
7
|
+
- Allow ActiveSupport 6.1
|
8
|
+
|
9
|
+
#### 2.3.0
|
10
|
+
|
11
|
+
- Use system's CA certificate store by default (backport from v3.2.0)
|
12
|
+
To use bundled CAs instead:
|
13
|
+
SomeAppName::Api.ssl_cert_bundle = :bundled
|
14
|
+
On failure reading specified bundle, raises exception instead of warning
|
15
|
+
|
16
|
+
#### 2.2.2
|
17
|
+
|
18
|
+
- Update certs
|
19
|
+
|
1
20
|
#### 2.2.1
|
2
21
|
|
3
22
|
- Fix decimal attributes on Ruby <= 2.5.x
|
data/lib/ncore/client.rb
CHANGED
@@ -200,7 +200,7 @@ module NCore
|
|
200
200
|
rescue Excon::Errors::SocketError => e
|
201
201
|
case e.message
|
202
202
|
when /Unable to verify certificate/
|
203
|
-
raise parent::ConnectionError, "Unable to verify certificate for #{host_for_error rest_opts[:url]} : verify URL or disable SSL certificate verification (insecure)."
|
203
|
+
raise parent::ConnectionError, "Unable to verify certificate for #{host_for_error rest_opts[:url]} : verify URL, set ssl_cert_bundle=, or disable SSL certificate verification (insecure)."
|
204
204
|
when /Name or service not known/, /No address associated with hostname/
|
205
205
|
raise parent::ConnectionError, "DNS error for #{host_for_error rest_opts[:url]} : check network and DNS or visit #{status_page}."
|
206
206
|
when /Errno::ECONNREFUSED/
|
@@ -295,17 +295,16 @@ module NCore
|
|
295
295
|
|
296
296
|
def verify_ssl_cert?
|
297
297
|
return @verify_ssl_cert unless @verify_ssl_cert.nil?
|
298
|
-
|
299
|
-
|
298
|
+
if verify_ssl
|
299
|
+
if ssl_cert_bundle
|
300
|
+
bundle_readable = File.readable?(ssl_cert_bundle) rescue false
|
301
|
+
unless bundle_readable
|
302
|
+
raise parent::CertificateError, "Unable to read SSL cert bundle #{ssl_cert_bundle}."
|
303
|
+
end
|
304
|
+
end
|
300
305
|
@verify_ssl_cert = true
|
301
306
|
else
|
302
|
-
m =
|
303
|
-
unless verify_ssl
|
304
|
-
m += " Enable verification with: #{parent}::Api.verify_ssl = true."
|
305
|
-
end
|
306
|
-
unless bundle_readable
|
307
|
-
m += " Unable to read CA bundle #{ssl_cert_bundle}."
|
308
|
-
end
|
307
|
+
m = "WARNNG: SSL cert verification is disabled. Enable verification with: #{parent}::Api.verify_ssl = true."
|
309
308
|
$stderr.puts m
|
310
309
|
@verify_ssl_cert = false
|
311
310
|
end
|
data/lib/ncore/configuration.rb
CHANGED
@@ -45,13 +45,34 @@ module NCore
|
|
45
45
|
mattr_accessor :verify_ssl
|
46
46
|
self.verify_ssl = true
|
47
47
|
|
48
|
-
|
49
|
-
|
48
|
+
mattr_reader :ssl_cert_bundle
|
49
|
+
class_eval <<-MTH
|
50
|
+
def self.ssl_cert_bundle=(v)
|
51
|
+
v = find_excon_bundle if v==:bundled
|
52
|
+
@@ssl_cert_bundle = v
|
53
|
+
end
|
54
|
+
def ssl_cert_bundle=(v)
|
55
|
+
v = find_excon_bundle if v==:bundled
|
56
|
+
@@ssl_cert_bundle = v
|
57
|
+
end
|
58
|
+
MTH
|
50
59
|
|
51
60
|
mattr_accessor :logger
|
52
61
|
self.logger = Logger.new(STDOUT)
|
53
62
|
end
|
54
63
|
|
64
|
+
|
65
|
+
private
|
66
|
+
|
67
|
+
def find_excon_bundle
|
68
|
+
b = Gem.find_files_from_load_path('../data/cacert.pem').select{|p| p=~/excon/}.first
|
69
|
+
if b
|
70
|
+
b.freeze
|
71
|
+
else
|
72
|
+
raise parent::CertificateError, 'Failed to locate CA cert bundle from excon. Specify a full path instead.'
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
55
76
|
end
|
56
77
|
|
57
78
|
end
|
data/lib/ncore/exceptions.rb
CHANGED
@@ -9,6 +9,7 @@ module NCore
|
|
9
9
|
class AccessDenied < Error ; end
|
10
10
|
class AccountInactive < Error ; end
|
11
11
|
class AuthenticationFailed < Error ; end
|
12
|
+
class CertificateError < Error ; end
|
12
13
|
class ConnectionError < Error ; end
|
13
14
|
class RateLimited < Error ; end
|
14
15
|
class RecordNotFound < Error ; end
|
data/lib/ncore/version.rb
CHANGED
data/ncore.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_dependency 'activesupport', '>= 3.2', '<
|
21
|
+
spec.add_dependency 'activesupport', '>= 3.2', '< 7.1'
|
22
22
|
spec.add_dependency 'excon', '~> 0.32'
|
23
23
|
|
24
24
|
spec.add_development_dependency "bundler", "~> 1.3"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ncore
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2
|
4
|
+
version: 2.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Notioneer Team
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '3.2'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
22
|
+
version: '7.1'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: '3.2'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
32
|
+
version: '7.1'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: excon
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -117,7 +117,6 @@ files:
|
|
117
117
|
- lib/ncore/rails/log_subscriber.rb
|
118
118
|
- lib/ncore/rails/module_fix.rb
|
119
119
|
- lib/ncore/singleton_base.rb
|
120
|
-
- lib/ncore/ssl/ca-certificates.crt
|
121
120
|
- lib/ncore/util.rb
|
122
121
|
- lib/ncore/version.rb
|
123
122
|
- ncore.gemspec
|
@@ -125,7 +124,7 @@ homepage: https://notioneer.com/
|
|
125
124
|
licenses:
|
126
125
|
- MIT
|
127
126
|
metadata: {}
|
128
|
-
post_install_message:
|
127
|
+
post_install_message:
|
129
128
|
rdoc_options: []
|
130
129
|
require_paths:
|
131
130
|
- lib
|
@@ -140,8 +139,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
140
139
|
- !ruby/object:Gem::Version
|
141
140
|
version: '0'
|
142
141
|
requirements: []
|
143
|
-
rubygems_version: 3.
|
144
|
-
signing_key:
|
142
|
+
rubygems_version: 3.2.15
|
143
|
+
signing_key:
|
145
144
|
specification_version: 4
|
146
145
|
summary: NCore - Gem for building REST API clients
|
147
146
|
test_files: []
|